diff options
author | Kevin Rushforth <[email protected]> | 2006-09-29 18:05:22 +0000 |
---|---|---|
committer | Kevin Rushforth <[email protected]> | 2006-09-29 18:05:22 +0000 |
commit | ef52440ac08db7764adadcc11c9437ab67b98714 (patch) | |
tree | 31b86db859a1d0e6ed42a25695711e49e624d460 | |
parent | ffc8b12fb945850394498a1f9fe1f04e5f2042de (diff) |
Merged dev-1_5 branch back to MAIN trunk
git-svn-id: https://svn.java.net/svn/vecmath~svn/trunk@106 dd45e54d-f42e-c781-df72-dca083a658b1
27 files changed, 2773 insertions, 574 deletions
diff --git a/.cvsignore b/.cvsignore new file mode 100644 index 0000000..9d0b71a --- /dev/null +++ b/.cvsignore @@ -0,0 +1,2 @@ +build +dist diff --git a/LICENSE-SPEC.html b/LICENSE-SPEC.html index 82ab4da..1e68067 100644 --- a/LICENSE-SPEC.html +++ b/LICENSE-SPEC.html @@ -6,231 +6,8 @@ <title>Java 3D API Specification</title> </head> <body> -<p> -Specification: JSR-000926 Java(TM) 3D 1.4 ("Specification") -</p> -<p> -Version: 1.4 -</p> -<p> -Status: Maintenance Release -</p> -<p> -Release: 7 February 2006 -</p> -<p> -Copyright 2006 SUN MICROSYSTEMS, INC. -</p> -<p> -4150 Network Circle, Santa Clara, California 95054, U.S.A -</p> -<p> -All rights reserved. -</p> -<p> -LIMITED LICENSE GRANTS -</p> -<p> -1. License for Evaluation Purposes. Sun hereby grants you a -fully-paid, non-exclusive, non-transferable, worldwide, limited -license (without the right to sublicense), under Sun's applicable -intellectual property rights to view, download, use and reproduce the -Specification only for the purpose of internal evaluation. This -includes (i) developing applications intended to run on an -implementation of the Specification, provided that such applications -do not themselves implement any portion(s) of the Specification, and -(ii) discussing the Specification with any third party; and (iii) -excerpting brief portions of the Specification in oral or written -communications which discuss the Specification provided that such -excerpts do not in the aggregate constitute a significant portion of -the Specification. -</p> -<p> -2. License for the Distribution of Compliant Implementations. Sun also -grants you a perpetual, non-exclusive, non-transferable, worldwide, -fully paid-up, royalty free, limited license (without the right to -sublicense) under any applicable copyrights or, subject to the -provisions of subsection 4 below, patent rights it may have covering -the Specification to create and/or distribute an Independent -Implementation of the Specification that: (a) fully implements the -Specification including all its required interfaces and functionality; -(b) does not modify, subset, superset or otherwise extend the Licensor -Name Space, or include any public or protected packages, classes, Java -interfaces, fields or methods within the Licensor Name Space other -than those required/authorized by the Specification or Specifications -being implemented; and (c) passes the Technology Compatibility Kit -(including satisfying the requirements of the applicable TCK Users -Guide) for such Specification ("Compliant Implementation"). In -addition, the foregoing license is expressly conditioned on your not -acting outside its scope. No license is granted hereunder for any -other purpose (including, for example, modifying the Specification, -other than to the extent of your fair use rights, or distributing the -Specification to third parties). Also, no right, title, or interest in -or to any trademarks, service marks, or trade names of Sun or Sun's -licensors, Sun or the Sun's licensors is granted hereunder. Java, and -Java-related logos, marks and names are trademarks or registered -trademarks of Sun Microsystems, Inc. in the U.S. and other countries. -</p> -<p> -3. Pass-through Conditions. You need not include limitations (a)-(c) -from the previous paragraph or any other particular "pass through" -requirements in any license You grant concerning the use of your -Independent Implementation or products derived from it. However, -except with respect to Independent Implementations (and products -derived from them) that satisfy limitations (a)-(c) from the previous -paragraph, You may neither: (a) grant or otherwise pass through to -your licensees any licenses under Sun's applicable intellectual -property rights; nor (b) authorize your licensees to make any claims -concerning their implementation's compliance with the Spec in -question. -</p> -<p> -4. Reciprocity Concerning Patent Licenses. -</p> -<p> -a. With respect to any patent claims covered by the license granted -under subparagraph 2 above that would be infringed by all technically -feasible implementations of the Specification, such license is -conditioned upon your offering on fair, reasonable and -non-discriminatory terms, to any party seeking it from You, a -perpetual, non-exclusive, non-transferable, worldwide license under -Your patent rights which are or would be infringed by all technically -feasible implementations of the Specification to develop, distribute -and use a Compliant Implementation. -</p> -<p> -b. With respect to any patent claims owned by Sun and covered by the -license granted under subparagraph 2, whether or not their -infringement can be avoided in a technically feasible manner when -implementing the Specification, such license shall terminate with -respect to such claims if You initiate a claim against Sun that it -has, in the course of performing its responsibilities as the Sun, -induced any other entity to infringe Your patent rights. -</p> -<p> -c. Also with respect to any patent claims owned by Sun and covered by -the license granted under subparagraph, where the infringement of such -claims can be avoided in a technically feasible manner when -implementing the Specification such license, with respect to such -claims, shall terminate if You initiate a claim against Sun that its -making, having made, using, offering to sell, selling or importing a -Compliant Implementation infringes Your patent rights. -</p> -<p> -5. Definitions. For the purposes of this Agreement: "Independent -Implementation" shall mean an implementation of the Specification that -neither derives from any of Sun's source code or binary code materials -nor, except with an appropriate and separate license from Sun, -includes any of Sun's source code or binary code materials; "Licensor -Name Space" shall mean the public class or interface declarations -whose names begin with "java", "javax", "com.sun" or their equivalents -in any subsequent naming convention adopted by Sun through the Java -Community Process, or any recognized successors or replacements -thereof; and "Technology Compatibility Kit" or "TCK" shall mean the -test suite and accompanying TCK User's Guide provided by Sun which -corresponds to the Specification and that was available either (i) -from Sun's 120 days before the first release of Your Independent -Implementation that allows its use for commercial purposes, or (ii) -more recently than 120 days from such release but against which You -elect to test Your implementation of the Specification. -</p> -<p> -This Agreement will terminate immediately without notice from Sun if -you breach the Agreement or act outside the scope of the licenses -granted above. -</p> -<p> -DISCLAIMER OF WARRANTIES -</p> -<p> -THE SPECIFICATION IS PROVIDED "AS IS". SUN MAKES NO REPRESENTATIONS OR -WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO, -WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, -NON-INFRINGEMENT (INCLUDING AS A CONSEQUENCE OF ANY PRACTICE OR -IMPLEMENTATION OF THE SPECIFICATION), OR THAT THE CONTENTS OF THE -SPECIFICATION ARE SUITABLE FOR ANY PURPOSE. This document does not -represent any commitment to release or implement any portion of the -Specification in any product. In addition, the Specification could -include technical inaccuracies or typographical errors. -</p> -<p> -LIMITATION OF LIABILITY -</p> -<p> -TO THE EXTENT NOT PROHIBITED BY LAW, IN NO EVENT WILL SUN OR ITS -LICENSORS BE LIABLE FOR ANY DAMAGES, INCLUDING WITHOUT LIMITATION, -LOST REVENUE, PROFITS OR DATA, OR FOR SPECIAL, INDIRECT, -CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER CAUSED AND -REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF OR RELATED IN -ANY WAY TO YOUR HAVING, IMPELEMENTING OR OTHERWISE USING USING THE -SPECIFICATION, EVEN IF SUN AND/OR ITS LICENSORS HAVE BEEN ADVISED OF -THE POSSIBILITY OF SUCH DAMAGES. -</p> -<p> -You will indemnify, hold harmless, and defend Sun and its licensors -from any claims arising or resulting from: (i) your use of the -Specification; (ii) the use or distribution of your Java application, -applet and/or implementation; and/or (iii) any claims that later -versions or releases of any Specification furnished to you are -incompatible with the Specification provided to you under this -license. -</p> -<p> -RESTRICTED RIGHTS LEGEND -</p> -<p> -U.S. Government: If this Specification is being acquired by or on -behalf of the U.S. Government or by a U.S. Government prime contractor -or subcontractor (at any tier), then the Government's rights in the -Software and accompanying documentation shall be only as set forth in -this license; this is in accordance with 48 C.F.R. 227.7201 through -227.7202-4 (for Department of Defense (DoD) acquisitions) and with 48 -C.F.R. 2.101 and 12.212 (for non-DoD acquisitions). -</p> -<p> -REPORT -</p> -<p> -If you provide Sun with any comments or suggestions concerning the -Specification ("Feedback"), you hereby: (i) agree that such Feedback -is provided on a non-proprietary and non-confidential basis, and (ii) -grant Sun a perpetual, non-exclusive, worldwide, fully paid-up, -irrevocable license, with the right to sublicense through multiple -levels of sublicensees, to incorporate, disclose, and use without -limitation the Feedback for any purpose. -</p> -<p> -GENERAL TERMS -</p> -<p> -Any action related to this Agreement will be governed by California -law and controlling U.S. federal law. The U.N. Convention for the -International Sale of Goods and the choice of law rules of any -jurisdiction will not apply. -</p> -<p> -The Specification is subject to U.S. export control laws and may be -subject to export or import regulations in other countries. Licensee -agrees to comply strictly with all such laws and regulations and -acknowledges that it has the responsibility to obtain such licenses to -export, re-export or import as may be required after delivery to -Licensee. -</p> -<p> -This Agreement is the parties' entire agreement relating to its -subject matter. It supersedes all prior or contemporaneous oral or -written communications, proposals, conditions, representations and -warranties and prevails over any conflicting or additional terms of -any quote, order, acknowledgment, or other communication between the -parties relating to its subject matter during the term of this -Agreement. No modification to this Agreement will be binding, unless -in writing and signed by an authorized representative of each party. -</p> -<p> -Rev. January, 2006 -</p> -<p> -Sun/Final/Full +<p>Copyright (c) 2005 Sun Microsystems, Inc. All rights reserved. +Use is subject to license terms. </p> </body> </html> diff --git a/LICENSE.txt b/LICENSE.txt index 930cc77..12263f3 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -2,8 +2,12 @@ This software is licensed by Sun: i) for research use under terms of the Java Research License (JRL) as specified in the LICENSE-JRL.txt file and on the web at -"http://java3d.dev.java.net/jrl.html"; or +"http://java3d.dev.java.net/jrl.html" -ii) for commercial use under the terms of the Java Distribution License -(JDL) as specified in the LICENSE-JDL.txt file and on the web at -"http://java3d.dev.java.net/jdl-java3d.pdf". +NOTE: The main trunk of the vecmath source code (vecmath +project) contains proposed API changes for an eventual 1.5 version of +the Java 3D API. THESE API CHANGES ARE NOT YET APPROVED AS PART OF +A JAVA SPECIFICATION REQUEST (JSR) UNDER THE JAVA COMMUNITY PROCESS +(JCP). UNTIL SUCH TIME AS THEY ARE ADOPTED AND APPROVED BY A JSR, +THE 1.5-EXPERIMENTAL VERSION OF THE JAVA 3D API MAY ONLY BE USED FOR +RESEARCH UNDER THE TERMS OF THE JAVA RESEARCH LICENSE (JRL). diff --git a/README-FIRST.txt b/README-FIRST.txt index e84c25b..c1fb0d9 100644 --- a/README-FIRST.txt +++ b/README-FIRST.txt @@ -1,3 +1,11 @@ +NOTE: The main trunk of the vecmath source code (vecmath +project) contains proposed API changes for an eventual 1.5 version of +the Java 3D API. THESE API CHANGES ARE NOT YET APPROVED AS PART OF +A JAVA SPECIFICATION REQUEST (JSR) UNDER THE JAVA COMMUNITY PROCESS +(JCP). UNTIL SUCH TIME AS THEY ARE ADOPTED AND APPROVED BY A JSR, +THE 1.5-EXPERIMENTAL VERSION OF THE JAVA 3D API MAY ONLY BE USED FOR +RESEARCH UNDER THE TERMS OF THE JAVA RESEARCH LICENSE (JRL). + The source code for the vecmath project is copyrighted code that is licensed to individuals or companies who download or otherwise access the code. diff --git a/README-build.html b/README-build.html index c61141c..7c3caa6 100644 --- a/README-build.html +++ b/README-build.html @@ -50,9 +50,9 @@ operating environments:<br> </ul> <p>The following software must be installed:</p> <ul> - <li><a href="http://java.sun.com/j2se">JDK 1.4.2</a> <br> + <li><a href="http://java.sun.com/j2se">JDK 1.5.0</a> <br> </li> - <li><a href="http://jakarta.apache.org/ant">Apache Ant 1.6.5</a><br> + <li><a href="http://jakarta.apache.org/ant">Apache Ant 1.6.1</a><br> </li> </ul> <h3><span style="text-decoration: underline;">Building @@ -14,13 +14,13 @@ */ --> -<project name="vecmath-1.4.0" default="jar-opt" basedir="."> +<project name="vecmath-1.5.0" default="jar-opt" basedir="."> <!-- Set global properties for this build --> <property name="src" location="src"/> <property name="build" location="build"/> <property name="dist" location="dist"/> - <property name="version" value="1_4_0"/> + <property name="version" value="1_5_0"/> <property name="docname" value="vecmath-${version}-doc"/> <target name="echo"> @@ -52,8 +52,8 @@ <!-- Compile the java code from ${src} into ${build}/debug/classes --> <javac srcdir="${src}" destdir="${build}/debug/classes" - source="1.4" - target="1.4" + source="1.5" + target="1.5" debug="true" deprecation="on" /> @@ -72,8 +72,8 @@ <!-- Compile the java code from ${src} into ${build}/opt/classes --> <javac srcdir="${src}" destdir="${build}/opt/classes" - source="1.4" - target="1.4" + source="1.5" + target="1.5" debug="true" debuglevel="lines,source" deprecation="on" diff --git a/docs/api-changes-1_5.txt b/docs/api-changes-1_5.txt new file mode 100644 index 0000000..bb27408 --- /dev/null +++ b/docs/api-changes-1_5.txt @@ -0,0 +1,289 @@ +------------------------------------------------------------------------ +$RCSfile$ +$Revision$ +$Date$ +------------------------------------------------------------------------ +This document conatains proposed API changes to the vecmath 1.5 API +that deviate from the 1.4 API. + +This file must be updated to record the addition or deprecation of any +public or protected class, interface, field, constructor, or method to +the vecmath API. + +The one exception to this rule is that you don't need to update this +file when adding a non-final (i.e., virtual) method to a class if that +method--with exactly the same signature--already exists in a +superclass. For example, adding a "toString" method to a vecmath object +doesn't require an entry in this file. + +No incompatible changes to the vecmath 1.4 API are allowed. + + +I. New/deprecated fields, constructors, methods + + AxisAngle4f + --------------- + New methods: + public final void setAngle(float angle) + public final float getAngle() + public final float getX() + public final float getY() + public final float getZ() + public final void setX(float x) + public final void setY(float y) + public final void setZ(float z) + + AxisAngle4d + -------------- + New methods: + public final void setAngle(double angle) + public final float getAngle() + public final double getX() + public final double getY() + public final double getZ() + public final void setX(double x) + public final void setY(double y) + public final void setZ(double z) + + + + Matrix3d + --------------- + New methods: + + public final void setM00(double m00) + public final void setM01(double m01) + public final void setM02(double m02) + public final void setM10(double m10) + public final void setM11(double m11) + public final void setM12(double m12) + public final void setM20(double m20) + public final void setM21(double m21) + public final void setM22(double m22) + public final double getM00() + public final double getM01() + public final double getM02() + public final double getM10() + public final double getM11() + public final double getM12() + public final double getM20() + public final double getM21() + public final double getM22() + + Matrix3f + --------------- + New methods: + public final void setM00(float m00) + public final void setM01(float m01) + public final void setM02(float m02) + public final void setM10(float m10) + public final void setM11(float m11) + public final void setM12(float m12) + public final void setM20(float m20) + public final void setM21(float m21) + public final void setM22(float m22) + public final float getM00() + public final float getM01() + public final float getM02() + public final float getM10() + public final float getM11() + public final float getM12() + public final float getM20() + public final float getM21() + public final float getM22() + + Matrix4d + ------------- + New methods: + public final void setM00(double m00) + public final void setM01(double m01) + public final void setM02(double m02) + public final void setM03(double m03) + public final void setM10(double m10) + public final void setM11(double m11) + public final void setM12(double m12) + public final void setM13(double m13) + public final void setM20(double m20) + public final void setM21(double m21) + public final void setM22(double m22) + public final void setM23(double m23) + public final void setM30(double m30) + public final void setM31(double m31) + public final void setM32(double m32) + public final void setM33(double m33) + public final double getM00() + public final double getM01() + public final double getM02() + public final double getM03() + public final double getM10() + public final double getM11() + public final double getM12() + public final double getM13() + public final double getM20() + public final double getM21() + public final double getM22() + public final double getM23() + public final double getM30() + public final double getM31() + public final double getM32() + public final double getM33() + + + Matrix4f + ------------- + New methods: + public final void setM00(float m00) + public final void setM01(float m01) + public final void setM02(float m02) + public final void setM03(float m03) + public final void setM10(float m10) + public final void setM11(float m11) + public final void setM12(float m12) + public final void setM13(float m13) + public final void setM20(float m20) + public final void setM21(float m21) + public final void setM22(float m22) + public final void setM23(float m23) + public final void setM30(float m30) + public final void setM31(float m31) + public final void setM32(float m32) + public final void setM33(float m33) + public final float getM00() + public final float getM01() + public final float getM02() + public final float getM03() + public final float getM10() + public final float getM11() + public final float getM12() + public final float getM13() + public final float getM20() + public final float getM21() + public final float getM22() + public final float getM23() + public final float getM30() + public final float getM31() + public final float getM32() + public final float getM33() + + Tuple2d + ------------ + New methods: + public final void setX(double x) + public final void setY(double y) + public final double getX() + public final double getY() + + + Tuple2f + ------------ + New methods: + public final void setX(float x) + public final void setY(float y) + public final float getX() + public final float getY() + + Tuple2i + ------------ + New methods: + public final void setX(int x) + public final void setY(int y) + public final int getX() + public final int getY() + + Tuple3d + ------------ + New methods: + public final void setX(double x) + public final void setY(double y) + public final void setZ(double z) + public final double getX() + public final double getY() + public final double getZ() + + Tuple3f + ------------ + New methods: + public final void setX(float x) + public final void setY(float y) + public final void setZ(float z) + public final float getX() + public final float getY() + public final float getZ() + + Tuple3i + ------------ + New methods: + public final void setX(int x) + public final void setY(int y) + public final void setZ(int z) + public final int getX() + public final int getY() + public final int getZ() + + Tuple3b + ------------ + New methods: + public final void setX(byte x) + public final void setY(byte y) + public final void setZ(byte z) + public final byte getX() + public final byte getY() + public final byte getZ() + + Tuple4d + ------------ + New methods: + public final void setX(double x) + public final void setY(double y) + public final void setZ(double z) + public final void setW(double w) + public final double getX() + public final double getY() + public final double getZ() + public final double getW() + + Tuple4f + ------------ + New methods: + public final void setX(float x) + public final void setY(float y) + public final void setZ(float z) + public final void setW(double w) + public final float getX() + public final float getY() + public final float getZ() + public final float getW() + + Tuple4i + ------------ + New methods: + public final void setX(int x) + public final void setY(int y) + public final void setZ(int z) + public final void setW(int w) + public final int getX() + public final int getY() + public final int getZ() + public final int getW() + + Tuple4b + ------------ + New methods: + public final void setX(byte x) + public final void setY(byte y) + public final void setZ(byte z) + public final void setW(byte w) + public final byte getX() + public final byte getY() + public final byte getZ() + public final byte getW() + +II. Reparented classes + + <EXISTINGCLASS> + --------------- + <EXISTINGCLASS> now extends <NEWSUPERCLASS> (used to extend <OLDSUPERCLASS>) + + +III. New classes and interfaces (in javax.vecmath) + diff --git a/nbproject/.cvsignore b/nbproject/.cvsignore new file mode 100644 index 0000000..3e18ebf --- /dev/null +++ b/nbproject/.cvsignore @@ -0,0 +1 @@ +private diff --git a/nbproject/project.xml b/nbproject/project.xml index 9bd60e9..3877930 100644 --- a/nbproject/project.xml +++ b/nbproject/project.xml @@ -4,7 +4,7 @@ <configuration> <general-data xmlns="http://www.netbeans.org/ns/freeform-project/1"> <!--Do not use Project Properties customizer when editing this file manually.--> - <name>vecmath-1.4.0</name> + <name>vecmath-1.5.0</name> <properties/> <folders> <source-folder> @@ -56,7 +56,7 @@ <compilation-unit> <package-root>src</package-root> <built-to>build/debug/lib/ext/vecmath.jar</built-to> - <source-level>1.4</source-level> + <source-level>1.5</source-level> </compilation-unit> </java-data> </configuration> diff --git a/src/VECMATH.MF b/src/VECMATH.MF index feef661..20736a8 100644 --- a/src/VECMATH.MF +++ b/src/VECMATH.MF @@ -1,9 +1,17 @@ Manifest-Version: 1.0 Specification-Title: Java 3D API Specification -Specification-Version: 1.4 +Specification-Version: 1.5 Specification-Vendor: Sun Microsystems, Inc. Implementation-Title: Java 3D Vecmath Runtime Environment -Implementation-Version: 1.4.0 +Implementation-Version: 1.5.0 Implementation-Vendor: Sun Microsystems, Inc. Extension-Name: javax.vecmath Implementation-Vendor-Id: com.sun +Bundle-ManifestVersion: 2 +Bundle-Name: Vecmath Library +Bundle-Vendor: Sun Microsystems +Bundle-Localization: plugin +Bundle-SymbolicName: javax.vecmath; singleton:=true +Bundle-Version: 1.5.0 +Eclipse-AutoStart: true +Export-Package: javax.vecmath diff --git a/src/javax/vecmath/AxisAngle4d.java b/src/javax/vecmath/AxisAngle4d.java index 0bd988d..3b367d9 100644 --- a/src/javax/vecmath/AxisAngle4d.java +++ b/src/javax/vecmath/AxisAngle4d.java @@ -533,4 +533,102 @@ public class AxisAngle4d implements java.io.Serializable, Cloneable { } } + + /** + * Get the axis angle, in radians.<br> + * An axis angle is a rotation angle about the vector (x,y,z). + * + * @return the angle, in radians. + * + * @since vecmath 1.5 + */ + public final double getAngle() { + return angle; + } + + + /** + * Set the axis angle, in radians.<br> + * An axis angle is a rotation angle about the vector (x,y,z). + * + * @param angle The angle to set, in radians. + * + * @since vecmath 1.5 + */ + public final void setAngle(double angle) { + this.angle = angle; + } + + + /** + * Get value of <i>x</i> coordinate. + * + * @return the <i>x</i> coordinate. + * + * @since vecmath 1.5 + */ + public double getX() { + return x; + } + + + /** + * Set a new value for <i>x</i> coordinate. + * + * @param x the <i>x</i> coordinate. + * + * @since vecmath 1.5 + */ + public final void setX(double x) { + this.x = x; + } + + + /** + * Get value of <i>y</i> coordinate. + * + * @return the <i>y</i> coordinate. + * + * @since vecmath 1.5 + */ + public final double getY() { + return y; + } + + + /** + * Set a new value for <i>y</i> coordinate. + * + * @param y the <i>y</i> coordinate. + * + * @since vecmath 1.5 + */ + public final void setY(double y) { + this.y = y; + } + + + /** + * Get value of <i>z</i> coordinate. + * + * @return the <i>z</i> coordinate. + * + * @since vecmath 1.5 + */ + public double getZ() { + return z; + } + + + /** + * Set a new value for <i>z</i> coordinate. + * + * @param z the <i>z</i> coordinate. + * + * @since vecmath 1.5 + */ + public final void setZ(double z) { + this.z = z; + } + } diff --git a/src/javax/vecmath/AxisAngle4f.java b/src/javax/vecmath/AxisAngle4f.java index fdde6c1..22cf902 100644 --- a/src/javax/vecmath/AxisAngle4f.java +++ b/src/javax/vecmath/AxisAngle4f.java @@ -529,4 +529,102 @@ public class AxisAngle4f implements java.io.Serializable, Cloneable { } } + + /** + * Get the axis angle, in radians.<br> + * An axis angle is a rotation angle about the vector (x,y,z). + * + * @return Returns the angle, in radians. + * + * @since vecmath 1.5 + */ + public final float getAngle() { + return angle; + } + + + /** + * Set the axis angle, in radians.<br> + * An axis angle is a rotation angle about the vector (x,y,z). + * + * @param angle The angle to set, in radians. + * + * @since vecmath 1.5 + */ + public final void setAngle(float angle) { + this.angle = angle; + } + + + /** + * Get value of <i>x</i> coordinate. + * + * @return the <i>x</i> coordinate. + * + * @since vecmath 1.5 + */ + public final float getX() { + return x; + } + + + /** + * Set a new value for <i>x</i> coordinate. + * + * @param x the <i>x</i> coordinate. + * + * @since vecmath 1.5 + */ + public final void setX(float x) { + this.x = x; + } + + + /** + * Get value of <i>y</i> coordinate. + * + * @return the <i>y</i> coordinate + * + * @since vecmath 1.5 + */ + public final float getY() { + return y; + } + + + /** + * Set a new value for <i>y</i> coordinate. + * + * @param y the <i>y</i> coordinate. + * + * @since vecmath 1.5 + */ + public final void setY(float y) { + this.y = y; + } + + + /** + * Get value of <i>z</i> coordinate. + * + * @return the <i>z</i> coordinate. + * + * @since vecmath 1.5 + */ + public final float getZ() { + return z; + } + + + /** + * Set a new value for <i>z</i> coordinate. + * + * @param z the <i>z</i> coordinate. + * + * @since vecmath 1.5 + */ + public final void setZ(float z) { + this.z = z; + } + } diff --git a/src/javax/vecmath/Matrix3d.java b/src/javax/vecmath/Matrix3d.java index d816dc5..ca5cad3 100644 --- a/src/javax/vecmath/Matrix3d.java +++ b/src/javax/vecmath/Matrix3d.java @@ -191,7 +191,7 @@ public class Matrix3d implements java.io.Serializable, Cloneable { /** * Returns a string that contains the values of this Matrix3d. * @return the String representation - */ + */ public String toString() { return this.m00 + ", " + this.m01 + ", " + this.m02 + "\n" + @@ -219,13 +219,13 @@ public class Matrix3d implements java.io.Serializable, Cloneable { /** * Sets the scale component of the current matrix by factoring - * out the current scale (by doing an SVD) and multiplying by + * out the current scale (by doing an SVD) and multiplying by * the new scale. * @param scale the new scale amount */ public final void setScale(double scale) { - + double[] tmp_rot = new double[9]; // scratch matrix double[] tmp_scale = new double[3]; // scratch matrix @@ -252,7 +252,7 @@ public class Matrix3d implements java.io.Serializable, Cloneable { */ public final void setElement(int row, int column, double value) { - switch (row) + switch (row) { case 0: switch(column) @@ -272,7 +272,7 @@ public class Matrix3d implements java.io.Serializable, Cloneable { break; case 1: - switch(column) + switch(column) { case 0: this.m10 = value; @@ -288,9 +288,9 @@ public class Matrix3d implements java.io.Serializable, Cloneable { } break; - + case 2: - switch(column) + switch(column) { case 0: this.m20 = value; @@ -320,7 +320,7 @@ public class Matrix3d implements java.io.Serializable, Cloneable { */ public final double getElement(int row, int column) { - switch (row) + switch (row) { case 0: switch(column) @@ -336,7 +336,7 @@ public class Matrix3d implements java.io.Serializable, Cloneable { } break; case 1: - switch(column) + switch(column) { case 0: return(this.m10); @@ -348,9 +348,9 @@ public class Matrix3d implements java.io.Serializable, Cloneable { break; } break; - + case 2: - switch(column) + switch(column) { case 0: return(this.m20); @@ -362,7 +362,7 @@ public class Matrix3d implements java.io.Serializable, Cloneable { break; } break; - + default: break; } @@ -374,7 +374,7 @@ public class Matrix3d implements java.io.Serializable, Cloneable { * Copies the matrix values in the specified row into the vector parameter. * @param row the matrix row * @param v the vector into which the matrix row values will be copied - */ + */ public final void getRow(int row, Vector3d v) { if( row == 0 ) { v.x = m00; @@ -394,11 +394,11 @@ public class Matrix3d implements java.io.Serializable, Cloneable { } - /** + /** * Copies the matrix values in the specified row into the array parameter. * @param row the matrix row * @param v the array into which the matrix row values will be copied - */ + */ public final void getRow(int row, double v[]) { if( row == 0 ) { v[0] = m00; @@ -418,12 +418,12 @@ public class Matrix3d implements java.io.Serializable, Cloneable { } - /** + /** * Copies the matrix values in the specified column into the vector * parameter. * @param column the matrix column * @param v the vector into which the matrix row values will be copied - */ + */ public final void getColumn(int column, Vector3d v) { if( column == 0 ) { v.x = m00; @@ -443,12 +443,12 @@ public class Matrix3d implements java.io.Serializable, Cloneable { } - /** + /** * Copies the matrix values in the specified column into the array * parameter. * @param column the matrix column * @param v the array into which the matrix row values will be copied - */ + */ public final void getColumn(int column, double v[]) { if( column == 0 ) { v[0] = m00; @@ -467,7 +467,7 @@ public class Matrix3d implements java.io.Serializable, Cloneable { } } - + /** * Sets the specified row of this matrix3d to the 4 values provided. @@ -661,14 +661,14 @@ public class Matrix3d implements java.io.Serializable, Cloneable { /** * Performs an SVD normalization of this matrix to calculate - * and return the uniform scale factor. If the matrix has non-uniform - * scale factors, the largest of the x, y, and z scale factors will + * and return the uniform scale factor. If the matrix has non-uniform + * scale factors, the largest of the x, y, and z scale factors will * be returned. This matrix is not modified. * @return the scale factor of this matrix - */ + */ public final double getScale() { - + double[] tmp_scale = new double[3]; // scratch matrix double[] tmp_rot = new double[9]; // scratch matrix getScaleRotate(tmp_scale, tmp_rot); @@ -702,7 +702,7 @@ public class Matrix3d implements java.io.Serializable, Cloneable { * the result into this. Matrix m1 is not modified. * @param scalar the scalar adder * @param m1 the original matrix values - */ + */ public final void add(double scalar, Matrix3d m1) { this.m00 = m1.m00 + scalar; @@ -738,20 +738,20 @@ public class Matrix3d implements java.io.Serializable, Cloneable { this.m22 = m1.m22 + m2.m22; } - /** - * Sets the value of this matrix to the sum of itself and matrix m1. + /** + * Sets the value of this matrix to the sum of itself and matrix m1. * @param m1 the other matrix - */ + */ public final void add(Matrix3d m1) - { + { this.m00 += m1.m00; this.m01 += m1.m01; this.m02 += m1.m02; - + this.m10 += m1.m10; this.m11 += m1.m11; this.m12 += m1.m12; - + this.m20 += m1.m20; this.m21 += m1.m21; this.m22 += m1.m22; @@ -784,15 +784,15 @@ public class Matrix3d implements java.io.Serializable, Cloneable { * @param m1 the other matrix */ public final void sub(Matrix3d m1) - { + { this.m00 -= m1.m00; this.m01 -= m1.m01; this.m02 -= m1.m02; - + this.m10 -= m1.m10; this.m11 -= m1.m11; this.m12 -= m1.m12; - + this.m20 -= m1.m20; this.m21 -= m1.m21; this.m22 -= m1.m22; @@ -891,18 +891,18 @@ public class Matrix3d implements java.io.Serializable, Cloneable { double cosTheta = Math.cos(a1.angle); double t = 1.0 - cosTheta; - double xz = a1.x * a1.z; - double xy = a1.x * a1.y; - double yz = a1.y * a1.z; + double xz = ax * az; + double xy = ax * ay; + double yz = ay * az; m00 = t * ax * ax + cosTheta; m01 = t * xy - sinTheta * az; m02 = t * xz + sinTheta * ay; - + m10 = t * xy + sinTheta * az; m11 = t * ay * ay + cosTheta; m12 = t * yz - sinTheta * ax; - + m20 = t * xz - sinTheta * ay; m21 = t * yz + sinTheta * ax; m22 = t * az * az + cosTheta; @@ -958,18 +958,18 @@ public class Matrix3d implements java.io.Serializable, Cloneable { double cosTheta = Math.cos(a1.angle); double t = 1.0 - cosTheta; - double xz = ax * az; + double xz = ax * az; double xy = ax * ay; double yz = ay * az; m00 = t * ax * ax + cosTheta; m01 = t * xy - sinTheta * az; m02 = t * xz + sinTheta * ay; - + m10 = t * xy + sinTheta * az; m11 = t * ay * ay + cosTheta; m12 = t * yz - sinTheta * ax; - + m20 = t * xz - sinTheta * ay; m21 = t * yz + sinTheta * ax; m22 = t * az * az + cosTheta; @@ -1000,7 +1000,7 @@ public class Matrix3d implements java.io.Serializable, Cloneable { * Sets the value of this matrix to the value of the Matrix3d * argument. * @param m1 the source matrix3d - */ + */ public final void set(Matrix3d m1) { this.m00 = m1.m00; @@ -1020,8 +1020,8 @@ public class Matrix3d implements java.io.Serializable, Cloneable { * Sets the values in this Matrix3d equal to the row-major * array parameter (ie, the first three elements of the * array will be copied into the first row of this matrix, etc.). - * @param m the double precision array of length 9 - */ + * @param m the double precision array of length 9 + */ public final void set(double[] m) { m00 = m[0]; @@ -1073,27 +1073,27 @@ public class Matrix3d implements java.io.Serializable, Cloneable { // Use LU decomposition and backsubstitution code specifically // for floating-point 3x3 matrices. - // Copy source matrix to t1tmp + // Copy source matrix to t1tmp tmp[0] = m1.m00; tmp[1] = m1.m01; tmp[2] = m1.m02; - + tmp[3] = m1.m10; tmp[4] = m1.m11; tmp[5] = m1.m12; - + tmp[6] = m1.m20; tmp[7] = m1.m21; tmp[8] = m1.m22; - - // Calculate LU decomposition: Is the matrix singular? + + // Calculate LU decomposition: Is the matrix singular? if (!luDecomposition(tmp, row_perm)) { - // Matrix has no inverse + // Matrix has no inverse throw new SingularMatrixException(VecMathI18N.getString("Matrix3d12")); } - // Perform back substitution on the identity matrix + // Perform back substitution on the identity matrix for(i=0;i<9;i++) result[i] = 0.0; result[0] = 1.0; result[4] = 1.0; result[8] = 1.0; luBacksubstitution(tmp, row_perm, result); @@ -1105,7 +1105,7 @@ public class Matrix3d implements java.io.Serializable, Cloneable { this.m10 = result[3]; this.m11 = result[4]; this.m12 = result[5]; - + this.m20 = result[6]; this.m21 = result[7]; this.m22 = result[8]; @@ -1113,13 +1113,13 @@ public class Matrix3d implements java.io.Serializable, Cloneable { } /** - * Given a 3x3 array "matrix0", this function replaces it with the - * LU decomposition of a row-wise permutation of itself. The input - * parameters are "matrix0" and "dimen". The array "matrix0" is also - * an output parameter. The vector "row_perm[3]" is an output - * parameter that contains the row permutations resulting from partial - * pivoting. The output parameter "even_row_xchg" is 1 when the - * number of row exchanges is even, or -1 otherwise. Assumes data + * Given a 3x3 array "matrix0", this function replaces it with the + * LU decomposition of a row-wise permutation of itself. The input + * parameters are "matrix0" and "dimen". The array "matrix0" is also + * an output parameter. The vector "row_perm[3]" is an output + * parameter that contains the row permutations resulting from partial + * pivoting. The output parameter "even_row_xchg" is 1 when the + * number of row exchanges is even, or -1 otherwise. Assumes data * type is always double. * * This function is similar to luDecomposition, except that it @@ -1128,8 +1128,8 @@ public class Matrix3d implements java.io.Serializable, Cloneable { * @return true if the matrix is nonsingular, or false otherwise. */ // - // Reference: Press, Flannery, Teukolsky, Vetterling, - // _Numerical_Recipes_in_C_, Cambridge University Press, + // Reference: Press, Flannery, Teukolsky, Vetterling, + // _Numerical_Recipes_in_C_, Cambridge University Press, // 1988, pp 40-45. // static boolean luDecomposition(double[] matrix0, @@ -1137,7 +1137,7 @@ public class Matrix3d implements java.io.Serializable, Cloneable { double row_scale[] = new double[3]; - // Determine implicit scaling information by looping over rows + // Determine implicit scaling information by looping over rows { int i, j; int ptr, rs; @@ -1146,12 +1146,12 @@ public class Matrix3d implements java.io.Serializable, Cloneable { ptr = 0; rs = 0; - // For each row ... + // For each row ... i = 3; while (i-- != 0) { big = 0.0; - // For each column, find the largest element in the row + // For each column, find the largest element in the row j = 3; while (j-- != 0) { temp = matrix0[ptr++]; @@ -1161,7 +1161,7 @@ public class Matrix3d implements java.io.Serializable, Cloneable { } } - // Is the matrix singular? + // Is the matrix singular? if (big == 0.0) { return false; } @@ -1175,13 +1175,13 @@ public class Matrix3d implements java.io.Serializable, Cloneable { mtx = 0; - // For all columns, execute Crout's method + // For all columns, execute Crout's method for (j = 0; j < 3; j++) { int i, imax, k; int target, p1, p2; double sum, big, temp; - // Determine elements of upper diagonal matrix U + // Determine elements of upper diagonal matrix U for (i = 0; i < j; i++) { target = mtx + (3*i) + j; sum = matrix0[target]; @@ -1213,7 +1213,7 @@ public class Matrix3d implements java.io.Serializable, Cloneable { } matrix0[target] = sum; - // Is this the best pivot so far? + // Is this the best pivot so far? if ((temp = row_scale[i] * Math.abs(sum)) >= big) { big = temp; imax = i; @@ -1224,9 +1224,9 @@ public class Matrix3d implements java.io.Serializable, Cloneable { throw new RuntimeException(VecMathI18N.getString("Matrix3d13")); } - // Is a row exchange necessary? + // Is a row exchange necessary? if (j != imax) { - // Yes: exchange rows + // Yes: exchange rows k = 3; p1 = mtx + (3*imax); p2 = mtx + (3*j); @@ -1236,19 +1236,19 @@ public class Matrix3d implements java.io.Serializable, Cloneable { matrix0[p2++] = temp; } - // Record change in scale factor + // Record change in scale factor row_scale[imax] = row_scale[j]; } - // Record row permutation + // Record row permutation row_perm[j] = imax; - // Is the matrix singular + // Is the matrix singular if (matrix0[(mtx + (3*j) + j)] == 0.0) { return false; } - // Divide elements of lower diagonal matrix L by pivot + // Divide elements of lower diagonal matrix L by pivot if (j != (3-1)) { temp = 1.0 / (matrix0[(mtx + (3*j) + j)]); target = mtx + (3*(j+1)) + j; @@ -1278,8 +1278,8 @@ public class Matrix3d implements java.io.Serializable, Cloneable { * derived. */ // - // Reference: Press, Flannery, Teukolsky, Vetterling, - // _Numerical_Recipes_in_C_, Cambridge University Press, + // Reference: Press, Flannery, Teukolsky, Vetterling, + // _Numerical_Recipes_in_C_, Cambridge University Press, // 1988, pp 44-45. // static void luBacksubstitution(double[] matrix1, @@ -1289,17 +1289,17 @@ public class Matrix3d implements java.io.Serializable, Cloneable { int i, ii, ip, j, k; int rp; int cv, rv; - + // rp = row_perm; rp = 0; - // For each column vector of matrix2 ... + // For each column vector of matrix2 ... for (k = 0; k < 3; k++) { // cv = &(matrix2[0][k]); cv = k; ii = -1; - // Forward substitution + // Forward substitution for (i = 0; i < 3; i++) { double sum; @@ -1319,7 +1319,7 @@ public class Matrix3d implements java.io.Serializable, Cloneable { matrix2[cv+3*i] = sum; } - // Backsubstitution + // Backsubstitution // rv = &(matrix1[3][0]); rv = 2*3; matrix2[cv+3*2] /= matrix1[rv+2]; @@ -1371,7 +1371,7 @@ public class Matrix3d implements java.io.Serializable, Cloneable { } /** - * Sets the value of this matrix to a counter clockwise rotation + * Sets the value of this matrix to a counter clockwise rotation * about the x axis. * @param angle the angle to rotate about the X axis in radians */ @@ -1396,7 +1396,7 @@ public class Matrix3d implements java.io.Serializable, Cloneable { } /** - * Sets the value of this matrix to a counter clockwise rotation + * Sets the value of this matrix to a counter clockwise rotation * about the y axis. * @param angle the angle to rotate about the Y axis in radians */ @@ -1421,7 +1421,7 @@ public class Matrix3d implements java.io.Serializable, Cloneable { } /** - * Sets the value of this matrix to a counter clockwise rotation + * Sets the value of this matrix to a counter clockwise rotation * about the z axis. * @param angle the angle to rotate about the Z axis in radians */ @@ -1470,17 +1470,17 @@ public class Matrix3d implements java.io.Serializable, Cloneable { * the result into this. Matrix m1 is not modified. * @param scalar the scalar multiplier * @param m1 the original matrix - */ + */ public final void mul(double scalar, Matrix3d m1) { this.m00 = scalar * m1.m00; this.m01 = scalar * m1.m01; this.m02 = scalar * m1.m02; - + this.m10 = scalar * m1.m10; this.m11 = scalar * m1.m11; this.m12 = scalar * m1.m12; - + this.m20 = scalar * m1.m20; this.m21 = scalar * m1.m21; this.m22 = scalar * m1.m22; @@ -1502,15 +1502,15 @@ public class Matrix3d implements java.io.Serializable, Cloneable { m01 = this.m00*m1.m01 + this.m01*m1.m11 + this.m02*m1.m21; m02 = this.m00*m1.m02 + this.m01*m1.m12 + this.m02*m1.m22; - m10 = this.m10*m1.m00 + this.m11*m1.m10 + this.m12*m1.m20; + m10 = this.m10*m1.m00 + this.m11*m1.m10 + this.m12*m1.m20; m11 = this.m10*m1.m01 + this.m11*m1.m11 + this.m12*m1.m21; m12 = this.m10*m1.m02 + this.m11*m1.m12 + this.m12*m1.m22; - + m20 = this.m20*m1.m00 + this.m21*m1.m10 + this.m22*m1.m20; m21 = this.m20*m1.m01 + this.m21*m1.m11 + this.m22*m1.m21; m22 = this.m20*m1.m02 + this.m21*m1.m12 + this.m22*m1.m22; - this.m00 = m00; this.m01 = m01; this.m02 = m02; + this.m00 = m00; this.m01 = m01; this.m02 = m02; this.m10 = m10; this.m11 = m11; this.m12 = m12; this.m20 = m20; this.m21 = m21; this.m22 = m22; } @@ -1527,31 +1527,31 @@ public class Matrix3d implements java.io.Serializable, Cloneable { this.m00 = m1.m00*m2.m00 + m1.m01*m2.m10 + m1.m02*m2.m20; this.m01 = m1.m00*m2.m01 + m1.m01*m2.m11 + m1.m02*m2.m21; this.m02 = m1.m00*m2.m02 + m1.m01*m2.m12 + m1.m02*m2.m22; - + this.m10 = m1.m10*m2.m00 + m1.m11*m2.m10 + m1.m12*m2.m20; this.m11 = m1.m10*m2.m01 + m1.m11*m2.m11 + m1.m12*m2.m21; this.m12 = m1.m10*m2.m02 + m1.m11*m2.m12 + m1.m12*m2.m22; - + this.m20 = m1.m20*m2.m00 + m1.m21*m2.m10 + m1.m22*m2.m20; this.m21 = m1.m20*m2.m01 + m1.m21*m2.m11 + m1.m22*m2.m21; this.m22 = m1.m20*m2.m02 + m1.m21*m2.m12 + m1.m22*m2.m22; } else { double m00, m01, m02, m10, m11, m12, - m20, m21, m22; // vars for temp result matrix + m20, m21, m22; // vars for temp result matrix m00 = m1.m00*m2.m00 + m1.m01*m2.m10 + m1.m02*m2.m20; m01 = m1.m00*m2.m01 + m1.m01*m2.m11 + m1.m02*m2.m21; m02 = m1.m00*m2.m02 + m1.m01*m2.m12 + m1.m02*m2.m22; - m10 = m1.m10*m2.m00 + m1.m11*m2.m10 + m1.m12*m2.m20; + m10 = m1.m10*m2.m00 + m1.m11*m2.m10 + m1.m12*m2.m20; m11 = m1.m10*m2.m01 + m1.m11*m2.m11 + m1.m12*m2.m21; m12 = m1.m10*m2.m02 + m1.m11*m2.m12 + m1.m12*m2.m22; - m20 = m1.m20*m2.m00 + m1.m21*m2.m10 + m1.m22*m2.m20; + m20 = m1.m20*m2.m00 + m1.m21*m2.m10 + m1.m22*m2.m20; m21 = m1.m20*m2.m01 + m1.m21*m2.m11 + m1.m22*m2.m21; m22 = m1.m20*m2.m02 + m1.m21*m2.m12 + m1.m22*m2.m22; - + this.m00 = m00; this.m01 = m01; this.m02 = m02; this.m10 = m10; this.m11 = m11; this.m12 = m12; this.m20 = m20; this.m21 = m21; this.m22 = m22; @@ -1559,13 +1559,13 @@ public class Matrix3d implements java.io.Serializable, Cloneable { } /** - * Multiplies this matrix by matrix m1, does an SVD normalization + * Multiplies this matrix by matrix m1, does an SVD normalization * of the result, and places the result back into this matrix * this = SVDnorm(this*m1). * @param m1 the matrix on the right hand side of the multiplication - */ + */ public final void mulNormalize(Matrix3d m1){ - + double[] tmp = new double[9]; // scratch matrix double[] tmp_rot = new double[9]; // scratch matrix double[] tmp_scale = new double[3]; // scratch matrix @@ -1574,10 +1574,10 @@ public class Matrix3d implements java.io.Serializable, Cloneable { tmp[1] = this.m00*m1.m01 + this.m01*m1.m11 + this.m02*m1.m21; tmp[2] = this.m00*m1.m02 + this.m01*m1.m12 + this.m02*m1.m22; - tmp[3] = this.m10*m1.m00 + this.m11*m1.m10 + this.m12*m1.m20; + tmp[3] = this.m10*m1.m00 + this.m11*m1.m10 + this.m12*m1.m20; tmp[4] = this.m10*m1.m01 + this.m11*m1.m11 + this.m12*m1.m21; tmp[5] = this.m10*m1.m02 + this.m11*m1.m12 + this.m12*m1.m22; - + tmp[6] = this.m20*m1.m00 + this.m21*m1.m10 + this.m22*m1.m20; tmp[7] = this.m20*m1.m01 + this.m21*m1.m11 + this.m22*m1.m21; tmp[8] = this.m20*m1.m02 + this.m21*m1.m12 + this.m22*m1.m22; @@ -1597,16 +1597,16 @@ public class Matrix3d implements java.io.Serializable, Cloneable { this.m22 = tmp_rot[8]; } - - - /** - * Multiplies matrix m1 by matrix m2, does an SVD normalization + + + /** + * Multiplies matrix m1 by matrix m2, does an SVD normalization * of the result, and places the result into this matrix * this = SVDnorm(m1*m2). * @param m1 the matrix on the left hand side of the multiplication * @param m2 the matrix on the right hand side of the multiplication - */ - public final void mulNormalize(Matrix3d m1, Matrix3d m2){ + */ + public final void mulNormalize(Matrix3d m1, Matrix3d m2){ double[] tmp = new double[9]; // scratch matrix double[] tmp_rot = new double[9]; // scratch matrix @@ -1623,7 +1623,7 @@ public class Matrix3d implements java.io.Serializable, Cloneable { tmp[6] = m1.m20*m2.m00 + m1.m21*m2.m10 + m1.m22*m2.m20; tmp[7] = m1.m20*m2.m01 + m1.m21*m2.m11 + m1.m22*m2.m21; tmp[8] = m1.m20*m2.m02 + m1.m21*m2.m12 + m1.m22*m2.m22; - + compute_svd( tmp, tmp_scale, tmp_rot); this.m00 = tmp_rot[0]; @@ -1645,7 +1645,7 @@ public class Matrix3d implements java.io.Serializable, Cloneable { * m2, and places the result into this. * @param m1 the matrix on the left hand side of the multiplication * @param m2 the matrix on the right hand side of the multiplication - */ + */ public final void mulTransposeBoth(Matrix3d m1, Matrix3d m2) { if (this != m1 && this != m2) { @@ -1663,20 +1663,20 @@ public class Matrix3d implements java.io.Serializable, Cloneable { } else { double m00, m01, m02, m10, m11, m12, - m20, m21, m22; // vars for temp result matrix + m20, m21, m22; // vars for temp result matrix m00 = m1.m00*m2.m00 + m1.m10*m2.m01 + m1.m20*m2.m02; m01 = m1.m00*m2.m10 + m1.m10*m2.m11 + m1.m20*m2.m12; m02 = m1.m00*m2.m20 + m1.m10*m2.m21 + m1.m20*m2.m22; - + m10 = m1.m01*m2.m00 + m1.m11*m2.m01 + m1.m21*m2.m02; m11 = m1.m01*m2.m10 + m1.m11*m2.m11 + m1.m21*m2.m12; m12 = m1.m01*m2.m20 + m1.m11*m2.m21 + m1.m21*m2.m22; - + m20 = m1.m02*m2.m00 + m1.m12*m2.m01 + m1.m22*m2.m02; m21 = m1.m02*m2.m10 + m1.m12*m2.m11 + m1.m22*m2.m12; m22 = m1.m02*m2.m20 + m1.m12*m2.m21 + m1.m22*m2.m22; - + this.m00 = m00; this.m01 = m01; this.m02 = m02; this.m10 = m10; this.m11 = m11; this.m12 = m12; this.m20 = m20; this.m21 = m21; this.m22 = m22; @@ -1691,43 +1691,43 @@ public class Matrix3d implements java.io.Serializable, Cloneable { * @param m2 the matrix on the right hand side of the multiplication */ public final void mulTransposeRight(Matrix3d m1, Matrix3d m2) - { + { if (this != m1 && this != m2) { this.m00 = m1.m00*m2.m00 + m1.m01*m2.m01 + m1.m02*m2.m02; this.m01 = m1.m00*m2.m10 + m1.m01*m2.m11 + m1.m02*m2.m12; this.m02 = m1.m00*m2.m20 + m1.m01*m2.m21 + m1.m02*m2.m22; - + this.m10 = m1.m10*m2.m00 + m1.m11*m2.m01 + m1.m12*m2.m02; this.m11 = m1.m10*m2.m10 + m1.m11*m2.m11 + m1.m12*m2.m12; this.m12 = m1.m10*m2.m20 + m1.m11*m2.m21 + m1.m12*m2.m22; - + this.m20 = m1.m20*m2.m00 + m1.m21*m2.m01 + m1.m22*m2.m02; this.m21 = m1.m20*m2.m10 + m1.m21*m2.m11 + m1.m22*m2.m12; this.m22 = m1.m20*m2.m20 + m1.m21*m2.m21 + m1.m22*m2.m22; } else { double m00, m01, m02, m10, m11, m12, - m20, m21, m22; // vars for temp result matrix + m20, m21, m22; // vars for temp result matrix m00 = m1.m00*m2.m00 + m1.m01*m2.m01 + m1.m02*m2.m02; m01 = m1.m00*m2.m10 + m1.m01*m2.m11 + m1.m02*m2.m12; m02 = m1.m00*m2.m20 + m1.m01*m2.m21 + m1.m02*m2.m22; - m10 = m1.m10*m2.m00 + m1.m11*m2.m01 + m1.m12*m2.m02; + m10 = m1.m10*m2.m00 + m1.m11*m2.m01 + m1.m12*m2.m02; m11 = m1.m10*m2.m10 + m1.m11*m2.m11 + m1.m12*m2.m12; m12 = m1.m10*m2.m20 + m1.m11*m2.m21 + m1.m12*m2.m22; - m20 = m1.m20*m2.m00 + m1.m21*m2.m01 + m1.m22*m2.m02; + m20 = m1.m20*m2.m00 + m1.m21*m2.m01 + m1.m22*m2.m02; m21 = m1.m20*m2.m10 + m1.m21*m2.m11 + m1.m22*m2.m12; m22 = m1.m20*m2.m20 + m1.m21*m2.m21 + m1.m22*m2.m22; - + this.m00 = m00; this.m01 = m01; this.m02 = m02; this.m10 = m10; this.m11 = m11; this.m12 = m12; this.m20 = m20; this.m21 = m21; this.m22 = m22; } } - - + + /** * Multiplies the transpose of matrix m1 times matrix m2, and * places the result into this. @@ -1739,46 +1739,46 @@ public class Matrix3d implements java.io.Serializable, Cloneable { this.m00 = m1.m00*m2.m00 + m1.m10*m2.m10 + m1.m20*m2.m20; this.m01 = m1.m00*m2.m01 + m1.m10*m2.m11 + m1.m20*m2.m21; this.m02 = m1.m00*m2.m02 + m1.m10*m2.m12 + m1.m20*m2.m22; - + this.m10 = m1.m01*m2.m00 + m1.m11*m2.m10 + m1.m21*m2.m20; this.m11 = m1.m01*m2.m01 + m1.m11*m2.m11 + m1.m21*m2.m21; this.m12 = m1.m01*m2.m02 + m1.m11*m2.m12 + m1.m21*m2.m22; - + this.m20 = m1.m02*m2.m00 + m1.m12*m2.m10 + m1.m22*m2.m20; this.m21 = m1.m02*m2.m01 + m1.m12*m2.m11 + m1.m22*m2.m21; this.m22 = m1.m02*m2.m02 + m1.m12*m2.m12 + m1.m22*m2.m22; } else { double m00, m01, m02, m10, m11, m12, - m20, m21, m22; // vars for temp result matrix + m20, m21, m22; // vars for temp result matrix m00 = m1.m00*m2.m00 + m1.m10*m2.m10 + m1.m20*m2.m20; m01 = m1.m00*m2.m01 + m1.m10*m2.m11 + m1.m20*m2.m21; m02 = m1.m00*m2.m02 + m1.m10*m2.m12 + m1.m20*m2.m22; - m10 = m1.m01*m2.m00 + m1.m11*m2.m10 + m1.m21*m2.m20; + m10 = m1.m01*m2.m00 + m1.m11*m2.m10 + m1.m21*m2.m20; m11 = m1.m01*m2.m01 + m1.m11*m2.m11 + m1.m21*m2.m21; m12 = m1.m01*m2.m02 + m1.m11*m2.m12 + m1.m21*m2.m22; - m20 = m1.m02*m2.m00 + m1.m12*m2.m10 + m1.m22*m2.m20; + m20 = m1.m02*m2.m00 + m1.m12*m2.m10 + m1.m22*m2.m20; m21 = m1.m02*m2.m01 + m1.m12*m2.m11 + m1.m22*m2.m21; m22 = m1.m02*m2.m02 + m1.m12*m2.m12 + m1.m22*m2.m22; - + this.m00 = m00; this.m01 = m01; this.m02 = m02; this.m10 = m10; this.m11 = m11; this.m12 = m12; this.m20 = m20; this.m21 = m21; this.m22 = m22; } } - - /** + + /** * Performs singular value decomposition normalization of this matrix. */ public final void normalize(){ double[] tmp_rot = new double[9]; // scratch matrix double[] tmp_scale = new double[3]; // scratch matrix - + getScaleRotate( tmp_scale, tmp_rot ); this.m00 = tmp_rot[0]; @@ -1794,8 +1794,8 @@ public class Matrix3d implements java.io.Serializable, Cloneable { this.m22 = tmp_rot[8]; } - - + + /** * Perform singular value decomposition normalization of matrix m1 and * place the normalized values into this. @@ -1834,11 +1834,11 @@ public class Matrix3d implements java.io.Serializable, Cloneable { this.m22 = tmp_rot[8]; } - + /** * Perform cross product normalization of this matrix. */ - + public final void normalizeCP() { double mag = 1.0/Math.sqrt(m00*m00 + m10*m10 + m20*m20); @@ -1856,7 +1856,7 @@ public class Matrix3d implements java.io.Serializable, Cloneable { m22 = m00*m11 - m01*m10; } - + /** * Perform cross product normalization of matrix m1 and place the * normalized values into this. @@ -1884,7 +1884,7 @@ public class Matrix3d implements java.io.Serializable, Cloneable { * equal to the corresponding data members in this Matrix3d. * @param m1 the matrix with which the comparison is made * @return true or false - */ + */ public boolean equals(Matrix3d m1) { try { @@ -1902,10 +1902,10 @@ public class Matrix3d implements java.io.Serializable, Cloneable { * this Matrix3d. * @param t1 the matrix with which the comparison is made * @return true or false - */ + */ public boolean equals(Object t1) { - try { + try { Matrix3d m2 = (Matrix3d) t1; return(this.m00 == m2.m00 && this.m01 == m2.m01 && this.m02 == m2.m02 && this.m10 == m2.m10 && this.m11 == m2.m11 && this.m12 == m2.m12 @@ -1916,15 +1916,15 @@ public class Matrix3d implements java.io.Serializable, Cloneable { } - /** + /** * Returns true if the L-infinite distance between this matrix * and matrix m1 is less than or equal to the epsilon parameter, * otherwise returns false. The L-infinite - * distance is equal to + * distance is equal to * MAX[i=0,1,2 ; j=0,1,2 ; abs(this.m(i,j) - m1.m(i,j)] * @param m1 the matrix to be compared to this matrix - * @param epsilon the threshold value - */ + * @param epsilon the threshold value + */ public boolean epsilonEquals(Matrix3d m1, double epsilon) { double diff; @@ -1967,7 +1967,7 @@ public class Matrix3d implements java.io.Serializable, Cloneable { * code value. Two objects with different data members may return the * same hash value, although this is not likely. * @return the integer hash code value - */ + */ public int hashCode() { long bits = 1L; bits = 31L * bits + VecMathUtil.doubleToLongBits(m00); @@ -1991,11 +1991,11 @@ public class Matrix3d implements java.io.Serializable, Cloneable { m00 = 0.0; m01 = 0.0; m02 = 0.0; - + m10 = 0.0; m11 = 0.0; m12 = 0.0; - + m20 = 0.0; m21 = 0.0; m22 = 0.0; @@ -2004,17 +2004,17 @@ public class Matrix3d implements java.io.Serializable, Cloneable { /** * Negates the value of this matrix: this = -this. - */ + */ public final void negate() { this.m00 = -this.m00; this.m01 = -this.m01; this.m02 = -this.m02; - + this.m10 = -this.m10; this.m11 = -this.m11; this.m12 = -this.m12; - + this.m20 = -this.m20; this.m21 = -this.m21; this.m22 = -this.m22; @@ -2025,17 +2025,17 @@ public class Matrix3d implements java.io.Serializable, Cloneable { * Sets the value of this matrix equal to the negation of * of the Matrix3d parameter. * @param m1 the source matrix - */ + */ public final void negate(Matrix3d m1) { this.m00 = -m1.m00; this.m01 = -m1.m01; this.m02 = -m1.m02; - + this.m10 = -m1.m10; this.m11 = -m1.m11; this.m12 = -m1.m12; - + this.m20 = -m1.m20; this.m21 = -m1.m21; this.m22 = -m1.m22; @@ -2055,7 +2055,7 @@ public class Matrix3d implements java.io.Serializable, Cloneable { t.set(x,y,z); } - /** + /** * Multiply this matrix by the tuple t and and place the result * into the tuple "result" (result = this*t). * @param t the tuple to be multiplied by this matrix @@ -2071,28 +2071,28 @@ public class Matrix3d implements java.io.Serializable, Cloneable { } /** - * perform SVD (if necessary to get rotational component + * perform SVD (if necessary to get rotational component */ final void getScaleRotate(double scales[], double rots[]) { - + double[] tmp = new double[9]; // scratch matrix - + tmp[0] = m00; tmp[1] = m01; tmp[2] = m02; - + tmp[3] = m10; tmp[4] = m11; tmp[5] = m12; - + tmp[6] = m20; tmp[7] = m21; tmp[8] = m22; compute_svd( tmp, scales, rots); - + return; } - + static void compute_svd( double[] m, double[] outScale, double[] outRot) { int i,j; double g,scale; @@ -2100,26 +2100,26 @@ public class Matrix3d implements java.io.Serializable, Cloneable { double[] v1 = new double[9]; double[] t1 = new double[9]; double[] t2 = new double[9]; - + double[] tmp = t1; double[] single_values = t2; - + double[] rot = new double[9]; double[] e = new double[3]; double[] scales = new double[3]; - + int converged, negCnt=0; double cs,sn; double c1,c2,c3,c4; double s1,s2,s3,s4; double cl1,cl2,cl3; - - + + for(i=0; i<9; i++) - rot[i] = m[i]; - + rot[i] = m[i]; + // u1 - + if( m[3]*m[3] < EPS ) { u1[0] = 1.0; u1[1] = 0.0; u1[2] = 0.0; u1[3] = 0.0; u1[4] = 1.0; u1[5] = 0.0; @@ -2131,11 +2131,11 @@ public class Matrix3d implements java.io.Serializable, Cloneable { m[0] = m[3]; m[1] = m[4]; m[2] = m[5]; - - m[3] = -tmp[0]; // zero + + m[3] = -tmp[0]; // zero m[4] = -tmp[1]; m[5] = -tmp[2]; - + u1[0] = 0.0; u1[1] = 1.0; u1[2] = 0.0; u1[3] = -1.0; u1[4] = 0.0; u1[5] = 0.0; u1[6] = 0.0; u1[7] = 0.0; u1[8] = 1.0; @@ -2146,11 +2146,11 @@ public class Matrix3d implements java.io.Serializable, Cloneable { tmp[0] = c1*m[0] + s1*m[3]; tmp[1] = c1*m[1] + s1*m[4]; tmp[2] = c1*m[2] + s1*m[5]; - - m[3] = -s1*m[0] + c1*m[3]; // zero + + m[3] = -s1*m[0] + c1*m[3]; // zero m[4] = -s1*m[1] + c1*m[4]; m[5] = -s1*m[2] + c1*m[5]; - + m[0] = tmp[0]; m[1] = tmp[1]; m[2] = tmp[2]; @@ -2158,9 +2158,9 @@ public class Matrix3d implements java.io.Serializable, Cloneable { u1[3] = -s1; u1[4] = c1; u1[5] = 0.0; u1[6] = 0.0; u1[7] = 0.0; u1[8] = 1.0; } - + // u2 - + if( m[6]*m[6] < EPS ) { } else if( m[0]*m[0] < EPS ){ tmp[0] = m[0]; @@ -2169,19 +2169,19 @@ public class Matrix3d implements java.io.Serializable, Cloneable { m[0] = m[6]; m[1] = m[7]; m[2] = m[8]; - + m[6] = -tmp[0]; // zero m[7] = -tmp[1]; m[8] = -tmp[2]; - + tmp[0] = u1[0]; tmp[1] = u1[1]; tmp[2] = u1[2]; u1[0] = u1[6]; u1[1] = u1[7]; u1[2] = u1[8]; - - u1[6] = -tmp[0]; // zero + + u1[6] = -tmp[0]; // zero u1[7] = -tmp[1]; u1[8] = -tmp[2]; } else { @@ -2191,18 +2191,18 @@ public class Matrix3d implements java.io.Serializable, Cloneable { tmp[0] = c2*m[0] + s2*m[6]; tmp[1] = c2*m[1] + s2*m[7]; tmp[2] = c2*m[2] + s2*m[8]; - + m[6] = -s2*m[0] + c2*m[6]; m[7] = -s2*m[1] + c2*m[7]; m[8] = -s2*m[2] + c2*m[8]; m[0] = tmp[0]; m[1] = tmp[1]; m[2] = tmp[2]; - - tmp[0] = c2*u1[0]; - tmp[1] = c2*u1[1]; + + tmp[0] = c2*u1[0]; + tmp[1] = c2*u1[1]; u1[2] = s2; - + tmp[6] = -u1[0]*s2; tmp[7] = -u1[1]*s2; u1[8] = c2; @@ -2213,7 +2213,7 @@ public class Matrix3d implements java.io.Serializable, Cloneable { } // v1 - + if( m[2]*m[2] < EPS ) { v1[0] = 1.0; v1[1] = 0.0; v1[2] = 0.0; v1[3] = 0.0; v1[4] = 1.0; v1[5] = 0.0; @@ -2225,11 +2225,11 @@ public class Matrix3d implements java.io.Serializable, Cloneable { m[2] = -m[1]; m[5] = -m[4]; m[8] = -m[7]; - - m[1] = tmp[2]; // zero + + m[1] = tmp[2]; // zero m[4] = tmp[5]; m[7] = tmp[8]; - + v1[0] = 1.0; v1[1] = 0.0; v1[2] = 0.0; v1[3] = 0.0; v1[4] = 0.0; v1[5] =-1.0; v1[6] = 0.0; v1[7] = 1.0; v1[8] = 0.0; @@ -2238,145 +2238,145 @@ public class Matrix3d implements java.io.Serializable, Cloneable { c3 = m[1]*g; s3 = m[2]*g; tmp[1] = c3*m[1] + s3*m[2]; // can assign to m[1]? - m[2] =-s3*m[1] + c3*m[2]; // zero + m[2] =-s3*m[1] + c3*m[2]; // zero m[1] = tmp[1]; - - tmp[4] = c3*m[4] + s3*m[5]; - m[5] =-s3*m[4] + c3*m[5]; + + tmp[4] = c3*m[4] + s3*m[5]; + m[5] =-s3*m[4] + c3*m[5]; m[4] = tmp[4]; - - tmp[7] = c3*m[7] + s3*m[8]; - m[8] =-s3*m[7] + c3*m[8]; + + tmp[7] = c3*m[7] + s3*m[8]; + m[8] =-s3*m[7] + c3*m[8]; m[7] = tmp[7]; - + v1[0] = 1.0; v1[1] = 0.0; v1[2] = 0.0; v1[3] = 0.0; v1[4] = c3; v1[5] = -s3; v1[6] = 0.0; v1[7] = s3; v1[8] = c3; } - + // u3 - + if( m[7]*m[7] < EPS ) { } else if( m[4]*m[4] < EPS ) { tmp[3] = m[3]; tmp[4] = m[4]; tmp[5] = m[5]; - m[3] = m[6]; // zero + m[3] = m[6]; // zero m[4] = m[7]; m[5] = m[8]; - - m[6] = -tmp[3]; // zero - m[7] = -tmp[4]; // zero + + m[6] = -tmp[3]; // zero + m[7] = -tmp[4]; // zero m[8] = -tmp[5]; - + tmp[3] = u1[3]; tmp[4] = u1[4]; tmp[5] = u1[5]; u1[3] = u1[6]; u1[4] = u1[7]; u1[5] = u1[8]; - - u1[6] = -tmp[3]; // zero + + u1[6] = -tmp[3]; // zero u1[7] = -tmp[4]; u1[8] = -tmp[5]; - + } else { g = 1.0/Math.sqrt(m[4]*m[4] + m[7]*m[7]); c4 = m[4]*g; s4 = m[7]*g; - tmp[3] = c4*m[3] + s4*m[6]; - m[6] =-s4*m[3] + c4*m[6]; // zero + tmp[3] = c4*m[3] + s4*m[6]; + m[6] =-s4*m[3] + c4*m[6]; // zero m[3] = tmp[3]; - - tmp[4] = c4*m[4] + s4*m[7]; - m[7] =-s4*m[4] + c4*m[7]; + + tmp[4] = c4*m[4] + s4*m[7]; + m[7] =-s4*m[4] + c4*m[7]; m[4] = tmp[4]; - - tmp[5] = c4*m[5] + s4*m[8]; - m[8] =-s4*m[5] + c4*m[8]; + + tmp[5] = c4*m[5] + s4*m[8]; + m[8] =-s4*m[5] + c4*m[8]; m[5] = tmp[5]; - - tmp[3] = c4*u1[3] + s4*u1[6]; - u1[6] =-s4*u1[3] + c4*u1[6]; + + tmp[3] = c4*u1[3] + s4*u1[6]; + u1[6] =-s4*u1[3] + c4*u1[6]; u1[3] = tmp[3]; - - tmp[4] = c4*u1[4] + s4*u1[7]; - u1[7] =-s4*u1[4] + c4*u1[7]; + + tmp[4] = c4*u1[4] + s4*u1[7]; + u1[7] =-s4*u1[4] + c4*u1[7]; u1[4] = tmp[4]; - - tmp[5] = c4*u1[5] + s4*u1[8]; - u1[8] =-s4*u1[5] + c4*u1[8]; + + tmp[5] = c4*u1[5] + s4*u1[8]; + u1[8] =-s4*u1[5] + c4*u1[8]; u1[5] = tmp[5]; } - + single_values[0] = m[0]; single_values[1] = m[4]; single_values[2] = m[8]; e[0] = m[1]; e[1] = m[5]; - + if( e[0]*e[0]<EPS && e[1]*e[1]<EPS ) { - + } else { - compute_qr( single_values, e, u1, v1); + compute_qr( single_values, e, u1, v1); } - + scales[0] = single_values[0]; scales[1] = single_values[1]; scales[2] = single_values[2]; - - + + // Do some optimization here. If scale is unity, simply return the rotation matric. if(almostEqual(Math.abs(scales[0]), 1.0) && almostEqual(Math.abs(scales[1]), 1.0) && almostEqual(Math.abs(scales[2]), 1.0)) { // System.out.println("Scale components almost to 1.0"); - - for(i=0;i<3;i++) + + for(i=0;i<3;i++) if(scales[i]<0.0) negCnt++; - + if((negCnt==0)||(negCnt==2)) { //System.out.println("Optimize!!"); outScale[0] = outScale[1] = outScale[2] = 1.0; for(i=0;i<9;i++) outRot[i] = rot[i]; - + return; } } - - + + transpose_mat(u1, t1); transpose_mat(v1, t2); - + /* System.out.println("t1 is \n" + t1); System.out.println("t1="+t1[0]+" "+t1[1]+" "+t1[2]); System.out.println("t1="+t1[3]+" "+t1[4]+" "+t1[5]); System.out.println("t1="+t1[6]+" "+t1[7]+" "+t1[8]); - + System.out.println("t2 is \n" + t2); System.out.println("t2="+t2[0]+" "+t2[1]+" "+t2[2]); System.out.println("t2="+t2[3]+" "+t2[4]+" "+t2[5]); System.out.println("t2="+t2[6]+" "+t2[7]+" "+t2[8]); */ - + svdReorder( m, t1, t2, scales, outRot, outScale); - + } - - static void svdReorder( double[] m, double[] t1, double[] t2, double[] scales, + + static void svdReorder( double[] m, double[] t1, double[] t2, double[] scales, double[] outRot, double[] outScale) { - + int[] out = new int[3]; int[] in = new int[3]; int in0, in1, in2, index, i; double[] mag = new double[3]; - double[] rot = new double[9]; + double[] rot = new double[9]; - - // check for rotation information in the scales + + // check for rotation information in the scales if(scales[0] < 0.0 ) { // move the rotation info to rotation matrix scales[0] = -scales[0]; t2[0] = -t2[0]; @@ -2395,11 +2395,11 @@ public class Matrix3d implements java.io.Serializable, Cloneable { t2[7] = -t2[7]; t2[8] = -t2[8]; } - + mat_mul(t1,t2,rot); - + // check for equal scales case and do not reorder - if(almostEqual(Math.abs(scales[0]), Math.abs(scales[1])) && + if(almostEqual(Math.abs(scales[0]), Math.abs(scales[1])) && almostEqual(Math.abs(scales[1]), Math.abs(scales[2])) ){ for(i=0;i<9;i++){ outRot[i] = rot[i]; @@ -2407,13 +2407,13 @@ public class Matrix3d implements java.io.Serializable, Cloneable { for(i=0;i<3;i++){ outScale[i] = scales[i]; } - + }else { - + // sort the order of the results of SVD - if( scales[0] > scales[1]) { + if( scales[0] > scales[1]) { if( scales[0] > scales[2] ) { - if( scales[2] > scales[1] ) { + if( scales[2] > scales[1] ) { out[0] = 0; out[1] = 2; out[2] = 1; // xzy } else { out[0] = 0; out[1] = 1; out[2] = 2; // xyz @@ -2432,20 +2432,20 @@ public class Matrix3d implements java.io.Serializable, Cloneable { out[0] = 2; out[1] = 1; out[2] = 0; // zyx } } - - /* + + /* System.out.println("\nscales="+scales[0]+" "+scales[1]+" "+scales[2]); System.out.println("\nrot="+rot[0]+" "+rot[1]+" "+rot[2]); System.out.println("rot="+rot[3]+" "+rot[4]+" "+rot[5]); System.out.println("rot="+rot[6]+" "+rot[7]+" "+rot[8]); */ - + // sort the order of the input matrix mag[0] = (m[0]*m[0] + m[1]*m[1] + m[2]*m[2]); mag[1] = (m[3]*m[3] + m[4]*m[4] + m[5]*m[5]); mag[2] = (m[6]*m[6] + m[7]*m[7] + m[8]*m[8]); - - if( mag[0] > mag[1]) { + + if( mag[0] > mag[1]) { if( mag[0] > mag[2] ) { if( mag[2] > mag[1] ) { // 0 - 2 - 1 @@ -2458,7 +2458,7 @@ public class Matrix3d implements java.io.Serializable, Cloneable { // 2 - 0 - 1 in2 = 0; in0 = 1; in1 = 2; // zxy } - } else { // y > x 1>0 + } else { // y > x 1>0 if( mag[1] > mag[2] ) { if( mag[2] > mag[0] ) { // 1 - 2 - 0 @@ -2467,54 +2467,54 @@ public class Matrix3d implements java.io.Serializable, Cloneable { // 1 - 0 - 2 in1 = 0; in0 = 1; in2 = 2; // yxz } - } else { + } else { // 2 - 1 - 0 in2 = 0; in1 = 1; in0 = 2; // zyx } } - - + + index = out[in0]; outScale[0] = scales[index]; - + index = out[in1]; outScale[1] = scales[index]; - + index = out[in2]; outScale[2] = scales[index]; - - + + index = out[in0]; outRot[0] = rot[index]; - + index = out[in0]+3; outRot[0+3] = rot[index]; - + index = out[in0]+6; outRot[0+6] = rot[index]; - + index = out[in1]; outRot[1] = rot[index]; - + index = out[in1]+3; outRot[1+3] = rot[index]; - + index = out[in1]+6; outRot[1+6] = rot[index]; - + index = out[in2]; outRot[2] = rot[index]; - + index = out[in2]+3; outRot[2+3] = rot[index]; - + index = out[in2]+6; outRot[2+6] = rot[index]; } } - + static int compute_qr( double[] s, double[] e, double[] u, double[] v) { - + int i,j,k; boolean converged; double shift,ssmin,ssmax,r; @@ -2523,23 +2523,23 @@ public class Matrix3d implements java.io.Serializable, Cloneable { double[] sinl = new double[2]; double[] sinr = new double[2]; double[] m = new double[9]; - + double utemp,vtemp; double f,g; - + final int MAX_INTERATIONS = 10; final double CONVERGE_TOL = 4.89E-15; - + double c_b48 = 1.; double c_b71 = -1.; int first; converged = false; - + first = 1; - + if( Math.abs(e[1]) < CONVERGE_TOL || Math.abs(e[0]) < CONVERGE_TOL) converged = true; - + for(k=0;k<MAX_INTERATIONS && !converged;k++) { shift = compute_shift( s[1], e[1], s[2]); f = (Math.abs(s[0]) - shift) * (d_sign(c_b48, s[0]) + shift/s[0]); @@ -2571,7 +2571,7 @@ public class Matrix3d implements java.io.Serializable, Cloneable { s[2] = cosl[1] * s[2] - sinl[1] * e[1]; e[1] = f; - // update u matrices + // update u matrices utemp = u[0]; u[0] = cosl[0]*utemp + sinl[0]*u[3]; u[3] = -sinl[0]*utemp + cosl[0]*u[3]; @@ -2592,7 +2592,7 @@ public class Matrix3d implements java.io.Serializable, Cloneable { u[5] = cosl[1]*utemp + sinl[1]*u[8]; u[8] = -sinl[1]*utemp + cosl[1]*u[8]; - // update v matrices + // update v matrices vtemp = v[0]; v[0] = cosr[0]*vtemp + sinr[0]*v[1]; @@ -2635,7 +2635,7 @@ public class Matrix3d implements java.io.Serializable, Cloneable { u[2] = cosl[0]*utemp + sinl[0]*u[5]; u[5] = -sinl[0]*utemp + cosl[0]*u[5]; - // update v matrices + // update v matrices vtemp = v[0]; v[0] = cosr[0]*vtemp + sinr[0]*v[1]; @@ -2659,7 +2659,7 @@ public class Matrix3d implements java.io.Serializable, Cloneable { u[5] = cosl[0]*utemp + sinl[0]*u[8]; u[8] = -sinl[0]*utemp + cosl[0]*u[8]; - // update v matrices + // update v matrices vtemp = v[1]; v[1] = cosr[0]*vtemp + sinr[0]*v[2]; @@ -2675,13 +2675,13 @@ public class Matrix3d implements java.io.Serializable, Cloneable { return(0); } static double max( double a, double b) { - if( a > b) + if( a > b) return( a); else return( b); } static double min( double a, double b) { - if( a < b) + if( a < b) return( a); else return( b); @@ -2696,7 +2696,7 @@ static double compute_shift( double f, double g, double h) { double d__1, d__2; double fhmn, fhmx, c, fa, ga, ha, as, at, au; double ssmin; - + fa = Math.abs(f); ga = Math.abs(g); ha = Math.abs(h); @@ -2730,7 +2730,7 @@ static double compute_shift( double f, double g, double h) { ssmin += ssmin; } } - } + } return(ssmin); } @@ -2739,7 +2739,7 @@ static int compute_2X2( double f, double g, double h, double[] single_values, double c_b3 = 2.; double c_b4 = 1.; - + double d__1; int pmax; double temp; @@ -2749,7 +2749,7 @@ static int compute_2X2( double f, double g, double h, double[] single_values, boolean gasmal; double tt, clt, crt, slt, srt; double ssmin,ssmax; - + ssmax = single_values[0]; ssmin = single_values[1]; clt = 0.0; @@ -2762,11 +2762,11 @@ static int compute_2X2( double f, double g, double h, double[] single_values, fa = Math.abs(ft); ht = h; ha = Math.abs(h); - + pmax = 1; - if( ha > fa) + if( ha > fa) swap = true; - else + else swap = false; if (swap) { @@ -2777,12 +2777,12 @@ static int compute_2X2( double f, double g, double h, double[] single_values, temp = fa; fa = ha; ha = temp; - + } gt = g; ga = Math.abs(gt); if (ga == 0.) { - + single_values[1] = ha; single_values[0] = fa; clt = 1.; @@ -2795,7 +2795,7 @@ static int compute_2X2( double f, double g, double h, double[] single_values, if (ga > fa) { pmax = 2; if (fa / ga < EPS) { - + gasmal = false; ssmax = ga; if (ha > 1.) { @@ -2810,35 +2810,35 @@ static int compute_2X2( double f, double g, double h, double[] single_values, } } if (gasmal) { - + d = fa - ha; if (d == fa) { - + l = 1.; } else { l = d / fa; } - + m = gt / ft; - + t = 2. - l; - + mm = m * m; tt = t * t; s = Math.sqrt(tt + mm); - + if (l == 0.) { r = Math.abs(m); } else { r = Math.sqrt(l * l + mm); } - + a = (s + r) * .5; - + if (ga > fa) { pmax = 2; if (fa / ga < EPS) { - + gasmal = false; ssmax = ga; if (ha > 1.) { @@ -2853,36 +2853,36 @@ static int compute_2X2( double f, double g, double h, double[] single_values, } } if (gasmal) { - + d = fa - ha; if (d == fa) { - + l = 1.; } else { l = d / fa; } - + m = gt / ft; - + t = 2. - l; - + mm = m * m; tt = t * t; s = Math.sqrt(tt + mm); - + if (l == 0.) { r = Math.abs(m); } else { r = Math.sqrt(l * l + mm); } - + a = (s + r) * .5; - - + + ssmin = ha / a; ssmax = fa * a; if (mm == 0.) { - + if (l == 0.) { t = d_sign(c_b3, ft) * d_sign(c_b4, gt); } else { @@ -2909,7 +2909,7 @@ static int compute_2X2( double f, double g, double h, double[] single_values, csr[0] = crt; snr[0] = srt; } - + if (pmax == 1) { tsign = d_sign(c_b4, csr[0]) * d_sign(c_b4, csl[0]) * d_sign(c_b4, f); } @@ -2922,9 +2922,9 @@ static int compute_2X2( double f, double g, double h, double[] single_values, single_values[index] = d_sign(ssmax, tsign); d__1 = tsign * d_sign(c_b4, f) * d_sign(c_b4, h); single_values[index+1] = d_sign(ssmin, d__1); - - - } + + + } return 0; } static double compute_rot( double f, double g, double[] sin, double[] cos, int index, int first) { @@ -2938,7 +2938,7 @@ static int compute_2X2( double f, double g, double h, double[] single_values, double r; final double safmn2 = 2.002083095183101E-146; final double safmx2 = 4.994797680505588E+145; - + if (g == 0.) { cs = 1.; sn = 0.; @@ -2991,7 +2991,7 @@ static int compute_2X2( double f, double g, double h, double[] single_values, sn = -sn; r = -r; } - } + } sin[index] = sn; cos[index] = cs; return r; @@ -3002,11 +3002,11 @@ int i; for(i=0;i<3;i++){ System.out.println(mat[i*3+0]+" "+mat[i*3+1]+" "+mat[i*3+2]+"\n"); } - + } static void print_det( double[] mat) { double det; - + det = mat[0]*mat[4]*mat[8] + mat[1]*mat[5]*mat[6] + mat[2]*mat[3]*mat[7] - @@ -3022,15 +3022,15 @@ static void mat_mul(double[] m1, double[] m2, double[] m3) { tmp[0] = m1[0]*m2[0] + m1[1]*m2[3] + m1[2]*m2[6]; tmp[1] = m1[0]*m2[1] + m1[1]*m2[4] + m1[2]*m2[7]; tmp[2] = m1[0]*m2[2] + m1[1]*m2[5] + m1[2]*m2[8]; - + tmp[3] = m1[3]*m2[0] + m1[4]*m2[3] + m1[5]*m2[6]; tmp[4] = m1[3]*m2[1] + m1[4]*m2[4] + m1[5]*m2[7]; tmp[5] = m1[3]*m2[2] + m1[4]*m2[5] + m1[5]*m2[8]; - + tmp[6] = m1[6]*m2[0] + m1[7]*m2[3] + m1[8]*m2[6]; tmp[7] = m1[6]*m2[1] + m1[7]*m2[4] + m1[8]*m2[7]; tmp[8] = m1[6]*m2[2] + m1[7]*m2[5] + m1[8]*m2[8]; - + for(i=0;i<9;i++) { m3[i] = tmp[i]; } @@ -3039,11 +3039,11 @@ static void transpose_mat(double[] in, double[] out) { out[0] = in[0]; out[1] = in[3]; out[2] = in[6]; - + out[3] = in[1]; out[4] = in[4]; out[5] = in[7]; - + out[6] = in[2]; out[7] = in[5]; out[8] = in[8]; @@ -3052,12 +3052,12 @@ static double max3( double[] values) { if( values[0] > values[1] ) { if( values[0] > values[2] ) return(values[0]); - else + else return(values[2]); } else { if( values[1] > values[2] ) return(values[1]); - else + else return(values[2]); } } @@ -3103,4 +3103,200 @@ static double max3( double[] values) { return m1; } + /** + * Get the first matrix element in the first row. + * @return Returns the m00. + * @since vecmath 1.5 + */ + public final double getM00() { + return m00; + } + + /** + * Set the first matrix element in the first row. + * + * @param m00 The m00 to set. + * + * @since vecmath 1.5 + */ + public final void setM00(double m00) { + this.m00 = m00; + } + + /** + * Get the second matrix element in the first row. + * + * @return Returns the m01. + * + * @since vecmath 1.5 + */ + public final double getM01() { + return m01; + } + + /** + * Set the second matrix element in the first row. + * + * @param m01 The m01 to set. + * + * @since vecmath 1.5 + */ + public final void setM01(double m01) { + this.m01 = m01; + } + + /** + * Get the third matrix element in the first row. + * + * @return Returns the m02. + * + * @since vecmath 1.5 + */ + public final double getM02() { + return m02; + } + + /** + * Set the third matrix element in the first row. + * + * @param m02 The m02 to set. + * + * @since vecmath 1.5 + */ + public final void setM02(double m02) { + this.m02 = m02; + } + + /** + * Get first matrix element in the second row. + * + * @return Returns the m10. + * + * @since vecmath 1.5 + */ + public final double getM10() { + return m10; + } + + /** + * Set first matrix element in the second row. + * + * @param m10 The m10 to set. + * + * @since vecmath 1.5 + */ + public final void setM10(double m10) { + this.m10 = m10; + } + + /** + * Get second matrix element in the second row. + * + * @return Returns the m11. + * + * @since vecmath 1.5 + */ + public final double getM11() { + return m11; + } + + /** + * Set the second matrix element in the second row. + * + * @param m11 The m11 to set. + * + * @since vecmath 1.5 + */ + public final void setM11(double m11) { + this.m11 = m11; + } + + /** + * Get the third matrix element in the second row. + * + * @return Returns the m12. + * + * @since vecmath 1.5 + */ + public final double getM12() { + return m12; + } + + /** + * Set the third matrix element in the second row. + * + * @param m12 The m12 to set. + * + * @since vecmath 1.5 + */ + public final void setM12(double m12) { + this.m12 = m12; + } + + /** + * Get the first matrix element in the third row. + * + * @return Returns the m20. + * + * @since vecmath 1.5 + */ + public final double getM20() { + return m20; + } + + /** + * Set the first matrix element in the third row. + * + * @param m20 The m20 to set. + * + * @since vecmath 1.5 + */ + public final void setM20(double m20) { + this.m20 = m20; + } + + /** + * Get the second matrix element in the third row. + * + * @return Returns the m21. + * + * @since vecmath 1.5 + */ + public final double getM21() { + return m21; + } + + /** + * Set the second matrix element in the third row. + * + * @param m21 The m21 to set. + * + * @since vecmath 1.5 + */ + public final void setM21(double m21) { + this.m21 = m21; + } + + /** + * Get the third matrix element in the third row . + * + * @return Returns the m22. + * + * @since vecmath 1.5 + */ + public final double getM22() { + return m22; + } + + /** + * Set the third matrix element in the third row. + * + * @param m22 The m22 to set. + * + * @since vecmath 1.5 + */ + public final void setM22(double m22) { + this.m22 = m22; + } + } diff --git a/src/javax/vecmath/Matrix3f.java b/src/javax/vecmath/Matrix3f.java index 02027d3..733d96f 100644 --- a/src/javax/vecmath/Matrix3f.java +++ b/src/javax/vecmath/Matrix3f.java @@ -2093,4 +2093,202 @@ public class Matrix3f implements java.io.Serializable, Cloneable { return m1; } + + /** + * Get the first matrix element in the first row. + * + * @return Returns the m00. + * + * @since vecmath 1.5 + */ + public final float getM00() { + return m00; + } + + /** + * Set the first matrix element in the first row. + * + * @param m00 The m00 to set. + * + * @since vecmath 1.5 + */ + public final void setM00(float m00) { + this.m00 = m00; + } + + /** + * Get the second matrix element in the first row. + * + * @return Returns the m01. + * + * + * @since vecmath 1.5 + */ + public final float getM01() { + return m01; + } + + /** + * Set the second matrix element in the first row. + * + * @param m01 The m01 to set. + * + * @since vecmath 1.5 + */ + public final void setM01(float m01) { + this.m01 = m01; + } + + /** + * Get the third matrix element in the first row. + * + * @return Returns the m02. + * + * @since vecmath 1.5 + */ + public final float getM02() { + return m02; + } + + /** + * Set the third matrix element in the first row. + * + * @param m02 The m02 to set. + * + * @since vecmath 1.5 + */ + public final void setM02(float m02) { + this.m02 = m02; + } + + /** + * Get first matrix element in the second row. + * + * @return Returns the m10. + * + * @since vecmath 1.5 + */ + public final float getM10() { + return m10; + } + + /** + * Set first matrix element in the second row. + * + * @param m10 The m10 to set. + * + * @since vecmath 1.5 + */ + public final void setM10(float m10) { + this.m10 = m10; + } + + /** + * Get second matrix element in the second row. + * + * @return Returns the m11. + * + * @since vecmath 1.5 + */ + public final float getM11() { + return m11; + } + + /** + * Set the second matrix element in the second row. + * + * @param m11 The m11 to set. + * + * @since vecmath 1.5 + */ + public final void setM11(float m11) { + this.m11 = m11; + } + + /** + * Get the third matrix element in the second row. + * + * @return Returns the m12. + * + * @since vecmath 1.5 + */ + public final float getM12() { + return m12; + } + + /** + * Set the third matrix element in the second row. + * @param m12 The m12 to set. + * @since vecmath 1.5 + */ + public final void setM12(float m12) { + this.m12 = m12; + } + + /** + * Get the first matrix element in the third row. + * + * @return Returns the m20. + * + * @since vecmath 1.5 + */ + public final float getM20() { + return m20; + } + + /** + * Set the first matrix element in the third row. + * + * @param m20 The m20 to set. + * + * @since vecmath 1.5 + */ + public final void setM20(float m20) { + this.m20 = m20; + } + + /** + * Get the second matrix element in the third row. + * + * @return Returns the m21. + * + * @since vecmath 1.5 + */ + public final float getM21() { + return m21; + } + + /** + * Set the second matrix element in the third row. + * + * @param m21 The m21 to set. + * + * @since vecmath 1.5 + */ + public final void setM21(float m21) { + this.m21 = m21; + } + + /** + * Get the third matrix element in the third row . + * + * @return Returns the m22. + * + * @since vecmath 1.5 + */ + public final float getM22() { + return m22; + } + + /** + * Set the third matrix element in the third row. + * + * @param m22 The m22 to set. + * + * @since vecmath 1.5 + */ + public final void setM22(float m22) { + this.m22 = m22; + } + } diff --git a/src/javax/vecmath/Matrix4d.java b/src/javax/vecmath/Matrix4d.java index fc252cf..77b5b82 100644 --- a/src/javax/vecmath/Matrix4d.java +++ b/src/javax/vecmath/Matrix4d.java @@ -3582,4 +3582,358 @@ public class Matrix4d implements java.io.Serializable, Cloneable { return m1; } + /** + * Get the first matrix element in the first row. + * + * @return Returns the m00. + * + * @since vecmath 1.5 + */ + public final double getM00() { + return m00; + } + + /** + * Set the first matrix element in the first row. + * + * @param m00 The m00 to set. + * + * + * @since vecmath 1.5 + */ + public final void setM00(double m00) { + this.m00 = m00; + } + + /** + * Get the second matrix element in the first row. + * + * @return Returns the m01. + * + * @since vecmath 1.5 + */ + public final double getM01() { + return m01; + } + + /** + * Set the second matrix element in the first row. + * + * @param m01 The m01 to set. + * + * @since vecmath 1.5 + */ + public final void setM01(double m01) { + this.m01 = m01; + } + + /** + * Get the third matrix element in the first row. + * + * @return Returns the m02. + * + * @since vecmath 1.5 + */ + public final double getM02() { + return m02; + } + + /** + * Set the third matrix element in the first row. + * + * @param m02 The m02 to set. + * + * @since vecmath 1.5 + */ + public final void setM02(double m02) { + this.m02 = m02; + } + + /** + * Get first matrix element in the second row. + * + * @return Returns the m10. + * + * @since vecmath 1.5 + */ + public final double getM10() { + return m10; + } + + /** + * Set first matrix element in the second row. + * + * @param m10 The m10 to set. + * + * @since vecmath 1.5 + */ + public final void setM10(double m10) { + this.m10 = m10; + } + + /** + * Get second matrix element in the second row. + * + * @return Returns the m11. + * + * @since vecmath 1.5 + */ + public final double getM11() { + return m11; + } + + /** + * Set the second matrix element in the second row. + * + * @param m11 The m11 to set. + * + * @since vecmath 1.5 + */ + public final void setM11(double m11) { + this.m11 = m11; + } + + /** + * Get the third matrix element in the second row. + * + * @return Returns the m12. + * + * @since vecmath 1.5 + */ + public final double getM12() { + return m12; + } + + /** + * Set the third matrix element in the second row. + * + * @param m12 The m12 to set. + * + * + * @since vecmath 1.5 + */ + public final void setM12(double m12) { + this.m12 = m12; + } + + /** + * Get the first matrix element in the third row. + * + * @return Returns the m20. + * + * @since vecmath 1.5 + */ + public final double getM20() { + return m20; + } + + /** + * Set the first matrix element in the third row. + * + * @param m20 The m20 to set. + * + * @since vecmath 1.5 + */ + public final void setM20(double m20) { + this.m20 = m20; + } + + /** + * Get the second matrix element in the third row. + * + * @return Returns the m21. + * + * @since vecmath 1.5 + */ + public final double getM21() { + return m21; + } + + /** + * Set the second matrix element in the third row. + * + * @param m21 The m21 to set. + * + * @since vecmath 1.5 + */ + public final void setM21(double m21) { + this.m21 = m21; + } + + /** + * Get the third matrix element in the third row. + * + * @return Returns the m22. + * + * @since vecmath 1.5 + */ + public final double getM22() { + return m22; + } + + /** + * Set the third matrix element in the third row. + * + * @param m22 The m22 to set. + * + * @since vecmath 1.5 + */ + public final void setM22(double m22) { + this.m22 = m22; + } + + /** + * Get the fourth element of the first row. + * + * @return Returns the m03. + * + * @since vecmath 1.5 + */ + public final double getM03() { + return m03; + } + + /** + * Set the fourth element of the first row. + * + * @param m03 The m03 to set. + * + * @since vecmath 1.5 + */ + public final void setM03(double m03) { + this.m03 = m03; + } + + /** + * Get the fourth element of the second row. + * + * @return Returns the m13. + * + * @since vecmath 1.5 + */ + public final double getM13() { + return m13; + } + + /** + * Set the fourth element of the second row. + * + * @param m13 The m13 to set. + * + * @since vecmath 1.5 + */ + public final void setM13(double m13) { + this.m13 = m13; + } + + /** + * Get the fourth element of the third row. + * + * @return Returns the m23. + * + * @since vecmath 1.5 + */ + public final double getM23() { + return m23; + } + + /** + * Set the fourth element of the third row. + * + * @param m23 The m23 to set. + * + * @since vecmath 1.5 + */ + public final void setM23(double m23) { + this.m23 = m23; + } + + /** + * Get the first element of the fourth row. + * + * @return Returns the m30. + * + * @since vecmath 1.5 + */ + public final double getM30() { + return m30; + } + + /** + * Set the first element of the fourth row. + * + * @param m30 The m30 to set. + * + * @since vecmath 1.5 + */ + public final void setM30(double m30) { + this.m30 = m30; + } + + /** + * Get the second element of the fourth row. + * + * @return Returns the m31. + * + * @since vecmath 1.5 + */ + public final double getM31() { + return m31; + } + + /** + * Set the second element of the fourth row. + * + * @param m31 The m31 to set. + * + * @since vecmath 1.5 + */ + public final void setM31(double m31) { + this.m31 = m31; + } + + /** + * Get the third element of the fourth row. + * + * @return Returns the m32. + * + * + * @since vecmath 1.5 + */ + public final double getM32() { + return m32; + } + + /** + * Set the third element of the fourth row. + * + * @param m32 The m32 to set. + * + * @since vecmath 1.5 + */ + public final void setM32(double m32) { + this.m32 = m32; + } + + /** + * Get the fourth element of the fourth row. + * + * @return Returns the m33. + * + * @since vecmath 1.5 + */ + public final double getM33() { + return m33; + } + + /** + * Set the fourth element of the fourth row. + * + * @param m33 The m33 to set. + * + * @since vecmath 1.5 + */ + public final void setM33(double m33) { + this.m33 = m33; + } } diff --git a/src/javax/vecmath/Matrix4f.java b/src/javax/vecmath/Matrix4f.java index 25bb1ea..054bc21 100644 --- a/src/javax/vecmath/Matrix4f.java +++ b/src/javax/vecmath/Matrix4f.java @@ -3242,4 +3242,357 @@ public class Matrix4f implements java.io.Serializable, Cloneable { return m1; } + /** + * Get the first matrix element in the first row. + * + * @return Returns the m00. + * + * @since vecmath 1.5 + */ + public final float getM00() { + return m00; + } + + /** + * Set the first matrix element in the first row. + * + * @param m00 The m00 to set. + * + * @since vecmath 1.5 + */ + public final void setM00(float m00) { + this.m00 = m00; + } + + /** + * Get the second matrix element in the first row. + * + * @return Returns the m01. + * + * @since vecmath 1.5 + */ + public final float getM01() { + return m01; + } + + /** + * Set the second matrix element in the first row. + * + * @param m01 The m01 to set. + * + * @since vecmath 1.5 + */ + public final void setM01(float m01) { + this.m01 = m01; + } + + /** + * Get the third matrix element in the first row. + * + * @return Returns the m02. + * + * @since vecmath 1.5 + */ + public final float getM02() { + return m02; + } + + /** + * Set the third matrix element in the first row. + * + * @param m02 The m02 to set. + * + * @since vecmath 1.5 + */ + public final void setM02(float m02) { + this.m02 = m02; + } + + /** + * Get first matrix element in the second row. + * + * @return Returns the m10. + * + * @since vecmath 1.5 + */ + public final float getM10() { + return m10; + } + + /** + * Set first matrix element in the second row. + * + * @param m10 The m10 to set. + * + * @since vecmath 1.5 + */ + public final void setM10(float m10) { + this.m10 = m10; + } + + /** + * Get second matrix element in the second row. + * + * @return Returns the m11. + * + * @since vecmath 1.5 + */ + public final float getM11() { + return m11; + } + + /** + * Set the second matrix element in the second row. + * + * @param m11 The m11 to set. + * + * @since vecmath 1.5 + */ + public final void setM11(float m11) { + this.m11 = m11; + } + + /** + * Get the third matrix element in the second row. + * + * @return Returns the m12. + * + * @since vecmath 1.5 + */ + public final float getM12() { + return m12; + } + + /** + * Set the third matrix element in the second row. + * + * @param m12 The m12 to set. + * + * @since vecmath 1.5 + */ + public final void setM12(float m12) { + this.m12 = m12; + } + + /** + * Get the first matrix element in the third row. + * + * @return Returns the m20. + * + * @since vecmath 1.5 + */ + public final float getM20() { + return m20; + } + + /** + * Set the first matrix element in the third row. + * + * @param m20 The m20 to set. + * + * @since vecmath 1.5 + */ + public final void setM20(float m20) { + this.m20 = m20; + } + + /** + * Get the second matrix element in the third row. + * + * @return Returns the m21. + * + * @since vecmath 1.5 + */ + public final float getM21() { + return m21; + } + + /** + * Set the second matrix element in the third row. + * + * @param m21 The m21 to set. + * + * @since vecmath 1.5 + */ + public final void setM21(float m21) { + this.m21 = m21; + } + + /** + * Get the third matrix element in the third row. + * + * @return Returns the m22. + * + * @since vecmath 1.5 + */ + public final float getM22() { + return m22; + } + + /** + * Set the third matrix element in the third row. + * + * @param m22 The m22 to set. + * + * @since vecmath 1.5 + */ + public final void setM22(float m22) { + this.m22 = m22; + } + + /** + * Get the fourth element of the first row. + * + * @return Returns the m03. + * + * @since vecmath 1.5 + */ + public final float getM03() { + return m03; + } + + /** + * Set the fourth element of the first row. + * + * @param m03 The m03 to set. + * + * @since vecmath 1.5 + */ + public final void setM03(float m03) { + this.m03 = m03; + } + + /** + * Get the fourth element of the second row. + * + * @return Returns the m13. + * + * @since vecmath 1.5 + */ + public final float getM13() { + return m13; + } + + /** + * Set the fourth element of the second row. + * + * @param m13 The m13 to set. + * + * @since vecmath 1.5 + */ + public final void setM13(float m13) { + this.m13 = m13; + } + + /** + * Get the fourth element of the third row. + * + * @return Returns the m23. + * + * @since vecmath 1.5 + */ + public final float getM23() { + return m23; + } + + /** + * Set the fourth element of the third row. + * + * @param m23 The m23 to set. + * + * @since vecmath 1.5 + */ + public final void setM23(float m23) { + this.m23 = m23; + } + + /** + * Get the first element of the fourth row. + * + * @return Returns the m30. + * + * @since vecmath 1.5 + */ + public final float getM30() { + return m30; + } + + /** + * Set the first element of the fourth row. + * + * @param m30 The m30 to set. + * + * + * @since vecmath 1.5 + */ + public final void setM30(float m30) { + this.m30 = m30; + } + + /** + * Get the second element of the fourth row. + * + * @return Returns the m31. + * + * @since vecmath 1.5 + */ + public final float getM31() { + return m31; + } + + /** + * Set the second element of the fourth row. + * + * @param m31 The m31 to set. + * + * @since vecmath 1.5 + */ + public final void setM31(float m31) { + this.m31 = m31; + } + + /** + * Get the third element of the fourth row. + * + * @return Returns the m32. + * + * @since vecmath 1.5 + */ + public final float getM32() { + return m32; + } + + /** + * Set the third element of the fourth row. + * + * @param m32 The m32 to set. + * + * + * @since vecmath 1.5 + */ + public final void setM32(float m32) { + this.m32 = m32; + } + + /** + * Get the fourth element of the fourth row. + * + * @return Returns the m33. + * + * @since vecmath 1.5 + */ + public final float getM33() { + return m33; + } + + /** + * Set the fourth element of the fourth row. + * + * @param m33 The m33 to set. + * + * @since vecmath 1.5 + */ + public final void setM33(float m33) { + this.m33 = m33; + } } diff --git a/src/javax/vecmath/Tuple2d.java b/src/javax/vecmath/Tuple2d.java index 665b6bf..443bba7 100644 --- a/src/javax/vecmath/Tuple2d.java +++ b/src/javax/vecmath/Tuple2d.java @@ -329,9 +329,11 @@ public abstract class Tuple2d implements java.io.Serializable, Cloneable { double diff; diff = x - t1.x; + if(Double.isNaN(diff)) return false; if((diff<0?-diff:diff) > epsilon) return false; diff = y - t1.y; + if(Double.isNaN(diff)) return false; if((diff<0?-diff:diff) > epsilon) return false; return true; @@ -534,4 +536,52 @@ public abstract class Tuple2d implements java.io.Serializable, Cloneable { } } + + /** + * Get the <i>x</i> coordinate. + * + * @return the <i>x</i> coordinate. + * + * @since vecmath 1.5 + */ + public final double getX() { + return x; + } + + + /** + * Set the <i>x</i> coordinate. + * + * @param x value to <i>x</i> coordinate. + * + * @since vecmath 1.5 + */ + public final void setX(double x) { + this.x = x; + } + + + /** + * Get the <i>y</i> coordinate. + * + * @return the <i>y</i> coordinate. + * + * @since vecmath 1.5 + */ + public final double getY() { + return y; + } + + + /** + * Set the <i>y</i> coordinate. + * + * @param y value to <i>y</i> coordinate. + * + * @since vecmath 1.5 + */ + public final void setY(double y) { + this.y = y; + } + } diff --git a/src/javax/vecmath/Tuple2f.java b/src/javax/vecmath/Tuple2f.java index 85f5319..e75fafc 100644 --- a/src/javax/vecmath/Tuple2f.java +++ b/src/javax/vecmath/Tuple2f.java @@ -331,9 +331,11 @@ public abstract class Tuple2f implements java.io.Serializable, Cloneable { float diff; diff = x - t1.x; + if(Float.isNaN(diff)) return false; if((diff<0?-diff:diff) > epsilon) return false; diff = y - t1.y; + if(Float.isNaN(diff)) return false; if((diff<0?-diff:diff) > epsilon) return false; return true; @@ -538,4 +540,51 @@ public abstract class Tuple2f implements java.io.Serializable, Cloneable { } } + + /** + * Get the <i>x</i> coordinate. + * + * @return the <i>x</i> coordinate. + * + * @since vecmath 1.5 + */ + public final float getX() { + return x; + } + + + /** + * Set the <i>x</i> coordinate. + * + * @param x value to <i>x</i> coordinate. + * + * @since vecmath 1.5 + */ + public final void setX(float x) { + this.x = x; + } + + + /** + * Get the <i>y</i> coordinate. + * + * @return the <i>y</i> coordinate. + * + * @since vecmath 1.5 + */ + public final float getY() { + return y; + } + + + /** + * Set the <i>y</i> coordinate. + * + * @param y value to <i>y</i> coordinate. + * + * @since vecmath 1.5 + */ + public final void setY(float y) { + this.y = y; + } } diff --git a/src/javax/vecmath/Tuple2i.java b/src/javax/vecmath/Tuple2i.java index 912d09d..3a402da 100644 --- a/src/javax/vecmath/Tuple2i.java +++ b/src/javax/vecmath/Tuple2i.java @@ -437,4 +437,51 @@ public abstract class Tuple2i implements java.io.Serializable, Cloneable { } } + + /** + * Get the <i>x</i> coordinate. + * + * @return the x coordinate. + * + * @since vecmath 1.5 + */ + public final int getX() { + return x; + } + + + /** + * Set the <i>x</i> coordinate. + * + * @param x value to <i>x</i> coordinate. + * + * @since vecmath 1.5 + */ + public final void setX(int x) { + this.x = x; + } + + + /** + * Get the <i>y</i> coordinate. + * + * @return the <i>y</i> coordinate. + * + * @since vecmath 1.5 + */ + public final int getY() { + return y; + } + + + /** + * Set the <i>y</i> coordinate. + * + * @param y value to <i>y</i> coordinate. + * + * @since vecmath 1.5 + */ + public final void setY(int y) { + this.y = y; + } } diff --git a/src/javax/vecmath/Tuple3b.java b/src/javax/vecmath/Tuple3b.java index 201b39f..22d4e59 100644 --- a/src/javax/vecmath/Tuple3b.java +++ b/src/javax/vecmath/Tuple3b.java @@ -226,4 +226,75 @@ public abstract class Tuple3b implements java.io.Serializable, Cloneable { } } + + /** + * Get <i>x</i>, the first value. + * + * @return the first value. + * + * @since vecmath 1.5 + */ + public final byte getX() { + return x; + } + + + /** + * Set <i>x</i>, the first value. + * + * @param x the first value to set. + * + * @since vecmath 1.5 + */ + public final void setX(byte x) { + this.x = x; + } + + + /** + * Get <i>y</i>, the second value. + * + * @return the second value. + * + * @since vecmath 1.5 + */ + public final byte getY() { + return y; + } + + + /** + * Set <i>y</i>, the second value. + * + * @param y the second value to set. + * + * @since vecmath 1.5 + */ + public final void setY(byte y) { + this.y = y; + } + + /** + * Get <i>z</i>, the third value. + * + * @return the third value. + * + * @since vecmath 1.5 + */ + public final byte getZ() { + return z; + } + + + /** + * Set <i>z</i>, the third value. + * + * @param z the third value to set. + * + * @since vecmath 1.5 + */ + public final void setZ(byte z) { + this.z = z; + } + } diff --git a/src/javax/vecmath/Tuple3d.java b/src/javax/vecmath/Tuple3d.java index 3d1c26b..969ea12 100644 --- a/src/javax/vecmath/Tuple3d.java +++ b/src/javax/vecmath/Tuple3d.java @@ -377,12 +377,15 @@ public abstract class Tuple3d implements java.io.Serializable, Cloneable { double diff; diff = x - t1.x; + if(Double.isNaN(diff)) return false; if((diff<0?-diff:diff) > epsilon) return false; diff = y - t1.y; + if(Double.isNaN(diff)) return false; if((diff<0?-diff:diff) > epsilon) return false; diff = z - t1.z; + if(Double.isNaN(diff)) return false; if((diff<0?-diff:diff) > epsilon) return false; return true; @@ -664,4 +667,73 @@ public abstract class Tuple3d implements java.io.Serializable, Cloneable { } } + /** + * Get the <i>x</i> coordinate. + * + * @return the <i>x</i> coordinate. + * + * @since vecmath 1.5 + */ + public final double getX() { + return x; + } + + + /** + * Set the <i>x</i> coordinate. + * + * @param x value to <i>x</i> coordinate. + * + * @since vecmath 1.5 + */ + public final void setX(double x) { + this.x = x; + } + + + /** + * Get the <i>y</i> coordinate. + * + * @return the <i>y</i> coordinate. + * + * @since vecmath 1.5 + */ + public final double getY() { + return y; + } + + + /** + * Set the <i>y</i> coordinate. + * + * @param y value to <i>y</i> coordinate. + * + * @since vecmath 1.5 + */ + public final void setY(double y) { + this.y = y; + } + + /** + * Get the <i>z</i> coordinate. + * + * @return the <i>z</i> coordinate. + * + * @since vecmath 1.5 + */ + public final double getZ() { + return z; + } + + + /** + * Set the <i>z</i> coordinate. + * + * @param z value to <i>z</i> coordinate. + * + * @since vecmath 1.5 + */ + public final void setZ(double z) { + this.z = z; + } } diff --git a/src/javax/vecmath/Tuple3f.java b/src/javax/vecmath/Tuple3f.java index f6cdbdb..0c2f827 100644 --- a/src/javax/vecmath/Tuple3f.java +++ b/src/javax/vecmath/Tuple3f.java @@ -363,12 +363,15 @@ public abstract class Tuple3f implements java.io.Serializable, Cloneable { float diff; diff = x - t1.x; + if(Float.isNaN(diff)) return false; if((diff<0?-diff:diff) > epsilon) return false; diff = y - t1.y; + if(Float.isNaN(diff)) return false; if((diff<0?-diff:diff) > epsilon) return false; diff = z - t1.z; + if(Float.isNaN(diff)) return false; if((diff<0?-diff:diff) > epsilon) return false; return true; @@ -618,4 +621,74 @@ public abstract class Tuple3f implements java.io.Serializable, Cloneable { } } + + /** + * Get the <i>x</i> coordinate. + * + * @return the <i>x</i> coordinate. + * + * @since vecmath 1.5 + */ + public final float getX() { + return x; + } + + + /** + * Set the <i>x</i> coordinate. + * + * @param x value to <i>x</i> coordinate. + * + * @since vecmath 1.5 + */ + public final void setX(float x) { + this.x = x; + } + + + /** + * Get the <i>y</i> coordinate. + * + * @return the <i>y</i> coordinate. + * + * @since vecmath 1.5 + */ + public final float getY() { + return y; + } + + + /** + * Set the <i>y</i> coordinate. + * + * @param y value to <i>y</i> coordinate. + * + * @since vecmath 1.5 + */ + public final void setY(float y) { + this.y = y; + } + + /** + * Get the <i>z</i> coordinate. + * + * @return the <i>z</i> coordinate + * + * @since vecmath 1.5 + */ + public final float getZ() { + return z; + } + + + /** + * Set the <i>Z</i> coordinate. + * + * @param z value to <i>z</i> coordinate. + * + * @since vecmath 1.5 + */ + public final void setZ(float z) { + this.z = z; + } } diff --git a/src/javax/vecmath/Tuple3i.java b/src/javax/vecmath/Tuple3i.java index 73b6f08..b4ba328 100644 --- a/src/javax/vecmath/Tuple3i.java +++ b/src/javax/vecmath/Tuple3i.java @@ -499,4 +499,73 @@ public abstract class Tuple3i implements java.io.Serializable, Cloneable { } } + + /** + * Get the <i>x</i> coordinate. + * + * @return the <i>x</i> coordinate. + * + * @since vecmath 1.5 + */ + public final int getX() { + return x; + } + + + /** + * Set the <i>x</i> coordinate. + * + * @param x value to <i>x</i> coordinate. + * + * @since vecmath 1.5 + */ + public final void setX(int x) { + this.x = x; + } + + + /** + * Get the <i>y</i> coordinate. + * + * @return the <i>y</i> coordinate. + * + * @since vecmath 1.5 + */ + public final int getY() { + return y; + } + + + /** + * Set the <i>y</i> coordinate. + * + * @param y value to <i>y</i> coordinate. + * + * @since vecmath 1.5 + */ + public final void setY(int y) { + this.y = y; + } + + /** + * Get the <i>z</i> coordinate. + * + * @return the <i>z</i> coordinate. + * @since vecmath 1.5 + */ + public final int getZ() { + return z; + } + + + /** + * Set the <i>z</i> coordinate. + * + * @param z value to <i>z</i> coordinate. + * + * @since vecmath 1.5 + */ + public final void setZ(int z) { + this.z = z; + } } diff --git a/src/javax/vecmath/Tuple4b.java b/src/javax/vecmath/Tuple4b.java index 441b567..d8cc5b3 100644 --- a/src/javax/vecmath/Tuple4b.java +++ b/src/javax/vecmath/Tuple4b.java @@ -243,4 +243,98 @@ public abstract class Tuple4b implements java.io.Serializable, Cloneable { } } + + /** + * Get <i>x</i>, the first value. + * + * @return Returns <i>x</i>, the first value. + * + * @since vecmath 1.5 + */ + public final byte getX() { + return x; + } + + + /** + * Set <i>x</i>, the first value. + * + * @param x the first value. + * + * @since vecmath 1.5 + */ + public final void setX(byte x) { + this.x = x; + } + + + /** + * Get <i>y</i>, the second value. + * + * @return Returns <i>y</i>, the second value. + * + * @since vecmath 1.5 + */ + public final byte getY() { + return y; + } + + + /** + * Set <i>y</i>, the second value. + * + * @param y the second value. + * + * @since vecmath 1.5 + */ + public final void setY(byte y) { + this.y = y; + } + + /** + * Get <i>z</i>, the third value. + * + * @return Returns <i>z</i>, the third value. + * + * @since vecmath 1.5 + */ + public final byte getZ() { + return z; + } + + + /** + * Set <i>z</i>, the third value. + * + * @param z the third value. + * + * @since vecmath 1.5 + */ + public final void setZ(byte z) { + this.z = z; + } + + + /** + * Get <i>w</i>, the fourth value. + * + * @return Returns <i>w</i> - the fourth value. + * + * @since vecmath 1.5 + */ + public final byte getW() { + return w; + } + + + /** + * Set <i>w</i>, the fourth value. + * + * @param w the fourth value. + * + * @since vecmath 1.5 + */ + public final void setW(byte w) { + this.w = w; + } } diff --git a/src/javax/vecmath/Tuple4d.java b/src/javax/vecmath/Tuple4d.java index d306bf0..2385723 100644 --- a/src/javax/vecmath/Tuple4d.java +++ b/src/javax/vecmath/Tuple4d.java @@ -406,15 +406,19 @@ public abstract class Tuple4d implements java.io.Serializable, Cloneable { double diff; diff = x - t1.x; + if(Double.isNaN(diff)) return false; if((diff<0?-diff:diff) > epsilon) return false; diff = y - t1.y; + if(Double.isNaN(diff)) return false; if((diff<0?-diff:diff) > epsilon) return false; diff = z - t1.z; + if(Double.isNaN(diff)) return false; if((diff<0?-diff:diff) > epsilon) return false; diff = w - t1.w; + if(Double.isNaN(diff)) return false; if((diff<0?-diff:diff) > epsilon) return false; return true; @@ -748,4 +752,97 @@ public abstract class Tuple4d implements java.io.Serializable, Cloneable { } } + /** + * Get the <i>x</i> coordinate. + * + * @return the x coordinate. + * + * @since vecmath 1.5 + */ + public final double getX() { + return x; + } + + + /** + * Set the <i>x</i> coordinate. + * + * @param x value to <i>x</i> coordinate. + * + * @since vecmath 1.5 + */ + public final void setX(double x) { + this.x = x; + } + + + /** + * Get the <i>y</i> coordinate. + * + * @return the <i>y</i> coordinate. + * + * @since vecmath 1.5 + */ + public final double getY() { + return y; + } + + + /** + * Set the <i>y</i> coordinate. + * + * @param y value to <i>y</i> coordinate. + * + * @since vecmath 1.5 + */ + public final void setY(double y) { + this.y = y; + } + + /** + * Get the <i>z</i> coordinate. + * + * @return the <i>z</i> coordinate. + * + * @since vecmath 1.5 + */ + public final double getZ() { + return z; + } + + + /** + * Set the <i>z</i> coordinate. + * + * @param z value to <i>z</i> coordinate. + * + * @since vecmath 1.5 + */ + public final void setZ(double z) { + this.z = z; + } + + + /** + * Get the <i>w</i> coordinate. + * + * @return the <i>w</i> coordinate. + * + * @since vecmath 1.5 + */ + public final double getW() { + return w; + } + + + /** + * Set the <i>w</i> coordinate. + * + * @param w value to <i>w</i> coordinate. + * + * @since vecmath 1.5 + */ + public final void setW(double w) { + this.w = w; + } } diff --git a/src/javax/vecmath/Tuple4f.java b/src/javax/vecmath/Tuple4f.java index a213cdb..1b6cc82 100644 --- a/src/javax/vecmath/Tuple4f.java +++ b/src/javax/vecmath/Tuple4f.java @@ -393,15 +393,19 @@ public abstract class Tuple4f implements java.io.Serializable, Cloneable { float diff; diff = x - t1.x; + if(Float.isNaN(diff)) return false; if((diff<0?-diff:diff) > epsilon) return false; diff = y - t1.y; + if(Float.isNaN(diff)) return false; if((diff<0?-diff:diff) > epsilon) return false; diff = z - t1.z; + if(Float.isNaN(diff)) return false; if((diff<0?-diff:diff) > epsilon) return false; diff = w - t1.w; + if(Float.isNaN(diff)) return false; if((diff<0?-diff:diff) > epsilon) return false; return true; @@ -679,4 +683,97 @@ public abstract class Tuple4f implements java.io.Serializable, Cloneable { } } + /** + * Get the <i>x</i> coordinate. + * + * @return the <i>x</i> coordinate. + * + * @since vecmath 1.5 + */ + public final float getX() { + return x; + } + + + /** + * Set the <i>x</i> coordinate. + * + * @param x value to <i>x</i> coordinate. + * + * @since vecmath 1.5 + */ + public final void setX(float x) { + this.x = x; + } + + + /** + * Get the <i>y</i> coordinate. + * + * @return the <i>y</i> coordinate. + * + * @since vecmath 1.5 + */ + public final float getY() { + return y; + } + + + /** + * Set the <i>y</i> coordinate. + * + * @param y value to <i>y</i> coordinate. + * + * @since vecmath 1.5 + */ + public final void setY(float y) { + this.y = y; + } + + /** + * Get the <i>z</i> coordinate. + * + * @return the <i>z</i> coordinate. + * + * @since vecmath 1.5 + */ + public final float getZ() { + return z; + } + + + /** + * Set the <i>z</i> coordinate. + * + * @param z value to <i>z</i> coordinate. + * + * @since vecmath 1.5 + */ + public final void setZ(float z) { + this.z = z; + } + + + /** + * Get the <i>w</i> coordinate. + * + * @return the <i>w</i> coordinate. + * + * @since vecmath 1.5 + */ + public final float getW() { + return w; + } + + + /** + * Set the <i>w</i> coordinate. + * + * @param w value to <i>w</i> coordinate. + * + * @since vecmath 1.5 + */ + public final void setW(float w) { + this.w = w; + } } diff --git a/src/javax/vecmath/Tuple4i.java b/src/javax/vecmath/Tuple4i.java index e50c8f9..3cb670b 100644 --- a/src/javax/vecmath/Tuple4i.java +++ b/src/javax/vecmath/Tuple4i.java @@ -564,4 +564,98 @@ public abstract class Tuple4i implements java.io.Serializable, Cloneable { } } + + + /** + * Get the <i>x</i> coordinate. + * + * @return the <i>x</i> coordinate. + * + * @since vecmath 1.5 + */ + public final int getX() { + return x; + } + + + /** + * Set the <i>x</i> coordinate. + * + * @param x value to <i>x</i> coordinate. + * + * @since vecmath 1.5 + */ + public final void setX(int x) { + this.x = x; + } + + + /** + * Get the <i>y</i> coordinate. + * + * @return the <i>y</i> coordinate. + * + * @since vecmath 1.5 + */ + public final int getY() { + return y; + } + + + /** + * Set the <i>y</i> coordinate. + * + * @param y value to <i>y</i> coordinate. + * + * @since vecmath 1.5 + */ + public final void setY(int y) { + this.y = y; + } + + /** + * Get the <i>z</i> coordinate. + * + * @return the <i>z</i> coordinate. + * + * @since vecmath 1.5 + */ + public final int getZ() { + return z; + } + + + /** + * Set the <i>z</i> coordinate. + * + * @param z value to <i>z</i> coordinate. + * + * @since vecmath 1.5 + */ + public final void setZ(int z) { + this.z = z; + } + + + /** + * Get the <i>w</i> coordinate. + * @return the <i>w</i> coordinate. + * @since vecmath 1.5 + */ + public final int getW() { + return w; + } + + + /** + * Set the <i>w</i> coordinate. + * + * @param w value to <i>w</i> coordinate. + * + * @since vecmath 1.5 + */ + public final void setW(int w) { + this.w = w; + } + } |