x_ite 5.0.3 → 6.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.vscode/settings.json +12 -5
- package/.vscode/tasks.json +25 -1
- package/Makefile +36 -28
- package/README.md +6 -11
- package/build/bin/dist.pl +0 -6
- package/build/bin/examples-and-tests.pl +75 -0
- package/build/bin/tests-menu.pl +57 -0
- package/build/bin/version.pl +7 -4
- package/build/parts/default.start.frag.js +3 -2
- package/dist/assets/components/annotation.js +3 -2
- package/dist/assets/components/annotation.min.js +1 -1
- package/dist/assets/components/cad-geometry.js +3 -2
- package/dist/assets/components/cad-geometry.min.js +1 -1
- package/dist/assets/components/cube-map-texturing.js +8 -20
- package/dist/assets/components/cube-map-texturing.min.js +1 -1
- package/dist/assets/components/dis.js +3 -2
- package/dist/assets/components/dis.min.js +1 -1
- package/dist/assets/components/event-utilities.js +4 -3
- package/dist/assets/components/event-utilities.min.js +1 -1
- package/dist/assets/components/geometry2d.js +38 -52
- package/dist/assets/components/geometry2d.min.js +1 -1
- package/dist/assets/components/geospatial.js +34 -1686
- package/dist/assets/components/geospatial.min.js +1 -1
- package/dist/assets/components/h-anim.js +71 -77
- package/dist/assets/components/h-anim.min.js +1 -1
- package/dist/assets/components/key-device-sensor.js +4 -3
- package/dist/assets/components/key-device-sensor.min.js +1 -1
- package/dist/assets/components/layout.js +101 -173
- package/dist/assets/components/layout.min.js +1 -1
- package/dist/assets/components/nurbs.js +3 -2
- package/dist/assets/components/nurbs.min.js +1 -1
- package/dist/assets/components/particle-systems.js +1926 -1669
- package/dist/assets/components/particle-systems.min.js +1 -1
- package/dist/assets/components/picking.js +34 -41
- package/dist/assets/components/picking.min.js +1 -1
- package/dist/assets/components/projective-texture-mapping.js +73 -86
- package/dist/assets/components/projective-texture-mapping.min.js +1 -1
- package/dist/assets/components/rigid-body-physics.js +37 -57
- package/dist/assets/components/rigid-body-physics.min.js +1 -1
- package/dist/assets/components/scripting.js +3 -2
- package/dist/assets/components/scripting.min.js +1 -1
- package/dist/assets/components/texturing-3d.js +27 -33
- package/dist/assets/components/texturing-3d.min.js +3 -3
- package/dist/assets/components/volume-rendering.js +12 -11
- package/dist/assets/components/volume-rendering.min.js +1 -1
- package/dist/assets/components/x_ite.js +3 -2
- package/dist/assets/components/x_ite.min.js +1 -1
- package/dist/assets/images/Shading.png +0 -0
- package/dist/assets/linetype/1.png +0 -0
- package/dist/assets/linetype/10.png +0 -0
- package/dist/assets/linetype/11.png +0 -0
- package/dist/assets/linetype/12.png +0 -0
- package/dist/assets/linetype/13.png +0 -0
- package/dist/assets/linetype/14.png +0 -0
- package/dist/assets/linetype/15.png +0 -0
- package/dist/assets/linetype/16.png +0 -0
- package/dist/assets/linetype/2.png +0 -0
- package/dist/assets/linetype/3.png +0 -0
- package/dist/assets/linetype/4.png +0 -0
- package/dist/assets/linetype/5.png +0 -0
- package/dist/assets/linetype/6.png +0 -0
- package/dist/assets/linetype/7.png +0 -0
- package/dist/assets/linetype/8.png +0 -0
- package/dist/assets/linetype/9.png +0 -0
- package/dist/assets/shaders/webgl1/Gouraud.vs +1 -1
- package/dist/assets/shaders/webgl1/Line.fs +0 -21
- package/dist/assets/shaders/webgl1/Line.vs +0 -10
- package/dist/assets/shaders/webgl1/PBR.fs +1 -1
- package/dist/assets/shaders/webgl1/PBR.vs +1 -1
- package/dist/assets/shaders/webgl1/Phong.fs +1 -1
- package/dist/assets/shaders/webgl1/Point.vs +1 -1
- package/dist/assets/shaders/webgl2/Depth.vs +29 -1
- package/dist/assets/shaders/webgl2/Gouraud.vs +32 -4
- package/dist/assets/shaders/webgl2/Line.fs +24 -12
- package/dist/assets/shaders/webgl2/Line.vs +36 -11
- package/dist/assets/shaders/webgl2/LineTransform.fs +4 -0
- package/dist/assets/shaders/webgl2/LineTransform.vs +57 -0
- package/dist/assets/shaders/webgl2/PBR.fs +1 -1
- package/dist/assets/shaders/webgl2/PBR.vs +35 -7
- package/dist/assets/shaders/webgl2/Phong.fs +1 -1
- package/dist/assets/shaders/webgl2/Phong.vs +31 -3
- package/dist/assets/shaders/webgl2/Point.vs +30 -2
- package/dist/assets/shaders/webgl2/Unlit.vs +31 -3
- package/dist/example.html +6 -6
- package/dist/x_ite.css +199 -224
- package/dist/x_ite.js +16335 -15917
- package/dist/x_ite.min.js +17 -17
- package/dist/x_ite.zip +0 -0
- package/docs/404.md +6 -0
- package/docs/Accessing-the-External-Browser.md +21 -15
- package/docs/Browser-Support.md +6 -0
- package/docs/Custom-Shaders.md +18 -25
- package/docs/Features.md +11 -5
- package/docs/Gemfile +44 -0
- package/docs/Gemfile.lock +122 -0
- package/docs/Glossary.md +6 -0
- package/docs/How-To-Configure-Your-Web-Server.md +6 -0
- package/docs/Supported-Nodes.md +9 -1
- package/docs/What's-New.md +93 -39
- package/docs/XHTML-DOM-Integration.md +6 -0
- package/docs/_config.yml +2 -2
- package/docs/assets/css/main.scss +26 -0
- package/docs/index.md +42 -50
- package/docs/reference/Browser-Services.md +9 -3
- package/docs/reference/Constants-Services.md +6 -0
- package/docs/reference/ECMAScript-Object-and-Function-Definitions.md +12 -6
- package/docs/reference/Field-Services-and-Objects.md +105 -1
- package/docs/reference/Prototype-Services.md +11 -0
- package/docs/reference/Route-Services.md +9 -0
- package/docs/reference/Scene-Services.md +17 -2
- package/docs/reference/Script-Node-Authoring-Interface.md +7 -1
- package/docs/tutorials/Adding-backgrounds.md +6 -0
- package/docs/tutorials/Adding-fog.md +6 -0
- package/docs/tutorials/Adding-sound.md +6 -0
- package/docs/tutorials/Animating-transforms.md +6 -0
- package/docs/tutorials/Basic-Nodes.md +6 -0
- package/docs/tutorials/Building-a-X3D-world.md +6 -0
- package/docs/tutorials/Building-elevation-grids.md +6 -0
- package/docs/tutorials/Building-extruded-shapes.md +6 -0
- package/docs/tutorials/Building-primitive-shapes.md +6 -0
- package/docs/tutorials/Building-shapes-out-of-points,-lines,-and-faces.md +6 -0
- package/docs/tutorials/Controlling-appearance-with-materials.md +6 -0
- package/docs/tutorials/Controlling-color-on-coordinate-based-geometry.md +6 -0
- package/docs/tutorials/Controlling-detail.md +6 -0
- package/docs/tutorials/Controlling-how-textures-are-mapped.md +6 -0
- package/docs/tutorials/Controlling-navigation.md +6 -0
- package/docs/tutorials/Controlling-shading-on-coordinate-based-geometry.md +6 -0
- package/docs/tutorials/Controlling-the-viewpoint.md +6 -0
- package/docs/tutorials/Creating-new-node-types.md +6 -0
- package/docs/tutorials/Grouping-nodes.md +6 -0
- package/docs/tutorials/Hello,-World!.md +6 -0
- package/docs/tutorials/Improving-Performance.md +6 -0
- package/docs/tutorials/Increasing-Rendering-Speed.md +6 -0
- package/docs/tutorials/Introducing-X3D.md +6 -0
- package/docs/tutorials/Introducing-animation.md +6 -0
- package/docs/tutorials/Introducing-script-use.md +6 -0
- package/docs/tutorials/Lighting-your-world.md +6 -0
- package/docs/tutorials/Mapping-textures.md +6 -0
- package/docs/tutorials/Naming-nodes.md +6 -0
- package/docs/tutorials/Providing-information-about-your-world.md +6 -0
- package/docs/tutorials/Sensing-the-viewer.md +6 -0
- package/docs/tutorials/Sensing-viewer-actions.md +6 -0
- package/docs/tutorials/Transforming-Shapes.md +6 -0
- package/docs/tutorials/Writing-program-scripts-with-ECMAScript.md +6 -0
- package/docs/tutorials/index.md +42 -36
- package/package.json +6 -7
- package/src/assets/components/geometry2d.js +1 -1
- package/src/assets/components/key-device-sensor.js +1 -1
- package/src/assets/components/layout.js +1 -1
- package/src/assets/components/particle-systems.js +1 -1
- package/src/assets/components/volume-rendering.js +1 -1
- package/src/assets/images/Shading.png +0 -0
- package/src/assets/linetype/1.png +0 -0
- package/src/assets/linetype/10.png +0 -0
- package/src/assets/linetype/11.png +0 -0
- package/src/assets/linetype/12.png +0 -0
- package/src/assets/linetype/13.png +0 -0
- package/src/assets/linetype/14.png +0 -0
- package/src/assets/linetype/15.png +0 -0
- package/src/assets/linetype/16.png +0 -0
- package/src/assets/linetype/2.png +0 -0
- package/src/assets/linetype/3.png +0 -0
- package/src/assets/linetype/4.png +0 -0
- package/src/assets/linetype/5.png +0 -0
- package/src/assets/linetype/6.png +0 -0
- package/src/assets/linetype/7.png +0 -0
- package/src/assets/linetype/8.png +0 -0
- package/src/assets/linetype/9.png +0 -0
- package/src/assets/shaders/Types.glsl +1 -9
- package/src/assets/shaders/webgl1/Gouraud.fs +1 -1
- package/src/assets/shaders/webgl1/Gouraud.vs +2 -3
- package/src/assets/shaders/webgl1/Line.fs +3 -28
- package/src/assets/shaders/webgl1/Line.vs +6 -20
- package/src/assets/shaders/webgl1/PBR.fs +6 -6
- package/src/assets/shaders/webgl1/PBR.vs +1 -1
- package/src/assets/shaders/webgl1/Phong.fs +10 -10
- package/src/assets/shaders/webgl1/Point.vs +2 -2
- package/src/assets/shaders/webgl1/Unlit.fs +4 -4
- package/src/assets/shaders/webgl1/include/Normal.glsl +1 -1
- package/src/assets/shaders/webgl1/include/Texture.glsl +3 -8
- package/src/assets/shaders/webgl2/Depth.vs +4 -1
- package/src/assets/shaders/webgl2/Gouraud.fs +1 -1
- package/src/assets/shaders/webgl2/Gouraud.vs +8 -6
- package/src/assets/shaders/webgl2/Line.fs +11 -17
- package/src/assets/shaders/webgl2/Line.vs +17 -21
- package/src/assets/shaders/webgl2/LineTransform.fs +6 -0
- package/src/assets/shaders/webgl2/LineTransform.vs +77 -0
- package/src/assets/shaders/webgl2/PBR.fs +6 -6
- package/src/assets/shaders/webgl2/PBR.vs +10 -7
- package/src/assets/shaders/webgl2/Phong.fs +11 -11
- package/src/assets/shaders/webgl2/Phong.vs +6 -3
- package/src/assets/shaders/webgl2/Point.vs +5 -4
- package/src/assets/shaders/webgl2/Unlit.fs +5 -5
- package/src/assets/shaders/webgl2/Unlit.vs +6 -3
- package/src/assets/shaders/webgl2/include/Line2.glsl +20 -0
- package/src/assets/shaders/webgl2/include/Normal.glsl +1 -1
- package/src/assets/shaders/webgl2/include/Particle.glsl +36 -0
- package/src/assets/shaders/webgl2/include/Texture.glsl +3 -3
- package/src/example.html +6 -6
- package/src/examples.js +5 -4
- package/src/standard/Math/Algorithm.js +12 -28
- package/src/standard/Math/Geometry/Line2.js +163 -0
- package/src/standard/Math/Geometry/Line3.js +3 -5
- package/src/standard/Math/Geometry/Plane3.js +0 -2
- package/src/standard/Math/Geometry/Triangle3.js +1 -1
- package/src/standard/Math/Geometry/ViewVolume.js +121 -103
- package/src/standard/Math/Numbers/Color3.js +6 -0
- package/src/standard/Math/Numbers/Color4.js +7 -0
- package/src/standard/Math/Numbers/Complex.js +48 -34
- package/src/standard/Math/Numbers/Matrix2.js +62 -2
- package/src/standard/Math/Numbers/Matrix3.js +129 -110
- package/src/standard/Math/Numbers/Matrix4.js +138 -119
- package/src/standard/Math/Numbers/Quaternion.js +12 -5
- package/src/standard/Math/Numbers/Rotation4.js +8 -1
- package/src/standard/Math/Numbers/Vector2.js +42 -9
- package/src/standard/Math/Numbers/Vector3.js +50 -14
- package/src/standard/Math/Numbers/Vector4.js +48 -11
- package/src/standard/Math/Utility/BVH.js +45 -17
- package/src/tests.js +68 -66
- package/src/x_ite/Base/X3DBaseNode.js +22 -11
- package/src/x_ite/Base/X3DField.js +1 -1
- package/src/x_ite/Browser/Core/BrowserOptions.js +24 -143
- package/src/x_ite/Browser/Core/BrowserTimings.js +6 -4
- package/src/x_ite/Browser/Core/Context.js +185 -0
- package/src/x_ite/Browser/Core/ContextMenu.js +398 -211
- package/src/x_ite/Browser/Core/Notification.js +1 -0
- package/src/x_ite/Browser/Core/X3DCoreContext.js +35 -146
- package/src/x_ite/Browser/Followers/X3DArrayFollowerTemplate.js +1 -1
- package/src/x_ite/Browser/Geometry2D/Disk2DOptions.js +1 -0
- package/src/x_ite/Browser/Geometry2D/X3DGeometry2DContext.js +2 -2
- package/src/x_ite/Browser/Geometry3D/X3DGeometry3DContext.js +41 -2
- package/src/x_ite/Browser/Geospatial/Geocentric.js +2 -2
- package/src/x_ite/Browser/Interpolation/CatmullRomSplineInterpolatorTemplate.js +1 -1
- package/src/x_ite/Browser/Layout/ScreenText.js +18 -65
- package/src/x_ite/Browser/Layout/X3DLayoutContext.js +59 -16
- package/src/x_ite/Browser/Navigation/ExamineViewer.js +13 -20
- package/src/x_ite/Browser/Navigation/LookAtViewer.js +1 -4
- package/src/x_ite/Browser/Navigation/PlaneViewer.js +0 -3
- package/src/x_ite/Browser/Navigation/X3DFlyViewer.js +15 -8
- package/src/x_ite/Browser/Navigation/X3DViewer.js +12 -20
- package/src/x_ite/Browser/Networking/X3DNetworkingContext.js +11 -7
- package/src/x_ite/Browser/ParticleSystems/BVH.glsl +183 -0
- package/src/x_ite/Browser/ParticleSystems/Box3.glsl +47 -0
- package/src/x_ite/Browser/ParticleSystems/GeometryTypes.js +66 -0
- package/src/x_ite/Browser/ParticleSystems/Line3.glsl +55 -0
- package/src/x_ite/Browser/ParticleSystems/Plane3.glsl +160 -0
- package/src/x_ite/Browser/PointingDeviceSensor/PointingDevice.js +27 -3
- package/src/x_ite/Browser/PointingDeviceSensor/X3DPointingDeviceSensorContext.js +41 -37
- package/src/x_ite/Browser/Rendering/X3DRenderingContext.js +21 -13
- package/src/x_ite/Browser/Shaders/Shader.js +33 -12
- package/src/x_ite/Browser/Shaders/ShaderSource.js +6 -0
- package/src/x_ite/Browser/Shaders/ShaderTest.js +16 -10
- package/src/x_ite/Browser/Shape/X3DShapeContext.js +50 -9
- package/src/x_ite/Browser/Text/X3DTextContext.js +4 -13
- package/src/x_ite/Browser/Text/X3DTextGeometry.js +2 -1
- package/src/x_ite/Browser/Texturing/X3DTexturingContext.js +71 -34
- package/src/x_ite/Browser/Texturing3D/DICOMParser.js +2 -2
- package/src/x_ite/Browser/Time/X3DTimeContext.js +4 -2
- package/src/x_ite/Browser/VERSION.js +1 -1
- package/src/x_ite/Browser/X3DBrowser.js +7 -6
- package/src/x_ite/Browser/X3DBrowserContext.js +43 -10
- package/src/x_ite/Components/Core/X3DNode.js +4 -0
- package/src/x_ite/Components/Core/X3DPrototypeInstance.js +0 -2
- package/src/x_ite/Components/CubeMapTexturing/ComposedCubeMapTexture.js +3 -4
- package/src/x_ite/Components/CubeMapTexturing/GeneratedCubeMapTexture.js +1 -12
- package/src/x_ite/Components/CubeMapTexturing/ImageCubeMapTexture.js +1 -2
- package/src/x_ite/Components/EnvironmentalEffects/TextureBackground.js +1 -1
- package/src/x_ite/Components/EnvironmentalEffects/X3DBackgroundNode.js +76 -77
- package/src/x_ite/Components/EnvironmentalEffects/X3DFogObject.js +2 -9
- package/src/x_ite/Components/EnvironmentalSensor/ProximitySensor.js +51 -65
- package/src/x_ite/Components/EventUtilities/X3DSequencerNode.js +1 -1
- package/src/x_ite/Components/Followers/ColorDamper.js +1 -1
- package/src/x_ite/Components/Followers/X3DChaserNode.js +18 -32
- package/src/x_ite/Components/Followers/X3DDamperNode.js +1 -6
- package/src/x_ite/Components/Followers/X3DFollowerNode.js +1 -1
- package/src/x_ite/Components/Geometry2D/Disk2D.js +30 -46
- package/src/x_ite/Components/Geometry2D/TriangleSet2D.js +1 -1
- package/src/x_ite/Components/Geometry3D/ElevationGrid.js +12 -4
- package/src/x_ite/Components/Geometry3D/IndexedFaceSet.js +4 -4
- package/src/x_ite/Components/Geospatial/GeoCoordinate.js +10 -27
- package/src/x_ite/Components/Geospatial/GeoLOD.js +1 -1
- package/src/x_ite/Components/Geospatial/GeoPositionInterpolator.js +5 -10
- package/src/x_ite/Components/Geospatial/GeoTouchSensor.js +9 -16
- package/src/x_ite/Components/Geospatial/GeoTransform.js +6 -18
- package/src/x_ite/Components/Geospatial/GeoViewpoint.js +26 -30
- package/src/x_ite/Components/Geospatial/X3DGeospatialObject.js +20 -27
- package/src/x_ite/Components/Grouping/X3DGroupingNode.js +8 -8
- package/src/x_ite/Components/Grouping/X3DTransformNode.js +0 -4
- package/src/x_ite/Components/HAnim/HAnimHumanoid.js +68 -75
- package/src/x_ite/Components/Interpolation/OrientationInterpolator.js +4 -11
- package/src/x_ite/Components/Interpolation/X3DInterpolatorNode.js +1 -1
- package/src/x_ite/Components/Layout/LayoutGroup.js +4 -9
- package/src/x_ite/Components/Layout/ScreenFontStyle.js +1 -1
- package/src/x_ite/Components/Layout/ScreenGroup.js +16 -80
- package/src/x_ite/Components/Lighting/DirectionalLight.js +28 -36
- package/src/x_ite/Components/Lighting/PointLight.js +32 -47
- package/src/x_ite/Components/Lighting/SpotLight.js +33 -48
- package/src/x_ite/Components/Navigation/Billboard.js +49 -56
- package/src/x_ite/Components/Navigation/LOD.js +2 -2
- package/src/x_ite/Components/Navigation/OrthoViewpoint.js +29 -30
- package/src/x_ite/Components/Navigation/Viewpoint.js +16 -20
- package/src/x_ite/Components/Navigation/X3DViewpointNode.js +82 -111
- package/src/x_ite/Components/Networking/Anchor.js +18 -7
- package/src/x_ite/Components/ParticleSystems/BoundedPhysicsModel.js +6 -6
- package/src/x_ite/Components/ParticleSystems/ConeEmitter.js +44 -36
- package/src/x_ite/Components/ParticleSystems/ExplosionEmitter.js +26 -17
- package/src/x_ite/Components/ParticleSystems/ForcePhysicsModel.js +20 -7
- package/src/x_ite/Components/ParticleSystems/ParticleSystem.js +463 -882
- package/src/x_ite/Components/ParticleSystems/PointEmitter.js +39 -35
- package/src/x_ite/Components/ParticleSystems/PolylineEmitter.js +112 -128
- package/src/x_ite/Components/ParticleSystems/SurfaceEmitter.js +105 -112
- package/src/x_ite/Components/ParticleSystems/VolumeEmitter.js +138 -176
- package/src/x_ite/Components/ParticleSystems/WindPhysicsModel.js +16 -11
- package/src/x_ite/Components/ParticleSystems/X3DParticleEmitterNode.js +807 -217
- package/src/x_ite/Components/Picking/LinePickSensor.js +31 -39
- package/src/x_ite/Components/PointingDeviceSensor/CylinderSensor.js +91 -108
- package/src/x_ite/Components/PointingDeviceSensor/PlaneSensor.js +56 -59
- package/src/x_ite/Components/PointingDeviceSensor/SphereSensor.js +54 -71
- package/src/x_ite/Components/PointingDeviceSensor/TouchSensor.js +8 -15
- package/src/x_ite/Components/ProjectiveTextureMapping/TextureProjectorParallel.js +43 -50
- package/src/x_ite/Components/ProjectiveTextureMapping/TextureProjectorPerspective.js +32 -39
- package/src/x_ite/Components/Rendering/ClipPlane.js +3 -11
- package/src/x_ite/Components/Rendering/Color.js +12 -24
- package/src/x_ite/Components/Rendering/ColorRGBA.js +13 -25
- package/src/x_ite/Components/Rendering/IndexedLineSet.js +26 -4
- package/src/x_ite/Components/Rendering/LineSet.js +35 -13
- package/src/x_ite/Components/Rendering/PointSet.js +35 -13
- package/src/x_ite/Components/Rendering/X3DComposedGeometryNode.js +13 -5
- package/src/x_ite/Components/Rendering/X3DGeometryNode.js +331 -387
- package/src/x_ite/Components/Rendering/X3DLineGeometryNode.js +350 -140
- package/src/x_ite/Components/Rendering/X3DPointGeometryNode.js +116 -126
- package/src/x_ite/Components/RigidBodyPhysics/DoubleAxisHingeJoint.js +24 -38
- package/src/x_ite/Components/RigidBodyPhysics/SingleAxisHingeJoint.js +10 -17
- package/src/x_ite/Components/Shaders/ComposedShader.js +35 -75
- package/src/x_ite/Components/Shaders/FloatVertexAttribute.js +8 -11
- package/src/x_ite/Components/Shaders/Matrix3VertexAttribute.js +10 -14
- package/src/x_ite/Components/Shaders/Matrix4VertexAttribute.js +10 -14
- package/src/x_ite/Components/Shaders/ShaderPart.js +1 -10
- package/src/x_ite/Components/Shaders/X3DProgrammableShaderObject.js +220 -210
- package/src/x_ite/Components/Shaders/X3DShaderNode.js +28 -10
- package/src/x_ite/Components/Shaders/X3DVertexAttributeNode.js +15 -1
- package/src/x_ite/Components/Shape/Appearance.js +37 -4
- package/src/x_ite/Components/Shape/FillProperties.js +12 -1
- package/src/x_ite/Components/Shape/LineProperties.js +33 -1
- package/src/x_ite/Components/Shape/PointProperties.js +24 -3
- package/src/x_ite/Components/Shape/Shape.js +30 -39
- package/src/x_ite/Components/Shape/TwoSidedMaterial.js +3 -1
- package/src/x_ite/Components/Sound/Sound.js +31 -41
- package/src/x_ite/Components/Text/Text.js +6 -20
- package/src/x_ite/Components/Texturing/ImageTexture.js +1 -1
- package/src/x_ite/Components/Texturing/MovieTexture.js +1 -1
- package/src/x_ite/Components/Texturing/PixelTexture.js +2 -2
- package/src/x_ite/Components/Texturing/TextureCoordinate.js +5 -5
- package/src/x_ite/Components/Texturing/TextureProperties.js +4 -4
- package/src/x_ite/Components/Texturing/X3DSingleTextureNode.js +5 -4
- package/src/x_ite/Components/Texturing/X3DTexture2DNode.js +24 -33
- package/src/x_ite/Components/Texturing3D/TextureCoordinate3D.js +5 -5
- package/src/x_ite/Components/Texturing3D/TextureCoordinate4D.js +5 -5
- package/src/x_ite/Components/Texturing3D/X3DTexture3DNode.js +12 -19
- package/src/x_ite/Components/VolumeRendering/X3DVolumeDataNode.js +8 -8
- package/src/x_ite/Components.js +2 -2
- package/src/x_ite/Fallback.js +9 -3
- package/src/x_ite/Fields/SFColor.js +4 -0
- package/src/x_ite/Fields/SFColorRGBA.js +4 -0
- package/src/x_ite/Fields/SFImage.js +2 -11
- package/src/x_ite/Fields/SFMatrixPrototypeTemplate.js +4 -0
- package/src/x_ite/Fields/SFRotation.js +4 -0
- package/src/x_ite/Fields/SFString.js +4 -0
- package/src/x_ite/Fields/SFVecPrototypeTemplate.js +22 -2
- package/src/x_ite/Parser/XMLParser.js +1 -1
- package/src/x_ite/Rendering/TextureBuffer.js +43 -36
- package/src/x_ite/Rendering/VertexArray.js +103 -0
- package/src/x_ite/Rendering/X3DRenderObject.js +127 -148
- package/src/x_ite/X3D.js +32 -26
- package/src/x_ite.config.js +0 -5
- package/src/x_ite.css +216 -175
- package/src/x_ite.html +15 -10
- package/src/x_ite.js +49 -1
- package/x_ite.min.html +15 -10
- package/dist/assets/hatching/0.png +0 -0
- package/dist/assets/linetype/0.png +0 -0
- package/src/assets/hatching/0.png +0 -0
- package/src/assets/linetype/0.png +0 -0
- package/src/spinner.css +0 -67
- package/src/x_ite/Browser/Shape/LineStipples.xcf +0 -0
|
@@ -120,7 +120,7 @@ function (Vector3)
|
|
|
120
120
|
d1 = this .direction,
|
|
121
121
|
d2 = line .direction;
|
|
122
122
|
|
|
123
|
-
let t =
|
|
123
|
+
let t = d1 .dot (d2);
|
|
124
124
|
|
|
125
125
|
if (Math .abs (t) >= 1)
|
|
126
126
|
return false; // lines are parallel
|
|
@@ -139,11 +139,9 @@ function (Vector3)
|
|
|
139
139
|
|
|
140
140
|
return function (point, result)
|
|
141
141
|
{
|
|
142
|
-
|
|
142
|
+
result .assign (this .point) .subtract (point);
|
|
143
143
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
return d .subtract (t .assign (this .direction) .multiply (d .dot (this .direction)));
|
|
144
|
+
return result .subtract (t .assign (this .direction) .multiply (result .dot (this .direction)));
|
|
147
145
|
};
|
|
148
146
|
})(),
|
|
149
147
|
getPerpendicularVectorToLine: (function ()
|
|
@@ -90,7 +90,6 @@ function (Vector3,
|
|
|
90
90
|
return this;
|
|
91
91
|
},
|
|
92
92
|
multRight: function (matrix)
|
|
93
|
-
//throw
|
|
94
93
|
{
|
|
95
94
|
// Taken from Inventor:
|
|
96
95
|
|
|
@@ -116,7 +115,6 @@ function (Vector3,
|
|
|
116
115
|
return this;
|
|
117
116
|
},
|
|
118
117
|
multLeft: function (matrix)
|
|
119
|
-
//throw
|
|
120
118
|
{
|
|
121
119
|
// Taken from Inventor:
|
|
122
120
|
|
|
@@ -66,7 +66,7 @@ function (Vector3,
|
|
|
66
66
|
|
|
67
67
|
return function (a, b, c)
|
|
68
68
|
{
|
|
69
|
-
return B .assign (b) .subtract (a) .cross (C .assign (c) .subtract (a)) .
|
|
69
|
+
return B .assign (b) .subtract (a) .cross (C .assign (c) .subtract (a)) .magnitude () / 2;
|
|
70
70
|
};
|
|
71
71
|
})(),
|
|
72
72
|
normal: function (v1, v2, v3, normal)
|
|
@@ -50,6 +50,7 @@
|
|
|
50
50
|
define ([
|
|
51
51
|
"standard/Math/Geometry/Plane3",
|
|
52
52
|
"standard/Math/Geometry/Triangle3",
|
|
53
|
+
"standard/Math/Numbers/Vector2",
|
|
53
54
|
"standard/Math/Numbers/Vector3",
|
|
54
55
|
"standard/Math/Numbers/Vector4",
|
|
55
56
|
"standard/Math/Numbers/Matrix4",
|
|
@@ -57,6 +58,7 @@ define ([
|
|
|
57
58
|
],
|
|
58
59
|
function (Plane3,
|
|
59
60
|
Triangle3,
|
|
61
|
+
Vector2,
|
|
60
62
|
Vector3,
|
|
61
63
|
Vector4,
|
|
62
64
|
Matrix4,
|
|
@@ -136,66 +138,57 @@ function (Plane3,
|
|
|
136
138
|
|
|
137
139
|
return function (projectionMatrix, viewport, scissor)
|
|
138
140
|
{
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
this .edges .tainted = true;
|
|
192
|
-
this .valid = true;
|
|
193
|
-
}
|
|
194
|
-
catch (error)
|
|
195
|
-
{
|
|
196
|
-
this .valid = false;
|
|
197
|
-
//console .log (error);
|
|
198
|
-
}
|
|
141
|
+
this .viewport .assign (viewport);
|
|
142
|
+
this .scissor .assign (scissor);
|
|
143
|
+
|
|
144
|
+
const points = this .points;
|
|
145
|
+
|
|
146
|
+
const
|
|
147
|
+
p0 = points [0],
|
|
148
|
+
p1 = points [1],
|
|
149
|
+
p2 = points [2],
|
|
150
|
+
p3 = points [3],
|
|
151
|
+
p4 = points [4],
|
|
152
|
+
p5 = points [5],
|
|
153
|
+
p6 = points [6],
|
|
154
|
+
p7 = points [7];
|
|
155
|
+
|
|
156
|
+
const
|
|
157
|
+
x1 = scissor [0],
|
|
158
|
+
x2 = x1 + scissor [2],
|
|
159
|
+
y1 = scissor [1],
|
|
160
|
+
y2 = y1 + scissor [3];
|
|
161
|
+
|
|
162
|
+
matrix .assign (projectionMatrix) .inverse ();
|
|
163
|
+
|
|
164
|
+
ViewVolume .unProjectPointMatrix (x1, y1, 0, matrix, viewport, p0),
|
|
165
|
+
ViewVolume .unProjectPointMatrix (x2, y1, 0, matrix, viewport, p1),
|
|
166
|
+
ViewVolume .unProjectPointMatrix (x2, y2, 0, matrix, viewport, p2),
|
|
167
|
+
ViewVolume .unProjectPointMatrix (x1, y2, 0, matrix, viewport, p3),
|
|
168
|
+
ViewVolume .unProjectPointMatrix (x1, y1, 1, matrix, viewport, p4),
|
|
169
|
+
ViewVolume .unProjectPointMatrix (x2, y1, 1, matrix, viewport, p5);
|
|
170
|
+
ViewVolume .unProjectPointMatrix (x2, y2, 1, matrix, viewport, p6);
|
|
171
|
+
ViewVolume .unProjectPointMatrix (x1, y2, 1, matrix, viewport, p7);
|
|
172
|
+
|
|
173
|
+
const normals = this .normals;
|
|
174
|
+
|
|
175
|
+
Triangle3 .normal (p0, p1, p2, normals [0]); // front
|
|
176
|
+
Triangle3 .normal (p7, p4, p0, normals [1]); // left
|
|
177
|
+
Triangle3 .normal (p6, p2, p1, normals [2]); // right
|
|
178
|
+
Triangle3 .normal (p2, p6, p7, normals [3]); // top
|
|
179
|
+
Triangle3 .normal (p1, p0, p4, normals [4]); // bottom
|
|
180
|
+
Triangle3 .normal (p4, p7, p6, normals [5]); // back
|
|
181
|
+
|
|
182
|
+
const planes = this .planes;
|
|
183
|
+
|
|
184
|
+
planes [0] .set (p1, normals [0]); // front
|
|
185
|
+
planes [1] .set (p4, normals [1]); // left
|
|
186
|
+
planes [2] .set (p2, normals [2]); // right
|
|
187
|
+
planes [3] .set (p6, normals [3]); // top
|
|
188
|
+
planes [4] .set (p0, normals [4]); // bottom
|
|
189
|
+
planes [5] .set (p7, normals [5]); // back
|
|
190
|
+
|
|
191
|
+
this .edges .tainted = true;
|
|
199
192
|
|
|
200
193
|
return this;
|
|
201
194
|
};
|
|
@@ -237,28 +230,25 @@ function (Plane3,
|
|
|
237
230
|
},
|
|
238
231
|
intersectsSphere: function (radius, center)
|
|
239
232
|
{
|
|
240
|
-
|
|
241
|
-
{
|
|
242
|
-
const planes = this .planes;
|
|
233
|
+
const planes = this .planes;
|
|
243
234
|
|
|
244
|
-
|
|
245
|
-
|
|
235
|
+
if (planes [0] .getDistanceToPoint (center) > radius)
|
|
236
|
+
return false;
|
|
246
237
|
|
|
247
|
-
|
|
248
|
-
|
|
238
|
+
if (planes [1] .getDistanceToPoint (center) > radius)
|
|
239
|
+
return false;
|
|
249
240
|
|
|
250
|
-
|
|
251
|
-
|
|
241
|
+
if (planes [2] .getDistanceToPoint (center) > radius)
|
|
242
|
+
return false;
|
|
252
243
|
|
|
253
|
-
|
|
254
|
-
|
|
244
|
+
if (planes [3] .getDistanceToPoint (center) > radius)
|
|
245
|
+
return false;
|
|
255
246
|
|
|
256
|
-
|
|
257
|
-
|
|
247
|
+
if (planes [4] .getDistanceToPoint (center) > radius)
|
|
248
|
+
return false;
|
|
258
249
|
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
}
|
|
250
|
+
if (planes [5] .getDistanceToPoint (center) > radius)
|
|
251
|
+
return false;
|
|
262
252
|
|
|
263
253
|
return true;
|
|
264
254
|
},
|
|
@@ -337,20 +327,18 @@ function (Plane3,
|
|
|
337
327
|
{
|
|
338
328
|
unProjectPoint: (function ()
|
|
339
329
|
{
|
|
340
|
-
const
|
|
330
|
+
const invModelViewProjectionMatrix = new Matrix4 ();
|
|
341
331
|
|
|
342
332
|
return function (winx, winy, winz, modelViewMatrix, projectionMatrix, viewport, point)
|
|
343
333
|
{
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
return this .unProjectPointMatrix (winx, winy, winz, matrix, viewport, point);
|
|
334
|
+
return this .unProjectPointMatrix (winx, winy, winz, invModelViewProjectionMatrix .assign (modelViewMatrix) .multRight (projectionMatrix) .inverse (), viewport, point);
|
|
347
335
|
};
|
|
348
336
|
})(),
|
|
349
337
|
unProjectPointMatrix: (function ()
|
|
350
338
|
{
|
|
351
339
|
const vin = new Vector4 (0, 0, 0, 0);
|
|
352
340
|
|
|
353
|
-
return function (winx, winy, winz,
|
|
341
|
+
return function (winx, winy, winz, invModelViewProjectionMatrix, viewport, point)
|
|
354
342
|
{
|
|
355
343
|
// Transformation of normalized coordinates between -1 and 1
|
|
356
344
|
vin .set ((winx - viewport [0]) / viewport [2] * 2 - 1,
|
|
@@ -359,29 +347,32 @@ function (Plane3,
|
|
|
359
347
|
1);
|
|
360
348
|
|
|
361
349
|
//Objects coordinates
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
if (vin .w === 0)
|
|
365
|
-
throw new Error ("Couldn't unproject point: divisor is 0.");
|
|
350
|
+
invModelViewProjectionMatrix .multVecMatrix (vin);
|
|
366
351
|
|
|
367
352
|
const d = 1 / vin .w;
|
|
368
353
|
|
|
369
|
-
return point .set (vin .x * d, vin .y * d, vin .z * d);
|
|
354
|
+
return point .set (vin .x * d, vin .y * d, vin .z * d, 1);
|
|
370
355
|
};
|
|
371
356
|
})(),
|
|
372
357
|
unProjectRay: (function ()
|
|
373
358
|
{
|
|
374
|
-
const
|
|
375
|
-
near = new Vector3 (0, 0, 0),
|
|
376
|
-
far = new Vector3 (0, 0, 0),
|
|
377
|
-
matrix = new Matrix4 ();
|
|
359
|
+
const invModelViewProjectionMatrix = new Matrix4 ();
|
|
378
360
|
|
|
379
361
|
return function (winx, winy, modelViewMatrix, projectionMatrix, viewport, result)
|
|
380
362
|
{
|
|
381
|
-
|
|
363
|
+
return this .unProjectRayMatrix (winx, winy, invModelViewProjectionMatrix .assign (modelViewMatrix) .multRight (projectionMatrix) .inverse (), viewport, result);
|
|
364
|
+
};
|
|
365
|
+
})(),
|
|
366
|
+
unProjectRayMatrix: (function ()
|
|
367
|
+
{
|
|
368
|
+
const
|
|
369
|
+
near = new Vector3 (0, 0, 0),
|
|
370
|
+
far = new Vector3 (0, 0, 0);
|
|
382
371
|
|
|
383
|
-
|
|
384
|
-
|
|
372
|
+
return function (winx, winy, invModelViewProjectionMatrix, viewport, result)
|
|
373
|
+
{
|
|
374
|
+
ViewVolume .unProjectPointMatrix (winx, winy, 0.0, invModelViewProjectionMatrix, viewport, near);
|
|
375
|
+
ViewVolume .unProjectPointMatrix (winx, winy, 0.9, invModelViewProjectionMatrix, viewport, far);
|
|
385
376
|
|
|
386
377
|
return result .setPoints (near, far);
|
|
387
378
|
};
|
|
@@ -392,12 +383,32 @@ function (Plane3,
|
|
|
392
383
|
|
|
393
384
|
return function (point, modelViewMatrix, projectionMatrix, viewport, vout)
|
|
394
385
|
{
|
|
395
|
-
|
|
386
|
+
if (point .length === 4)
|
|
387
|
+
vin .assign (point);
|
|
388
|
+
else
|
|
389
|
+
vin .set (point .x, point .y, point .z, 1);
|
|
396
390
|
|
|
397
391
|
projectionMatrix .multVecMatrix (modelViewMatrix .multVecMatrix (vin));
|
|
398
392
|
|
|
399
|
-
|
|
400
|
-
|
|
393
|
+
const d = 1 / (2 * vin .w);
|
|
394
|
+
|
|
395
|
+
return vout .set ((vin .x * d + 0.5) * viewport [2] + viewport [0],
|
|
396
|
+
(vin .y * d + 0.5) * viewport [3] + viewport [1],
|
|
397
|
+
(vin .z * d + 0.5));
|
|
398
|
+
};
|
|
399
|
+
})(),
|
|
400
|
+
projectPointMatrix: (function ()
|
|
401
|
+
{
|
|
402
|
+
const vin = new Vector4 (0, 0, 0, 0);
|
|
403
|
+
|
|
404
|
+
return function (point, modelViewProjectionMatrix, viewport, vout)
|
|
405
|
+
{
|
|
406
|
+
if (point .length === 4)
|
|
407
|
+
vin .assign (point);
|
|
408
|
+
else
|
|
409
|
+
vin .set (point .x, point .y, point .z, 1);
|
|
410
|
+
|
|
411
|
+
modelViewProjectionMatrix .multVecMatrix (vin);
|
|
401
412
|
|
|
402
413
|
const d = 1 / (2 * vin .w);
|
|
403
414
|
|
|
@@ -408,17 +419,24 @@ function (Plane3,
|
|
|
408
419
|
})(),
|
|
409
420
|
projectLine: (function ()
|
|
410
421
|
{
|
|
411
|
-
const
|
|
412
|
-
near = new Vector3 (0, 0, 0),
|
|
413
|
-
far = new Vector3 (0, 0, 0);
|
|
422
|
+
const modelViewProjectionMatrix = new Matrix4 ();
|
|
414
423
|
|
|
415
424
|
return function (line, modelViewMatrix, projectionMatrix, viewport, result)
|
|
416
425
|
{
|
|
417
|
-
|
|
418
|
-
|
|
426
|
+
return this .projectLineMatrix (line, modelViewProjectionMatrix .assign (modelViewMatrix) .multRight (projectionMatrix), viewport, result);
|
|
427
|
+
};
|
|
428
|
+
})(),
|
|
429
|
+
projectLineMatrix: (function ()
|
|
430
|
+
{
|
|
431
|
+
const
|
|
432
|
+
near = new Vector2 (0, 0),
|
|
433
|
+
far = new Vector2 (0, 0),
|
|
434
|
+
direction = new Vector3 (0, 0, 0);
|
|
419
435
|
|
|
420
|
-
|
|
421
|
-
|
|
436
|
+
return function (line, modelViewProjectionMatrix, viewport, result)
|
|
437
|
+
{
|
|
438
|
+
ViewVolume .projectPointMatrix (line .point, modelViewProjectionMatrix, viewport, near);
|
|
439
|
+
ViewVolume .projectPointMatrix (direction .assign (line .direction) .multiply (1e9) .add (line .point), modelViewProjectionMatrix, viewport, far);
|
|
422
440
|
|
|
423
441
|
return result .setPoints (near, far);
|
|
424
442
|
};
|
|
@@ -85,6 +85,13 @@ function (Color3, Algorithm)
|
|
|
85
85
|
{
|
|
86
86
|
constructor: Color4,
|
|
87
87
|
length: 4,
|
|
88
|
+
[Symbol .iterator]: function* ()
|
|
89
|
+
{
|
|
90
|
+
yield this [_r];
|
|
91
|
+
yield this [_g];
|
|
92
|
+
yield this [_b];
|
|
93
|
+
yield this [_a];
|
|
94
|
+
},
|
|
88
95
|
copy: function ()
|
|
89
96
|
{
|
|
90
97
|
const copy = Object .create (Color4 .prototype);
|
|
@@ -53,13 +53,18 @@ define (function ()
|
|
|
53
53
|
|
|
54
54
|
function Complex (real, imag)
|
|
55
55
|
{
|
|
56
|
-
this .real = real
|
|
56
|
+
this .real = real;
|
|
57
57
|
this .imag = imag;
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
Complex .prototype =
|
|
61
61
|
{
|
|
62
62
|
constructor: Complex,
|
|
63
|
+
[Symbol .iterator]: function* ()
|
|
64
|
+
{
|
|
65
|
+
yield this .real;
|
|
66
|
+
yield this .imag;
|
|
67
|
+
},
|
|
63
68
|
copy: function ()
|
|
64
69
|
{
|
|
65
70
|
const copy = Object .create (Complex .prototype);
|
|
@@ -78,34 +83,10 @@ define (function ()
|
|
|
78
83
|
return this .real === complex .real &&
|
|
79
84
|
this .imag === complex .imag;
|
|
80
85
|
},
|
|
81
|
-
|
|
82
|
-
{
|
|
83
|
-
return this .setPolar (radius, this .getAngle ());
|
|
84
|
-
},
|
|
85
|
-
getRadius: function ()
|
|
86
|
-
{
|
|
87
|
-
if (this .real)
|
|
88
|
-
{
|
|
89
|
-
if (this .imag)
|
|
90
|
-
return Math .hypot (this .real, this .imag);
|
|
91
|
-
|
|
92
|
-
return Math .abs (this .real);
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
return Math .abs (this .imag);
|
|
96
|
-
},
|
|
97
|
-
setAngle: function (angle)
|
|
98
|
-
{
|
|
99
|
-
return this .setPolar (this .getRadius (), angle);
|
|
100
|
-
},
|
|
101
|
-
getAngle: function ()
|
|
86
|
+
setPolar: function (magnitude, angle)
|
|
102
87
|
{
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
setPolar: function (radius, angle)
|
|
106
|
-
{
|
|
107
|
-
this .real = radius * Math .cos (angle);
|
|
108
|
-
this .imag = radius * Math .sin (angle);
|
|
88
|
+
this .real = magnitude * Math .cos (angle);
|
|
89
|
+
this .imag = magnitude * Math .sin (angle);
|
|
109
90
|
return this;
|
|
110
91
|
},
|
|
111
92
|
conjugate: function ()
|
|
@@ -176,18 +157,51 @@ define (function ()
|
|
|
176
157
|
if (this .imag)
|
|
177
158
|
return this .real + " " + this .imag + "i";
|
|
178
159
|
|
|
179
|
-
return
|
|
160
|
+
return String (this .real);
|
|
180
161
|
},
|
|
181
162
|
};
|
|
182
163
|
|
|
164
|
+
Object .defineProperty (Complex .prototype, "magnitude",
|
|
165
|
+
{
|
|
166
|
+
get: function ()
|
|
167
|
+
{
|
|
168
|
+
if (this .real)
|
|
169
|
+
{
|
|
170
|
+
if (this .imag)
|
|
171
|
+
return Math .hypot (this .real, this .imag);
|
|
172
|
+
|
|
173
|
+
return Math .abs (this .real);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
return Math .abs (this .imag);
|
|
177
|
+
},
|
|
178
|
+
set: function (magnitude)
|
|
179
|
+
{
|
|
180
|
+
this .setPolar (magnitude, this .angle);
|
|
181
|
+
},
|
|
182
|
+
enumerable: false,
|
|
183
|
+
configurable: false
|
|
184
|
+
});
|
|
185
|
+
|
|
186
|
+
Object .defineProperty (Complex .prototype, "angle",
|
|
187
|
+
{
|
|
188
|
+
get: function ()
|
|
189
|
+
{
|
|
190
|
+
return Math .atan2 (this .imag, this .real);
|
|
191
|
+
},
|
|
192
|
+
set: function (angle)
|
|
193
|
+
{
|
|
194
|
+
this .setPolar (this .magnitude, angle);
|
|
195
|
+
},
|
|
196
|
+
enumerable: false,
|
|
197
|
+
configurable: false
|
|
198
|
+
});
|
|
199
|
+
|
|
183
200
|
Object .assign (Complex,
|
|
184
201
|
{
|
|
185
|
-
Polar: function (
|
|
202
|
+
Polar: function (magnitude, angle)
|
|
186
203
|
{
|
|
187
|
-
|
|
188
|
-
complex .real = radius * Math .cos (angle);
|
|
189
|
-
complex .imag = radius * Math .sin (angle);
|
|
190
|
-
return complex;
|
|
204
|
+
return Object .create (Complex .prototype) .setPolar (magnitude, angle);
|
|
191
205
|
},
|
|
192
206
|
multiply: function (lhs, rhs)
|
|
193
207
|
{
|
|
@@ -76,6 +76,13 @@ function (Vector2,
|
|
|
76
76
|
constructor: Matrix2,
|
|
77
77
|
order: 2,
|
|
78
78
|
length: 4,
|
|
79
|
+
[Symbol .iterator]: function* ()
|
|
80
|
+
{
|
|
81
|
+
const length = this .length;
|
|
82
|
+
|
|
83
|
+
for (let i = 0; i < length; ++ i)
|
|
84
|
+
yield this [i];
|
|
85
|
+
},
|
|
79
86
|
copy: function ()
|
|
80
87
|
{
|
|
81
88
|
const copy = Object .create (Matrix2 .prototype);
|
|
@@ -126,6 +133,8 @@ function (Vector2,
|
|
|
126
133
|
break;
|
|
127
134
|
}
|
|
128
135
|
}
|
|
136
|
+
|
|
137
|
+
return this;
|
|
129
138
|
},
|
|
130
139
|
determinant1: function ()
|
|
131
140
|
{
|
|
@@ -154,8 +163,7 @@ function (Vector2,
|
|
|
154
163
|
D = this [3],
|
|
155
164
|
d = A * D - B * C;
|
|
156
165
|
|
|
157
|
-
if (d === 0)
|
|
158
|
-
throw new Error ("Matrix2 .inverse: determinant is 0.");
|
|
166
|
+
// if (d === 0) ... determinant is zero.
|
|
159
167
|
|
|
160
168
|
this [0] = D / d;
|
|
161
169
|
this [1] = -B / d;
|
|
@@ -194,6 +202,46 @@ function (Vector2,
|
|
|
194
202
|
|
|
195
203
|
return this;
|
|
196
204
|
},
|
|
205
|
+
multVecMatrix: function (vector)
|
|
206
|
+
{
|
|
207
|
+
if (typeof vector === "number")
|
|
208
|
+
{
|
|
209
|
+
const
|
|
210
|
+
x = vector,
|
|
211
|
+
w = x * this [2] + this [3];
|
|
212
|
+
|
|
213
|
+
return (x * this [0] + this [1]) / w;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
const
|
|
217
|
+
x = vector .x,
|
|
218
|
+
y = vector .y;
|
|
219
|
+
|
|
220
|
+
vector .x = x * this [0] + y * this [2];
|
|
221
|
+
vector .y = x * this [1] + y * this [3];
|
|
222
|
+
|
|
223
|
+
return vector;
|
|
224
|
+
},
|
|
225
|
+
multMatrixVec: function (vector)
|
|
226
|
+
{
|
|
227
|
+
if (typeof vector === "number")
|
|
228
|
+
{
|
|
229
|
+
const
|
|
230
|
+
x = vector,
|
|
231
|
+
w = x * this [2] + this [3];
|
|
232
|
+
|
|
233
|
+
return (x * this [0] + this [1]) / w;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
const
|
|
237
|
+
x = vector .x,
|
|
238
|
+
y = vector .y;
|
|
239
|
+
|
|
240
|
+
vector .x = x * this [0] + y * this [1];
|
|
241
|
+
vector .y = x * this [2] + y * this [3];
|
|
242
|
+
|
|
243
|
+
return vector;
|
|
244
|
+
},
|
|
197
245
|
identity: function ()
|
|
198
246
|
{
|
|
199
247
|
this [0] = 1;
|
|
@@ -220,6 +268,18 @@ function (Vector2,
|
|
|
220
268
|
configurable: false
|
|
221
269
|
});
|
|
222
270
|
|
|
271
|
+
Object .defineProperty (Matrix2 .prototype, "y",
|
|
272
|
+
{
|
|
273
|
+
get: (function ()
|
|
274
|
+
{
|
|
275
|
+
const vector = new Vector2 (0, 0);
|
|
276
|
+
|
|
277
|
+
return function () { return vector .set (this [2], this [3]); };
|
|
278
|
+
})(),
|
|
279
|
+
enumerable: false,
|
|
280
|
+
configurable: false
|
|
281
|
+
});
|
|
282
|
+
|
|
223
283
|
Object .defineProperty (Matrix2 .prototype, "xAxis",
|
|
224
284
|
{
|
|
225
285
|
get: function () { return this [0]; },
|