toxiclibs 0.2-java → 0.5.0-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +16 -0
- data/CHANGELOG.md +4 -0
- data/LICENSE +675 -0
- data/README.md +12 -5
- data/Rakefile +25 -82
- data/examples/attract_repel/attract_repel.rb +30 -0
- data/examples/attract_repel/attractor.rb +23 -0
- data/examples/attract_repel/particle.rb +27 -0
- data/examples/data/ti_yong.png +0 -0
- data/examples/force_directed/cluster.rb +76 -0
- data/examples/force_directed/force_directed_graph.rb +92 -0
- data/examples/force_directed/node.rb +26 -0
- data/examples/gray_scott_image.rb +75 -0
- data/examples/gray_scott_tone_map.rb +77 -0
- data/examples/implicit.rb +139 -0
- data/examples/inflate_mesh.rb +89 -0
- data/examples/model_align.rb +44 -0
- data/examples/povmesh/ftest.rb +46 -0
- data/examples/povmesh/tentacle.rb +73 -0
- data/examples/simple_cluster/cluster.rb +47 -0
- data/examples/simple_cluster/node.rb +27 -0
- data/examples/simple_cluster/simple_cluster.rb +60 -0
- data/examples/soft_body/blanket.rb +45 -0
- data/examples/soft_body/connection.rb +16 -0
- data/examples/soft_body/particle.rb +22 -0
- data/examples/soft_body/soft_body_square_adapted.rb +55 -0
- data/lib/toxiclibs.jar +0 -0
- data/lib/toxiclibs.rb +91 -32
- data/lib/toxiclibs/version.rb +1 -1
- data/pom.xml +122 -0
- data/src/com/toxi/net/ClientListener.java +41 -0
- data/src/com/toxi/net/ServerListener.java +70 -0
- data/src/com/toxi/net/ServerListenerAdapter.java +47 -0
- data/src/com/toxi/net/ServerState.java +18 -0
- data/src/com/toxi/net/UDPConnection.java +66 -0
- data/src/com/toxi/net/UDPSyncClient.java +81 -0
- data/src/com/toxi/net/UDPSyncServer.java +450 -0
- data/src/com/toxi/nio/UDPClient.java +121 -0
- data/src/com/toxi/nio/UDPClientState.java +32 -0
- data/src/com/toxi/nio/UDPServer.java +129 -0
- data/src/toxi/color/AccessCriteria.java +114 -0
- data/src/toxi/color/AlphaAccessor.java +67 -0
- data/src/toxi/color/CMYKAccessor.java +122 -0
- data/src/toxi/color/CMYKDistanceProxy.java +40 -0
- data/src/toxi/color/ColorGradient.java +260 -0
- data/src/toxi/color/ColorList.java +699 -0
- data/src/toxi/color/ColorRange.java +671 -0
- data/src/toxi/color/ColorTheme.java +163 -0
- data/src/toxi/color/DistanceProxy.java +44 -0
- data/src/toxi/color/HSVAccessor.java +113 -0
- data/src/toxi/color/HSVDistanceProxy.java +40 -0
- data/src/toxi/color/HistEntry.java +85 -0
- data/src/toxi/color/Histogram.java +185 -0
- data/src/toxi/color/Hue.java +249 -0
- data/src/toxi/color/LuminanceAccessor.java +78 -0
- data/src/toxi/color/NamedColor.java +935 -0
- data/src/toxi/color/ProximityComparator.java +70 -0
- data/src/toxi/color/RGBAccessor.java +113 -0
- data/src/toxi/color/RGBDistanceProxy.java +41 -0
- data/src/toxi/color/ReadonlyTColor.java +296 -0
- data/src/toxi/color/TColor.java +1677 -0
- data/src/toxi/color/TColorAdapter.java +68 -0
- data/src/toxi/color/ToneMap.java +218 -0
- data/src/toxi/color/theory/AnalogousStrategy.java +140 -0
- data/src/toxi/color/theory/ColorTheoryRegistry.java +139 -0
- data/src/toxi/color/theory/ColorTheoryStrategy.java +56 -0
- data/src/toxi/color/theory/ComplementaryStrategy.java +111 -0
- data/src/toxi/color/theory/CompoundTheoryStrategy.java +143 -0
- data/src/toxi/color/theory/LeftSplitComplementaryStrategy.java +82 -0
- data/src/toxi/color/theory/MonochromeTheoryStrategy.java +103 -0
- data/src/toxi/color/theory/RightSplitComplementaryStrategy.java +82 -0
- data/src/toxi/color/theory/SingleComplementStrategy.java +76 -0
- data/src/toxi/color/theory/SplitComplementaryStrategy.java +77 -0
- data/src/toxi/color/theory/TetradTheoryStrategy.java +114 -0
- data/src/toxi/color/theory/TriadTheoryStrategy.java +77 -0
- data/src/toxi/data/csv/CSVAdapter.java +74 -0
- data/src/toxi/data/csv/CSVFieldMapper.java +212 -0
- data/src/toxi/data/csv/CSVListener.java +61 -0
- data/src/toxi/data/csv/CSVParser.java +202 -0
- data/src/toxi/data/feeds/AtomAuthor.java +49 -0
- data/src/toxi/data/feeds/AtomContent.java +50 -0
- data/src/toxi/data/feeds/AtomEntry.java +111 -0
- data/src/toxi/data/feeds/AtomFeed.java +129 -0
- data/src/toxi/data/feeds/AtomLink.java +62 -0
- data/src/toxi/data/feeds/RSSChannel.java +88 -0
- data/src/toxi/data/feeds/RSSEnclosure.java +60 -0
- data/src/toxi/data/feeds/RSSFeed.java +99 -0
- data/src/toxi/data/feeds/RSSItem.java +104 -0
- data/src/toxi/data/feeds/util/EntityStripper.java +2480 -0
- data/src/toxi/data/feeds/util/Iso8601DateAdapter.java +101 -0
- data/src/toxi/data/feeds/util/Rfc822DateAdapter.java +93 -0
- data/src/toxi/geom/AABB.java +658 -0
- data/src/toxi/geom/Axis3D.java +116 -0
- data/src/toxi/geom/AxisAlignedCylinder.java +163 -0
- data/src/toxi/geom/BernsteinPolynomial.java +94 -0
- data/src/toxi/geom/BezierCurve2D.java +159 -0
- data/src/toxi/geom/BezierCurve3D.java +148 -0
- data/src/toxi/geom/BooleanShapeBuilder.java +185 -0
- data/src/toxi/geom/BoxIntersector.java +52 -0
- data/src/toxi/geom/Circle.java +230 -0
- data/src/toxi/geom/CircleIntersector.java +85 -0
- data/src/toxi/geom/Cone.java +150 -0
- data/src/toxi/geom/ConvexPolygonClipper.java +136 -0
- data/src/toxi/geom/CoordinateExtractor.java +16 -0
- data/src/toxi/geom/Ellipse.java +250 -0
- data/src/toxi/geom/GMatrix.java +2599 -0
- data/src/toxi/geom/GVector.java +833 -0
- data/src/toxi/geom/GlobalGridTesselator.java +54 -0
- data/src/toxi/geom/GridTesselator.java +108 -0
- data/src/toxi/geom/Intersector2D.java +49 -0
- data/src/toxi/geom/Intersector3D.java +51 -0
- data/src/toxi/geom/IsectData2D.java +103 -0
- data/src/toxi/geom/IsectData3D.java +103 -0
- data/src/toxi/geom/Line2D.java +534 -0
- data/src/toxi/geom/Line3D.java +471 -0
- data/src/toxi/geom/LineStrip2D.java +430 -0
- data/src/toxi/geom/LineStrip3D.java +230 -0
- data/src/toxi/geom/LocalGridTesselator.java +57 -0
- data/src/toxi/geom/Matrix3d.java +3048 -0
- data/src/toxi/geom/Matrix4f.java +3446 -0
- data/src/toxi/geom/Matrix4x4.java +1076 -0
- data/src/toxi/geom/MatrixSizeException.java +58 -0
- data/src/toxi/geom/OctreeVisitor.java +44 -0
- data/src/toxi/geom/Origin3D.java +148 -0
- data/src/toxi/geom/Plane.java +293 -0
- data/src/toxi/geom/PlaneIntersector.java +57 -0
- data/src/toxi/geom/PointCloud3D.java +253 -0
- data/src/toxi/geom/PointOctree.java +502 -0
- data/src/toxi/geom/PointQuadtree.java +375 -0
- data/src/toxi/geom/Polygon2D.java +1038 -0
- data/src/toxi/geom/PolygonClipper2D.java +45 -0
- data/src/toxi/geom/PolygonTesselator.java +20 -0
- data/src/toxi/geom/QuadtreeVisitor.java +44 -0
- data/src/toxi/geom/Quaternion.java +641 -0
- data/src/toxi/geom/Ray2D.java +146 -0
- data/src/toxi/geom/Ray3D.java +150 -0
- data/src/toxi/geom/Ray3DIntersector.java +75 -0
- data/src/toxi/geom/ReadonlyVec2D.java +575 -0
- data/src/toxi/geom/ReadonlyVec3D.java +628 -0
- data/src/toxi/geom/ReadonlyVec4D.java +431 -0
- data/src/toxi/geom/Rect.java +720 -0
- data/src/toxi/geom/Reflector3D.java +58 -0
- data/src/toxi/geom/Shape2D.java +94 -0
- data/src/toxi/geom/Shape3D.java +42 -0
- data/src/toxi/geom/SingularMatrixException.java +57 -0
- data/src/toxi/geom/SpatialBins.java +182 -0
- data/src/toxi/geom/SpatialIndex.java +61 -0
- data/src/toxi/geom/Sphere.java +224 -0
- data/src/toxi/geom/SphereIntersectorReflector.java +196 -0
- data/src/toxi/geom/Spline2D.java +349 -0
- data/src/toxi/geom/Spline3D.java +351 -0
- data/src/toxi/geom/SutherlandHodgemanClipper.java +151 -0
- data/src/toxi/geom/Triangle2D.java +422 -0
- data/src/toxi/geom/Triangle3D.java +456 -0
- data/src/toxi/geom/TriangleIntersector.java +105 -0
- data/src/toxi/geom/Vec2D.java +1328 -0
- data/src/toxi/geom/Vec3D.java +1832 -0
- data/src/toxi/geom/Vec4D.java +985 -0
- data/src/toxi/geom/VecMathUtil.java +100 -0
- data/src/toxi/geom/XAxisCylinder.java +64 -0
- data/src/toxi/geom/YAxisCylinder.java +65 -0
- data/src/toxi/geom/ZAxisCylinder.java +64 -0
- data/src/toxi/geom/mesh/BezierPatch.java +200 -0
- data/src/toxi/geom/mesh/BoxSelector.java +62 -0
- data/src/toxi/geom/mesh/DefaultSTLColorModel.java +67 -0
- data/src/toxi/geom/mesh/DefaultSelector.java +50 -0
- data/src/toxi/geom/mesh/Face.java +176 -0
- data/src/toxi/geom/mesh/LaplacianSmooth.java +80 -0
- data/src/toxi/geom/mesh/MaterialiseSTLColorModel.java +150 -0
- data/src/toxi/geom/mesh/Mesh3D.java +224 -0
- data/src/toxi/geom/mesh/MeshIntersector.java +91 -0
- data/src/toxi/geom/mesh/OBJWriter.java +194 -0
- data/src/toxi/geom/mesh/PLYWriter.java +167 -0
- data/src/toxi/geom/mesh/PlaneSelector.java +90 -0
- data/src/toxi/geom/mesh/STLColorModel.java +54 -0
- data/src/toxi/geom/mesh/STLReader.java +185 -0
- data/src/toxi/geom/mesh/STLWriter.java +323 -0
- data/src/toxi/geom/mesh/SphereFunction.java +156 -0
- data/src/toxi/geom/mesh/SphericalHarmonics.java +110 -0
- data/src/toxi/geom/mesh/SuperEllipsoid.java +110 -0
- data/src/toxi/geom/mesh/SurfaceFunction.java +75 -0
- data/src/toxi/geom/mesh/SurfaceMeshBuilder.java +149 -0
- data/src/toxi/geom/mesh/Terrain.java +451 -0
- data/src/toxi/geom/mesh/TriangleMesh.java +1201 -0
- data/src/toxi/geom/mesh/Vertex.java +78 -0
- data/src/toxi/geom/mesh/VertexSelector.java +193 -0
- data/src/toxi/geom/mesh/WEFace.java +100 -0
- data/src/toxi/geom/mesh/WEMeshFilterStrategy.java +51 -0
- data/src/toxi/geom/mesh/WETriangleMesh.java +761 -0
- data/src/toxi/geom/mesh/WEVertex.java +134 -0
- data/src/toxi/geom/mesh/WingedEdge.java +115 -0
- data/src/toxi/geom/mesh/subdiv/CentroidSubdiv.java +37 -0
- data/src/toxi/geom/mesh/subdiv/DisplacementSubdivision.java +85 -0
- data/src/toxi/geom/mesh/subdiv/DualDisplacementSubdivision.java +94 -0
- data/src/toxi/geom/mesh/subdiv/DualSubdivision.java +49 -0
- data/src/toxi/geom/mesh/subdiv/EdgeLengthComparator.java +50 -0
- data/src/toxi/geom/mesh/subdiv/FaceCountComparator.java +51 -0
- data/src/toxi/geom/mesh/subdiv/MidpointDisplacementSubdivision.java +80 -0
- data/src/toxi/geom/mesh/subdiv/MidpointSubdiv.java +42 -0
- data/src/toxi/geom/mesh/subdiv/MidpointSubdivision.java +48 -0
- data/src/toxi/geom/mesh/subdiv/NewSubdivStrategy.java +23 -0
- data/src/toxi/geom/mesh/subdiv/NormalDisplacementSubdivision.java +74 -0
- data/src/toxi/geom/mesh/subdiv/SubdivisionStrategy.java +83 -0
- data/src/toxi/geom/mesh/subdiv/TriSubdivision.java +51 -0
- data/src/toxi/geom/mesh2d/DelaunayTriangle.java +222 -0
- data/src/toxi/geom/mesh2d/DelaunayTriangulation.java +327 -0
- data/src/toxi/geom/mesh2d/DelaunayVertex.java +560 -0
- data/src/toxi/geom/mesh2d/Voronoi.java +149 -0
- data/src/toxi/geom/nurbs/BasicNurbsCurve.java +210 -0
- data/src/toxi/geom/nurbs/BasicNurbsSurface.java +233 -0
- data/src/toxi/geom/nurbs/ControlNet.java +148 -0
- data/src/toxi/geom/nurbs/CurveCreator.java +112 -0
- data/src/toxi/geom/nurbs/CurveUtils.java +259 -0
- data/src/toxi/geom/nurbs/InterpolationException.java +65 -0
- data/src/toxi/geom/nurbs/KnotVector.java +333 -0
- data/src/toxi/geom/nurbs/NurbsCreator.java +815 -0
- data/src/toxi/geom/nurbs/NurbsCurve.java +120 -0
- data/src/toxi/geom/nurbs/NurbsMeshCreator.java +145 -0
- data/src/toxi/geom/nurbs/NurbsSurface.java +147 -0
- data/src/toxi/image/util/Filter8bit.java +331 -0
- data/src/toxi/image/util/TiledFrameExporter.java +162 -0
- data/src/toxi/math/BezierInterpolation.java +102 -0
- data/src/toxi/math/CircularInterpolation.java +88 -0
- data/src/toxi/math/CosineInterpolation.java +51 -0
- data/src/toxi/math/DecimatedInterpolation.java +77 -0
- data/src/toxi/math/ExponentialInterpolation.java +68 -0
- data/src/toxi/math/InterpolateStrategy.java +60 -0
- data/src/toxi/math/Interpolation2D.java +93 -0
- data/src/toxi/math/LinearInterpolation.java +46 -0
- data/src/toxi/math/MathUtils.java +990 -0
- data/src/toxi/math/NonLinearScaleMap.java +101 -0
- data/src/toxi/math/ScaleMap.java +183 -0
- data/src/toxi/math/SigmoidInterpolation.java +78 -0
- data/src/toxi/math/SinCosLUT.java +141 -0
- data/src/toxi/math/ThresholdInterpolation.java +58 -0
- data/src/toxi/math/ZoomLensInterpolation.java +126 -0
- data/src/toxi/math/conversion/UnitTranslator.java +161 -0
- data/src/toxi/math/noise/PerlinNoise.java +281 -0
- data/src/toxi/math/noise/SimplexNoise.java +542 -0
- data/src/toxi/math/waves/AMFMSineWave.java +143 -0
- data/src/toxi/math/waves/AbstractWave.java +248 -0
- data/src/toxi/math/waves/ConstantWave.java +48 -0
- data/src/toxi/math/waves/FMHarmonicSquareWave.java +155 -0
- data/src/toxi/math/waves/FMSawtoothWave.java +144 -0
- data/src/toxi/math/waves/FMSineWave.java +142 -0
- data/src/toxi/math/waves/FMSquareWave.java +143 -0
- data/src/toxi/math/waves/FMTriangleWave.java +126 -0
- data/src/toxi/math/waves/SineWave.java +81 -0
- data/src/toxi/math/waves/Wave2D.java +68 -0
- data/src/toxi/math/waves/WaveState.java +69 -0
- data/src/toxi/music/scale/AbstractScale.java +117 -0
- data/src/toxi/music/scale/GenericScale.java +66 -0
- data/src/toxi/music/scale/MajorScale.java +41 -0
- data/src/toxi/newmesh/AttributedEdge.java +106 -0
- data/src/toxi/newmesh/AttributedFace.java +63 -0
- data/src/toxi/newmesh/IndexedTriangleMesh.java +809 -0
- data/src/toxi/newmesh/MeshAttributeCompiler.java +45 -0
- data/src/toxi/newmesh/MeshFaceNormalCompiler.java +52 -0
- data/src/toxi/newmesh/MeshUVCompiler.java +52 -0
- data/src/toxi/newmesh/MeshVertexColorCompiler.java +49 -0
- data/src/toxi/newmesh/MeshVertexCompiler.java +54 -0
- data/src/toxi/newmesh/MeshVertexNormalCompiler.java +55 -0
- data/src/toxi/newmesh/SpatialIndex.java +78 -0
- data/src/toxi/physics2d/ParticlePath2D.java +100 -0
- data/src/toxi/physics2d/ParticleString2D.java +184 -0
- data/src/toxi/physics2d/PullBackSpring2D.java +51 -0
- data/src/toxi/physics2d/VerletConstrainedSpring2D.java +89 -0
- data/src/toxi/physics2d/VerletMinDistanceSpring2D.java +57 -0
- data/src/toxi/physics2d/VerletParticle2D.java +457 -0
- data/src/toxi/physics2d/VerletPhysics2D.java +448 -0
- data/src/toxi/physics2d/VerletSpring2D.java +181 -0
- data/src/toxi/physics2d/behaviors/AttractionBehavior2D.java +212 -0
- data/src/toxi/physics2d/behaviors/ConstantForceBehavior2D.java +112 -0
- data/src/toxi/physics2d/behaviors/GravityBehavior2D.java +61 -0
- data/src/toxi/physics2d/behaviors/ParticleBehavior2D.java +66 -0
- data/src/toxi/physics2d/constraints/AngularConstraint.java +83 -0
- data/src/toxi/physics2d/constraints/AxisConstraint.java +71 -0
- data/src/toxi/physics2d/constraints/CircularConstraint.java +69 -0
- data/src/toxi/physics2d/constraints/MaxConstraint.java +66 -0
- data/src/toxi/physics2d/constraints/MinConstraint.java +66 -0
- data/src/toxi/physics2d/constraints/ParticleConstraint2D.java +47 -0
- data/src/toxi/physics2d/constraints/PolygonConstraint.java +93 -0
- data/src/toxi/physics2d/constraints/RectConstraint.java +114 -0
- data/src/toxi/physics3d/ParticlePath3D.java +100 -0
- data/src/toxi/physics3d/ParticleString3D.java +184 -0
- data/src/toxi/physics3d/PullBackSpring3D.java +50 -0
- data/src/toxi/physics3d/VerletConstrainedSpring3D.java +88 -0
- data/src/toxi/physics3d/VerletMinDistanceSpring3D.java +56 -0
- data/src/toxi/physics3d/VerletParticle3D.java +385 -0
- data/src/toxi/physics3d/VerletPhysics3D.java +417 -0
- data/src/toxi/physics3d/VerletSpring3D.java +180 -0
- data/src/toxi/physics3d/behaviors/AttractionBehavior3D.java +182 -0
- data/src/toxi/physics3d/behaviors/ConstantForceBehavior3D.java +92 -0
- data/src/toxi/physics3d/behaviors/GravityBehavior3D.java +61 -0
- data/src/toxi/physics3d/behaviors/ParticleBehavior3D.java +52 -0
- data/src/toxi/physics3d/constraints/AxisConstraint.java +68 -0
- data/src/toxi/physics3d/constraints/BoxConstraint.java +121 -0
- data/src/toxi/physics3d/constraints/CylinderConstraint.java +87 -0
- data/src/toxi/physics3d/constraints/MaxConstraint.java +65 -0
- data/src/toxi/physics3d/constraints/MinConstraint.java +65 -0
- data/src/toxi/physics3d/constraints/ParticleConstraint3D.java +49 -0
- data/src/toxi/physics3d/constraints/PlaneConstraint.java +78 -0
- data/src/toxi/physics3d/constraints/SoftBoxConstraint.java +87 -0
- data/src/toxi/physics3d/constraints/SphereConstraint.java +108 -0
- data/src/toxi/processing/ArrowModifier.java +116 -0
- data/src/toxi/processing/DashedLineModifier.java +48 -0
- data/src/toxi/processing/DeltaOrientationMapper.java +57 -0
- data/src/toxi/processing/Line2DRenderModifier.java +18 -0
- data/src/toxi/processing/MeshToVBO.java +94 -0
- data/src/toxi/processing/NormalMapper.java +18 -0
- data/src/toxi/processing/POVInterface.java +121 -0
- data/src/toxi/processing/POVMesh.java +219 -0
- data/src/toxi/processing/POVWriter.java +460 -0
- data/src/toxi/processing/RCOpaque.java +77 -0
- data/src/toxi/processing/RCTransp.java +78 -0
- data/src/toxi/processing/TextureBuilder.java +232 -0
- data/src/toxi/processing/Textures.java +110 -0
- data/src/toxi/processing/ToxiclibsSupport.java +1239 -0
- data/src/toxi/processing/Tracing.java +25 -0
- data/src/toxi/processing/XYZNormalMapper.java +30 -0
- data/src/toxi/sim/automata/CAMatrix.java +297 -0
- data/src/toxi/sim/automata/CARule.java +76 -0
- data/src/toxi/sim/automata/CARule2D.java +354 -0
- data/src/toxi/sim/automata/CAWolfram1D.java +309 -0
- data/src/toxi/sim/automata/EvolvableMatrix.java +61 -0
- data/src/toxi/sim/automata/MatrixEvolver.java +42 -0
- data/src/toxi/sim/dla/BottomUpOrder.java +76 -0
- data/src/toxi/sim/dla/DLA.java +497 -0
- data/src/toxi/sim/dla/DLAConfiguration.java +364 -0
- data/src/toxi/sim/dla/DLAEventAdapter.java +64 -0
- data/src/toxi/sim/dla/DLAEventListener.java +57 -0
- data/src/toxi/sim/dla/DLAGuideLines.java +219 -0
- data/src/toxi/sim/dla/DLAParticle.java +102 -0
- data/src/toxi/sim/dla/DLASegment.java +88 -0
- data/src/toxi/sim/dla/PipelineOrder.java +50 -0
- data/src/toxi/sim/dla/RadialDistanceOrder.java +92 -0
- data/src/toxi/sim/erosion/ErosionFunction.java +122 -0
- data/src/toxi/sim/erosion/TalusAngleErosion.java +145 -0
- data/src/toxi/sim/erosion/ThermalErosion.java +75 -0
- data/src/toxi/sim/fluids/FluidSolver2D.java +762 -0
- data/src/toxi/sim/fluids/FluidSolver3D.java +326 -0
- data/src/toxi/sim/grayscott/GrayScott.java +469 -0
- data/src/toxi/util/DateUtils.java +141 -0
- data/src/toxi/util/FileSequenceDescriptor.java +181 -0
- data/src/toxi/util/FileUtils.java +467 -0
- data/src/toxi/util/datatypes/ArraySet.java +128 -0
- data/src/toxi/util/datatypes/ArrayUtil.java +404 -0
- data/src/toxi/util/datatypes/BiasedDoubleRange.java +141 -0
- data/src/toxi/util/datatypes/BiasedFloatRange.java +141 -0
- data/src/toxi/util/datatypes/BiasedIntegerRange.java +141 -0
- data/src/toxi/util/datatypes/DoubleRange.java +251 -0
- data/src/toxi/util/datatypes/FloatRange.java +251 -0
- data/src/toxi/util/datatypes/GenericSet.java +215 -0
- data/src/toxi/util/datatypes/IntegerRange.java +247 -0
- data/src/toxi/util/datatypes/IntegerSet.java +149 -0
- data/src/toxi/util/datatypes/ItemIndex.java +72 -0
- data/src/toxi/util/datatypes/SingletonRegistry.java +91 -0
- data/src/toxi/util/datatypes/TypedProperties.java +291 -0
- data/src/toxi/util/datatypes/UndirectedGraph.java +134 -0
- data/src/toxi/util/datatypes/UniqueItemIndex.java +223 -0
- data/src/toxi/util/datatypes/WeightedRandomEntry.java +76 -0
- data/src/toxi/util/datatypes/WeightedRandomSet.java +125 -0
- data/src/toxi/util/events/EventDispatcher.java +86 -0
- data/src/toxi/volume/AdditiveBrush.java +19 -0
- data/src/toxi/volume/ArrayIsoSurface.java +297 -0
- data/src/toxi/volume/BoxBrush.java +100 -0
- data/src/toxi/volume/BrushMode.java +16 -0
- data/src/toxi/volume/HashIsoSurface.java +354 -0
- data/src/toxi/volume/IsoSurface.java +59 -0
- data/src/toxi/volume/MarchingCubesIndex.java +312 -0
- data/src/toxi/volume/MeshLatticeBuilder.java +358 -0
- data/src/toxi/volume/MeshVoxelizer.java +216 -0
- data/src/toxi/volume/MultiplyBrush.java +20 -0
- data/src/toxi/volume/PeakBrush.java +21 -0
- data/src/toxi/volume/ReplaceBrush.java +19 -0
- data/src/toxi/volume/RoundBrush.java +113 -0
- data/src/toxi/volume/VolumetricBrush.java +160 -0
- data/src/toxi/volume/VolumetricHashMap.java +179 -0
- data/src/toxi/volume/VolumetricSpace.java +195 -0
- data/src/toxi/volume/VolumetricSpaceArray.java +214 -0
- data/toxiclibs.gemspec +34 -0
- metadata +424 -27
@@ -0,0 +1,3446 @@
|
|
1
|
+
/*
|
2
|
+
* $RCSfile$
|
3
|
+
*
|
4
|
+
* Copyright 1996-2008 Sun Microsystems, Inc. All Rights Reserved.
|
5
|
+
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
6
|
+
*
|
7
|
+
* This code is free software; you can redistribute it and/or modify it
|
8
|
+
* under the terms of the GNU General Public License version 2 only, as
|
9
|
+
* published by the Free Software Foundation. Sun designates this
|
10
|
+
* particular file as subject to the "Classpath" exception as provided
|
11
|
+
* by Sun in the LICENSE file that accompanied this code.
|
12
|
+
*
|
13
|
+
* This code is distributed in the hope that it will be useful, but WITHOUT
|
14
|
+
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
15
|
+
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
16
|
+
* version 2 for more details (a copy is included in the LICENSE file that
|
17
|
+
* accompanied this code).
|
18
|
+
*
|
19
|
+
* You should have received a copy of the GNU General Public License version
|
20
|
+
* 2 along with this work; if not, write to the Free Software Foundation,
|
21
|
+
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
22
|
+
*
|
23
|
+
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
24
|
+
* CA 95054 USA or visit www.sun.com if you need additional information or
|
25
|
+
* have any questions.
|
26
|
+
*
|
27
|
+
* $Revision: 127 $
|
28
|
+
* $Date: 2008-02-28 20:18:51 +0000 (Thu, 28 Feb 2008) $
|
29
|
+
* $State$
|
30
|
+
*/
|
31
|
+
|
32
|
+
package toxi.geom;
|
33
|
+
|
34
|
+
import toxi.math.MathUtils;
|
35
|
+
|
36
|
+
/**
|
37
|
+
* A single precision floating point 4 by 4 matrix. Primarily to support 3D
|
38
|
+
* rotations.
|
39
|
+
*
|
40
|
+
*/
|
41
|
+
public class Matrix4f implements java.io.Serializable, Cloneable {
|
42
|
+
|
43
|
+
// Compatible with 1.1
|
44
|
+
static final long serialVersionUID = -8405036035410109353L;
|
45
|
+
|
46
|
+
/**
|
47
|
+
* Solves a set of linear equations. The input parameters "matrix1", and
|
48
|
+
* "row_perm" come from luDecompostionD4x4 and do not change here. The
|
49
|
+
* parameter "matrix2" is a set of column vectors assembled into a 4x4
|
50
|
+
* matrix of floating-point values. The procedure takes each column of
|
51
|
+
* "matrix2" in turn and treats it as the right-hand side of the matrix
|
52
|
+
* equation Ax = LUx = b. The solution vector replaces the original column
|
53
|
+
* of the matrix.
|
54
|
+
*
|
55
|
+
* If "matrix2" is the identity matrix, the procedure replaces its contents
|
56
|
+
* with the inverse of the matrix from which "matrix1" was originally
|
57
|
+
* derived.
|
58
|
+
*/
|
59
|
+
//
|
60
|
+
// Reference: Press, Flannery, Teukolsky, Vetterling,
|
61
|
+
// _Numerical_Recipes_in_C_, Cambridge University Press,
|
62
|
+
// 1988, pp 44-45.
|
63
|
+
//
|
64
|
+
static void luBacksubstitution(double[] matrix1, int[] row_perm,
|
65
|
+
double[] matrix2) {
|
66
|
+
|
67
|
+
int i, ii, ip, j, k;
|
68
|
+
int rp;
|
69
|
+
int cv, rv;
|
70
|
+
|
71
|
+
// rp = row_perm;
|
72
|
+
rp = 0;
|
73
|
+
|
74
|
+
// For each column vector of matrix2 ...
|
75
|
+
for (k = 0; k < 4; k++) {
|
76
|
+
// cv = &(matrix2[0][k]);
|
77
|
+
cv = k;
|
78
|
+
ii = -1;
|
79
|
+
|
80
|
+
// Forward substitution
|
81
|
+
for (i = 0; i < 4; i++) {
|
82
|
+
double sum;
|
83
|
+
|
84
|
+
ip = row_perm[rp + i];
|
85
|
+
sum = matrix2[cv + 4 * ip];
|
86
|
+
matrix2[cv + 4 * ip] = matrix2[cv + 4 * i];
|
87
|
+
if (ii >= 0) {
|
88
|
+
// rv = &(matrix1[i][0]);
|
89
|
+
rv = i * 4;
|
90
|
+
for (j = ii; j <= i - 1; j++) {
|
91
|
+
sum -= matrix1[rv + j] * matrix2[cv + 4 * j];
|
92
|
+
}
|
93
|
+
} else if (sum != 0.0) {
|
94
|
+
ii = i;
|
95
|
+
}
|
96
|
+
matrix2[cv + 4 * i] = sum;
|
97
|
+
}
|
98
|
+
|
99
|
+
// Backsubstitution
|
100
|
+
// rv = &(matrix1[3][0]);
|
101
|
+
rv = 3 * 4;
|
102
|
+
matrix2[cv + 4 * 3] /= matrix1[rv + 3];
|
103
|
+
|
104
|
+
rv -= 4;
|
105
|
+
matrix2[cv + 4 * 2] = (matrix2[cv + 4 * 2] - matrix1[rv + 3]
|
106
|
+
* matrix2[cv + 4 * 3])
|
107
|
+
/ matrix1[rv + 2];
|
108
|
+
|
109
|
+
rv -= 4;
|
110
|
+
matrix2[cv + 4 * 1] = (matrix2[cv + 4 * 1] - matrix1[rv + 2]
|
111
|
+
* matrix2[cv + 4 * 2] - matrix1[rv + 3]
|
112
|
+
* matrix2[cv + 4 * 3])
|
113
|
+
/ matrix1[rv + 1];
|
114
|
+
|
115
|
+
rv -= 4;
|
116
|
+
matrix2[cv + 4 * 0] = (matrix2[cv + 4 * 0] - matrix1[rv + 1]
|
117
|
+
* matrix2[cv + 4 * 1] - matrix1[rv + 2]
|
118
|
+
* matrix2[cv + 4 * 2] - matrix1[rv + 3]
|
119
|
+
* matrix2[cv + 4 * 3])
|
120
|
+
/ matrix1[rv + 0];
|
121
|
+
}
|
122
|
+
}
|
123
|
+
|
124
|
+
/**
|
125
|
+
* The first element of the first row.
|
126
|
+
*/
|
127
|
+
public float m00;
|
128
|
+
|
129
|
+
/**
|
130
|
+
* The second element of the first row.
|
131
|
+
*/
|
132
|
+
public float m01;
|
133
|
+
|
134
|
+
/**
|
135
|
+
* The third element of the first row.
|
136
|
+
*/
|
137
|
+
public float m02;
|
138
|
+
|
139
|
+
/**
|
140
|
+
* The fourth element of the first row.
|
141
|
+
*/
|
142
|
+
public float m03;
|
143
|
+
|
144
|
+
/**
|
145
|
+
* The first element of the second row.
|
146
|
+
*/
|
147
|
+
public float m10;
|
148
|
+
|
149
|
+
/**
|
150
|
+
* The second element of the second row.
|
151
|
+
*/
|
152
|
+
public float m11;
|
153
|
+
|
154
|
+
/**
|
155
|
+
* The third element of the second row.
|
156
|
+
*/
|
157
|
+
public float m12;
|
158
|
+
|
159
|
+
/**
|
160
|
+
* The fourth element of the second row.
|
161
|
+
*/
|
162
|
+
public float m13;
|
163
|
+
|
164
|
+
/**
|
165
|
+
* The first element of the third row.
|
166
|
+
*/
|
167
|
+
public float m20;
|
168
|
+
|
169
|
+
/**
|
170
|
+
* The second element of the third row.
|
171
|
+
*/
|
172
|
+
public float m21;
|
173
|
+
|
174
|
+
/**
|
175
|
+
* The third element of the third row.
|
176
|
+
*/
|
177
|
+
public float m22;
|
178
|
+
|
179
|
+
/**
|
180
|
+
* The fourth element of the third row.
|
181
|
+
*/
|
182
|
+
public float m23;
|
183
|
+
|
184
|
+
/**
|
185
|
+
* The first element of the fourth row.
|
186
|
+
*/
|
187
|
+
public float m30;
|
188
|
+
|
189
|
+
/**
|
190
|
+
* The second element of the fourth row.
|
191
|
+
*/
|
192
|
+
public float m31;
|
193
|
+
/**
|
194
|
+
* The third element of the fourth row.
|
195
|
+
*/
|
196
|
+
public float m32;
|
197
|
+
|
198
|
+
/**
|
199
|
+
* The fourth element of the fourth row.
|
200
|
+
*/
|
201
|
+
public float m33;
|
202
|
+
|
203
|
+
/*
|
204
|
+
* double[] tmp = new double[9]; double[] tmp_scale = new double[3];
|
205
|
+
* double[] tmp_rot = new double[9];
|
206
|
+
*/
|
207
|
+
private static final double EPS = 1.0E-8;
|
208
|
+
|
209
|
+
/**
|
210
|
+
* Constructs and initializes a Matrix4f to all zeros.
|
211
|
+
*/
|
212
|
+
public Matrix4f() {
|
213
|
+
this.m00 = (float) 0.0;
|
214
|
+
this.m01 = (float) 0.0;
|
215
|
+
this.m02 = (float) 0.0;
|
216
|
+
this.m03 = (float) 0.0;
|
217
|
+
|
218
|
+
this.m10 = (float) 0.0;
|
219
|
+
this.m11 = (float) 0.0;
|
220
|
+
this.m12 = (float) 0.0;
|
221
|
+
this.m13 = (float) 0.0;
|
222
|
+
|
223
|
+
this.m20 = (float) 0.0;
|
224
|
+
this.m21 = (float) 0.0;
|
225
|
+
this.m22 = (float) 0.0;
|
226
|
+
this.m23 = (float) 0.0;
|
227
|
+
|
228
|
+
this.m30 = (float) 0.0;
|
229
|
+
this.m31 = (float) 0.0;
|
230
|
+
this.m32 = (float) 0.0;
|
231
|
+
this.m33 = (float) 0.0;
|
232
|
+
|
233
|
+
}
|
234
|
+
|
235
|
+
/**
|
236
|
+
* Constructs and initializes a Matrix4f from the specified 16 values.
|
237
|
+
*
|
238
|
+
* @param m00
|
239
|
+
* the [0][0] element
|
240
|
+
* @param m01
|
241
|
+
* the [0][1] element
|
242
|
+
* @param m02
|
243
|
+
* the [0][2] element
|
244
|
+
* @param m03
|
245
|
+
* the [0][3] element
|
246
|
+
* @param m10
|
247
|
+
* the [1][0] element
|
248
|
+
* @param m11
|
249
|
+
* the [1][1] element
|
250
|
+
* @param m12
|
251
|
+
* the [1][2] element
|
252
|
+
* @param m13
|
253
|
+
* the [1][3] element
|
254
|
+
* @param m20
|
255
|
+
* the [2][0] element
|
256
|
+
* @param m21
|
257
|
+
* the [2][1] element
|
258
|
+
* @param m22
|
259
|
+
* the [2][2] element
|
260
|
+
* @param m23
|
261
|
+
* the [2][3] element
|
262
|
+
* @param m30
|
263
|
+
* the [3][0] element
|
264
|
+
* @param m31
|
265
|
+
* the [3][1] element
|
266
|
+
* @param m32
|
267
|
+
* the [3][2] element
|
268
|
+
* @param m33
|
269
|
+
* the [3][3] element
|
270
|
+
*/
|
271
|
+
public Matrix4f(float m00, float m01, float m02, float m03, float m10,
|
272
|
+
float m11, float m12, float m13, float m20, float m21, float m22,
|
273
|
+
float m23, float m30, float m31, float m32, float m33) {
|
274
|
+
this.m00 = m00;
|
275
|
+
this.m01 = m01;
|
276
|
+
this.m02 = m02;
|
277
|
+
this.m03 = m03;
|
278
|
+
|
279
|
+
this.m10 = m10;
|
280
|
+
this.m11 = m11;
|
281
|
+
this.m12 = m12;
|
282
|
+
this.m13 = m13;
|
283
|
+
|
284
|
+
this.m20 = m20;
|
285
|
+
this.m21 = m21;
|
286
|
+
this.m22 = m22;
|
287
|
+
this.m23 = m23;
|
288
|
+
|
289
|
+
this.m30 = m30;
|
290
|
+
this.m31 = m31;
|
291
|
+
this.m32 = m32;
|
292
|
+
this.m33 = m33;
|
293
|
+
|
294
|
+
}
|
295
|
+
|
296
|
+
/**
|
297
|
+
* Constructs and initializes a Matrix4f from the specified 16 element
|
298
|
+
* array. this.m00 =v[0], this.m01=v[1], etc.
|
299
|
+
*
|
300
|
+
* @param v
|
301
|
+
* the array of length 16 containing in order
|
302
|
+
*/
|
303
|
+
public Matrix4f(float[] v) {
|
304
|
+
this.m00 = v[0];
|
305
|
+
this.m01 = v[1];
|
306
|
+
this.m02 = v[2];
|
307
|
+
this.m03 = v[3];
|
308
|
+
|
309
|
+
this.m10 = v[4];
|
310
|
+
this.m11 = v[5];
|
311
|
+
this.m12 = v[6];
|
312
|
+
this.m13 = v[7];
|
313
|
+
|
314
|
+
this.m20 = v[8];
|
315
|
+
this.m21 = v[9];
|
316
|
+
this.m22 = v[10];
|
317
|
+
this.m23 = v[11];
|
318
|
+
|
319
|
+
this.m30 = v[12];
|
320
|
+
this.m31 = v[13];
|
321
|
+
this.m32 = v[14];
|
322
|
+
this.m33 = v[15];
|
323
|
+
|
324
|
+
}
|
325
|
+
|
326
|
+
/**
|
327
|
+
* Constructs and initializes a Matrix4f from the rotation matrix,
|
328
|
+
* translation, and scale values; the scale is applied only to the
|
329
|
+
* rotational components of the matrix (upper 3x3) and not to the
|
330
|
+
* translational components of the matrix.
|
331
|
+
*
|
332
|
+
* @param m1
|
333
|
+
* the rotation matrix representing the rotational components
|
334
|
+
* @param t1
|
335
|
+
* the translational components of the matrix
|
336
|
+
* @param s
|
337
|
+
* the scale value applied to the rotational components
|
338
|
+
*/
|
339
|
+
public Matrix4f(Matrix3d m1, Vec3D t1, float s) {
|
340
|
+
this.m00 = (float) (m1.m00 * s);
|
341
|
+
this.m01 = (float) (m1.m01 * s);
|
342
|
+
this.m02 = (float) (m1.m02 * s);
|
343
|
+
this.m03 = t1.x;
|
344
|
+
|
345
|
+
this.m10 = (float) (m1.m10 * s);
|
346
|
+
this.m11 = (float) (m1.m11 * s);
|
347
|
+
this.m12 = (float) (m1.m12 * s);
|
348
|
+
this.m13 = t1.y;
|
349
|
+
|
350
|
+
this.m20 = (float) (m1.m20 * s);
|
351
|
+
this.m21 = (float) (m1.m21 * s);
|
352
|
+
this.m22 = (float) (m1.m22 * s);
|
353
|
+
this.m23 = t1.z;
|
354
|
+
|
355
|
+
this.m30 = 0.0f;
|
356
|
+
this.m31 = 0.0f;
|
357
|
+
this.m32 = 0.0f;
|
358
|
+
this.m33 = 1.0f;
|
359
|
+
|
360
|
+
}
|
361
|
+
|
362
|
+
/**
|
363
|
+
* Constructs a new matrix with the same values as the Matrix4f parameter.
|
364
|
+
*
|
365
|
+
* @param m1
|
366
|
+
* the source matrix
|
367
|
+
*/
|
368
|
+
public Matrix4f(Matrix4f m1) {
|
369
|
+
this.m00 = m1.m00;
|
370
|
+
this.m01 = m1.m01;
|
371
|
+
this.m02 = m1.m02;
|
372
|
+
this.m03 = m1.m03;
|
373
|
+
|
374
|
+
this.m10 = m1.m10;
|
375
|
+
this.m11 = m1.m11;
|
376
|
+
this.m12 = m1.m12;
|
377
|
+
this.m13 = m1.m13;
|
378
|
+
|
379
|
+
this.m20 = m1.m20;
|
380
|
+
this.m21 = m1.m21;
|
381
|
+
this.m22 = m1.m22;
|
382
|
+
this.m23 = m1.m23;
|
383
|
+
|
384
|
+
this.m30 = m1.m30;
|
385
|
+
this.m31 = m1.m31;
|
386
|
+
this.m32 = m1.m32;
|
387
|
+
this.m33 = m1.m33;
|
388
|
+
|
389
|
+
}
|
390
|
+
|
391
|
+
/**
|
392
|
+
* Constructs and initializes a Matrix4f from the quaternion, translation,
|
393
|
+
* and scale values; the scale is applied only to the rotational components
|
394
|
+
* of the matrix (upper 3x3) and not to the translational components.
|
395
|
+
*
|
396
|
+
* @param q1
|
397
|
+
* the quaternion value representing the rotational component
|
398
|
+
* @param t1
|
399
|
+
* the translational component of the matrix
|
400
|
+
* @param s
|
401
|
+
* the scale value applied to the rotational components
|
402
|
+
*/
|
403
|
+
public Matrix4f(Quaternion q1, Vec3D t1, float s) {
|
404
|
+
m00 = (float) (s * (1.0 - 2.0 * q1.y * q1.y - 2.0 * q1.z * q1.z));
|
405
|
+
m10 = (float) (s * (2.0 * (q1.x * q1.y + q1.w * q1.z)));
|
406
|
+
m20 = (float) (s * (2.0 * (q1.x * q1.z - q1.w * q1.y)));
|
407
|
+
|
408
|
+
m01 = (float) (s * (2.0 * (q1.x * q1.y - q1.w * q1.z)));
|
409
|
+
m11 = (float) (s * (1.0 - 2.0 * q1.x * q1.x - 2.0 * q1.z * q1.z));
|
410
|
+
m21 = (float) (s * (2.0 * (q1.y * q1.z + q1.w * q1.x)));
|
411
|
+
|
412
|
+
m02 = (float) (s * (2.0 * (q1.x * q1.z + q1.w * q1.y)));
|
413
|
+
m12 = (float) (s * (2.0 * (q1.y * q1.z - q1.w * q1.x)));
|
414
|
+
m22 = (float) (s * (1.0 - 2.0 * q1.x * q1.x - 2.0 * q1.y * q1.y));
|
415
|
+
|
416
|
+
m03 = t1.x;
|
417
|
+
m13 = t1.y;
|
418
|
+
m23 = t1.z;
|
419
|
+
|
420
|
+
m30 = 0.0f;
|
421
|
+
m31 = 0.0f;
|
422
|
+
m32 = 0.0f;
|
423
|
+
m33 = 1.0f;
|
424
|
+
|
425
|
+
}
|
426
|
+
|
427
|
+
/**
|
428
|
+
* Adds a scalar to each component of this matrix.
|
429
|
+
*
|
430
|
+
* @param scalar
|
431
|
+
* the scalar adder
|
432
|
+
*/
|
433
|
+
public final void add(float scalar) {
|
434
|
+
m00 += scalar;
|
435
|
+
m01 += scalar;
|
436
|
+
m02 += scalar;
|
437
|
+
m03 += scalar;
|
438
|
+
m10 += scalar;
|
439
|
+
m11 += scalar;
|
440
|
+
m12 += scalar;
|
441
|
+
m13 += scalar;
|
442
|
+
m20 += scalar;
|
443
|
+
m21 += scalar;
|
444
|
+
m22 += scalar;
|
445
|
+
m23 += scalar;
|
446
|
+
m30 += scalar;
|
447
|
+
m31 += scalar;
|
448
|
+
m32 += scalar;
|
449
|
+
m33 += scalar;
|
450
|
+
}
|
451
|
+
|
452
|
+
/**
|
453
|
+
* Adds a scalar to each component of the matrix m1 and places the result
|
454
|
+
* into this. Matrix m1 is not modified.
|
455
|
+
*
|
456
|
+
* @param scalar
|
457
|
+
* the scalar adder
|
458
|
+
* @param m1
|
459
|
+
* the original matrix values
|
460
|
+
*/
|
461
|
+
public final void add(float scalar, Matrix4f m1) {
|
462
|
+
this.m00 = m1.m00 + scalar;
|
463
|
+
this.m01 = m1.m01 + scalar;
|
464
|
+
this.m02 = m1.m02 + scalar;
|
465
|
+
this.m03 = m1.m03 + scalar;
|
466
|
+
this.m10 = m1.m10 + scalar;
|
467
|
+
this.m11 = m1.m11 + scalar;
|
468
|
+
this.m12 = m1.m12 + scalar;
|
469
|
+
this.m13 = m1.m13 + scalar;
|
470
|
+
this.m20 = m1.m20 + scalar;
|
471
|
+
this.m21 = m1.m21 + scalar;
|
472
|
+
this.m22 = m1.m22 + scalar;
|
473
|
+
this.m23 = m1.m23 + scalar;
|
474
|
+
this.m30 = m1.m30 + scalar;
|
475
|
+
this.m31 = m1.m31 + scalar;
|
476
|
+
this.m32 = m1.m32 + scalar;
|
477
|
+
this.m33 = m1.m33 + scalar;
|
478
|
+
}
|
479
|
+
|
480
|
+
/**
|
481
|
+
* Sets the value of this matrix to the sum of itself and matrix m1.
|
482
|
+
*
|
483
|
+
* @param m1
|
484
|
+
* the other matrix
|
485
|
+
*/
|
486
|
+
public final void add(Matrix4f m1) {
|
487
|
+
this.m00 += m1.m00;
|
488
|
+
this.m01 += m1.m01;
|
489
|
+
this.m02 += m1.m02;
|
490
|
+
this.m03 += m1.m03;
|
491
|
+
|
492
|
+
this.m10 += m1.m10;
|
493
|
+
this.m11 += m1.m11;
|
494
|
+
this.m12 += m1.m12;
|
495
|
+
this.m13 += m1.m13;
|
496
|
+
|
497
|
+
this.m20 += m1.m20;
|
498
|
+
this.m21 += m1.m21;
|
499
|
+
this.m22 += m1.m22;
|
500
|
+
this.m23 += m1.m23;
|
501
|
+
|
502
|
+
this.m30 += m1.m30;
|
503
|
+
this.m31 += m1.m31;
|
504
|
+
this.m32 += m1.m32;
|
505
|
+
this.m33 += m1.m33;
|
506
|
+
}
|
507
|
+
|
508
|
+
/**
|
509
|
+
* Sets the value of this matrix to the matrix sum of matrices m1 and m2.
|
510
|
+
*
|
511
|
+
* @param m1
|
512
|
+
* the first matrix
|
513
|
+
* @param m2
|
514
|
+
* the second matrix
|
515
|
+
*/
|
516
|
+
public final void add(Matrix4f m1, Matrix4f m2) {
|
517
|
+
this.m00 = m1.m00 + m2.m00;
|
518
|
+
this.m01 = m1.m01 + m2.m01;
|
519
|
+
this.m02 = m1.m02 + m2.m02;
|
520
|
+
this.m03 = m1.m03 + m2.m03;
|
521
|
+
|
522
|
+
this.m10 = m1.m10 + m2.m10;
|
523
|
+
this.m11 = m1.m11 + m2.m11;
|
524
|
+
this.m12 = m1.m12 + m2.m12;
|
525
|
+
this.m13 = m1.m13 + m2.m13;
|
526
|
+
|
527
|
+
this.m20 = m1.m20 + m2.m20;
|
528
|
+
this.m21 = m1.m21 + m2.m21;
|
529
|
+
this.m22 = m1.m22 + m2.m22;
|
530
|
+
this.m23 = m1.m23 + m2.m23;
|
531
|
+
|
532
|
+
this.m30 = m1.m30 + m2.m30;
|
533
|
+
this.m31 = m1.m31 + m2.m31;
|
534
|
+
this.m32 = m1.m32 + m2.m32;
|
535
|
+
this.m33 = m1.m33 + m2.m33;
|
536
|
+
}
|
537
|
+
|
538
|
+
/**
|
539
|
+
* Creates a new object of the same class as this object.
|
540
|
+
*
|
541
|
+
* @return a clone of this instance.
|
542
|
+
* @exception OutOfMemoryError
|
543
|
+
* if there is not enough memory.
|
544
|
+
* @see java.lang.Cloneable
|
545
|
+
* @since vecmath 1.3
|
546
|
+
*/
|
547
|
+
// public Object clone() {
|
548
|
+
// Matrix4f m1 = null;
|
549
|
+
// try {
|
550
|
+
// m1 = (Matrix4f) super.clone();
|
551
|
+
// } catch (CloneNotSupportedException e) {
|
552
|
+
// // this shouldn't happen, since we are Cloneable
|
553
|
+
// throw new InternalError();
|
554
|
+
// }
|
555
|
+
//
|
556
|
+
// return m1;
|
557
|
+
// }
|
558
|
+
|
559
|
+
/**
|
560
|
+
* Computes the determinate of this matrix.
|
561
|
+
*
|
562
|
+
* @return the determinate of the matrix
|
563
|
+
*/
|
564
|
+
public final float determinant() {
|
565
|
+
float det;
|
566
|
+
|
567
|
+
// cofactor exapainsion along first row
|
568
|
+
|
569
|
+
det = m00
|
570
|
+
* (m11 * m22 * m33 + m12 * m23 * m31 + m13 * m21 * m32 - m13
|
571
|
+
* m22 * m31 - m11 * m23 * m32 - m12 * m21 * m33);
|
572
|
+
det -= m01
|
573
|
+
* (m10 * m22 * m33 + m12 * m23 * m30 + m13 * m20 * m32 - m13
|
574
|
+
* m22 * m30 - m10 * m23 * m32 - m12 * m20 * m33);
|
575
|
+
det += m02
|
576
|
+
* (m10 * m21 * m33 + m11 * m23 * m30 + m13 * m20 * m31 - m13
|
577
|
+
* m21 * m30 - m10 * m23 * m31 - m11 * m20 * m33);
|
578
|
+
det -= m03
|
579
|
+
* (m10 * m21 * m32 + m11 * m22 * m30 + m12 * m20 * m31 - m12
|
580
|
+
* m21 * m30 - m10 * m22 * m31 - m11 * m20 * m32);
|
581
|
+
|
582
|
+
return (det);
|
583
|
+
}
|
584
|
+
|
585
|
+
/**
|
586
|
+
* Returns true if the L-infinite distance between this matrix and matrix m1
|
587
|
+
* is less than or equal to the epsilon parameter, otherwise returns false.
|
588
|
+
* The L-infinite distance is equal to MAX[i=0,1,2,3 ; j=0,1,2,3 ;
|
589
|
+
* abs(this.m(i,j) - m1.m(i,j)]
|
590
|
+
*
|
591
|
+
* @param m1
|
592
|
+
* the matrix to be compared to this matrix
|
593
|
+
* @param epsilon
|
594
|
+
* the threshold value
|
595
|
+
* @return
|
596
|
+
*/
|
597
|
+
public boolean epsilonEquals(Matrix4f m1, float epsilon) {
|
598
|
+
|
599
|
+
boolean status = true;
|
600
|
+
|
601
|
+
if (Math.abs(this.m00 - m1.m00) > epsilon) {
|
602
|
+
status = false;
|
603
|
+
}
|
604
|
+
if (Math.abs(this.m01 - m1.m01) > epsilon) {
|
605
|
+
status = false;
|
606
|
+
}
|
607
|
+
if (Math.abs(this.m02 - m1.m02) > epsilon) {
|
608
|
+
status = false;
|
609
|
+
}
|
610
|
+
if (Math.abs(this.m03 - m1.m03) > epsilon) {
|
611
|
+
status = false;
|
612
|
+
}
|
613
|
+
|
614
|
+
if (Math.abs(this.m10 - m1.m10) > epsilon) {
|
615
|
+
status = false;
|
616
|
+
}
|
617
|
+
if (Math.abs(this.m11 - m1.m11) > epsilon) {
|
618
|
+
status = false;
|
619
|
+
}
|
620
|
+
if (Math.abs(this.m12 - m1.m12) > epsilon) {
|
621
|
+
status = false;
|
622
|
+
}
|
623
|
+
if (Math.abs(this.m13 - m1.m13) > epsilon) {
|
624
|
+
status = false;
|
625
|
+
}
|
626
|
+
|
627
|
+
if (Math.abs(this.m20 - m1.m20) > epsilon) {
|
628
|
+
status = false;
|
629
|
+
}
|
630
|
+
if (Math.abs(this.m21 - m1.m21) > epsilon) {
|
631
|
+
status = false;
|
632
|
+
}
|
633
|
+
if (Math.abs(this.m22 - m1.m22) > epsilon) {
|
634
|
+
status = false;
|
635
|
+
}
|
636
|
+
if (Math.abs(this.m23 - m1.m23) > epsilon) {
|
637
|
+
status = false;
|
638
|
+
}
|
639
|
+
|
640
|
+
if (Math.abs(this.m30 - m1.m30) > epsilon) {
|
641
|
+
status = false;
|
642
|
+
}
|
643
|
+
if (Math.abs(this.m31 - m1.m31) > epsilon) {
|
644
|
+
status = false;
|
645
|
+
}
|
646
|
+
if (Math.abs(this.m32 - m1.m32) > epsilon) {
|
647
|
+
status = false;
|
648
|
+
}
|
649
|
+
if (Math.abs(this.m33 - m1.m33) > epsilon) {
|
650
|
+
status = false;
|
651
|
+
}
|
652
|
+
|
653
|
+
return (status);
|
654
|
+
|
655
|
+
}
|
656
|
+
|
657
|
+
/**
|
658
|
+
* Returns true if all of the data members of Matrix4f m1 are equal to the
|
659
|
+
* corresponding data members in this Matrix4f.
|
660
|
+
*
|
661
|
+
* @param m1
|
662
|
+
* the matrix with which the comparison is made.
|
663
|
+
* @return true or false
|
664
|
+
*/
|
665
|
+
public boolean equals(Matrix4f m1) {
|
666
|
+
try {
|
667
|
+
return (this.m00 == m1.m00 && this.m01 == m1.m01
|
668
|
+
&& this.m02 == m1.m02 && this.m03 == m1.m03
|
669
|
+
&& this.m10 == m1.m10 && this.m11 == m1.m11
|
670
|
+
&& this.m12 == m1.m12 && this.m13 == m1.m13
|
671
|
+
&& this.m20 == m1.m20 && this.m21 == m1.m21
|
672
|
+
&& this.m22 == m1.m22 && this.m23 == m1.m23
|
673
|
+
&& this.m30 == m1.m30 && this.m31 == m1.m31
|
674
|
+
&& this.m32 == m1.m32 && this.m33 == m1.m33);
|
675
|
+
} catch (NullPointerException e2) {
|
676
|
+
return false;
|
677
|
+
}
|
678
|
+
|
679
|
+
}
|
680
|
+
|
681
|
+
/**
|
682
|
+
* Returns true if the Object t1 is of type Matrix4f and all of the data
|
683
|
+
* members of t1 are equal to the corresponding data members in this
|
684
|
+
* Matrix4f.
|
685
|
+
*
|
686
|
+
* @param t1
|
687
|
+
* the matrix with which the comparison is made.
|
688
|
+
* @return true or false
|
689
|
+
*/
|
690
|
+
@Override
|
691
|
+
public boolean equals(Object t1) {
|
692
|
+
if (t1 instanceof Matrix4f) {
|
693
|
+
Matrix4f m2 = (Matrix4f) t1;
|
694
|
+
return (this.m00 == m2.m00 && this.m01 == m2.m01
|
695
|
+
&& this.m02 == m2.m02 && this.m03 == m2.m03
|
696
|
+
&& this.m10 == m2.m10 && this.m11 == m2.m11
|
697
|
+
&& this.m12 == m2.m12 && this.m13 == m2.m13
|
698
|
+
&& this.m20 == m2.m20 && this.m21 == m2.m21
|
699
|
+
&& this.m22 == m2.m22 && this.m23 == m2.m23
|
700
|
+
&& this.m30 == m2.m30 && this.m31 == m2.m31
|
701
|
+
&& this.m32 == m2.m32 && this.m33 == m2.m33);
|
702
|
+
}
|
703
|
+
return false;
|
704
|
+
}
|
705
|
+
|
706
|
+
/**
|
707
|
+
*
|
708
|
+
* @return
|
709
|
+
*/
|
710
|
+
@Override
|
711
|
+
public int hashCode() {
|
712
|
+
int hash = 3;
|
713
|
+
hash = 23 * hash + Float.floatToIntBits(this.m00);
|
714
|
+
hash = 23 * hash + Float.floatToIntBits(this.m01);
|
715
|
+
hash = 23 * hash + Float.floatToIntBits(this.m02);
|
716
|
+
hash = 23 * hash + Float.floatToIntBits(this.m03);
|
717
|
+
hash = 23 * hash + Float.floatToIntBits(this.m10);
|
718
|
+
hash = 23 * hash + Float.floatToIntBits(this.m11);
|
719
|
+
hash = 23 * hash + Float.floatToIntBits(this.m12);
|
720
|
+
hash = 23 * hash + Float.floatToIntBits(this.m13);
|
721
|
+
hash = 23 * hash + Float.floatToIntBits(this.m20);
|
722
|
+
hash = 23 * hash + Float.floatToIntBits(this.m21);
|
723
|
+
hash = 23 * hash + Float.floatToIntBits(this.m22);
|
724
|
+
hash = 23 * hash + Float.floatToIntBits(this.m23);
|
725
|
+
hash = 23 * hash + Float.floatToIntBits(this.m30);
|
726
|
+
hash = 23 * hash + Float.floatToIntBits(this.m31);
|
727
|
+
hash = 23 * hash + Float.floatToIntBits(this.m32);
|
728
|
+
hash = 23 * hash + Float.floatToIntBits(this.m33);
|
729
|
+
return hash;
|
730
|
+
}
|
731
|
+
|
732
|
+
/**
|
733
|
+
* Performs an SVD normalization of this matrix in order to acquire the
|
734
|
+
* normalized rotational component; the values are placed into the Matrix3d
|
735
|
+
* parameter.
|
736
|
+
*
|
737
|
+
* @param m1
|
738
|
+
* matrix into which the rotational component is placed
|
739
|
+
*/
|
740
|
+
public final void get(Matrix3d m1) {
|
741
|
+
|
742
|
+
double[] tmp_rot = new double[9]; // scratch matrix
|
743
|
+
double[] tmp_scale = new double[3]; // scratch matrix
|
744
|
+
|
745
|
+
getScaleRotate(tmp_scale, tmp_rot);
|
746
|
+
|
747
|
+
m1.m00 = tmp_rot[0];
|
748
|
+
m1.m01 = tmp_rot[1];
|
749
|
+
m1.m02 = tmp_rot[2];
|
750
|
+
|
751
|
+
m1.m10 = tmp_rot[3];
|
752
|
+
m1.m11 = tmp_rot[4];
|
753
|
+
m1.m12 = tmp_rot[5];
|
754
|
+
|
755
|
+
m1.m20 = tmp_rot[6];
|
756
|
+
m1.m21 = tmp_rot[7];
|
757
|
+
m1.m22 = tmp_rot[8];
|
758
|
+
|
759
|
+
}
|
760
|
+
|
761
|
+
/**
|
762
|
+
* Performs an SVD normalization of this matrix to calculate the rotation as
|
763
|
+
* a 3x3 matrix, the translation, and the scale. None of the matrix values
|
764
|
+
* are modified.
|
765
|
+
*
|
766
|
+
* @param m1
|
767
|
+
* the normalized matrix representing the rotation
|
768
|
+
* @param t1
|
769
|
+
* the translation component
|
770
|
+
* @return the scale component of this transform
|
771
|
+
*/
|
772
|
+
public final double get(Matrix3d m1, Vec3D t1) {
|
773
|
+
double[] tmp_rot = new double[9];
|
774
|
+
double[] tmp_scale = new double[3];
|
775
|
+
getScaleRotate(tmp_scale, tmp_rot);
|
776
|
+
|
777
|
+
m1.m00 = tmp_rot[0];
|
778
|
+
m1.m01 = tmp_rot[1];
|
779
|
+
m1.m02 = tmp_rot[2];
|
780
|
+
|
781
|
+
m1.m10 = tmp_rot[3];
|
782
|
+
m1.m11 = tmp_rot[4];
|
783
|
+
m1.m12 = tmp_rot[5];
|
784
|
+
|
785
|
+
m1.m20 = tmp_rot[6];
|
786
|
+
m1.m21 = tmp_rot[7];
|
787
|
+
m1.m22 = tmp_rot[8];
|
788
|
+
|
789
|
+
t1.x = m03;
|
790
|
+
t1.y = m13;
|
791
|
+
t1.z = m23;
|
792
|
+
|
793
|
+
return MathUtils.max(tmp_scale);
|
794
|
+
|
795
|
+
}
|
796
|
+
|
797
|
+
/**
|
798
|
+
* Performs an SVD normalization of this matrix in order to acquire the
|
799
|
+
* normalized rotational component; the values are placed into the Quat4f
|
800
|
+
* parameter.
|
801
|
+
*
|
802
|
+
* @param q1
|
803
|
+
* quaternion into which the rotation component is placed
|
804
|
+
*/
|
805
|
+
public final void get(Quaternion q1) {
|
806
|
+
double[] tmp_rot = new double[9]; // scratch matrix
|
807
|
+
double[] tmp_scale = new double[3]; // scratch matrix
|
808
|
+
getScaleRotate(tmp_scale, tmp_rot);
|
809
|
+
|
810
|
+
double ww;
|
811
|
+
|
812
|
+
ww = 0.25 * (1.0 + tmp_rot[0] + tmp_rot[4] + tmp_rot[8]);
|
813
|
+
if (!((ww < 0 ? -ww : ww) < 1.0e-30)) {
|
814
|
+
q1.w = (float) Math.sqrt(ww);
|
815
|
+
ww = 0.25 / q1.w;
|
816
|
+
q1.x = (float) ((tmp_rot[7] - tmp_rot[5]) * ww);
|
817
|
+
q1.y = (float) ((tmp_rot[2] - tmp_rot[6]) * ww);
|
818
|
+
q1.z = (float) ((tmp_rot[3] - tmp_rot[1]) * ww);
|
819
|
+
return;
|
820
|
+
}
|
821
|
+
|
822
|
+
q1.w = 0.0f;
|
823
|
+
ww = -0.5 * (tmp_rot[4] + tmp_rot[8]);
|
824
|
+
if (!((ww < 0 ? -ww : ww) < 1.0e-30)) {
|
825
|
+
q1.x = (float) Math.sqrt(ww);
|
826
|
+
ww = 0.5 / q1.x;
|
827
|
+
q1.y = (float) (tmp_rot[3] * ww);
|
828
|
+
q1.z = (float) (tmp_rot[6] * ww);
|
829
|
+
return;
|
830
|
+
}
|
831
|
+
|
832
|
+
q1.x = 0.0f;
|
833
|
+
ww = 0.5 * (1.0 - tmp_rot[8]);
|
834
|
+
if (!((ww < 0 ? -ww : ww) < 1.0e-30)) {
|
835
|
+
q1.y = (float) (Math.sqrt(ww));
|
836
|
+
q1.z = (float) (tmp_rot[7] / (2.0 * q1.y));
|
837
|
+
return;
|
838
|
+
}
|
839
|
+
|
840
|
+
q1.y = 0.0f;
|
841
|
+
q1.z = 1.0f;
|
842
|
+
|
843
|
+
}
|
844
|
+
|
845
|
+
/**
|
846
|
+
* Retrieves the translational components of this matrix.
|
847
|
+
*
|
848
|
+
* @param trans
|
849
|
+
* the vector that will receive the translational component
|
850
|
+
*/
|
851
|
+
public final void get(Vec3D trans) {
|
852
|
+
trans.x = m03;
|
853
|
+
trans.y = m13;
|
854
|
+
trans.z = m23;
|
855
|
+
}
|
856
|
+
|
857
|
+
/**
|
858
|
+
* Copies the matrix values in the specified column into the array
|
859
|
+
* parameter.
|
860
|
+
*
|
861
|
+
* @param column
|
862
|
+
* the matrix column
|
863
|
+
* @param v
|
864
|
+
* the array into which the matrix row values will be copied
|
865
|
+
*/
|
866
|
+
public final void getColumn(int column, float v[]) {
|
867
|
+
if (column == 0) {
|
868
|
+
v[0] = m00;
|
869
|
+
v[1] = m10;
|
870
|
+
v[2] = m20;
|
871
|
+
v[3] = m30;
|
872
|
+
} else if (column == 1) {
|
873
|
+
v[0] = m01;
|
874
|
+
v[1] = m11;
|
875
|
+
v[2] = m21;
|
876
|
+
v[3] = m31;
|
877
|
+
} else if (column == 2) {
|
878
|
+
v[0] = m02;
|
879
|
+
v[1] = m12;
|
880
|
+
v[2] = m22;
|
881
|
+
v[3] = m32;
|
882
|
+
} else if (column == 3) {
|
883
|
+
v[0] = m03;
|
884
|
+
v[1] = m13;
|
885
|
+
v[2] = m23;
|
886
|
+
v[3] = m33;
|
887
|
+
} else {
|
888
|
+
throw new ArrayIndexOutOfBoundsException();
|
889
|
+
}
|
890
|
+
|
891
|
+
}
|
892
|
+
|
893
|
+
/**
|
894
|
+
* Copies the matrix values in the specified column into the vector
|
895
|
+
* parameter.
|
896
|
+
*
|
897
|
+
* @param column
|
898
|
+
* the matrix column
|
899
|
+
* @param v
|
900
|
+
* the vector into which the matrix row values will be copied
|
901
|
+
*/
|
902
|
+
public final void getColumn(int column, Vec4D v) {
|
903
|
+
if (column == 0) {
|
904
|
+
v.x = m00;
|
905
|
+
v.y = m10;
|
906
|
+
v.z = m20;
|
907
|
+
v.w = m30;
|
908
|
+
} else if (column == 1) {
|
909
|
+
v.x = m01;
|
910
|
+
v.y = m11;
|
911
|
+
v.z = m21;
|
912
|
+
v.w = m31;
|
913
|
+
} else if (column == 2) {
|
914
|
+
v.x = m02;
|
915
|
+
v.y = m12;
|
916
|
+
v.z = m22;
|
917
|
+
v.w = m32;
|
918
|
+
} else if (column == 3) {
|
919
|
+
v.x = m03;
|
920
|
+
v.y = m13;
|
921
|
+
v.z = m23;
|
922
|
+
v.w = m33;
|
923
|
+
} else {
|
924
|
+
throw new ArrayIndexOutOfBoundsException();
|
925
|
+
}
|
926
|
+
|
927
|
+
}
|
928
|
+
|
929
|
+
/**
|
930
|
+
* Retrieves the value at the specified row and column of this matrix.
|
931
|
+
*
|
932
|
+
* @param row
|
933
|
+
* the row number to be retrieved (zero indexed)
|
934
|
+
* @param column
|
935
|
+
* the column number to be retrieved (zero indexed)
|
936
|
+
* @return the value at the indexed element
|
937
|
+
*/
|
938
|
+
public final float getElement(int row, int column) {
|
939
|
+
switch (row) {
|
940
|
+
case 0:
|
941
|
+
switch (column) {
|
942
|
+
case 0:
|
943
|
+
return (this.m00);
|
944
|
+
case 1:
|
945
|
+
return (this.m01);
|
946
|
+
case 2:
|
947
|
+
return (this.m02);
|
948
|
+
case 3:
|
949
|
+
return (this.m03);
|
950
|
+
default:
|
951
|
+
break;
|
952
|
+
}
|
953
|
+
break;
|
954
|
+
case 1:
|
955
|
+
switch (column) {
|
956
|
+
case 0:
|
957
|
+
return (this.m10);
|
958
|
+
case 1:
|
959
|
+
return (this.m11);
|
960
|
+
case 2:
|
961
|
+
return (this.m12);
|
962
|
+
case 3:
|
963
|
+
return (this.m13);
|
964
|
+
default:
|
965
|
+
break;
|
966
|
+
}
|
967
|
+
break;
|
968
|
+
|
969
|
+
case 2:
|
970
|
+
switch (column) {
|
971
|
+
case 0:
|
972
|
+
return (this.m20);
|
973
|
+
case 1:
|
974
|
+
return (this.m21);
|
975
|
+
case 2:
|
976
|
+
return (this.m22);
|
977
|
+
case 3:
|
978
|
+
return (this.m23);
|
979
|
+
default:
|
980
|
+
break;
|
981
|
+
}
|
982
|
+
break;
|
983
|
+
|
984
|
+
case 3:
|
985
|
+
switch (column) {
|
986
|
+
case 0:
|
987
|
+
return (this.m30);
|
988
|
+
case 1:
|
989
|
+
return (this.m31);
|
990
|
+
case 2:
|
991
|
+
return (this.m32);
|
992
|
+
case 3:
|
993
|
+
return (this.m33);
|
994
|
+
default:
|
995
|
+
break;
|
996
|
+
}
|
997
|
+
break;
|
998
|
+
|
999
|
+
default:
|
1000
|
+
break;
|
1001
|
+
}
|
1002
|
+
throw new ArrayIndexOutOfBoundsException();
|
1003
|
+
}
|
1004
|
+
|
1005
|
+
/**
|
1006
|
+
* Get the first matrix element in the first row.
|
1007
|
+
*
|
1008
|
+
* @return Returns the m00.
|
1009
|
+
*
|
1010
|
+
* @since vecmath 1.5
|
1011
|
+
*/
|
1012
|
+
public final float getM00() {
|
1013
|
+
return m00;
|
1014
|
+
}
|
1015
|
+
|
1016
|
+
/**
|
1017
|
+
* Get the second matrix element in the first row.
|
1018
|
+
*
|
1019
|
+
* @return Returns the m01.
|
1020
|
+
*
|
1021
|
+
* @since vecmath 1.5
|
1022
|
+
*/
|
1023
|
+
public final float getM01() {
|
1024
|
+
return m01;
|
1025
|
+
}
|
1026
|
+
|
1027
|
+
/**
|
1028
|
+
* Get the third matrix element in the first row.
|
1029
|
+
*
|
1030
|
+
* @return Returns the m02.
|
1031
|
+
*
|
1032
|
+
* @since vecmath 1.5
|
1033
|
+
*/
|
1034
|
+
public final float getM02() {
|
1035
|
+
return m02;
|
1036
|
+
}
|
1037
|
+
|
1038
|
+
/**
|
1039
|
+
* Get the fourth element of the first row.
|
1040
|
+
*
|
1041
|
+
* @return Returns the m03.
|
1042
|
+
*
|
1043
|
+
* @since vecmath 1.5
|
1044
|
+
*/
|
1045
|
+
public final float getM03() {
|
1046
|
+
return m03;
|
1047
|
+
}
|
1048
|
+
|
1049
|
+
/**
|
1050
|
+
* Get first matrix element in the second row.
|
1051
|
+
*
|
1052
|
+
* @return Returns the m10.
|
1053
|
+
*
|
1054
|
+
* @since vecmath 1.5
|
1055
|
+
*/
|
1056
|
+
public final float getM10() {
|
1057
|
+
return m10;
|
1058
|
+
}
|
1059
|
+
|
1060
|
+
/**
|
1061
|
+
* Get second matrix element in the second row.
|
1062
|
+
*
|
1063
|
+
* @return Returns the m11.
|
1064
|
+
*
|
1065
|
+
* @since vecmath 1.5
|
1066
|
+
*/
|
1067
|
+
public final float getM11() {
|
1068
|
+
return m11;
|
1069
|
+
}
|
1070
|
+
|
1071
|
+
/**
|
1072
|
+
* Get the third matrix element in the second row.
|
1073
|
+
*
|
1074
|
+
* @return Returns the m12.
|
1075
|
+
*
|
1076
|
+
* @since vecmath 1.5
|
1077
|
+
*/
|
1078
|
+
public final float getM12() {
|
1079
|
+
return m12;
|
1080
|
+
}
|
1081
|
+
|
1082
|
+
/**
|
1083
|
+
* Get the fourth element of the second row.
|
1084
|
+
*
|
1085
|
+
* @return Returns the m13.
|
1086
|
+
*
|
1087
|
+
* @since vecmath 1.5
|
1088
|
+
*/
|
1089
|
+
public final float getM13() {
|
1090
|
+
return m13;
|
1091
|
+
}
|
1092
|
+
|
1093
|
+
/**
|
1094
|
+
* Get the first matrix element in the third row.
|
1095
|
+
*
|
1096
|
+
* @return Returns the m20.
|
1097
|
+
*
|
1098
|
+
* @since vecmath 1.5
|
1099
|
+
*/
|
1100
|
+
public final float getM20() {
|
1101
|
+
return m20;
|
1102
|
+
}
|
1103
|
+
|
1104
|
+
/**
|
1105
|
+
* Get the second matrix element in the third row.
|
1106
|
+
*
|
1107
|
+
* @return Returns the m21.
|
1108
|
+
*
|
1109
|
+
* @since vecmath 1.5
|
1110
|
+
*/
|
1111
|
+
public final float getM21() {
|
1112
|
+
return m21;
|
1113
|
+
}
|
1114
|
+
|
1115
|
+
/**
|
1116
|
+
* Get the third matrix element in the third row.
|
1117
|
+
*
|
1118
|
+
* @return Returns the m22.
|
1119
|
+
*
|
1120
|
+
* @since vecmath 1.5
|
1121
|
+
*/
|
1122
|
+
public final float getM22() {
|
1123
|
+
return m22;
|
1124
|
+
}
|
1125
|
+
|
1126
|
+
/**
|
1127
|
+
* Get the fourth element of the third row.
|
1128
|
+
*
|
1129
|
+
* @return Returns the m23.
|
1130
|
+
*
|
1131
|
+
* @since vecmath 1.5
|
1132
|
+
*/
|
1133
|
+
public final float getM23() {
|
1134
|
+
return m23;
|
1135
|
+
}
|
1136
|
+
|
1137
|
+
/**
|
1138
|
+
* Get the first element of the fourth row.
|
1139
|
+
*
|
1140
|
+
* @return Returns the m30.
|
1141
|
+
*
|
1142
|
+
* @since vecmath 1.5
|
1143
|
+
*/
|
1144
|
+
public final float getM30() {
|
1145
|
+
return m30;
|
1146
|
+
}
|
1147
|
+
|
1148
|
+
/**
|
1149
|
+
* Get the second element of the fourth row.
|
1150
|
+
*
|
1151
|
+
* @return Returns the m31.
|
1152
|
+
*
|
1153
|
+
* @since vecmath 1.5
|
1154
|
+
*/
|
1155
|
+
public final float getM31() {
|
1156
|
+
return m31;
|
1157
|
+
}
|
1158
|
+
|
1159
|
+
/**
|
1160
|
+
* Get the third element of the fourth row.
|
1161
|
+
*
|
1162
|
+
* @return Returns the m32.
|
1163
|
+
*
|
1164
|
+
* @since vecmath 1.5
|
1165
|
+
*/
|
1166
|
+
public final float getM32() {
|
1167
|
+
return m32;
|
1168
|
+
}
|
1169
|
+
|
1170
|
+
/**
|
1171
|
+
* Get the fourth element of the fourth row.
|
1172
|
+
*
|
1173
|
+
* @return Returns the m33.
|
1174
|
+
*
|
1175
|
+
* @since vecmath 1.5
|
1176
|
+
*/
|
1177
|
+
public final float getM33() {
|
1178
|
+
return m33;
|
1179
|
+
}
|
1180
|
+
|
1181
|
+
/**
|
1182
|
+
* Gets the upper 3x3 values of this matrix and places them into the matrix
|
1183
|
+
* m1.
|
1184
|
+
*
|
1185
|
+
* @param m1
|
1186
|
+
* the matrix that will hold the values
|
1187
|
+
*/
|
1188
|
+
public final void getRotationScale(Matrix3d m1) {
|
1189
|
+
m1.m00 = m00;
|
1190
|
+
m1.m01 = m01;
|
1191
|
+
m1.m02 = m02;
|
1192
|
+
m1.m10 = m10;
|
1193
|
+
m1.m11 = m11;
|
1194
|
+
m1.m12 = m12;
|
1195
|
+
m1.m20 = m20;
|
1196
|
+
m1.m21 = m21;
|
1197
|
+
m1.m22 = m22;
|
1198
|
+
}
|
1199
|
+
|
1200
|
+
/**
|
1201
|
+
* Copies the matrix values in the specified row into the array parameter.
|
1202
|
+
*
|
1203
|
+
* @param row
|
1204
|
+
* the matrix row
|
1205
|
+
* @param v
|
1206
|
+
* the array into which the matrix row values will be copied
|
1207
|
+
*/
|
1208
|
+
public final void getRow(int row, float v[]) {
|
1209
|
+
if (row == 0) {
|
1210
|
+
v[0] = m00;
|
1211
|
+
v[1] = m01;
|
1212
|
+
v[2] = m02;
|
1213
|
+
v[3] = m03;
|
1214
|
+
} else if (row == 1) {
|
1215
|
+
v[0] = m10;
|
1216
|
+
v[1] = m11;
|
1217
|
+
v[2] = m12;
|
1218
|
+
v[3] = m13;
|
1219
|
+
} else if (row == 2) {
|
1220
|
+
v[0] = m20;
|
1221
|
+
v[1] = m21;
|
1222
|
+
v[2] = m22;
|
1223
|
+
v[3] = m23;
|
1224
|
+
} else if (row == 3) {
|
1225
|
+
v[0] = m30;
|
1226
|
+
v[1] = m31;
|
1227
|
+
v[2] = m32;
|
1228
|
+
v[3] = m33;
|
1229
|
+
} else {
|
1230
|
+
throw new ArrayIndexOutOfBoundsException();
|
1231
|
+
}
|
1232
|
+
|
1233
|
+
}
|
1234
|
+
|
1235
|
+
/**
|
1236
|
+
* Copies the matrix values in the specified row into the vector parameter.
|
1237
|
+
*
|
1238
|
+
* @param row
|
1239
|
+
* the matrix row
|
1240
|
+
* @param v
|
1241
|
+
* the vector into which the matrix row values will be copied
|
1242
|
+
*/
|
1243
|
+
public final void getRow(int row, Vec4D v) {
|
1244
|
+
if (row == 0) {
|
1245
|
+
v.x = m00;
|
1246
|
+
v.y = m01;
|
1247
|
+
v.z = m02;
|
1248
|
+
v.w = m03;
|
1249
|
+
} else if (row == 1) {
|
1250
|
+
v.x = m10;
|
1251
|
+
v.y = m11;
|
1252
|
+
v.z = m12;
|
1253
|
+
v.w = m13;
|
1254
|
+
} else if (row == 2) {
|
1255
|
+
v.x = m20;
|
1256
|
+
v.y = m21;
|
1257
|
+
v.z = m22;
|
1258
|
+
v.w = m23;
|
1259
|
+
} else if (row == 3) {
|
1260
|
+
v.x = m30;
|
1261
|
+
v.y = m31;
|
1262
|
+
v.z = m32;
|
1263
|
+
v.w = m33;
|
1264
|
+
} else {
|
1265
|
+
throw new ArrayIndexOutOfBoundsException();
|
1266
|
+
}
|
1267
|
+
|
1268
|
+
}
|
1269
|
+
|
1270
|
+
/**
|
1271
|
+
* Performs an SVD normalization of this matrix to calculate and return the
|
1272
|
+
* uniform scale factor. If the matrix has non-uniform scale factors, the
|
1273
|
+
* largest of the x, y, and z scale factors will be returned. This matrix is
|
1274
|
+
* not modified.
|
1275
|
+
*
|
1276
|
+
* @return the scale factor of this matrix
|
1277
|
+
*/
|
1278
|
+
public final float getScale() {
|
1279
|
+
double[] tmp_scale = new double[3];
|
1280
|
+
getScaleRotate(tmp_scale, new double[9]);
|
1281
|
+
return ((float) MathUtils.max(tmp_scale));
|
1282
|
+
}
|
1283
|
+
|
1284
|
+
private void getScaleRotate(double scales[], double rots[]) {
|
1285
|
+
|
1286
|
+
double[] tmp = new double[9]; // scratch matrix
|
1287
|
+
tmp[0] = m00;
|
1288
|
+
tmp[1] = m01;
|
1289
|
+
tmp[2] = m02;
|
1290
|
+
|
1291
|
+
tmp[3] = m10;
|
1292
|
+
tmp[4] = m11;
|
1293
|
+
tmp[5] = m12;
|
1294
|
+
|
1295
|
+
tmp[6] = m20;
|
1296
|
+
tmp[7] = m21;
|
1297
|
+
tmp[8] = m22;
|
1298
|
+
|
1299
|
+
Matrix3d.compute_svd(tmp, scales, rots);
|
1300
|
+
}
|
1301
|
+
|
1302
|
+
/**
|
1303
|
+
* Returns a hash code value based on the data values in this object. Two
|
1304
|
+
* different Matrix4f objects with identical data values (i.e.,
|
1305
|
+
* Matrix4f.equals returns true) will return the same hash code value. Two
|
1306
|
+
* objects with different data members may return the same hash value,
|
1307
|
+
* although this is not likely.
|
1308
|
+
*
|
1309
|
+
* @return the integer hash code value
|
1310
|
+
*/
|
1311
|
+
// @Override
|
1312
|
+
// public int hashCode() {
|
1313
|
+
// long bits = 1L;
|
1314
|
+
// bits = 31L * bits + VecMathUtil.floatToIntBits(m00);
|
1315
|
+
// bits = 31L * bits + VecMathUtil.floatToIntBits(m01);
|
1316
|
+
// bits = 31L * bits + VecMathUtil.floatToIntBits(m02);
|
1317
|
+
// bits = 31L * bits + VecMathUtil.floatToIntBits(m03);
|
1318
|
+
// bits = 31L * bits + VecMathUtil.floatToIntBits(m10);
|
1319
|
+
// bits = 31L * bits + VecMathUtil.floatToIntBits(m11);
|
1320
|
+
// bits = 31L * bits + VecMathUtil.floatToIntBits(m12);
|
1321
|
+
// bits = 31L * bits + VecMathUtil.floatToIntBits(m13);
|
1322
|
+
// bits = 31L * bits + VecMathUtil.floatToIntBits(m20);
|
1323
|
+
// bits = 31L * bits + VecMathUtil.floatToIntBits(m21);
|
1324
|
+
// bits = 31L * bits + VecMathUtil.floatToIntBits(m22);
|
1325
|
+
// bits = 31L * bits + VecMathUtil.floatToIntBits(m23);
|
1326
|
+
// bits = 31L * bits + VecMathUtil.floatToIntBits(m30);
|
1327
|
+
// bits = 31L * bits + VecMathUtil.floatToIntBits(m31);
|
1328
|
+
// bits = 31L * bits + VecMathUtil.floatToIntBits(m32);
|
1329
|
+
// bits = 31L * bits + VecMathUtil.floatToIntBits(m33);
|
1330
|
+
// return (int) (bits ^ (bits >> 32));
|
1331
|
+
// }
|
1332
|
+
|
1333
|
+
/**
|
1334
|
+
* Inverts this matrix in place.
|
1335
|
+
*/
|
1336
|
+
public final void invert() {
|
1337
|
+
invertGeneral(this);
|
1338
|
+
}
|
1339
|
+
|
1340
|
+
/**
|
1341
|
+
* Sets the value of this matrix to the matrix inverse of the passed (user
|
1342
|
+
* declared) matrix m1.
|
1343
|
+
*
|
1344
|
+
* @param m1
|
1345
|
+
* the matrix to be inverted
|
1346
|
+
*/
|
1347
|
+
public final void invert(Matrix4f m1) {
|
1348
|
+
|
1349
|
+
invertGeneral(m1);
|
1350
|
+
}
|
1351
|
+
|
1352
|
+
/**
|
1353
|
+
* General invert routine. Inverts m1 and places the result in "this". Note
|
1354
|
+
* that this routine handles both the "this" version and the non-"this"
|
1355
|
+
* version.
|
1356
|
+
*
|
1357
|
+
* Also note that since this routine is slow anyway, we won't worry about
|
1358
|
+
* allocating a little bit of garbage.
|
1359
|
+
*/
|
1360
|
+
final void invertGeneral(Matrix4f m1) {
|
1361
|
+
double temp[] = new double[16];
|
1362
|
+
double result[] = new double[16];
|
1363
|
+
int row_perm[] = new int[4];
|
1364
|
+
int i, r, c;
|
1365
|
+
|
1366
|
+
// Use LU decomposition and backsubstitution code specifically
|
1367
|
+
// for floating-point 4x4 matrices.
|
1368
|
+
|
1369
|
+
// Copy source matrix to t1tmp
|
1370
|
+
temp[0] = m1.m00;
|
1371
|
+
temp[1] = m1.m01;
|
1372
|
+
temp[2] = m1.m02;
|
1373
|
+
temp[3] = m1.m03;
|
1374
|
+
|
1375
|
+
temp[4] = m1.m10;
|
1376
|
+
temp[5] = m1.m11;
|
1377
|
+
temp[6] = m1.m12;
|
1378
|
+
temp[7] = m1.m13;
|
1379
|
+
|
1380
|
+
temp[8] = m1.m20;
|
1381
|
+
temp[9] = m1.m21;
|
1382
|
+
temp[10] = m1.m22;
|
1383
|
+
temp[11] = m1.m23;
|
1384
|
+
|
1385
|
+
temp[12] = m1.m30;
|
1386
|
+
temp[13] = m1.m31;
|
1387
|
+
temp[14] = m1.m32;
|
1388
|
+
temp[15] = m1.m33;
|
1389
|
+
|
1390
|
+
// Calculate LU decomposition: Is the matrix singular?
|
1391
|
+
if (!Matrix4x4.LUDecomposition(temp, row_perm, 4)) {
|
1392
|
+
// Matrix has no inverse
|
1393
|
+
throw new SingularMatrixException();
|
1394
|
+
}
|
1395
|
+
|
1396
|
+
// Perform back substitution on the identity matrix
|
1397
|
+
for (i = 0; i < 16; i++) {
|
1398
|
+
result[i] = 0.0;
|
1399
|
+
}
|
1400
|
+
result[0] = 1.0;
|
1401
|
+
result[5] = 1.0;
|
1402
|
+
result[10] = 1.0;
|
1403
|
+
result[15] = 1.0;
|
1404
|
+
luBacksubstitution(temp, row_perm, result);
|
1405
|
+
|
1406
|
+
this.m00 = (float) result[0];
|
1407
|
+
this.m01 = (float) result[1];
|
1408
|
+
this.m02 = (float) result[2];
|
1409
|
+
this.m03 = (float) result[3];
|
1410
|
+
|
1411
|
+
this.m10 = (float) result[4];
|
1412
|
+
this.m11 = (float) result[5];
|
1413
|
+
this.m12 = (float) result[6];
|
1414
|
+
this.m13 = (float) result[7];
|
1415
|
+
|
1416
|
+
this.m20 = (float) result[8];
|
1417
|
+
this.m21 = (float) result[9];
|
1418
|
+
this.m22 = (float) result[10];
|
1419
|
+
this.m23 = (float) result[11];
|
1420
|
+
|
1421
|
+
this.m30 = (float) result[12];
|
1422
|
+
this.m31 = (float) result[13];
|
1423
|
+
this.m32 = (float) result[14];
|
1424
|
+
this.m33 = (float) result[15];
|
1425
|
+
|
1426
|
+
}
|
1427
|
+
|
1428
|
+
/**
|
1429
|
+
* Multiplies each element of this matrix by a scalar.
|
1430
|
+
*
|
1431
|
+
* @param scalar
|
1432
|
+
* the scalar multiplier.
|
1433
|
+
*/
|
1434
|
+
public final void mul(float scalar) {
|
1435
|
+
m00 *= scalar;
|
1436
|
+
m01 *= scalar;
|
1437
|
+
m02 *= scalar;
|
1438
|
+
m03 *= scalar;
|
1439
|
+
m10 *= scalar;
|
1440
|
+
m11 *= scalar;
|
1441
|
+
m12 *= scalar;
|
1442
|
+
m13 *= scalar;
|
1443
|
+
m20 *= scalar;
|
1444
|
+
m21 *= scalar;
|
1445
|
+
m22 *= scalar;
|
1446
|
+
m23 *= scalar;
|
1447
|
+
m30 *= scalar;
|
1448
|
+
m31 *= scalar;
|
1449
|
+
m32 *= scalar;
|
1450
|
+
m33 *= scalar;
|
1451
|
+
}
|
1452
|
+
|
1453
|
+
/**
|
1454
|
+
* Multiplies each element of matrix m1 by a scalar and places the result
|
1455
|
+
* into this. Matrix m1 is not modified.
|
1456
|
+
*
|
1457
|
+
* @param scalar
|
1458
|
+
* the scalar multiplier.
|
1459
|
+
* @param m1
|
1460
|
+
* the original matrix.
|
1461
|
+
*/
|
1462
|
+
public final void mul(float scalar, Matrix4f m1) {
|
1463
|
+
this.m00 = m1.m00 * scalar;
|
1464
|
+
this.m01 = m1.m01 * scalar;
|
1465
|
+
this.m02 = m1.m02 * scalar;
|
1466
|
+
this.m03 = m1.m03 * scalar;
|
1467
|
+
this.m10 = m1.m10 * scalar;
|
1468
|
+
this.m11 = m1.m11 * scalar;
|
1469
|
+
this.m12 = m1.m12 * scalar;
|
1470
|
+
this.m13 = m1.m13 * scalar;
|
1471
|
+
this.m20 = m1.m20 * scalar;
|
1472
|
+
this.m21 = m1.m21 * scalar;
|
1473
|
+
this.m22 = m1.m22 * scalar;
|
1474
|
+
this.m23 = m1.m23 * scalar;
|
1475
|
+
this.m30 = m1.m30 * scalar;
|
1476
|
+
this.m31 = m1.m31 * scalar;
|
1477
|
+
this.m32 = m1.m32 * scalar;
|
1478
|
+
this.m33 = m1.m33 * scalar;
|
1479
|
+
}
|
1480
|
+
|
1481
|
+
/**
|
1482
|
+
* Sets the value of this matrix to the result of multiplying itself with
|
1483
|
+
* matrix m1.
|
1484
|
+
*
|
1485
|
+
* @param m1
|
1486
|
+
* the other matrix
|
1487
|
+
*/
|
1488
|
+
public final void mul(Matrix4f m1) {
|
1489
|
+
float mm00, mm01, mm02, mm03, mm10, mm11, mm12, mm13, mm20, mm21, mm22, mm23, mm30, mm31, mm32, mm33; // vars
|
1490
|
+
// for
|
1491
|
+
// temp
|
1492
|
+
// result
|
1493
|
+
// matrix
|
1494
|
+
|
1495
|
+
mm00 = this.m00 * m1.m00 + this.m01 * m1.m10 + this.m02 * m1.m20
|
1496
|
+
+ this.m03 * m1.m30;
|
1497
|
+
mm01 = this.m00 * m1.m01 + this.m01 * m1.m11 + this.m02 * m1.m21
|
1498
|
+
+ this.m03 * m1.m31;
|
1499
|
+
mm02 = this.m00 * m1.m02 + this.m01 * m1.m12 + this.m02 * m1.m22
|
1500
|
+
+ this.m03 * m1.m32;
|
1501
|
+
mm03 = this.m00 * m1.m03 + this.m01 * m1.m13 + this.m02 * m1.m23
|
1502
|
+
+ this.m03 * m1.m33;
|
1503
|
+
|
1504
|
+
mm10 = this.m10 * m1.m00 + this.m11 * m1.m10 + this.m12 * m1.m20
|
1505
|
+
+ this.m13 * m1.m30;
|
1506
|
+
mm11 = this.m10 * m1.m01 + this.m11 * m1.m11 + this.m12 * m1.m21
|
1507
|
+
+ this.m13 * m1.m31;
|
1508
|
+
mm12 = this.m10 * m1.m02 + this.m11 * m1.m12 + this.m12 * m1.m22
|
1509
|
+
+ this.m13 * m1.m32;
|
1510
|
+
mm13 = this.m10 * m1.m03 + this.m11 * m1.m13 + this.m12 * m1.m23
|
1511
|
+
+ this.m13 * m1.m33;
|
1512
|
+
|
1513
|
+
mm20 = this.m20 * m1.m00 + this.m21 * m1.m10 + this.m22 * m1.m20
|
1514
|
+
+ this.m23 * m1.m30;
|
1515
|
+
mm21 = this.m20 * m1.m01 + this.m21 * m1.m11 + this.m22 * m1.m21
|
1516
|
+
+ this.m23 * m1.m31;
|
1517
|
+
mm22 = this.m20 * m1.m02 + this.m21 * m1.m12 + this.m22 * m1.m22
|
1518
|
+
+ this.m23 * m1.m32;
|
1519
|
+
mm23 = this.m20 * m1.m03 + this.m21 * m1.m13 + this.m22 * m1.m23
|
1520
|
+
+ this.m23 * m1.m33;
|
1521
|
+
|
1522
|
+
mm30 = this.m30 * m1.m00 + this.m31 * m1.m10 + this.m32 * m1.m20
|
1523
|
+
+ this.m33 * m1.m30;
|
1524
|
+
mm31 = this.m30 * m1.m01 + this.m31 * m1.m11 + this.m32 * m1.m21
|
1525
|
+
+ this.m33 * m1.m31;
|
1526
|
+
mm32 = this.m30 * m1.m02 + this.m31 * m1.m12 + this.m32 * m1.m22
|
1527
|
+
+ this.m33 * m1.m32;
|
1528
|
+
mm33 = this.m30 * m1.m03 + this.m31 * m1.m13 + this.m32 * m1.m23
|
1529
|
+
+ this.m33 * m1.m33;
|
1530
|
+
|
1531
|
+
this.m00 = mm00;
|
1532
|
+
this.m01 = mm01;
|
1533
|
+
this.m02 = mm02;
|
1534
|
+
this.m03 = mm03;
|
1535
|
+
this.m10 = mm10;
|
1536
|
+
this.m11 = mm11;
|
1537
|
+
this.m12 = mm12;
|
1538
|
+
this.m13 = mm13;
|
1539
|
+
this.m20 = mm20;
|
1540
|
+
this.m21 = mm21;
|
1541
|
+
this.m22 = mm22;
|
1542
|
+
this.m23 = mm23;
|
1543
|
+
this.m30 = mm30;
|
1544
|
+
this.m31 = mm31;
|
1545
|
+
this.m32 = mm32;
|
1546
|
+
this.m33 = mm33;
|
1547
|
+
}
|
1548
|
+
|
1549
|
+
/**
|
1550
|
+
* Sets the value of this matrix to the result of multiplying the two
|
1551
|
+
* argument matrices together.
|
1552
|
+
*
|
1553
|
+
* @param m1
|
1554
|
+
* the first matrix
|
1555
|
+
* @param m2
|
1556
|
+
* the second matrix
|
1557
|
+
*/
|
1558
|
+
public final void mul(Matrix4f m1, Matrix4f m2) {
|
1559
|
+
if (this != m1 && this != m2) {
|
1560
|
+
|
1561
|
+
this.m00 = m1.m00 * m2.m00 + m1.m01 * m2.m10 + m1.m02 * m2.m20
|
1562
|
+
+ m1.m03 * m2.m30;
|
1563
|
+
this.m01 = m1.m00 * m2.m01 + m1.m01 * m2.m11 + m1.m02 * m2.m21
|
1564
|
+
+ m1.m03 * m2.m31;
|
1565
|
+
this.m02 = m1.m00 * m2.m02 + m1.m01 * m2.m12 + m1.m02 * m2.m22
|
1566
|
+
+ m1.m03 * m2.m32;
|
1567
|
+
this.m03 = m1.m00 * m2.m03 + m1.m01 * m2.m13 + m1.m02 * m2.m23
|
1568
|
+
+ m1.m03 * m2.m33;
|
1569
|
+
|
1570
|
+
this.m10 = m1.m10 * m2.m00 + m1.m11 * m2.m10 + m1.m12 * m2.m20
|
1571
|
+
+ m1.m13 * m2.m30;
|
1572
|
+
this.m11 = m1.m10 * m2.m01 + m1.m11 * m2.m11 + m1.m12 * m2.m21
|
1573
|
+
+ m1.m13 * m2.m31;
|
1574
|
+
this.m12 = m1.m10 * m2.m02 + m1.m11 * m2.m12 + m1.m12 * m2.m22
|
1575
|
+
+ m1.m13 * m2.m32;
|
1576
|
+
this.m13 = m1.m10 * m2.m03 + m1.m11 * m2.m13 + m1.m12 * m2.m23
|
1577
|
+
+ m1.m13 * m2.m33;
|
1578
|
+
|
1579
|
+
this.m20 = m1.m20 * m2.m00 + m1.m21 * m2.m10 + m1.m22 * m2.m20
|
1580
|
+
+ m1.m23 * m2.m30;
|
1581
|
+
this.m21 = m1.m20 * m2.m01 + m1.m21 * m2.m11 + m1.m22 * m2.m21
|
1582
|
+
+ m1.m23 * m2.m31;
|
1583
|
+
this.m22 = m1.m20 * m2.m02 + m1.m21 * m2.m12 + m1.m22 * m2.m22
|
1584
|
+
+ m1.m23 * m2.m32;
|
1585
|
+
this.m23 = m1.m20 * m2.m03 + m1.m21 * m2.m13 + m1.m22 * m2.m23
|
1586
|
+
+ m1.m23 * m2.m33;
|
1587
|
+
|
1588
|
+
this.m30 = m1.m30 * m2.m00 + m1.m31 * m2.m10 + m1.m32 * m2.m20
|
1589
|
+
+ m1.m33 * m2.m30;
|
1590
|
+
this.m31 = m1.m30 * m2.m01 + m1.m31 * m2.m11 + m1.m32 * m2.m21
|
1591
|
+
+ m1.m33 * m2.m31;
|
1592
|
+
this.m32 = m1.m30 * m2.m02 + m1.m31 * m2.m12 + m1.m32 * m2.m22
|
1593
|
+
+ m1.m33 * m2.m32;
|
1594
|
+
this.m33 = m1.m30 * m2.m03 + m1.m31 * m2.m13 + m1.m32 * m2.m23
|
1595
|
+
+ m1.m33 * m2.m33;
|
1596
|
+
} else {
|
1597
|
+
float mm00, mm01, mm02, mm03, mm10, mm11, mm12, mm13, mm20, mm21, mm22, mm23, mm30, mm31, mm32, mm33; // vars
|
1598
|
+
// for
|
1599
|
+
// temp
|
1600
|
+
// result
|
1601
|
+
// matrix
|
1602
|
+
mm00 = m1.m00 * m2.m00 + m1.m01 * m2.m10 + m1.m02 * m2.m20 + m1.m03
|
1603
|
+
* m2.m30;
|
1604
|
+
mm01 = m1.m00 * m2.m01 + m1.m01 * m2.m11 + m1.m02 * m2.m21 + m1.m03
|
1605
|
+
* m2.m31;
|
1606
|
+
mm02 = m1.m00 * m2.m02 + m1.m01 * m2.m12 + m1.m02 * m2.m22 + m1.m03
|
1607
|
+
* m2.m32;
|
1608
|
+
mm03 = m1.m00 * m2.m03 + m1.m01 * m2.m13 + m1.m02 * m2.m23 + m1.m03
|
1609
|
+
* m2.m33;
|
1610
|
+
|
1611
|
+
mm10 = m1.m10 * m2.m00 + m1.m11 * m2.m10 + m1.m12 * m2.m20 + m1.m13
|
1612
|
+
* m2.m30;
|
1613
|
+
mm11 = m1.m10 * m2.m01 + m1.m11 * m2.m11 + m1.m12 * m2.m21 + m1.m13
|
1614
|
+
* m2.m31;
|
1615
|
+
mm12 = m1.m10 * m2.m02 + m1.m11 * m2.m12 + m1.m12 * m2.m22 + m1.m13
|
1616
|
+
* m2.m32;
|
1617
|
+
mm13 = m1.m10 * m2.m03 + m1.m11 * m2.m13 + m1.m12 * m2.m23 + m1.m13
|
1618
|
+
* m2.m33;
|
1619
|
+
|
1620
|
+
mm20 = m1.m20 * m2.m00 + m1.m21 * m2.m10 + m1.m22 * m2.m20 + m1.m23
|
1621
|
+
* m2.m30;
|
1622
|
+
mm21 = m1.m20 * m2.m01 + m1.m21 * m2.m11 + m1.m22 * m2.m21 + m1.m23
|
1623
|
+
* m2.m31;
|
1624
|
+
mm22 = m1.m20 * m2.m02 + m1.m21 * m2.m12 + m1.m22 * m2.m22 + m1.m23
|
1625
|
+
* m2.m32;
|
1626
|
+
mm23 = m1.m20 * m2.m03 + m1.m21 * m2.m13 + m1.m22 * m2.m23 + m1.m23
|
1627
|
+
* m2.m33;
|
1628
|
+
|
1629
|
+
mm30 = m1.m30 * m2.m00 + m1.m31 * m2.m10 + m1.m32 * m2.m20 + m1.m33
|
1630
|
+
* m2.m30;
|
1631
|
+
mm31 = m1.m30 * m2.m01 + m1.m31 * m2.m11 + m1.m32 * m2.m21 + m1.m33
|
1632
|
+
* m2.m31;
|
1633
|
+
mm32 = m1.m30 * m2.m02 + m1.m31 * m2.m12 + m1.m32 * m2.m22 + m1.m33
|
1634
|
+
* m2.m32;
|
1635
|
+
mm33 = m1.m30 * m2.m03 + m1.m31 * m2.m13 + m1.m32 * m2.m23 + m1.m33
|
1636
|
+
* m2.m33;
|
1637
|
+
|
1638
|
+
this.m00 = mm00;
|
1639
|
+
this.m01 = mm01;
|
1640
|
+
this.m02 = mm02;
|
1641
|
+
this.m03 = mm03;
|
1642
|
+
this.m10 = mm10;
|
1643
|
+
this.m11 = mm11;
|
1644
|
+
this.m12 = mm12;
|
1645
|
+
this.m13 = mm13;
|
1646
|
+
this.m20 = mm20;
|
1647
|
+
this.m21 = mm21;
|
1648
|
+
this.m22 = mm22;
|
1649
|
+
this.m23 = mm23;
|
1650
|
+
this.m30 = mm30;
|
1651
|
+
this.m31 = mm31;
|
1652
|
+
this.m32 = mm32;
|
1653
|
+
this.m33 = mm33;
|
1654
|
+
}
|
1655
|
+
}
|
1656
|
+
|
1657
|
+
/**
|
1658
|
+
* Multiplies the transpose of matrix m1 times the transpose of matrix m2,
|
1659
|
+
* and places the result into this.
|
1660
|
+
*
|
1661
|
+
* @param m1
|
1662
|
+
* the matrix on the left hand side of the multiplication
|
1663
|
+
* @param m2
|
1664
|
+
* the matrix on the right hand side of the multiplication
|
1665
|
+
*/
|
1666
|
+
public final void mulTransposeBoth(Matrix4f m1, Matrix4f m2) {
|
1667
|
+
if (this != m1 && this != m2) {
|
1668
|
+
this.m00 = m1.m00 * m2.m00 + m1.m10 * m2.m01 + m1.m20 * m2.m02
|
1669
|
+
+ m1.m30 * m2.m03;
|
1670
|
+
this.m01 = m1.m00 * m2.m10 + m1.m10 * m2.m11 + m1.m20 * m2.m12
|
1671
|
+
+ m1.m30 * m2.m13;
|
1672
|
+
this.m02 = m1.m00 * m2.m20 + m1.m10 * m2.m21 + m1.m20 * m2.m22
|
1673
|
+
+ m1.m30 * m2.m23;
|
1674
|
+
this.m03 = m1.m00 * m2.m30 + m1.m10 * m2.m31 + m1.m20 * m2.m32
|
1675
|
+
+ m1.m30 * m2.m33;
|
1676
|
+
|
1677
|
+
this.m10 = m1.m01 * m2.m00 + m1.m11 * m2.m01 + m1.m21 * m2.m02
|
1678
|
+
+ m1.m31 * m2.m03;
|
1679
|
+
this.m11 = m1.m01 * m2.m10 + m1.m11 * m2.m11 + m1.m21 * m2.m12
|
1680
|
+
+ m1.m31 * m2.m13;
|
1681
|
+
this.m12 = m1.m01 * m2.m20 + m1.m11 * m2.m21 + m1.m21 * m2.m22
|
1682
|
+
+ m1.m31 * m2.m23;
|
1683
|
+
this.m13 = m1.m01 * m2.m30 + m1.m11 * m2.m31 + m1.m21 * m2.m32
|
1684
|
+
+ m1.m31 * m2.m33;
|
1685
|
+
|
1686
|
+
this.m20 = m1.m02 * m2.m00 + m1.m12 * m2.m01 + m1.m22 * m2.m02
|
1687
|
+
+ m1.m32 * m2.m03;
|
1688
|
+
this.m21 = m1.m02 * m2.m10 + m1.m12 * m2.m11 + m1.m22 * m2.m12
|
1689
|
+
+ m1.m32 * m2.m13;
|
1690
|
+
this.m22 = m1.m02 * m2.m20 + m1.m12 * m2.m21 + m1.m22 * m2.m22
|
1691
|
+
+ m1.m32 * m2.m23;
|
1692
|
+
this.m23 = m1.m02 * m2.m30 + m1.m12 * m2.m31 + m1.m22 * m2.m32
|
1693
|
+
+ m1.m32 * m2.m33;
|
1694
|
+
|
1695
|
+
this.m30 = m1.m03 * m2.m00 + m1.m13 * m2.m01 + m1.m23 * m2.m02
|
1696
|
+
+ m1.m33 * m2.m03;
|
1697
|
+
this.m31 = m1.m03 * m2.m10 + m1.m13 * m2.m11 + m1.m23 * m2.m12
|
1698
|
+
+ m1.m33 * m2.m13;
|
1699
|
+
this.m32 = m1.m03 * m2.m20 + m1.m13 * m2.m21 + m1.m23 * m2.m22
|
1700
|
+
+ m1.m33 * m2.m23;
|
1701
|
+
this.m33 = m1.m03 * m2.m30 + m1.m13 * m2.m31 + m1.m23 * m2.m32
|
1702
|
+
+ m1.m33 * m2.m33;
|
1703
|
+
} else {
|
1704
|
+
float mm00, mm01, mm02, mm03, mm10, mm11, mm12, mm13, mm20, mm21, mm22, mm23, // vars
|
1705
|
+
// for
|
1706
|
+
// temp
|
1707
|
+
// result
|
1708
|
+
// matrix
|
1709
|
+
mm30, mm31, mm32, mm33;
|
1710
|
+
|
1711
|
+
mm00 = m1.m00 * m2.m00 + m1.m10 * m2.m01 + m1.m20 * m2.m02 + m1.m30
|
1712
|
+
* m2.m03;
|
1713
|
+
mm01 = m1.m00 * m2.m10 + m1.m10 * m2.m11 + m1.m20 * m2.m12 + m1.m30
|
1714
|
+
* m2.m13;
|
1715
|
+
mm02 = m1.m00 * m2.m20 + m1.m10 * m2.m21 + m1.m20 * m2.m22 + m1.m30
|
1716
|
+
* m2.m23;
|
1717
|
+
mm03 = m1.m00 * m2.m30 + m1.m10 * m2.m31 + m1.m20 * m2.m32 + m1.m30
|
1718
|
+
* m2.m33;
|
1719
|
+
|
1720
|
+
mm10 = m1.m01 * m2.m00 + m1.m11 * m2.m01 + m1.m21 * m2.m02 + m1.m31
|
1721
|
+
* m2.m03;
|
1722
|
+
mm11 = m1.m01 * m2.m10 + m1.m11 * m2.m11 + m1.m21 * m2.m12 + m1.m31
|
1723
|
+
* m2.m13;
|
1724
|
+
mm12 = m1.m01 * m2.m20 + m1.m11 * m2.m21 + m1.m21 * m2.m22 + m1.m31
|
1725
|
+
* m2.m23;
|
1726
|
+
mm13 = m1.m01 * m2.m30 + m1.m11 * m2.m31 + m1.m21 * m2.m32 + m1.m31
|
1727
|
+
* m2.m33;
|
1728
|
+
|
1729
|
+
mm20 = m1.m02 * m2.m00 + m1.m12 * m2.m01 + m1.m22 * m2.m02 + m1.m32
|
1730
|
+
* m2.m03;
|
1731
|
+
mm21 = m1.m02 * m2.m10 + m1.m12 * m2.m11 + m1.m22 * m2.m12 + m1.m32
|
1732
|
+
* m2.m13;
|
1733
|
+
mm22 = m1.m02 * m2.m20 + m1.m12 * m2.m21 + m1.m22 * m2.m22 + m1.m32
|
1734
|
+
* m2.m23;
|
1735
|
+
mm23 = m1.m02 * m2.m30 + m1.m12 * m2.m31 + m1.m22 * m2.m32 + m1.m32
|
1736
|
+
* m2.m33;
|
1737
|
+
|
1738
|
+
mm30 = m1.m03 * m2.m00 + m1.m13 * m2.m01 + m1.m23 * m2.m02 + m1.m33
|
1739
|
+
* m2.m03;
|
1740
|
+
mm31 = m1.m03 * m2.m10 + m1.m13 * m2.m11 + m1.m23 * m2.m12 + m1.m33
|
1741
|
+
* m2.m13;
|
1742
|
+
mm32 = m1.m03 * m2.m20 + m1.m13 * m2.m21 + m1.m23 * m2.m22 + m1.m33
|
1743
|
+
* m2.m23;
|
1744
|
+
mm33 = m1.m03 * m2.m30 + m1.m13 * m2.m31 + m1.m23 * m2.m32 + m1.m33
|
1745
|
+
* m2.m33;
|
1746
|
+
|
1747
|
+
this.m00 = mm00;
|
1748
|
+
this.m01 = mm01;
|
1749
|
+
this.m02 = mm02;
|
1750
|
+
this.m03 = mm03;
|
1751
|
+
this.m10 = mm10;
|
1752
|
+
this.m11 = mm11;
|
1753
|
+
this.m12 = mm12;
|
1754
|
+
this.m13 = mm13;
|
1755
|
+
this.m20 = mm20;
|
1756
|
+
this.m21 = mm21;
|
1757
|
+
this.m22 = mm22;
|
1758
|
+
this.m23 = mm23;
|
1759
|
+
this.m30 = mm30;
|
1760
|
+
this.m31 = mm31;
|
1761
|
+
this.m32 = mm32;
|
1762
|
+
this.m33 = mm33;
|
1763
|
+
}
|
1764
|
+
|
1765
|
+
}
|
1766
|
+
|
1767
|
+
/**
|
1768
|
+
* Multiplies the transpose of matrix m1 times matrix m2, and places the
|
1769
|
+
* result into this.
|
1770
|
+
*
|
1771
|
+
* @param m1
|
1772
|
+
* the matrix on the left hand side of the multiplication
|
1773
|
+
* @param m2
|
1774
|
+
* the matrix on the right hand side of the multiplication
|
1775
|
+
*/
|
1776
|
+
public final void mulTransposeLeft(Matrix4f m1, Matrix4f m2) {
|
1777
|
+
if (this != m1 && this != m2) {
|
1778
|
+
this.m00 = m1.m00 * m2.m00 + m1.m10 * m2.m10 + m1.m20 * m2.m20
|
1779
|
+
+ m1.m30 * m2.m30;
|
1780
|
+
this.m01 = m1.m00 * m2.m01 + m1.m10 * m2.m11 + m1.m20 * m2.m21
|
1781
|
+
+ m1.m30 * m2.m31;
|
1782
|
+
this.m02 = m1.m00 * m2.m02 + m1.m10 * m2.m12 + m1.m20 * m2.m22
|
1783
|
+
+ m1.m30 * m2.m32;
|
1784
|
+
this.m03 = m1.m00 * m2.m03 + m1.m10 * m2.m13 + m1.m20 * m2.m23
|
1785
|
+
+ m1.m30 * m2.m33;
|
1786
|
+
|
1787
|
+
this.m10 = m1.m01 * m2.m00 + m1.m11 * m2.m10 + m1.m21 * m2.m20
|
1788
|
+
+ m1.m31 * m2.m30;
|
1789
|
+
this.m11 = m1.m01 * m2.m01 + m1.m11 * m2.m11 + m1.m21 * m2.m21
|
1790
|
+
+ m1.m31 * m2.m31;
|
1791
|
+
this.m12 = m1.m01 * m2.m02 + m1.m11 * m2.m12 + m1.m21 * m2.m22
|
1792
|
+
+ m1.m31 * m2.m32;
|
1793
|
+
this.m13 = m1.m01 * m2.m03 + m1.m11 * m2.m13 + m1.m21 * m2.m23
|
1794
|
+
+ m1.m31 * m2.m33;
|
1795
|
+
|
1796
|
+
this.m20 = m1.m02 * m2.m00 + m1.m12 * m2.m10 + m1.m22 * m2.m20
|
1797
|
+
+ m1.m32 * m2.m30;
|
1798
|
+
this.m21 = m1.m02 * m2.m01 + m1.m12 * m2.m11 + m1.m22 * m2.m21
|
1799
|
+
+ m1.m32 * m2.m31;
|
1800
|
+
this.m22 = m1.m02 * m2.m02 + m1.m12 * m2.m12 + m1.m22 * m2.m22
|
1801
|
+
+ m1.m32 * m2.m32;
|
1802
|
+
this.m23 = m1.m02 * m2.m03 + m1.m12 * m2.m13 + m1.m22 * m2.m23
|
1803
|
+
+ m1.m32 * m2.m33;
|
1804
|
+
|
1805
|
+
this.m30 = m1.m03 * m2.m00 + m1.m13 * m2.m10 + m1.m23 * m2.m20
|
1806
|
+
+ m1.m33 * m2.m30;
|
1807
|
+
this.m31 = m1.m03 * m2.m01 + m1.m13 * m2.m11 + m1.m23 * m2.m21
|
1808
|
+
+ m1.m33 * m2.m31;
|
1809
|
+
this.m32 = m1.m03 * m2.m02 + m1.m13 * m2.m12 + m1.m23 * m2.m22
|
1810
|
+
+ m1.m33 * m2.m32;
|
1811
|
+
this.m33 = m1.m03 * m2.m03 + m1.m13 * m2.m13 + m1.m23 * m2.m23
|
1812
|
+
+ m1.m33 * m2.m33;
|
1813
|
+
} else {
|
1814
|
+
float mm00, mm01, mm02, mm03, mm10, mm11, mm12, mm13, mm20, mm21, mm22, mm23, // vars
|
1815
|
+
// for
|
1816
|
+
// temp
|
1817
|
+
// result
|
1818
|
+
// matrix
|
1819
|
+
mm30, mm31, mm32, mm33;
|
1820
|
+
|
1821
|
+
mm00 = m1.m00 * m2.m00 + m1.m10 * m2.m10 + m1.m20 * m2.m20 + m1.m30
|
1822
|
+
* m2.m30;
|
1823
|
+
mm01 = m1.m00 * m2.m01 + m1.m10 * m2.m11 + m1.m20 * m2.m21 + m1.m30
|
1824
|
+
* m2.m31;
|
1825
|
+
mm02 = m1.m00 * m2.m02 + m1.m10 * m2.m12 + m1.m20 * m2.m22 + m1.m30
|
1826
|
+
* m2.m32;
|
1827
|
+
mm03 = m1.m00 * m2.m03 + m1.m10 * m2.m13 + m1.m20 * m2.m23 + m1.m30
|
1828
|
+
* m2.m33;
|
1829
|
+
|
1830
|
+
mm10 = m1.m01 * m2.m00 + m1.m11 * m2.m10 + m1.m21 * m2.m20 + m1.m31
|
1831
|
+
* m2.m30;
|
1832
|
+
mm11 = m1.m01 * m2.m01 + m1.m11 * m2.m11 + m1.m21 * m2.m21 + m1.m31
|
1833
|
+
* m2.m31;
|
1834
|
+
mm12 = m1.m01 * m2.m02 + m1.m11 * m2.m12 + m1.m21 * m2.m22 + m1.m31
|
1835
|
+
* m2.m32;
|
1836
|
+
mm13 = m1.m01 * m2.m03 + m1.m11 * m2.m13 + m1.m21 * m2.m23 + m1.m31
|
1837
|
+
* m2.m33;
|
1838
|
+
|
1839
|
+
mm20 = m1.m02 * m2.m00 + m1.m12 * m2.m10 + m1.m22 * m2.m20 + m1.m32
|
1840
|
+
* m2.m30;
|
1841
|
+
mm21 = m1.m02 * m2.m01 + m1.m12 * m2.m11 + m1.m22 * m2.m21 + m1.m32
|
1842
|
+
* m2.m31;
|
1843
|
+
mm22 = m1.m02 * m2.m02 + m1.m12 * m2.m12 + m1.m22 * m2.m22 + m1.m32
|
1844
|
+
* m2.m32;
|
1845
|
+
mm23 = m1.m02 * m2.m03 + m1.m12 * m2.m13 + m1.m22 * m2.m23 + m1.m32
|
1846
|
+
* m2.m33;
|
1847
|
+
|
1848
|
+
mm30 = m1.m03 * m2.m00 + m1.m13 * m2.m10 + m1.m23 * m2.m20 + m1.m33
|
1849
|
+
* m2.m30;
|
1850
|
+
mm31 = m1.m03 * m2.m01 + m1.m13 * m2.m11 + m1.m23 * m2.m21 + m1.m33
|
1851
|
+
* m2.m31;
|
1852
|
+
mm32 = m1.m03 * m2.m02 + m1.m13 * m2.m12 + m1.m23 * m2.m22 + m1.m33
|
1853
|
+
* m2.m32;
|
1854
|
+
mm33 = m1.m03 * m2.m03 + m1.m13 * m2.m13 + m1.m23 * m2.m23 + m1.m33
|
1855
|
+
* m2.m33;
|
1856
|
+
|
1857
|
+
this.m00 = mm00;
|
1858
|
+
this.m01 = mm01;
|
1859
|
+
this.m02 = mm02;
|
1860
|
+
this.m03 = mm03;
|
1861
|
+
this.m10 = mm10;
|
1862
|
+
this.m11 = mm11;
|
1863
|
+
this.m12 = mm12;
|
1864
|
+
this.m13 = mm13;
|
1865
|
+
this.m20 = mm20;
|
1866
|
+
this.m21 = mm21;
|
1867
|
+
this.m22 = mm22;
|
1868
|
+
this.m23 = mm23;
|
1869
|
+
this.m30 = mm30;
|
1870
|
+
this.m31 = mm31;
|
1871
|
+
this.m32 = mm32;
|
1872
|
+
this.m33 = mm33;
|
1873
|
+
}
|
1874
|
+
|
1875
|
+
}
|
1876
|
+
|
1877
|
+
/**
|
1878
|
+
* Multiplies matrix m1 times the transpose of matrix m2, and places the
|
1879
|
+
* result into this.
|
1880
|
+
*
|
1881
|
+
* @param m1
|
1882
|
+
* the matrix on the left hand side of the multiplication
|
1883
|
+
* @param m2
|
1884
|
+
* the matrix on the right hand side of the multiplication
|
1885
|
+
*/
|
1886
|
+
public final void mulTransposeRight(Matrix4f m1, Matrix4f m2) {
|
1887
|
+
if (this != m1 && this != m2) {
|
1888
|
+
this.m00 = m1.m00 * m2.m00 + m1.m01 * m2.m01 + m1.m02 * m2.m02
|
1889
|
+
+ m1.m03 * m2.m03;
|
1890
|
+
this.m01 = m1.m00 * m2.m10 + m1.m01 * m2.m11 + m1.m02 * m2.m12
|
1891
|
+
+ m1.m03 * m2.m13;
|
1892
|
+
this.m02 = m1.m00 * m2.m20 + m1.m01 * m2.m21 + m1.m02 * m2.m22
|
1893
|
+
+ m1.m03 * m2.m23;
|
1894
|
+
this.m03 = m1.m00 * m2.m30 + m1.m01 * m2.m31 + m1.m02 * m2.m32
|
1895
|
+
+ m1.m03 * m2.m33;
|
1896
|
+
|
1897
|
+
this.m10 = m1.m10 * m2.m00 + m1.m11 * m2.m01 + m1.m12 * m2.m02
|
1898
|
+
+ m1.m13 * m2.m03;
|
1899
|
+
this.m11 = m1.m10 * m2.m10 + m1.m11 * m2.m11 + m1.m12 * m2.m12
|
1900
|
+
+ m1.m13 * m2.m13;
|
1901
|
+
this.m12 = m1.m10 * m2.m20 + m1.m11 * m2.m21 + m1.m12 * m2.m22
|
1902
|
+
+ m1.m13 * m2.m23;
|
1903
|
+
this.m13 = m1.m10 * m2.m30 + m1.m11 * m2.m31 + m1.m12 * m2.m32
|
1904
|
+
+ m1.m13 * m2.m33;
|
1905
|
+
|
1906
|
+
this.m20 = m1.m20 * m2.m00 + m1.m21 * m2.m01 + m1.m22 * m2.m02
|
1907
|
+
+ m1.m23 * m2.m03;
|
1908
|
+
this.m21 = m1.m20 * m2.m10 + m1.m21 * m2.m11 + m1.m22 * m2.m12
|
1909
|
+
+ m1.m23 * m2.m13;
|
1910
|
+
this.m22 = m1.m20 * m2.m20 + m1.m21 * m2.m21 + m1.m22 * m2.m22
|
1911
|
+
+ m1.m23 * m2.m23;
|
1912
|
+
this.m23 = m1.m20 * m2.m30 + m1.m21 * m2.m31 + m1.m22 * m2.m32
|
1913
|
+
+ m1.m23 * m2.m33;
|
1914
|
+
|
1915
|
+
this.m30 = m1.m30 * m2.m00 + m1.m31 * m2.m01 + m1.m32 * m2.m02
|
1916
|
+
+ m1.m33 * m2.m03;
|
1917
|
+
this.m31 = m1.m30 * m2.m10 + m1.m31 * m2.m11 + m1.m32 * m2.m12
|
1918
|
+
+ m1.m33 * m2.m13;
|
1919
|
+
this.m32 = m1.m30 * m2.m20 + m1.m31 * m2.m21 + m1.m32 * m2.m22
|
1920
|
+
+ m1.m33 * m2.m23;
|
1921
|
+
this.m33 = m1.m30 * m2.m30 + m1.m31 * m2.m31 + m1.m32 * m2.m32
|
1922
|
+
+ m1.m33 * m2.m33;
|
1923
|
+
} else {
|
1924
|
+
float mm00, mm01, mm02, mm03, mm10, mm11, mm12, mm13, mm20, mm21, mm22, mm23, // vars
|
1925
|
+
// for
|
1926
|
+
// temp
|
1927
|
+
// result
|
1928
|
+
// matrix
|
1929
|
+
mm30, mm31, mm32, mm33;
|
1930
|
+
|
1931
|
+
mm00 = m1.m00 * m2.m00 + m1.m01 * m2.m01 + m1.m02 * m2.m02 + m1.m03
|
1932
|
+
* m2.m03;
|
1933
|
+
mm01 = m1.m00 * m2.m10 + m1.m01 * m2.m11 + m1.m02 * m2.m12 + m1.m03
|
1934
|
+
* m2.m13;
|
1935
|
+
mm02 = m1.m00 * m2.m20 + m1.m01 * m2.m21 + m1.m02 * m2.m22 + m1.m03
|
1936
|
+
* m2.m23;
|
1937
|
+
mm03 = m1.m00 * m2.m30 + m1.m01 * m2.m31 + m1.m02 * m2.m32 + m1.m03
|
1938
|
+
* m2.m33;
|
1939
|
+
|
1940
|
+
mm10 = m1.m10 * m2.m00 + m1.m11 * m2.m01 + m1.m12 * m2.m02 + m1.m13
|
1941
|
+
* m2.m03;
|
1942
|
+
mm11 = m1.m10 * m2.m10 + m1.m11 * m2.m11 + m1.m12 * m2.m12 + m1.m13
|
1943
|
+
* m2.m13;
|
1944
|
+
mm12 = m1.m10 * m2.m20 + m1.m11 * m2.m21 + m1.m12 * m2.m22 + m1.m13
|
1945
|
+
* m2.m23;
|
1946
|
+
mm13 = m1.m10 * m2.m30 + m1.m11 * m2.m31 + m1.m12 * m2.m32 + m1.m13
|
1947
|
+
* m2.m33;
|
1948
|
+
|
1949
|
+
mm20 = m1.m20 * m2.m00 + m1.m21 * m2.m01 + m1.m22 * m2.m02 + m1.m23
|
1950
|
+
* m2.m03;
|
1951
|
+
mm21 = m1.m20 * m2.m10 + m1.m21 * m2.m11 + m1.m22 * m2.m12 + m1.m23
|
1952
|
+
* m2.m13;
|
1953
|
+
mm22 = m1.m20 * m2.m20 + m1.m21 * m2.m21 + m1.m22 * m2.m22 + m1.m23
|
1954
|
+
* m2.m23;
|
1955
|
+
mm23 = m1.m20 * m2.m30 + m1.m21 * m2.m31 + m1.m22 * m2.m32 + m1.m23
|
1956
|
+
* m2.m33;
|
1957
|
+
|
1958
|
+
mm30 = m1.m30 * m2.m00 + m1.m31 * m2.m01 + m1.m32 * m2.m02 + m1.m33
|
1959
|
+
* m2.m03;
|
1960
|
+
mm31 = m1.m30 * m2.m10 + m1.m31 * m2.m11 + m1.m32 * m2.m12 + m1.m33
|
1961
|
+
* m2.m13;
|
1962
|
+
mm32 = m1.m30 * m2.m20 + m1.m31 * m2.m21 + m1.m32 * m2.m22 + m1.m33
|
1963
|
+
* m2.m23;
|
1964
|
+
mm33 = m1.m30 * m2.m30 + m1.m31 * m2.m31 + m1.m32 * m2.m32 + m1.m33
|
1965
|
+
* m2.m33;
|
1966
|
+
|
1967
|
+
this.m00 = mm00;
|
1968
|
+
this.m01 = mm01;
|
1969
|
+
this.m02 = mm02;
|
1970
|
+
this.m03 = mm03;
|
1971
|
+
this.m10 = mm10;
|
1972
|
+
this.m11 = mm11;
|
1973
|
+
this.m12 = mm12;
|
1974
|
+
this.m13 = mm13;
|
1975
|
+
this.m20 = mm20;
|
1976
|
+
this.m21 = mm21;
|
1977
|
+
this.m22 = mm22;
|
1978
|
+
this.m23 = mm23;
|
1979
|
+
this.m30 = mm30;
|
1980
|
+
this.m31 = mm31;
|
1981
|
+
this.m32 = mm32;
|
1982
|
+
this.m33 = mm33;
|
1983
|
+
}
|
1984
|
+
|
1985
|
+
}
|
1986
|
+
|
1987
|
+
/**
|
1988
|
+
* Negates the value of this matrix: this = -this.
|
1989
|
+
*/
|
1990
|
+
public final void negate() {
|
1991
|
+
m00 = -m00;
|
1992
|
+
m01 = -m01;
|
1993
|
+
m02 = -m02;
|
1994
|
+
m03 = -m03;
|
1995
|
+
m10 = -m10;
|
1996
|
+
m11 = -m11;
|
1997
|
+
m12 = -m12;
|
1998
|
+
m13 = -m13;
|
1999
|
+
m20 = -m20;
|
2000
|
+
m21 = -m21;
|
2001
|
+
m22 = -m22;
|
2002
|
+
m23 = -m23;
|
2003
|
+
m30 = -m30;
|
2004
|
+
m31 = -m31;
|
2005
|
+
m32 = -m32;
|
2006
|
+
m33 = -m33;
|
2007
|
+
}
|
2008
|
+
|
2009
|
+
/**
|
2010
|
+
* Sets the value of this matrix equal to the negation of of the Matrix4f
|
2011
|
+
* parameter.
|
2012
|
+
*
|
2013
|
+
* @param m1
|
2014
|
+
* the source matrix
|
2015
|
+
*/
|
2016
|
+
public final void negate(Matrix4f m1) {
|
2017
|
+
this.m00 = -m1.m00;
|
2018
|
+
this.m01 = -m1.m01;
|
2019
|
+
this.m02 = -m1.m02;
|
2020
|
+
this.m03 = -m1.m03;
|
2021
|
+
this.m10 = -m1.m10;
|
2022
|
+
this.m11 = -m1.m11;
|
2023
|
+
this.m12 = -m1.m12;
|
2024
|
+
this.m13 = -m1.m13;
|
2025
|
+
this.m20 = -m1.m20;
|
2026
|
+
this.m21 = -m1.m21;
|
2027
|
+
this.m22 = -m1.m22;
|
2028
|
+
this.m23 = -m1.m23;
|
2029
|
+
this.m30 = -m1.m30;
|
2030
|
+
this.m31 = -m1.m31;
|
2031
|
+
this.m32 = -m1.m32;
|
2032
|
+
this.m33 = -m1.m33;
|
2033
|
+
}
|
2034
|
+
|
2035
|
+
/**
|
2036
|
+
* Sets the value of this matrix to a counter clockwise rotation about the x
|
2037
|
+
* axis.
|
2038
|
+
*
|
2039
|
+
* @param angle
|
2040
|
+
* the angle to rotate about the X axis in radians
|
2041
|
+
*/
|
2042
|
+
public final void rotX(float angle) {
|
2043
|
+
float sinAngle, cosAngle;
|
2044
|
+
|
2045
|
+
sinAngle = (float) Math.sin(angle);
|
2046
|
+
cosAngle = (float) Math.cos(angle);
|
2047
|
+
|
2048
|
+
this.m00 = (float) 1.0;
|
2049
|
+
this.m01 = (float) 0.0;
|
2050
|
+
this.m02 = (float) 0.0;
|
2051
|
+
this.m03 = (float) 0.0;
|
2052
|
+
|
2053
|
+
this.m10 = (float) 0.0;
|
2054
|
+
this.m11 = cosAngle;
|
2055
|
+
this.m12 = -sinAngle;
|
2056
|
+
this.m13 = (float) 0.0;
|
2057
|
+
|
2058
|
+
this.m20 = (float) 0.0;
|
2059
|
+
this.m21 = sinAngle;
|
2060
|
+
this.m22 = cosAngle;
|
2061
|
+
this.m23 = (float) 0.0;
|
2062
|
+
|
2063
|
+
this.m30 = (float) 0.0;
|
2064
|
+
this.m31 = (float) 0.0;
|
2065
|
+
this.m32 = (float) 0.0;
|
2066
|
+
this.m33 = (float) 1.0;
|
2067
|
+
}
|
2068
|
+
|
2069
|
+
/**
|
2070
|
+
* Sets the value of this matrix to a counter clockwise rotation about the y
|
2071
|
+
* axis.
|
2072
|
+
*
|
2073
|
+
* @param angle
|
2074
|
+
* the angle to rotate about the Y axis in radians
|
2075
|
+
*/
|
2076
|
+
public final void rotY(float angle) {
|
2077
|
+
float sinAngle, cosAngle;
|
2078
|
+
|
2079
|
+
sinAngle = (float) Math.sin(angle);
|
2080
|
+
cosAngle = (float) Math.cos(angle);
|
2081
|
+
|
2082
|
+
this.m00 = cosAngle;
|
2083
|
+
this.m01 = (float) 0.0;
|
2084
|
+
this.m02 = sinAngle;
|
2085
|
+
this.m03 = (float) 0.0;
|
2086
|
+
|
2087
|
+
this.m10 = (float) 0.0;
|
2088
|
+
this.m11 = (float) 1.0;
|
2089
|
+
this.m12 = (float) 0.0;
|
2090
|
+
this.m13 = (float) 0.0;
|
2091
|
+
|
2092
|
+
this.m20 = -sinAngle;
|
2093
|
+
this.m21 = (float) 0.0;
|
2094
|
+
this.m22 = cosAngle;
|
2095
|
+
this.m23 = (float) 0.0;
|
2096
|
+
|
2097
|
+
this.m30 = (float) 0.0;
|
2098
|
+
this.m31 = (float) 0.0;
|
2099
|
+
this.m32 = (float) 0.0;
|
2100
|
+
this.m33 = (float) 1.0;
|
2101
|
+
}
|
2102
|
+
|
2103
|
+
/**
|
2104
|
+
* Sets the value of this matrix to a counter clockwise rotation about the z
|
2105
|
+
* axis.
|
2106
|
+
*
|
2107
|
+
* @param angle
|
2108
|
+
* the angle to rotate about the Z axis in radians
|
2109
|
+
*/
|
2110
|
+
public final void rotZ(float angle) {
|
2111
|
+
float sinAngle, cosAngle;
|
2112
|
+
|
2113
|
+
sinAngle = (float) Math.sin(angle);
|
2114
|
+
cosAngle = (float) Math.cos(angle);
|
2115
|
+
|
2116
|
+
this.m00 = cosAngle;
|
2117
|
+
this.m01 = -sinAngle;
|
2118
|
+
this.m02 = (float) 0.0;
|
2119
|
+
this.m03 = (float) 0.0;
|
2120
|
+
|
2121
|
+
this.m10 = sinAngle;
|
2122
|
+
this.m11 = cosAngle;
|
2123
|
+
this.m12 = (float) 0.0;
|
2124
|
+
this.m13 = (float) 0.0;
|
2125
|
+
|
2126
|
+
this.m20 = (float) 0.0;
|
2127
|
+
this.m21 = (float) 0.0;
|
2128
|
+
this.m22 = (float) 1.0;
|
2129
|
+
this.m23 = (float) 0.0;
|
2130
|
+
|
2131
|
+
this.m30 = (float) 0.0;
|
2132
|
+
this.m31 = (float) 0.0;
|
2133
|
+
this.m32 = (float) 0.0;
|
2134
|
+
this.m33 = (float) 1.0;
|
2135
|
+
}
|
2136
|
+
|
2137
|
+
/**
|
2138
|
+
* Sets the value of this matrix to a scale matrix with the the passed scale
|
2139
|
+
* amount.
|
2140
|
+
*
|
2141
|
+
* @param scale
|
2142
|
+
* the scale factor for the matrix
|
2143
|
+
*/
|
2144
|
+
public final void set(float scale) {
|
2145
|
+
this.m00 = scale;
|
2146
|
+
this.m01 = (float) 0.0;
|
2147
|
+
this.m02 = (float) 0.0;
|
2148
|
+
this.m03 = (float) 0.0;
|
2149
|
+
|
2150
|
+
this.m10 = (float) 0.0;
|
2151
|
+
this.m11 = scale;
|
2152
|
+
this.m12 = (float) 0.0;
|
2153
|
+
this.m13 = (float) 0.0;
|
2154
|
+
|
2155
|
+
this.m20 = (float) 0.0;
|
2156
|
+
this.m21 = (float) 0.0;
|
2157
|
+
this.m22 = scale;
|
2158
|
+
this.m23 = (float) 0.0;
|
2159
|
+
|
2160
|
+
this.m30 = (float) 0.0;
|
2161
|
+
this.m31 = (float) 0.0;
|
2162
|
+
this.m32 = (float) 0.0;
|
2163
|
+
this.m33 = (float) 1.0;
|
2164
|
+
}
|
2165
|
+
|
2166
|
+
/**
|
2167
|
+
* Sets the value of this transform to a scale and translation matrix; the
|
2168
|
+
* scale is not applied to the translation and all of the matrix values are
|
2169
|
+
* modified.
|
2170
|
+
*
|
2171
|
+
* @param scale
|
2172
|
+
* the scale factor for the matrix
|
2173
|
+
* @param t1
|
2174
|
+
* the translation amount
|
2175
|
+
*/
|
2176
|
+
public final void set(float scale, Vec3D t1) {
|
2177
|
+
this.m00 = scale;
|
2178
|
+
this.m01 = (float) 0.0;
|
2179
|
+
this.m02 = (float) 0.0;
|
2180
|
+
this.m03 = t1.x;
|
2181
|
+
|
2182
|
+
this.m10 = (float) 0.0;
|
2183
|
+
this.m11 = scale;
|
2184
|
+
this.m12 = (float) 0.0;
|
2185
|
+
this.m13 = t1.y;
|
2186
|
+
|
2187
|
+
this.m20 = (float) 0.0;
|
2188
|
+
this.m21 = (float) 0.0;
|
2189
|
+
this.m22 = scale;
|
2190
|
+
this.m23 = t1.z;
|
2191
|
+
|
2192
|
+
this.m30 = (float) 0.0;
|
2193
|
+
this.m31 = (float) 0.0;
|
2194
|
+
this.m32 = (float) 0.0;
|
2195
|
+
this.m33 = (float) 1.0;
|
2196
|
+
}
|
2197
|
+
|
2198
|
+
/**
|
2199
|
+
* Sets the values in this Matrix4f equal to the row-major array parameter
|
2200
|
+
* (ie, the first four elements of the array will be copied into the first
|
2201
|
+
* row of this matrix, etc.).
|
2202
|
+
*
|
2203
|
+
* @param m
|
2204
|
+
* the single precision array of length 16
|
2205
|
+
*/
|
2206
|
+
public final void set(float[] m) {
|
2207
|
+
m00 = m[0];
|
2208
|
+
m01 = m[1];
|
2209
|
+
m02 = m[2];
|
2210
|
+
m03 = m[3];
|
2211
|
+
m10 = m[4];
|
2212
|
+
m11 = m[5];
|
2213
|
+
m12 = m[6];
|
2214
|
+
m13 = m[7];
|
2215
|
+
m20 = m[8];
|
2216
|
+
m21 = m[9];
|
2217
|
+
m22 = m[10];
|
2218
|
+
m23 = m[11];
|
2219
|
+
m30 = m[12];
|
2220
|
+
m31 = m[13];
|
2221
|
+
m32 = m[14];
|
2222
|
+
m33 = m[15];
|
2223
|
+
}
|
2224
|
+
|
2225
|
+
/**
|
2226
|
+
* Sets the rotational component (upper 3x3) of this matrix to the matrix
|
2227
|
+
* values in the double precision Matrix3d argument; the other elements of
|
2228
|
+
* this matrix are initialized as if this were an identity matrix (i.e.,
|
2229
|
+
* affine matrix with no translational component).
|
2230
|
+
*
|
2231
|
+
* @param m1
|
2232
|
+
* the double-precision 3x3 matrix
|
2233
|
+
*/
|
2234
|
+
public final void set(Matrix3d m1) {
|
2235
|
+
m00 = (float) m1.m00;
|
2236
|
+
m01 = (float) m1.m01;
|
2237
|
+
m02 = (float) m1.m02;
|
2238
|
+
m03 = 0.0f;
|
2239
|
+
m10 = (float) m1.m10;
|
2240
|
+
m11 = (float) m1.m11;
|
2241
|
+
m12 = (float) m1.m12;
|
2242
|
+
m13 = 0.0f;
|
2243
|
+
m20 = (float) m1.m20;
|
2244
|
+
m21 = (float) m1.m21;
|
2245
|
+
m22 = (float) m1.m22;
|
2246
|
+
m23 = 0.0f;
|
2247
|
+
m30 = 0.0f;
|
2248
|
+
m31 = 0.0f;
|
2249
|
+
m32 = 0.0f;
|
2250
|
+
m33 = 1.0f;
|
2251
|
+
}
|
2252
|
+
|
2253
|
+
/**
|
2254
|
+
* Sets the value of this matrix from the rotation expressed by the rotation
|
2255
|
+
* matrix m1, the translation t1, and the scale factor. The translation is
|
2256
|
+
* not modified by the scale.
|
2257
|
+
*
|
2258
|
+
* @param m1
|
2259
|
+
* the rotation component
|
2260
|
+
* @param t1
|
2261
|
+
* the translation component
|
2262
|
+
* @param scale
|
2263
|
+
* the scale factor
|
2264
|
+
*/
|
2265
|
+
public final void set(Matrix3d m1, Vec3D t1, double scale) {
|
2266
|
+
this.m00 = (float) (m1.m00 * scale);
|
2267
|
+
this.m01 = (float) (m1.m01 * scale);
|
2268
|
+
this.m02 = (float) (m1.m02 * scale);
|
2269
|
+
this.m03 = t1.x;
|
2270
|
+
|
2271
|
+
this.m10 = (float) (m1.m10 * scale);
|
2272
|
+
this.m11 = (float) (m1.m11 * scale);
|
2273
|
+
this.m12 = (float) (m1.m12 * scale);
|
2274
|
+
this.m13 = t1.y;
|
2275
|
+
|
2276
|
+
this.m20 = (float) (m1.m20 * scale);
|
2277
|
+
this.m21 = (float) (m1.m21 * scale);
|
2278
|
+
this.m22 = (float) (m1.m22 * scale);
|
2279
|
+
this.m23 = t1.z;
|
2280
|
+
|
2281
|
+
this.m30 = 0.0f;
|
2282
|
+
this.m31 = 0.0f;
|
2283
|
+
this.m32 = 0.0f;
|
2284
|
+
this.m33 = 1.0f;
|
2285
|
+
}
|
2286
|
+
|
2287
|
+
/**
|
2288
|
+
* Sets the value of this matrix to a copy of the passed matrix m1.
|
2289
|
+
*
|
2290
|
+
* @param m1
|
2291
|
+
* the matrix to be copied
|
2292
|
+
*/
|
2293
|
+
public final void set(Matrix4f m1) {
|
2294
|
+
this.m00 = m1.m00;
|
2295
|
+
this.m01 = m1.m01;
|
2296
|
+
this.m02 = m1.m02;
|
2297
|
+
this.m03 = m1.m03;
|
2298
|
+
|
2299
|
+
this.m10 = m1.m10;
|
2300
|
+
this.m11 = m1.m11;
|
2301
|
+
this.m12 = m1.m12;
|
2302
|
+
this.m13 = m1.m13;
|
2303
|
+
|
2304
|
+
this.m20 = m1.m20;
|
2305
|
+
this.m21 = m1.m21;
|
2306
|
+
this.m22 = m1.m22;
|
2307
|
+
this.m23 = m1.m23;
|
2308
|
+
|
2309
|
+
this.m30 = m1.m30;
|
2310
|
+
this.m31 = m1.m31;
|
2311
|
+
this.m32 = m1.m32;
|
2312
|
+
this.m33 = m1.m33;
|
2313
|
+
}
|
2314
|
+
|
2315
|
+
/**
|
2316
|
+
* Sets the value of this matrix to the matrix conversion of the single
|
2317
|
+
* precision quaternion argument.
|
2318
|
+
*
|
2319
|
+
* @param q1
|
2320
|
+
* the quaternion to be converted
|
2321
|
+
*/
|
2322
|
+
public final void set(Quaternion q1) {
|
2323
|
+
this.m00 = (1.0f - 2.0f * q1.y * q1.y - 2.0f * q1.z * q1.z);
|
2324
|
+
this.m10 = (2.0f * (q1.x * q1.y + q1.w * q1.z));
|
2325
|
+
this.m20 = (2.0f * (q1.x * q1.z - q1.w * q1.y));
|
2326
|
+
|
2327
|
+
this.m01 = (2.0f * (q1.x * q1.y - q1.w * q1.z));
|
2328
|
+
this.m11 = (1.0f - 2.0f * q1.x * q1.x - 2.0f * q1.z * q1.z);
|
2329
|
+
this.m21 = (2.0f * (q1.y * q1.z + q1.w * q1.x));
|
2330
|
+
|
2331
|
+
this.m02 = (2.0f * (q1.x * q1.z + q1.w * q1.y));
|
2332
|
+
this.m12 = (2.0f * (q1.y * q1.z - q1.w * q1.x));
|
2333
|
+
this.m22 = (1.0f - 2.0f * q1.x * q1.x - 2.0f * q1.y * q1.y);
|
2334
|
+
|
2335
|
+
this.m03 = (float) 0.0;
|
2336
|
+
this.m13 = (float) 0.0;
|
2337
|
+
this.m23 = (float) 0.0;
|
2338
|
+
|
2339
|
+
this.m30 = (float) 0.0;
|
2340
|
+
this.m31 = (float) 0.0;
|
2341
|
+
this.m32 = (float) 0.0;
|
2342
|
+
this.m33 = (float) 1.0;
|
2343
|
+
}
|
2344
|
+
|
2345
|
+
/**
|
2346
|
+
* Sets the value of this matrix from the rotation expressed by the
|
2347
|
+
* quaternion q1, the translation t1, and the scale s.
|
2348
|
+
*
|
2349
|
+
* @param q1
|
2350
|
+
* the rotation expressed as a quaternion
|
2351
|
+
* @param t1
|
2352
|
+
* the translation
|
2353
|
+
* @param s
|
2354
|
+
* the scale value
|
2355
|
+
*/
|
2356
|
+
public final void set(Quaternion q1, Vec3D t1, double s) {
|
2357
|
+
this.m00 = (float) (s * (1.0 - 2.0 * q1.y * q1.y - 2.0 * q1.z * q1.z));
|
2358
|
+
this.m10 = (float) (s * (2.0 * (q1.x * q1.y + q1.w * q1.z)));
|
2359
|
+
this.m20 = (float) (s * (2.0 * (q1.x * q1.z - q1.w * q1.y)));
|
2360
|
+
|
2361
|
+
this.m01 = (float) (s * (2.0 * (q1.x * q1.y - q1.w * q1.z)));
|
2362
|
+
this.m11 = (float) (s * (1.0 - 2.0 * q1.x * q1.x - 2.0 * q1.z * q1.z));
|
2363
|
+
this.m21 = (float) (s * (2.0 * (q1.y * q1.z + q1.w * q1.x)));
|
2364
|
+
|
2365
|
+
this.m02 = (float) (s * (2.0 * (q1.x * q1.z + q1.w * q1.y)));
|
2366
|
+
this.m12 = (float) (s * (2.0 * (q1.y * q1.z - q1.w * q1.x)));
|
2367
|
+
this.m22 = (float) (s * (1.0 - 2.0 * q1.x * q1.x - 2.0 * q1.y * q1.y));
|
2368
|
+
|
2369
|
+
this.m03 = t1.x;
|
2370
|
+
this.m13 = t1.y;
|
2371
|
+
this.m23 = t1.z;
|
2372
|
+
|
2373
|
+
this.m30 = (float) 0.0;
|
2374
|
+
this.m31 = (float) 0.0;
|
2375
|
+
this.m32 = (float) 0.0;
|
2376
|
+
this.m33 = (float) 1.0;
|
2377
|
+
}
|
2378
|
+
|
2379
|
+
/**
|
2380
|
+
* Sets the value of this matrix from the rotation expressed by the
|
2381
|
+
* quaternion q1, the translation t1, and the scale s.
|
2382
|
+
*
|
2383
|
+
* @param q1
|
2384
|
+
* the rotation expressed as a quaternion
|
2385
|
+
* @param t1
|
2386
|
+
* the translation
|
2387
|
+
* @param s
|
2388
|
+
* the scale value
|
2389
|
+
*/
|
2390
|
+
public final void set(Quaternion q1, Vec3D t1, float s) {
|
2391
|
+
this.m00 = (s * (1.0f - 2.0f * q1.y * q1.y - 2.0f * q1.z * q1.z));
|
2392
|
+
this.m10 = (s * (2.0f * (q1.x * q1.y + q1.w * q1.z)));
|
2393
|
+
this.m20 = (s * (2.0f * (q1.x * q1.z - q1.w * q1.y)));
|
2394
|
+
|
2395
|
+
this.m01 = (s * (2.0f * (q1.x * q1.y - q1.w * q1.z)));
|
2396
|
+
this.m11 = (s * (1.0f - 2.0f * q1.x * q1.x - 2.0f * q1.z * q1.z));
|
2397
|
+
this.m21 = (s * (2.0f * (q1.y * q1.z + q1.w * q1.x)));
|
2398
|
+
|
2399
|
+
this.m02 = (s * (2.0f * (q1.x * q1.z + q1.w * q1.y)));
|
2400
|
+
this.m12 = (s * (2.0f * (q1.y * q1.z - q1.w * q1.x)));
|
2401
|
+
this.m22 = (s * (1.0f - 2.0f * q1.x * q1.x - 2.0f * q1.y * q1.y));
|
2402
|
+
|
2403
|
+
this.m03 = t1.x;
|
2404
|
+
this.m13 = t1.y;
|
2405
|
+
this.m23 = t1.z;
|
2406
|
+
|
2407
|
+
this.m30 = (float) 0.0;
|
2408
|
+
this.m31 = (float) 0.0;
|
2409
|
+
this.m32 = (float) 0.0;
|
2410
|
+
this.m33 = (float) 1.0;
|
2411
|
+
}
|
2412
|
+
|
2413
|
+
/**
|
2414
|
+
* Sets the value of this matrix to a translate matrix with the passed
|
2415
|
+
* translation value.
|
2416
|
+
*
|
2417
|
+
* @param v1
|
2418
|
+
* the translation amount
|
2419
|
+
*/
|
2420
|
+
public final void set(Vec3D v1) {
|
2421
|
+
this.m00 = (float) 1.0;
|
2422
|
+
this.m01 = (float) 0.0;
|
2423
|
+
this.m02 = (float) 0.0;
|
2424
|
+
this.m03 = v1.x;
|
2425
|
+
|
2426
|
+
this.m10 = (float) 0.0;
|
2427
|
+
this.m11 = (float) 1.0;
|
2428
|
+
this.m12 = (float) 0.0;
|
2429
|
+
this.m13 = v1.y;
|
2430
|
+
|
2431
|
+
this.m20 = (float) 0.0;
|
2432
|
+
this.m21 = (float) 0.0;
|
2433
|
+
this.m22 = (float) 1.0;
|
2434
|
+
this.m23 = v1.z;
|
2435
|
+
|
2436
|
+
this.m30 = (float) 0.0;
|
2437
|
+
this.m31 = (float) 0.0;
|
2438
|
+
this.m32 = (float) 0.0;
|
2439
|
+
this.m33 = (float) 1.0;
|
2440
|
+
}
|
2441
|
+
|
2442
|
+
/**
|
2443
|
+
* Sets the value of this transform to a scale and translation matrix; the
|
2444
|
+
* translation is scaled by the scale factor and all of the matrix values
|
2445
|
+
* are modified.
|
2446
|
+
*
|
2447
|
+
* @param t1
|
2448
|
+
* the translation amount
|
2449
|
+
* @param scale
|
2450
|
+
* the scale factor for the matrix
|
2451
|
+
*/
|
2452
|
+
public final void set(Vec3D t1, float scale) {
|
2453
|
+
this.m00 = scale;
|
2454
|
+
this.m01 = (float) 0.0;
|
2455
|
+
this.m02 = (float) 0.0;
|
2456
|
+
this.m03 = scale * t1.x;
|
2457
|
+
|
2458
|
+
this.m10 = (float) 0.0;
|
2459
|
+
this.m11 = scale;
|
2460
|
+
this.m12 = (float) 0.0;
|
2461
|
+
this.m13 = scale * t1.y;
|
2462
|
+
|
2463
|
+
this.m20 = (float) 0.0;
|
2464
|
+
this.m21 = (float) 0.0;
|
2465
|
+
this.m22 = scale;
|
2466
|
+
this.m23 = scale * t1.z;
|
2467
|
+
|
2468
|
+
this.m30 = (float) 0.0;
|
2469
|
+
this.m31 = (float) 0.0;
|
2470
|
+
this.m32 = (float) 0.0;
|
2471
|
+
this.m33 = (float) 1.0;
|
2472
|
+
}
|
2473
|
+
|
2474
|
+
/**
|
2475
|
+
* Sets the specified column of this matrix4f to the four values provided.
|
2476
|
+
*
|
2477
|
+
* @param column
|
2478
|
+
* the column number to be modified (zero indexed)
|
2479
|
+
* @param v
|
2480
|
+
* the replacement column
|
2481
|
+
*/
|
2482
|
+
public final void setColumn(int column, float v[]) {
|
2483
|
+
switch (column) {
|
2484
|
+
case 0:
|
2485
|
+
this.m00 = v[0];
|
2486
|
+
this.m10 = v[1];
|
2487
|
+
this.m20 = v[2];
|
2488
|
+
this.m30 = v[3];
|
2489
|
+
break;
|
2490
|
+
|
2491
|
+
case 1:
|
2492
|
+
this.m01 = v[0];
|
2493
|
+
this.m11 = v[1];
|
2494
|
+
this.m21 = v[2];
|
2495
|
+
this.m31 = v[3];
|
2496
|
+
break;
|
2497
|
+
|
2498
|
+
case 2:
|
2499
|
+
this.m02 = v[0];
|
2500
|
+
this.m12 = v[1];
|
2501
|
+
this.m22 = v[2];
|
2502
|
+
this.m32 = v[3];
|
2503
|
+
break;
|
2504
|
+
|
2505
|
+
case 3:
|
2506
|
+
this.m03 = v[0];
|
2507
|
+
this.m13 = v[1];
|
2508
|
+
this.m23 = v[2];
|
2509
|
+
this.m33 = v[3];
|
2510
|
+
break;
|
2511
|
+
|
2512
|
+
default:
|
2513
|
+
throw new ArrayIndexOutOfBoundsException();
|
2514
|
+
}
|
2515
|
+
}
|
2516
|
+
|
2517
|
+
/**
|
2518
|
+
* Sets the specified column of this matrix4f to the four values provided.
|
2519
|
+
*
|
2520
|
+
* @param column
|
2521
|
+
* the column number to be modified (zero indexed)
|
2522
|
+
* @param x
|
2523
|
+
* the first row element
|
2524
|
+
* @param y
|
2525
|
+
* the second row element
|
2526
|
+
* @param z
|
2527
|
+
* the third row element
|
2528
|
+
* @param w
|
2529
|
+
* the fourth row element
|
2530
|
+
*/
|
2531
|
+
public final void setColumn(int column, float x, float y, float z, float w) {
|
2532
|
+
switch (column) {
|
2533
|
+
case 0:
|
2534
|
+
this.m00 = x;
|
2535
|
+
this.m10 = y;
|
2536
|
+
this.m20 = z;
|
2537
|
+
this.m30 = w;
|
2538
|
+
break;
|
2539
|
+
|
2540
|
+
case 1:
|
2541
|
+
this.m01 = x;
|
2542
|
+
this.m11 = y;
|
2543
|
+
this.m21 = z;
|
2544
|
+
this.m31 = w;
|
2545
|
+
break;
|
2546
|
+
|
2547
|
+
case 2:
|
2548
|
+
this.m02 = x;
|
2549
|
+
this.m12 = y;
|
2550
|
+
this.m22 = z;
|
2551
|
+
this.m32 = w;
|
2552
|
+
break;
|
2553
|
+
|
2554
|
+
case 3:
|
2555
|
+
this.m03 = x;
|
2556
|
+
this.m13 = y;
|
2557
|
+
this.m23 = z;
|
2558
|
+
this.m33 = w;
|
2559
|
+
break;
|
2560
|
+
|
2561
|
+
default:
|
2562
|
+
throw new ArrayIndexOutOfBoundsException();
|
2563
|
+
}
|
2564
|
+
}
|
2565
|
+
|
2566
|
+
/**
|
2567
|
+
* Sets the specified column of this matrix4f to the vector provided.
|
2568
|
+
*
|
2569
|
+
* @param column
|
2570
|
+
* the column number to be modified (zero indexed)
|
2571
|
+
* @param v
|
2572
|
+
* the replacement column
|
2573
|
+
*/
|
2574
|
+
public final void setColumn(int column, Vec4D v) {
|
2575
|
+
switch (column) {
|
2576
|
+
case 0:
|
2577
|
+
this.m00 = v.x;
|
2578
|
+
this.m10 = v.y;
|
2579
|
+
this.m20 = v.z;
|
2580
|
+
this.m30 = v.w;
|
2581
|
+
break;
|
2582
|
+
|
2583
|
+
case 1:
|
2584
|
+
this.m01 = v.x;
|
2585
|
+
this.m11 = v.y;
|
2586
|
+
this.m21 = v.z;
|
2587
|
+
this.m31 = v.w;
|
2588
|
+
break;
|
2589
|
+
|
2590
|
+
case 2:
|
2591
|
+
this.m02 = v.x;
|
2592
|
+
this.m12 = v.y;
|
2593
|
+
this.m22 = v.z;
|
2594
|
+
this.m32 = v.w;
|
2595
|
+
break;
|
2596
|
+
|
2597
|
+
case 3:
|
2598
|
+
this.m03 = v.x;
|
2599
|
+
this.m13 = v.y;
|
2600
|
+
this.m23 = v.z;
|
2601
|
+
this.m33 = v.w;
|
2602
|
+
break;
|
2603
|
+
|
2604
|
+
default:
|
2605
|
+
throw new ArrayIndexOutOfBoundsException();
|
2606
|
+
}
|
2607
|
+
}
|
2608
|
+
|
2609
|
+
/**
|
2610
|
+
* Sets the specified element of this matrix4f to the value provided.
|
2611
|
+
*
|
2612
|
+
* @param row
|
2613
|
+
* the row number to be modified (zero indexed)
|
2614
|
+
* @param column
|
2615
|
+
* the column number to be modified (zero indexed)
|
2616
|
+
* @param value
|
2617
|
+
* the new value
|
2618
|
+
*/
|
2619
|
+
public final void setElement(int row, int column, float value) {
|
2620
|
+
switch (row) {
|
2621
|
+
case 0:
|
2622
|
+
switch (column) {
|
2623
|
+
case 0:
|
2624
|
+
this.m00 = value;
|
2625
|
+
break;
|
2626
|
+
case 1:
|
2627
|
+
this.m01 = value;
|
2628
|
+
break;
|
2629
|
+
case 2:
|
2630
|
+
this.m02 = value;
|
2631
|
+
break;
|
2632
|
+
case 3:
|
2633
|
+
this.m03 = value;
|
2634
|
+
break;
|
2635
|
+
default:
|
2636
|
+
throw new ArrayIndexOutOfBoundsException();
|
2637
|
+
}
|
2638
|
+
break;
|
2639
|
+
|
2640
|
+
case 1:
|
2641
|
+
switch (column) {
|
2642
|
+
case 0:
|
2643
|
+
this.m10 = value;
|
2644
|
+
break;
|
2645
|
+
case 1:
|
2646
|
+
this.m11 = value;
|
2647
|
+
break;
|
2648
|
+
case 2:
|
2649
|
+
this.m12 = value;
|
2650
|
+
break;
|
2651
|
+
case 3:
|
2652
|
+
this.m13 = value;
|
2653
|
+
break;
|
2654
|
+
default:
|
2655
|
+
throw new ArrayIndexOutOfBoundsException();
|
2656
|
+
}
|
2657
|
+
break;
|
2658
|
+
|
2659
|
+
case 2:
|
2660
|
+
switch (column) {
|
2661
|
+
case 0:
|
2662
|
+
this.m20 = value;
|
2663
|
+
break;
|
2664
|
+
case 1:
|
2665
|
+
this.m21 = value;
|
2666
|
+
break;
|
2667
|
+
case 2:
|
2668
|
+
this.m22 = value;
|
2669
|
+
break;
|
2670
|
+
case 3:
|
2671
|
+
this.m23 = value;
|
2672
|
+
break;
|
2673
|
+
default:
|
2674
|
+
throw new ArrayIndexOutOfBoundsException();
|
2675
|
+
}
|
2676
|
+
break;
|
2677
|
+
|
2678
|
+
case 3:
|
2679
|
+
switch (column) {
|
2680
|
+
case 0:
|
2681
|
+
this.m30 = value;
|
2682
|
+
break;
|
2683
|
+
case 1:
|
2684
|
+
this.m31 = value;
|
2685
|
+
break;
|
2686
|
+
case 2:
|
2687
|
+
this.m32 = value;
|
2688
|
+
break;
|
2689
|
+
case 3:
|
2690
|
+
this.m33 = value;
|
2691
|
+
break;
|
2692
|
+
default:
|
2693
|
+
throw new ArrayIndexOutOfBoundsException();
|
2694
|
+
}
|
2695
|
+
break;
|
2696
|
+
|
2697
|
+
default:
|
2698
|
+
throw new ArrayIndexOutOfBoundsException();
|
2699
|
+
}
|
2700
|
+
}
|
2701
|
+
|
2702
|
+
/**
|
2703
|
+
* Sets this Matrix4f to identity.
|
2704
|
+
*/
|
2705
|
+
public final void setIdentity() {
|
2706
|
+
this.m00 = (float) 1.0;
|
2707
|
+
this.m01 = (float) 0.0;
|
2708
|
+
this.m02 = (float) 0.0;
|
2709
|
+
this.m03 = (float) 0.0;
|
2710
|
+
|
2711
|
+
this.m10 = (float) 0.0;
|
2712
|
+
this.m11 = (float) 1.0;
|
2713
|
+
this.m12 = (float) 0.0;
|
2714
|
+
this.m13 = (float) 0.0;
|
2715
|
+
|
2716
|
+
this.m20 = (float) 0.0;
|
2717
|
+
this.m21 = (float) 0.0;
|
2718
|
+
this.m22 = (float) 1.0;
|
2719
|
+
this.m23 = (float) 0.0;
|
2720
|
+
|
2721
|
+
this.m30 = (float) 0.0;
|
2722
|
+
this.m31 = (float) 0.0;
|
2723
|
+
this.m32 = (float) 0.0;
|
2724
|
+
this.m33 = (float) 1.0;
|
2725
|
+
}
|
2726
|
+
|
2727
|
+
/**
|
2728
|
+
* Set the first matrix element in the first row.
|
2729
|
+
*
|
2730
|
+
* @param m00
|
2731
|
+
* The m00 to set.
|
2732
|
+
*
|
2733
|
+
* @since vecmath 1.5
|
2734
|
+
*/
|
2735
|
+
public final void setM00(float m00) {
|
2736
|
+
this.m00 = m00;
|
2737
|
+
}
|
2738
|
+
|
2739
|
+
/**
|
2740
|
+
* Set the second matrix element in the first row.
|
2741
|
+
*
|
2742
|
+
* @param m01
|
2743
|
+
* The m01 to set.
|
2744
|
+
*
|
2745
|
+
* @since vecmath 1.5
|
2746
|
+
*/
|
2747
|
+
public final void setM01(float m01) {
|
2748
|
+
this.m01 = m01;
|
2749
|
+
}
|
2750
|
+
|
2751
|
+
/**
|
2752
|
+
* Set the third matrix element in the first row.
|
2753
|
+
*
|
2754
|
+
* @param m02
|
2755
|
+
* The m02 to set.
|
2756
|
+
*
|
2757
|
+
* @since vecmath 1.5
|
2758
|
+
*/
|
2759
|
+
public final void setM02(float m02) {
|
2760
|
+
this.m02 = m02;
|
2761
|
+
}
|
2762
|
+
|
2763
|
+
/**
|
2764
|
+
* Set the fourth element of the first row.
|
2765
|
+
*
|
2766
|
+
* @param m03
|
2767
|
+
* The m03 to set.
|
2768
|
+
*
|
2769
|
+
* @since vecmath 1.5
|
2770
|
+
*/
|
2771
|
+
public final void setM03(float m03) {
|
2772
|
+
this.m03 = m03;
|
2773
|
+
}
|
2774
|
+
|
2775
|
+
/**
|
2776
|
+
* Set first matrix element in the second row.
|
2777
|
+
*
|
2778
|
+
* @param m10
|
2779
|
+
* The m10 to set.
|
2780
|
+
*
|
2781
|
+
* @since vecmath 1.5
|
2782
|
+
*/
|
2783
|
+
public final void setM10(float m10) {
|
2784
|
+
this.m10 = m10;
|
2785
|
+
}
|
2786
|
+
|
2787
|
+
/**
|
2788
|
+
* Set the second matrix element in the second row.
|
2789
|
+
*
|
2790
|
+
* @param m11
|
2791
|
+
* The m11 to set.
|
2792
|
+
*
|
2793
|
+
* @since vecmath 1.5
|
2794
|
+
*/
|
2795
|
+
public final void setM11(float m11) {
|
2796
|
+
this.m11 = m11;
|
2797
|
+
}
|
2798
|
+
|
2799
|
+
/**
|
2800
|
+
* Set the third matrix element in the second row.
|
2801
|
+
*
|
2802
|
+
* @param m12
|
2803
|
+
* The m12 to set.
|
2804
|
+
*
|
2805
|
+
* @since vecmath 1.5
|
2806
|
+
*/
|
2807
|
+
public final void setM12(float m12) {
|
2808
|
+
this.m12 = m12;
|
2809
|
+
}
|
2810
|
+
|
2811
|
+
/**
|
2812
|
+
* Set the fourth element of the second row.
|
2813
|
+
*
|
2814
|
+
* @param m13
|
2815
|
+
* The m13 to set.
|
2816
|
+
*
|
2817
|
+
* @since vecmath 1.5
|
2818
|
+
*/
|
2819
|
+
public final void setM13(float m13) {
|
2820
|
+
this.m13 = m13;
|
2821
|
+
}
|
2822
|
+
|
2823
|
+
/**
|
2824
|
+
* Set the first matrix element in the third row.
|
2825
|
+
*
|
2826
|
+
* @param m20
|
2827
|
+
* The m20 to set.
|
2828
|
+
*
|
2829
|
+
* @since vecmath 1.5
|
2830
|
+
*/
|
2831
|
+
public final void setM20(float m20) {
|
2832
|
+
this.m20 = m20;
|
2833
|
+
}
|
2834
|
+
|
2835
|
+
/**
|
2836
|
+
* Set the second matrix element in the third row.
|
2837
|
+
*
|
2838
|
+
* @param m21
|
2839
|
+
* The m21 to set.
|
2840
|
+
*
|
2841
|
+
* @since vecmath 1.5
|
2842
|
+
*/
|
2843
|
+
public final void setM21(float m21) {
|
2844
|
+
this.m21 = m21;
|
2845
|
+
}
|
2846
|
+
|
2847
|
+
/**
|
2848
|
+
* Set the third matrix element in the third row.
|
2849
|
+
*
|
2850
|
+
* @param m22
|
2851
|
+
* The m22 to set.
|
2852
|
+
*
|
2853
|
+
* @since vecmath 1.5
|
2854
|
+
*/
|
2855
|
+
public final void setM22(float m22) {
|
2856
|
+
this.m22 = m22;
|
2857
|
+
}
|
2858
|
+
|
2859
|
+
/**
|
2860
|
+
* Set the fourth element of the third row.
|
2861
|
+
*
|
2862
|
+
* @param m23
|
2863
|
+
* The m23 to set.
|
2864
|
+
*
|
2865
|
+
* @since vecmath 1.5
|
2866
|
+
*/
|
2867
|
+
public final void setM23(float m23) {
|
2868
|
+
this.m23 = m23;
|
2869
|
+
}
|
2870
|
+
|
2871
|
+
/**
|
2872
|
+
* Set the first element of the fourth row.
|
2873
|
+
*
|
2874
|
+
* @param m30
|
2875
|
+
* The m30 to set.
|
2876
|
+
*
|
2877
|
+
*
|
2878
|
+
* @since vecmath 1.5
|
2879
|
+
*/
|
2880
|
+
public final void setM30(float m30) {
|
2881
|
+
this.m30 = m30;
|
2882
|
+
}
|
2883
|
+
|
2884
|
+
/**
|
2885
|
+
* Set the second element of the fourth row.
|
2886
|
+
*
|
2887
|
+
* @param m31
|
2888
|
+
* The m31 to set.
|
2889
|
+
*
|
2890
|
+
* @since vecmath 1.5
|
2891
|
+
*/
|
2892
|
+
public final void setM31(float m31) {
|
2893
|
+
this.m31 = m31;
|
2894
|
+
}
|
2895
|
+
|
2896
|
+
/**
|
2897
|
+
* Set the third element of the fourth row.
|
2898
|
+
*
|
2899
|
+
* @param m32
|
2900
|
+
* The m32 to set.
|
2901
|
+
*
|
2902
|
+
*
|
2903
|
+
* @since vecmath 1.5
|
2904
|
+
*/
|
2905
|
+
public final void setM32(float m32) {
|
2906
|
+
this.m32 = m32;
|
2907
|
+
}
|
2908
|
+
|
2909
|
+
/**
|
2910
|
+
* Set the fourth element of the fourth row.
|
2911
|
+
*
|
2912
|
+
* @param m33
|
2913
|
+
* The m33 to set.
|
2914
|
+
*
|
2915
|
+
* @since vecmath 1.5
|
2916
|
+
*/
|
2917
|
+
public final void setM33(float m33) {
|
2918
|
+
this.m33 = m33;
|
2919
|
+
}
|
2920
|
+
|
2921
|
+
/**
|
2922
|
+
* Sets the rotational component (upper 3x3) of this matrix to the matrix
|
2923
|
+
* values in the double precision Matrix3d argument; the other elements of
|
2924
|
+
* this matrix are unchanged; a singular value decomposition is performed on
|
2925
|
+
* this object's upper 3x3 matrix to factor out the scale, then this
|
2926
|
+
* object's upper 3x3 matrix components are replaced by the passed rotation
|
2927
|
+
* components, and then the scale is reapplied to the rotational components.
|
2928
|
+
*
|
2929
|
+
* @param m1
|
2930
|
+
* double precision 3x3 matrix
|
2931
|
+
*/
|
2932
|
+
public final void setRotation(Matrix3d m1) {
|
2933
|
+
double[] tmp_rot = new double[9];
|
2934
|
+
double[] tmp_scale = new double[3];
|
2935
|
+
|
2936
|
+
getScaleRotate(tmp_scale, tmp_rot);
|
2937
|
+
|
2938
|
+
m00 = (float) (m1.m00 * tmp_scale[0]);
|
2939
|
+
m01 = (float) (m1.m01 * tmp_scale[1]);
|
2940
|
+
m02 = (float) (m1.m02 * tmp_scale[2]);
|
2941
|
+
|
2942
|
+
m10 = (float) (m1.m10 * tmp_scale[0]);
|
2943
|
+
m11 = (float) (m1.m11 * tmp_scale[1]);
|
2944
|
+
m12 = (float) (m1.m12 * tmp_scale[2]);
|
2945
|
+
|
2946
|
+
m20 = (float) (m1.m20 * tmp_scale[0]);
|
2947
|
+
m21 = (float) (m1.m21 * tmp_scale[1]);
|
2948
|
+
m22 = (float) (m1.m22 * tmp_scale[2]);
|
2949
|
+
|
2950
|
+
}
|
2951
|
+
|
2952
|
+
/**
|
2953
|
+
* Sets the rotational component (upper 3x3) of this matrix to the matrix
|
2954
|
+
* equivalent values of the quaternion argument; the other elements of this
|
2955
|
+
* matrix are unchanged; a singular value decomposition is performed on this
|
2956
|
+
* object's upper 3x3 matrix to factor out the scale, then this object's
|
2957
|
+
* upper 3x3 matrix components are replaced by the matrix equivalent of the
|
2958
|
+
* quaternion, and then the scale is reapplied to the rotational components.
|
2959
|
+
*
|
2960
|
+
* @param q1
|
2961
|
+
* the quaternion that specifies the rotation
|
2962
|
+
*/
|
2963
|
+
public final void setRotation(Quaternion q1) {
|
2964
|
+
double[] tmp_rot = new double[9]; // scratch matrix
|
2965
|
+
double[] tmp_scale = new double[3]; // scratch matrix
|
2966
|
+
getScaleRotate(tmp_scale, tmp_rot);
|
2967
|
+
|
2968
|
+
m00 = (float) ((1.0f - 2.0f * q1.y * q1.y - 2.0f * q1.z * q1.z) * tmp_scale[0]);
|
2969
|
+
m10 = (float) ((2.0f * (q1.x * q1.y + q1.w * q1.z)) * tmp_scale[0]);
|
2970
|
+
m20 = (float) ((2.0f * (q1.x * q1.z - q1.w * q1.y)) * tmp_scale[0]);
|
2971
|
+
|
2972
|
+
m01 = (float) ((2.0f * (q1.x * q1.y - q1.w * q1.z)) * tmp_scale[1]);
|
2973
|
+
m11 = (float) ((1.0f - 2.0f * q1.x * q1.x - 2.0f * q1.z * q1.z) * tmp_scale[1]);
|
2974
|
+
m21 = (float) ((2.0f * (q1.y * q1.z + q1.w * q1.x)) * tmp_scale[1]);
|
2975
|
+
|
2976
|
+
m02 = (float) ((2.0f * (q1.x * q1.z + q1.w * q1.y)) * tmp_scale[2]);
|
2977
|
+
m12 = (float) ((2.0f * (q1.y * q1.z - q1.w * q1.x)) * tmp_scale[2]);
|
2978
|
+
m22 = (float) ((1.0f - 2.0f * q1.x * q1.x - 2.0f * q1.y * q1.y) * tmp_scale[2]);
|
2979
|
+
|
2980
|
+
}
|
2981
|
+
|
2982
|
+
/**
|
2983
|
+
* Replaces the upper 3x3 matrix values of this matrix with the values in
|
2984
|
+
* the matrix m1.
|
2985
|
+
*
|
2986
|
+
* @param m1
|
2987
|
+
* the matrix that will be the new upper 3x3
|
2988
|
+
*/
|
2989
|
+
public final void setRotationScale(Matrix3d m1) {
|
2990
|
+
m00 = (float) m1.m00;
|
2991
|
+
m01 = (float) m1.m01;
|
2992
|
+
m02 = (float) m1.m02;
|
2993
|
+
m10 = (float) m1.m10;
|
2994
|
+
m11 = (float) m1.m11;
|
2995
|
+
m12 = (float) m1.m12;
|
2996
|
+
m20 = (float) m1.m20;
|
2997
|
+
m21 = (float) m1.m21;
|
2998
|
+
m22 = (float) m1.m22;
|
2999
|
+
}
|
3000
|
+
|
3001
|
+
/**
|
3002
|
+
* Sets the specified row of this matrix4f to the four values provided in
|
3003
|
+
* the passed array.
|
3004
|
+
*
|
3005
|
+
* @param row
|
3006
|
+
* the row number to be modified (zero indexed)
|
3007
|
+
* @param v
|
3008
|
+
* the replacement row
|
3009
|
+
*/
|
3010
|
+
public final void setRow(int row, float v[]) {
|
3011
|
+
switch (row) {
|
3012
|
+
case 0:
|
3013
|
+
this.m00 = v[0];
|
3014
|
+
this.m01 = v[1];
|
3015
|
+
this.m02 = v[2];
|
3016
|
+
this.m03 = v[3];
|
3017
|
+
break;
|
3018
|
+
|
3019
|
+
case 1:
|
3020
|
+
this.m10 = v[0];
|
3021
|
+
this.m11 = v[1];
|
3022
|
+
this.m12 = v[2];
|
3023
|
+
this.m13 = v[3];
|
3024
|
+
break;
|
3025
|
+
|
3026
|
+
case 2:
|
3027
|
+
this.m20 = v[0];
|
3028
|
+
this.m21 = v[1];
|
3029
|
+
this.m22 = v[2];
|
3030
|
+
this.m23 = v[3];
|
3031
|
+
break;
|
3032
|
+
|
3033
|
+
case 3:
|
3034
|
+
this.m30 = v[0];
|
3035
|
+
this.m31 = v[1];
|
3036
|
+
this.m32 = v[2];
|
3037
|
+
this.m33 = v[3];
|
3038
|
+
break;
|
3039
|
+
|
3040
|
+
default:
|
3041
|
+
throw new ArrayIndexOutOfBoundsException();
|
3042
|
+
}
|
3043
|
+
}
|
3044
|
+
|
3045
|
+
/**
|
3046
|
+
* Sets the specified row of this matrix4f to the four values provided.
|
3047
|
+
*
|
3048
|
+
* @param row
|
3049
|
+
* the row number to be modified (zero indexed)
|
3050
|
+
* @param x
|
3051
|
+
* the first column element
|
3052
|
+
* @param y
|
3053
|
+
* the second column element
|
3054
|
+
* @param z
|
3055
|
+
* the third column element
|
3056
|
+
* @param w
|
3057
|
+
* the fourth column element
|
3058
|
+
*/
|
3059
|
+
public final void setRow(int row, float x, float y, float z, float w) {
|
3060
|
+
switch (row) {
|
3061
|
+
case 0:
|
3062
|
+
this.m00 = x;
|
3063
|
+
this.m01 = y;
|
3064
|
+
this.m02 = z;
|
3065
|
+
this.m03 = w;
|
3066
|
+
break;
|
3067
|
+
|
3068
|
+
case 1:
|
3069
|
+
this.m10 = x;
|
3070
|
+
this.m11 = y;
|
3071
|
+
this.m12 = z;
|
3072
|
+
this.m13 = w;
|
3073
|
+
break;
|
3074
|
+
|
3075
|
+
case 2:
|
3076
|
+
this.m20 = x;
|
3077
|
+
this.m21 = y;
|
3078
|
+
this.m22 = z;
|
3079
|
+
this.m23 = w;
|
3080
|
+
break;
|
3081
|
+
|
3082
|
+
case 3:
|
3083
|
+
this.m30 = x;
|
3084
|
+
this.m31 = y;
|
3085
|
+
this.m32 = z;
|
3086
|
+
this.m33 = w;
|
3087
|
+
break;
|
3088
|
+
|
3089
|
+
default:
|
3090
|
+
throw new ArrayIndexOutOfBoundsException();
|
3091
|
+
}
|
3092
|
+
}
|
3093
|
+
|
3094
|
+
/**
|
3095
|
+
* Sets the specified row of this matrix4f to the Vector provided.
|
3096
|
+
*
|
3097
|
+
* @param row
|
3098
|
+
* the row number to be modified (zero indexed)
|
3099
|
+
* @param v
|
3100
|
+
* the replacement row
|
3101
|
+
*/
|
3102
|
+
public final void setRow(int row, Vec4D v) {
|
3103
|
+
switch (row) {
|
3104
|
+
case 0:
|
3105
|
+
this.m00 = v.x;
|
3106
|
+
this.m01 = v.y;
|
3107
|
+
this.m02 = v.z;
|
3108
|
+
this.m03 = v.w;
|
3109
|
+
break;
|
3110
|
+
|
3111
|
+
case 1:
|
3112
|
+
this.m10 = v.x;
|
3113
|
+
this.m11 = v.y;
|
3114
|
+
this.m12 = v.z;
|
3115
|
+
this.m13 = v.w;
|
3116
|
+
break;
|
3117
|
+
|
3118
|
+
case 2:
|
3119
|
+
this.m20 = v.x;
|
3120
|
+
this.m21 = v.y;
|
3121
|
+
this.m22 = v.z;
|
3122
|
+
this.m23 = v.w;
|
3123
|
+
break;
|
3124
|
+
|
3125
|
+
case 3:
|
3126
|
+
this.m30 = v.x;
|
3127
|
+
this.m31 = v.y;
|
3128
|
+
this.m32 = v.z;
|
3129
|
+
this.m33 = v.w;
|
3130
|
+
break;
|
3131
|
+
|
3132
|
+
default:
|
3133
|
+
throw new ArrayIndexOutOfBoundsException();
|
3134
|
+
}
|
3135
|
+
}
|
3136
|
+
|
3137
|
+
/**
|
3138
|
+
* Sets the scale component of the current matrix by factoring out the
|
3139
|
+
* current scale (by doing an SVD) from the rotational component and
|
3140
|
+
* multiplying by the new scale.
|
3141
|
+
*
|
3142
|
+
* @param scale
|
3143
|
+
* the new scale amount
|
3144
|
+
*/
|
3145
|
+
public final void setScale(float scale) {
|
3146
|
+
|
3147
|
+
double[] tmp_rot = new double[9]; // scratch matrix
|
3148
|
+
double[] tmp_scale = new double[3]; // scratch matrix
|
3149
|
+
getScaleRotate(tmp_scale, tmp_rot);
|
3150
|
+
|
3151
|
+
m00 = (float) (tmp_rot[0] * scale);
|
3152
|
+
m01 = (float) (tmp_rot[1] * scale);
|
3153
|
+
m02 = (float) (tmp_rot[2] * scale);
|
3154
|
+
|
3155
|
+
m10 = (float) (tmp_rot[3] * scale);
|
3156
|
+
m11 = (float) (tmp_rot[4] * scale);
|
3157
|
+
m12 = (float) (tmp_rot[5] * scale);
|
3158
|
+
|
3159
|
+
m20 = (float) (tmp_rot[6] * scale);
|
3160
|
+
m21 = (float) (tmp_rot[7] * scale);
|
3161
|
+
m22 = (float) (tmp_rot[8] * scale);
|
3162
|
+
|
3163
|
+
}
|
3164
|
+
|
3165
|
+
/**
|
3166
|
+
* Modifies the translational components of this matrix to the values of the
|
3167
|
+
* Vector3f argument; the other values of this matrix are not modified.
|
3168
|
+
*
|
3169
|
+
* @param trans
|
3170
|
+
* the translational component
|
3171
|
+
*/
|
3172
|
+
public final void setTranslation(Vec3D trans) {
|
3173
|
+
m03 = trans.x;
|
3174
|
+
m13 = trans.y;
|
3175
|
+
m23 = trans.z;
|
3176
|
+
}
|
3177
|
+
|
3178
|
+
/**
|
3179
|
+
* Sets this matrix to all zeros.
|
3180
|
+
*/
|
3181
|
+
public final void setZero() {
|
3182
|
+
m00 = 0.0f;
|
3183
|
+
m01 = 0.0f;
|
3184
|
+
m02 = 0.0f;
|
3185
|
+
m03 = 0.0f;
|
3186
|
+
m10 = 0.0f;
|
3187
|
+
m11 = 0.0f;
|
3188
|
+
m12 = 0.0f;
|
3189
|
+
m13 = 0.0f;
|
3190
|
+
m20 = 0.0f;
|
3191
|
+
m21 = 0.0f;
|
3192
|
+
m22 = 0.0f;
|
3193
|
+
m23 = 0.0f;
|
3194
|
+
m30 = 0.0f;
|
3195
|
+
m31 = 0.0f;
|
3196
|
+
m32 = 0.0f;
|
3197
|
+
m33 = 0.0f;
|
3198
|
+
}
|
3199
|
+
|
3200
|
+
/**
|
3201
|
+
* Sets this matrix to the matrix difference of itself and matrix m1 (this =
|
3202
|
+
* this - m1).
|
3203
|
+
*
|
3204
|
+
* @param m1
|
3205
|
+
* the other matrix
|
3206
|
+
*/
|
3207
|
+
public final void sub(Matrix4f m1) {
|
3208
|
+
this.m00 -= m1.m00;
|
3209
|
+
this.m01 -= m1.m01;
|
3210
|
+
this.m02 -= m1.m02;
|
3211
|
+
this.m03 -= m1.m03;
|
3212
|
+
|
3213
|
+
this.m10 -= m1.m10;
|
3214
|
+
this.m11 -= m1.m11;
|
3215
|
+
this.m12 -= m1.m12;
|
3216
|
+
this.m13 -= m1.m13;
|
3217
|
+
|
3218
|
+
this.m20 -= m1.m20;
|
3219
|
+
this.m21 -= m1.m21;
|
3220
|
+
this.m22 -= m1.m22;
|
3221
|
+
this.m23 -= m1.m23;
|
3222
|
+
|
3223
|
+
this.m30 -= m1.m30;
|
3224
|
+
this.m31 -= m1.m31;
|
3225
|
+
this.m32 -= m1.m32;
|
3226
|
+
this.m33 -= m1.m33;
|
3227
|
+
}
|
3228
|
+
|
3229
|
+
/**
|
3230
|
+
* Performs an element-by-element subtraction of matrix m2 from matrix m1
|
3231
|
+
* and places the result into matrix this (this = m2 - m1).
|
3232
|
+
*
|
3233
|
+
* @param m1
|
3234
|
+
* the first matrix
|
3235
|
+
* @param m2
|
3236
|
+
* the second matrix
|
3237
|
+
*/
|
3238
|
+
public final void sub(Matrix4f m1, Matrix4f m2) {
|
3239
|
+
this.m00 = m1.m00 - m2.m00;
|
3240
|
+
this.m01 = m1.m01 - m2.m01;
|
3241
|
+
this.m02 = m1.m02 - m2.m02;
|
3242
|
+
this.m03 = m1.m03 - m2.m03;
|
3243
|
+
|
3244
|
+
this.m10 = m1.m10 - m2.m10;
|
3245
|
+
this.m11 = m1.m11 - m2.m11;
|
3246
|
+
this.m12 = m1.m12 - m2.m12;
|
3247
|
+
this.m13 = m1.m13 - m2.m13;
|
3248
|
+
|
3249
|
+
this.m20 = m1.m20 - m2.m20;
|
3250
|
+
this.m21 = m1.m21 - m2.m21;
|
3251
|
+
this.m22 = m1.m22 - m2.m22;
|
3252
|
+
this.m23 = m1.m23 - m2.m23;
|
3253
|
+
|
3254
|
+
this.m30 = m1.m30 - m2.m30;
|
3255
|
+
this.m31 = m1.m31 - m2.m31;
|
3256
|
+
this.m32 = m1.m32 - m2.m32;
|
3257
|
+
this.m33 = m1.m33 - m2.m33;
|
3258
|
+
}
|
3259
|
+
|
3260
|
+
/**
|
3261
|
+
* Returns a string that contains the values of this Matrix4f.
|
3262
|
+
*
|
3263
|
+
* @return the String representation
|
3264
|
+
*/
|
3265
|
+
@Override
|
3266
|
+
public String toString() {
|
3267
|
+
return this.m00 + ", " + this.m01 + ", " + this.m02 + ", " + this.m03
|
3268
|
+
+ "\n" + this.m10 + ", " + this.m11 + ", " + this.m12 + ", "
|
3269
|
+
+ this.m13 + "\n" + this.m20 + ", " + this.m21 + ", "
|
3270
|
+
+ this.m22 + ", " + this.m23 + "\n" + this.m30 + ", "
|
3271
|
+
+ this.m31 + ", " + this.m32 + ", " + this.m33 + "\n";
|
3272
|
+
}
|
3273
|
+
|
3274
|
+
/**
|
3275
|
+
* Transform the vector vec using this Transform and place the result back
|
3276
|
+
* into vec.
|
3277
|
+
*
|
3278
|
+
* @param vec
|
3279
|
+
* the single precision vector to be transformed
|
3280
|
+
*/
|
3281
|
+
public final void transform(Vec4D vec) {
|
3282
|
+
float x, y, z;
|
3283
|
+
|
3284
|
+
x = m00 * vec.x + m01 * vec.y + m02 * vec.z + m03 * vec.w;
|
3285
|
+
y = m10 * vec.x + m11 * vec.y + m12 * vec.z + m13 * vec.w;
|
3286
|
+
z = m20 * vec.x + m21 * vec.y + m22 * vec.z + m23 * vec.w;
|
3287
|
+
vec.w = m30 * vec.x + m31 * vec.y + m32 * vec.z + m33 * vec.w;
|
3288
|
+
vec.x = x;
|
3289
|
+
vec.y = y;
|
3290
|
+
vec.z = z;
|
3291
|
+
}
|
3292
|
+
|
3293
|
+
/**
|
3294
|
+
* Transform the vector vec using this Matrix4f and place the result into
|
3295
|
+
* vecOut.
|
3296
|
+
*
|
3297
|
+
* @param vec
|
3298
|
+
* the single precision vector to be transformed
|
3299
|
+
* @param vecOut
|
3300
|
+
* the vector into which the transformed values are placed
|
3301
|
+
*/
|
3302
|
+
public final void transform(Vec4D vec, Vec4D vecOut) {
|
3303
|
+
float x, y, z;
|
3304
|
+
x = m00 * vec.x + m01 * vec.y + m02 * vec.z + m03 * vec.w;
|
3305
|
+
y = m10 * vec.x + m11 * vec.y + m12 * vec.z + m13 * vec.w;
|
3306
|
+
z = m20 * vec.x + m21 * vec.y + m22 * vec.z + m23 * vec.w;
|
3307
|
+
vecOut.w = m30 * vec.x + m31 * vec.y + m32 * vec.z + m33 * vec.w;
|
3308
|
+
vecOut.x = x;
|
3309
|
+
vecOut.y = y;
|
3310
|
+
vecOut.z = z;
|
3311
|
+
}
|
3312
|
+
|
3313
|
+
/**
|
3314
|
+
* Transforms the point parameter with this Matrix4f and places the result
|
3315
|
+
* back into point. The fourth element of the point input paramter is
|
3316
|
+
* assumed to be one.
|
3317
|
+
*
|
3318
|
+
* @param point
|
3319
|
+
* the input point to be transformed.
|
3320
|
+
*/
|
3321
|
+
public final void transformOne(Vec3D point) {
|
3322
|
+
float x, y;
|
3323
|
+
x = m00 * point.x + m01 * point.y + m02 * point.z + m03;
|
3324
|
+
y = m10 * point.x + m11 * point.y + m12 * point.z + m13;
|
3325
|
+
point.z = m20 * point.x + m21 * point.y + m22 * point.z + m23;
|
3326
|
+
point.x = x;
|
3327
|
+
point.y = y;
|
3328
|
+
}
|
3329
|
+
|
3330
|
+
/**
|
3331
|
+
* Transforms the point parameter with this Matrix4f and places the result
|
3332
|
+
* into pointOut. The fourth element of the point input paramter is assumed
|
3333
|
+
* to be one.
|
3334
|
+
*
|
3335
|
+
* @param point
|
3336
|
+
* the input point to be transformed.
|
3337
|
+
* @param pointOut
|
3338
|
+
* the transformed point
|
3339
|
+
*/
|
3340
|
+
public final void transformOne(Vec3D point, Vec3D pointOut) {
|
3341
|
+
float x, y;
|
3342
|
+
x = m00 * point.x + m01 * point.y + m02 * point.z + m03;
|
3343
|
+
y = m10 * point.x + m11 * point.y + m12 * point.z + m13;
|
3344
|
+
pointOut.z = m20 * point.x + m21 * point.y + m22 * point.z + m23;
|
3345
|
+
pointOut.x = x;
|
3346
|
+
pointOut.y = y;
|
3347
|
+
}
|
3348
|
+
|
3349
|
+
/**
|
3350
|
+
* Transforms the normal parameter by this transform and places the value
|
3351
|
+
* back into normal. The fourth element of the normal is assumed to be zero.
|
3352
|
+
*
|
3353
|
+
* @param normal
|
3354
|
+
* the input normal to be transformed.
|
3355
|
+
*/
|
3356
|
+
public final void transformZero(Vec3D normal) {
|
3357
|
+
float x, y;
|
3358
|
+
|
3359
|
+
x = m00 * normal.x + m01 * normal.y + m02 * normal.z;
|
3360
|
+
y = m10 * normal.x + m11 * normal.y + m12 * normal.z;
|
3361
|
+
normal.z = m20 * normal.x + m21 * normal.y + m22 * normal.z;
|
3362
|
+
normal.x = x;
|
3363
|
+
normal.y = y;
|
3364
|
+
}
|
3365
|
+
|
3366
|
+
/**
|
3367
|
+
* Transforms the normal parameter by this Matrix4f and places the value
|
3368
|
+
* into normalOut. The fourth element of the normal is assumed to be zero.
|
3369
|
+
*
|
3370
|
+
* @param normal
|
3371
|
+
* the input normal to be transformed.
|
3372
|
+
* @param normalOut
|
3373
|
+
* the transformed normal
|
3374
|
+
*/
|
3375
|
+
public final void transformZero(Vec3D normal, Vec3D normalOut) {
|
3376
|
+
float x, y;
|
3377
|
+
x = m00 * normal.x + m01 * normal.y + m02 * normal.z;
|
3378
|
+
y = m10 * normal.x + m11 * normal.y + m12 * normal.z;
|
3379
|
+
normalOut.z = m20 * normal.x + m21 * normal.y + m22 * normal.z;
|
3380
|
+
normalOut.x = x;
|
3381
|
+
normalOut.y = y;
|
3382
|
+
}
|
3383
|
+
|
3384
|
+
/**
|
3385
|
+
* Sets the value of this matrix to its transpose in place.
|
3386
|
+
*/
|
3387
|
+
public final void transpose() {
|
3388
|
+
float temp;
|
3389
|
+
|
3390
|
+
temp = this.m10;
|
3391
|
+
this.m10 = this.m01;
|
3392
|
+
this.m01 = temp;
|
3393
|
+
|
3394
|
+
temp = this.m20;
|
3395
|
+
this.m20 = this.m02;
|
3396
|
+
this.m02 = temp;
|
3397
|
+
|
3398
|
+
temp = this.m30;
|
3399
|
+
this.m30 = this.m03;
|
3400
|
+
this.m03 = temp;
|
3401
|
+
|
3402
|
+
temp = this.m21;
|
3403
|
+
this.m21 = this.m12;
|
3404
|
+
this.m12 = temp;
|
3405
|
+
|
3406
|
+
temp = this.m31;
|
3407
|
+
this.m31 = this.m13;
|
3408
|
+
this.m13 = temp;
|
3409
|
+
|
3410
|
+
temp = this.m32;
|
3411
|
+
this.m32 = this.m23;
|
3412
|
+
this.m23 = temp;
|
3413
|
+
}
|
3414
|
+
|
3415
|
+
/**
|
3416
|
+
* Sets the value of this matrix to the transpose of the argument matrix.
|
3417
|
+
*
|
3418
|
+
* @param m1
|
3419
|
+
* the matrix to be transposed
|
3420
|
+
*/
|
3421
|
+
public final void transpose(Matrix4f m1) {
|
3422
|
+
if (this != m1) {
|
3423
|
+
this.m00 = m1.m00;
|
3424
|
+
this.m01 = m1.m10;
|
3425
|
+
this.m02 = m1.m20;
|
3426
|
+
this.m03 = m1.m30;
|
3427
|
+
|
3428
|
+
this.m10 = m1.m01;
|
3429
|
+
this.m11 = m1.m11;
|
3430
|
+
this.m12 = m1.m21;
|
3431
|
+
this.m13 = m1.m31;
|
3432
|
+
|
3433
|
+
this.m20 = m1.m02;
|
3434
|
+
this.m21 = m1.m12;
|
3435
|
+
this.m22 = m1.m22;
|
3436
|
+
this.m23 = m1.m32;
|
3437
|
+
|
3438
|
+
this.m30 = m1.m03;
|
3439
|
+
this.m31 = m1.m13;
|
3440
|
+
this.m32 = m1.m23;
|
3441
|
+
this.m33 = m1.m33;
|
3442
|
+
} else {
|
3443
|
+
this.transpose();
|
3444
|
+
}
|
3445
|
+
}
|
3446
|
+
}
|