Source Code Cross Referenced for ScaleInterpolator.java in  » 6.0-JDK-Modules » java-3d » javax » media » j3d » 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 » javax.media.j3d 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * $RCSfile: ScaleInterpolator.java,v $
003:         *
004:         * Copyright 1997-2008 Sun Microsystems, Inc.  All Rights Reserved.
005:         * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
006:         *
007:         * This code is free software; you can redistribute it and/or modify it
008:         * under the terms of the GNU General Public License version 2 only, as
009:         * published by the Free Software Foundation.  Sun designates this
010:         * particular file as subject to the "Classpath" exception as provided
011:         * by Sun in the LICENSE file that accompanied this code.
012:         *
013:         * This code is distributed in the hope that it will be useful, but WITHOUT
014:         * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
015:         * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
016:         * version 2 for more details (a copy is included in the LICENSE file that
017:         * accompanied this code).
018:         *
019:         * You should have received a copy of the GNU General Public License version
020:         * 2 along with this work; if not, write to the Free Software Foundation,
021:         * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
022:         *
023:         * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
024:         * CA 95054 USA or visit www.sun.com if you need additional information or
025:         * have any questions.
026:         *
027:         * $Revision: 1.5 $
028:         * $Date: 2008/02/28 20:17:29 $
029:         * $State: Exp $
030:         */
031:
032:        package javax.media.j3d;
033:
034:        /**
035:         * Scale interpolation behavior.  This class defines a behavior
036:         * that modifies the uniform scale component of its target
037:         * TransformGroup by linearly interpolating between a pair of
038:         * specified scale values (using the value generated by the
039:         * specified Alpha object).  The interpolated scale value is
040:         * used to generate a scale transform in the local coordinate
041:         * system of this interpolator.
042:         */
043:
044:        public class ScaleInterpolator extends TransformInterpolator {
045:
046:            float minimumScale;
047:            float maximumScale;
048:            private Transform3D scale = new Transform3D();
049:
050:            // We can't use a boolean flag since it is possible 
051:            // that after alpha change, this procedure only run
052:            // once at alpha.finish(). So the best way is to
053:            // detect alpha value change.
054:            private float prevAlphaValue = Float.NaN;
055:            private WakeupCriterion passiveWakeupCriterion = (WakeupCriterion) new WakeupOnElapsedFrames(
056:                    0, true);
057:
058:            // non-public, default constructor used by cloneNode
059:            ScaleInterpolator() {
060:            }
061:
062:            /**
063:             * Constructs a trivial scale interpolator that varies its target
064:             * TransformGroup node between the two specified alpha values 
065:             * using the specified alpha, an identity matrix, 
066:             * a minimum scale = 0.1f, and a maximum scale = 1.0f.
067:             * @param alpha the alpha object for this interpolator
068:             * @param target the TransformGroup node affected by this interpolator
069:             */
070:            public ScaleInterpolator(Alpha alpha, TransformGroup target) {
071:
072:                super (alpha, target);
073:                this .minimumScale = 0.1f;
074:                this .maximumScale = 1.0f;
075:            }
076:
077:            /**
078:             * Constructs a new scaleInterpolator object that varies its target 
079:             * TransformGroup node's scale component between two scale values
080:             * (minimumScale and maximumScale).  
081:             * @param alpha the alpha object for this interpolator
082:             * @param target the TransformGroup node affected by this interpolator
083:             * @param axisOfTransform the transform that defines the local coordinate
084:             * system in which this interpolator operates; the scale is done
085:             * about the origin of this local coordinate system.
086:             * @param minimumScale the starting scale
087:             * @param maximumScale the ending scale
088:             */
089:            public ScaleInterpolator(Alpha alpha, TransformGroup target,
090:                    Transform3D axisOfTransform, float minimumScale,
091:                    float maximumScale) {
092:
093:                super (alpha, target, axisOfTransform);
094:
095:                this .minimumScale = minimumScale;
096:                this .maximumScale = maximumScale;
097:            }
098:
099:            /**
100:             * This method sets the minimumScale for this interpolator.
101:             * @param scale The new minimal scale
102:             */
103:            public void setMinimumScale(float scale) {
104:                this .minimumScale = scale;
105:            }
106:
107:            /**
108:             * This method retrieves this interpolator's minimumScale.
109:             * @return the interpolator's minimal scale value
110:             */
111:            public float getMinimumScale() {
112:                return this .minimumScale;
113:            }
114:
115:            /**
116:             * This method sets the maximumScale for this interpolator.
117:             * @param scale the new maximum scale
118:             */
119:            public void setMaximumScale(float scale) {
120:                this .maximumScale = scale;
121:            }
122:
123:            /**
124:             * This method retrieves this interpolator's maximumScale.
125:             * @return the interpolator's maximum scale vslue
126:             */
127:            public float getMaximumScale() {
128:                return this .maximumScale;
129:            }
130:
131:            /**
132:             * @deprecated As of Java 3D version 1.3, replaced by
133:             * <code>TransformInterpolator.setTransformAxis(Transform3D)</code>
134:             */
135:            public void setAxisOfScale(Transform3D axisOfScale) {
136:                setTransformAxis(axisOfScale);
137:            }
138:
139:            /**
140:             * @deprecated As of Java 3D version 1.3, replaced by
141:             * <code>TransformInterpolator.getTransformAxis()</code>
142:             */
143:            public Transform3D getAxisOfScale() {
144:                return getTransformAxis();
145:            }
146:
147:            /**
148:             * Computes the new transform for this interpolator for a given
149:             * alpha value.
150:             *
151:             * @param alphaValue alpha value between 0.0 and 1.0
152:             * @param transform object that receives the computed transform for
153:             * the specified alpha value
154:             *
155:             * @since Java 3D 1.3
156:             */
157:            public void computeTransform(float alphaValue, Transform3D transform) {
158:
159:                double val = (1.0 - alphaValue) * minimumScale + alphaValue
160:                        * maximumScale;
161:
162:                // construct a Transform3D from:  axis  * scale * axisInverse
163:                scale.set(val);
164:                transform.mul(axis, scale);
165:                transform.mul(transform, axisInverse);
166:            }
167:
168:            /**
169:             * Used to create a new instance of the node.  This routine is called
170:             * by <code>cloneTree</code> to duplicate the current node.
171:             * @param forceDuplicate when set to <code>true</code>, causes the
172:             *  <code>duplicateOnCloneTree</code> flag to be ignored.  When
173:             *  <code>false</code>, the value of each node's
174:             *  <code>duplicateOnCloneTree</code> variable determines whether
175:             *  NodeComponent data is duplicated or copied.
176:             *
177:             * @see Node#cloneTree
178:             * @see Node#cloneNode
179:             * @see Node#duplicateNode
180:             * @see NodeComponent#setDuplicateOnCloneTree
181:             */
182:            public Node cloneNode(boolean forceDuplicate) {
183:                ScaleInterpolator si = new ScaleInterpolator();
184:                si.duplicateNode(this , forceDuplicate);
185:                return si;
186:            }
187:
188:            /**
189:             * Copies all ScaleInterpolator information from
190:             * <code>originalNode</code> into
191:             * the current node.  This method is called from the
192:             * <code>cloneNode</code> method which is, in turn, called by the
193:             * <code>cloneTree</code> method.<P> 
194:             *
195:             * @param originalNode the original node to duplicate.
196:             * @param forceDuplicate when set to <code>true</code>, causes the
197:             *  <code>duplicateOnCloneTree</code> flag to be ignored.  When
198:             *  <code>false</code>, the value of each node's
199:             *  <code>duplicateOnCloneTree</code> variable determines whether
200:             *  NodeComponent data is duplicated or copied.
201:             *
202:             * @exception RestrictedAccessException if this object is part of a live
203:             *  or compiled scenegraph.
204:             *
205:             * @see Node#duplicateNode
206:             * @see Node#cloneTree
207:             * @see NodeComponent#setDuplicateOnCloneTree
208:             */
209:            void duplicateAttributes(Node originalNode, boolean forceDuplicate) {
210:
211:                super .duplicateAttributes(originalNode, forceDuplicate);
212:
213:                ScaleInterpolator si = (ScaleInterpolator) originalNode;
214:
215:                setMinimumScale(si.getMinimumScale());
216:                setMaximumScale(si.getMaximumScale());
217:
218:            }
219:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.