Source Code Cross Referenced for ViewPoint.java in  » 6.0-JDK-Modules » java-3d » com » db » viewpoint » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » 6.0 JDK Modules » java 3d » com.db.viewpoint 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright (c) 2001 Silvere Martin-Michiellot All Rights Reserved.
003:         *
004:         * Silvere Martin-Michiellot grants you ("Licensee") a non-exclusive,
005:         * royalty free, license to use, modify and redistribute this
006:         * software in source and binary code form,
007:         * provided that i) this copyright notice and license appear on all copies of
008:         * the software; and ii) Licensee does not utilize the software in a manner
009:         * which is disparaging to Silvere Martin-Michiellot.
010:         *
011:         * This software is provided "AS IS," without a warranty of any kind. ALL
012:         * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING ANY
013:         * IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR
014:         * NON-INFRINGEMENT, ARE HEREBY EXCLUDED. Silvere Martin-Michiellot
015:         * AND ITS LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES
016:         * SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING
017:         * OR DISTRIBUTING THE SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL
018:         * Silvere Martin-Michiellot OR ITS LICENSORS BE LIABLE
019:         * FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR DIRECT,
020:         * INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER
021:         * CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF THE USE OF
022:         * OR INABILITY TO USE SOFTWARE, EVEN IF Silvere Martin-Michiellot HAS BEEN
023:         * ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
024:         *
025:         * This software is not designed or intended for use in on-line control of
026:         * aircraft, air traffic, aircraft navigation or aircraft communications; or in
027:         * the design, construction, operation or maintenance of any nuclear
028:         * facility. Licensee represents and warrants that it will not use or
029:         * redistribute the Software for such purposes.
030:         *
031:         * @Author: Silvere Martin-Michiellot
032:         *
033:         */
034:
035:        package com.db.viewpoint;
036:
037:        //	This code is repackaged after the software The Carnival by Douglas Pew
038:        //	Site http://www.access.digex.net/~dpew/carnival (link is dead)
039:        //	Email dpew@gmu.edu
040:
041:        /*
042:         *
043:         *  This program is free software; you can redistribute it and/or modify
044:         *  it under the terms of the GNU General Public License as published by
045:         *  the Free Software Foundation; either version 2 of the License, or
046:         *  (at your option) any later version.
047:         *
048:         *  This program is distributed in the hope that it will be useful,
049:         *  but WITHOUT ANY WARRANTY; without even the implied warranty of
050:         *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
051:         *  GNU General Public License for more details.
052:         *
053:         *  You should have received a copy of the GNU General Public License
054:         *  along with this program; if not, write to the Free Software
055:         *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
056:         *
057:         */
058:
059:        import javax.media.j3d.*;
060:        import javax.vecmath.*;
061:
062:        /** A class that defines a ViewPoint to be used in a Java3D scenegraph. */
063:        public class ViewPoint extends TransformGroup implements  Viewable {
064:
065:            private ViewSite[] site;
066:
067:            /** Builds a new ViewPoint
068:             * @param name The human readable name of the ViewPoint
069:             * @param location The location at which the View is to be.
070:             * @param look_to The direction towards which the View is oriented.
071:             */
072:            public ViewPoint(String name, Vector3d location, Point3d look_to) {
073:
074:                Vector3d negzaxis = new Vector3d(0.0, 0.0, -1.0);
075:                Vector3d yaxis = new Vector3d(0.0, 1.0, 0.0);
076:                Vector3d lk_vector = new Vector3d();
077:                Vector3d tmp = new Vector3d();
078:                double lk_angle;
079:                double tilt;
080:                Matrix3d m1 = new Matrix3d();
081:                Matrix3d m2 = new Matrix3d();
082:                TransformGroup vtg;
083:                Transform3D t3d;
084:
085:                //
086:                // Determin the angle and normal from the normal look angle (straight
087:                // down the Z axis, to the look_to point
088:                //
089:                lk_vector.sub(look_to, location);
090:                //System.out.println("Vector " + lk_vector);
091:
092:                // Get
093:                tmp.set(lk_vector.x, 0.0, lk_vector.z);
094:                lk_angle = negzaxis.angle(tmp);
095:                if (tmp.x < 0)
096:                    lk_angle = -lk_angle;
097:                m1.setIdentity();
098:                if (!Double.isNaN(lk_angle))
099:                    m1.rotY(lk_angle);
100:                m1.transform(lk_vector);
101:                tilt = lk_vector.angle(negzaxis);
102:                if (lk_vector.y < 0)
103:                    tilt = -tilt;
104:
105:                m1.setIdentity();
106:                if (!Double.isNaN(lk_angle))
107:                    m1.rotY(-lk_angle);
108:                m2.rotX(tilt);
109:                m1.mul(m2);
110:
111:                t3d = new Transform3D(m1, location, 1.0);
112:                this .setTransform(t3d);
113:
114:                Vector3d vec = new Vector3d(0.0, 0.0, (double) -lk_vector
115:                        .length());
116:                m1.transform(vec);
117:
118:                site = new ViewSite[1];
119:                site[0] = new ViewSite(name);
120:                vtg = site[0].makeViewPlatform();
121:                this .addChild(vtg);
122:
123:                site[0].setViewControl(new LookViewControl(vtg));
124:
125:            }
126:
127:            /** Retrieves the array of ViewSites associated with this ViewPoint. This should be
128:             * an array of length 1.
129:             * @return The ViewSite array.
130:             */
131:            public ViewSite[] getViewSites() {
132:
133:                return site;
134:
135:            }
136:
137:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.