opal-js_wrap-three 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/Gemfile.lock +4 -4
- data/lib/opal/js_wrap/three/version.rb +1 -1
- data/lib-opal/js_wrap/three/WebGL.js +102 -0
- data/lib-opal/js_wrap/three/animation/AnimationClipCreator.js +116 -0
- data/lib-opal/js_wrap/three/animation/CCDIKSolver.js +436 -0
- data/lib-opal/js_wrap/three/animation/MMDAnimationHelper.js +941 -0
- data/lib-opal/js_wrap/three/animation/MMDPhysics.js +1183 -0
- data/lib-opal/js_wrap/three/cameras/CinematicCamera.js +204 -0
- data/lib-opal/js_wrap/three/controls/ArcballControls.js +2649 -0
- data/lib-opal/js_wrap/three/controls/DragControls.js +234 -0
- data/lib-opal/js_wrap/three/controls/FirstPersonControls.js +301 -0
- data/lib-opal/js_wrap/three/controls/FlyControls.js +357 -0
- data/lib-opal/js_wrap/three/controls/OrbitControls.js +908 -0
- data/lib-opal/js_wrap/three/controls/PointerLockControls.js +173 -0
- data/lib-opal/js_wrap/three/controls/TrackballControls.js +666 -0
- data/lib-opal/js_wrap/three/controls/TransformControls.js +1210 -0
- data/lib-opal/js_wrap/three/controls/experimental/CameraControls.js +860 -0
- data/lib-opal/js_wrap/three/csm/CSM.js +346 -0
- data/lib-opal/js_wrap/three/csm/CSMFrustum.js +123 -0
- data/lib-opal/js_wrap/three/csm/CSMHelper.js +197 -0
- data/lib-opal/js_wrap/three/csm/CSMShader.js +29 -0
- data/lib-opal/js_wrap/three/curves/CurveExtras.js +544 -0
- data/lib-opal/js_wrap/three/curves/NURBSCurve.js +122 -0
- data/lib-opal/js_wrap/three/curves/NURBSSurface.js +78 -0
- data/lib-opal/js_wrap/three/curves/NURBSUtils.js +413 -0
- data/lib-opal/js_wrap/three/deprecated/Geometry.js +1373 -0
- data/lib-opal/js_wrap/three/effects/AnaglyphEffect.js +113 -0
- data/lib-opal/js_wrap/three/effects/AsciiEffect.js +267 -0
- data/lib-opal/js_wrap/three/effects/OutlineEffect.js +400 -0
- data/lib-opal/js_wrap/three/effects/ParallaxBarrierEffect.js +90 -0
- data/lib-opal/js_wrap/three/effects/PeppersGhostEffect.js +160 -0
- data/lib-opal/js_wrap/three/effects/StereoEffect.js +63 -0
- data/lib-opal/js_wrap/three/environments/DebugEnvironment.js +107 -0
- data/lib-opal/js_wrap/three/environments/RoomEnvironment.js +166 -0
- data/lib-opal/js_wrap/three/exporters/ColladaExporter.js +442 -0
- data/lib-opal/js_wrap/three/exporters/DRACOExporter.js +205 -0
- data/lib-opal/js_wrap/three/exporters/GLTFExporter.js +2042 -0
- data/lib-opal/js_wrap/three/exporters/MMDExporter.js +189 -0
- data/lib-opal/js_wrap/three/exporters/OBJExporter.js +241 -0
- data/lib-opal/js_wrap/three/exporters/PLYExporter.js +370 -0
- data/lib-opal/js_wrap/three/exporters/STLExporter.js +186 -0
- data/lib-opal/js_wrap/three/exporters/USDZExporter.js +402 -0
- data/lib-opal/js_wrap/three/geometries/BoxLineGeometry.js +106 -0
- data/lib-opal/js_wrap/three/geometries/ConvexGeometry.js +88 -0
- data/lib-opal/js_wrap/three/geometries/DecalGeometry.js +302 -0
- data/lib-opal/js_wrap/three/geometries/LightningStrike.js +817 -0
- data/lib-opal/js_wrap/three/geometries/ParametricGeometries.js +280 -0
- data/lib-opal/js_wrap/three/geometries/ParametricGeometry.js +146 -0
- data/lib-opal/js_wrap/three/geometries/RoundedBoxGeometry.js +183 -0
- data/lib-opal/js_wrap/three/geometries/TeapotGeometry.js +352 -0
- data/lib-opal/js_wrap/three/geometries/TextGeometry.js +76 -0
- data/lib-opal/js_wrap/three/helpers/LightProbeHelper.js +95 -0
- data/lib-opal/js_wrap/three/helpers/PositionalAudioHelper.js +138 -0
- data/lib-opal/js_wrap/three/helpers/RectAreaLightHelper.js +115 -0
- data/lib-opal/js_wrap/three/helpers/VertexNormalsHelper.js +131 -0
- data/lib-opal/js_wrap/three/helpers/VertexTangentsHelper.js +118 -0
- data/lib-opal/js_wrap/three/interactive/HTMLMesh.js +307 -0
- data/lib-opal/js_wrap/three/interactive/InteractiveGroup.js +138 -0
- data/lib-opal/js_wrap/three/interactive/SelectionBox.js +264 -0
- data/lib-opal/js_wrap/three/interactive/SelectionHelper.js +88 -0
- data/lib-opal/js_wrap/three/libs/OimoPhysics/OimoPhysics.js +46059 -0
- data/lib-opal/js_wrap/three/libs/OimoPhysics/index.js +92 -0
- data/lib-opal/js_wrap/three/libs/chevrotain.module.min.js +6947 -0
- data/lib-opal/js_wrap/three/libs/ecsy.module.js +1999 -0
- data/lib-opal/js_wrap/three/libs/fflate.module.js +3002 -0
- data/lib-opal/js_wrap/three/libs/flow.module.js +3033 -0
- data/lib-opal/js_wrap/three/libs/ktx-parse.module.js +392 -0
- data/lib-opal/js_wrap/three/libs/lil-gui.module.min.js +821 -0
- data/lib-opal/js_wrap/three/libs/meshopt_decoder.module.js +136 -0
- data/lib-opal/js_wrap/three/libs/mmdparser.module.js +11022 -0
- data/lib-opal/js_wrap/three/libs/motion-controllers.module.js +589 -0
- data/lib-opal/js_wrap/three/libs/opentype.module.min.js +6132 -0
- data/lib-opal/js_wrap/three/libs/potpack.module.js +171 -0
- data/lib-opal/js_wrap/three/libs/rhino3dm/rhino3dm.js +6781 -0
- data/lib-opal/js_wrap/three/libs/rhino3dm/rhino3dm.module.js +6783 -0
- data/lib-opal/js_wrap/three/libs/stats.module.js +139 -0
- data/lib-opal/js_wrap/three/libs/tween.module.min.js +349 -0
- data/lib-opal/js_wrap/three/lights/LightProbeGenerator.js +233 -0
- data/lib-opal/js_wrap/three/lights/RectAreaLightUniformsLib.js +75 -0
- data/lib-opal/js_wrap/three/lines/Line2.js +66 -0
- data/lib-opal/js_wrap/three/lines/LineGeometry.js +122 -0
- data/lib-opal/js_wrap/three/lines/LineMaterial.js +227 -0
- data/lib-opal/js_wrap/three/lines/LineSegments2.js +312 -0
- data/lib-opal/js_wrap/three/lines/LineSegmentsGeometry.js +238 -0
- data/lib-opal/js_wrap/three/lines/Wireframe.js +98 -0
- data/lib-opal/js_wrap/three/lines/WireframeGeometry2.js +65 -0
- data/lib-opal/js_wrap/three/loaders/3DMLoader.js +1230 -0
- data/lib-opal/js_wrap/three/loaders/3MFLoader.js +1123 -0
- data/lib-opal/js_wrap/three/loaders/AMFLoader.js +445 -0
- data/lib-opal/js_wrap/three/loaders/BVHLoader.js +365 -0
- data/lib-opal/js_wrap/three/loaders/BasisTextureLoader.js +692 -0
- data/lib-opal/js_wrap/three/loaders/ColladaLoader.js +3046 -0
- data/lib-opal/js_wrap/three/loaders/DDSLoader.js +264 -0
- data/lib-opal/js_wrap/three/loaders/DRACOLoader.js +531 -0
- data/lib-opal/js_wrap/three/loaders/EXRLoader.js +1834 -0
- data/lib-opal/js_wrap/three/loaders/FBXLoader.js +3125 -0
- data/lib-opal/js_wrap/three/loaders/FontLoader.js +201 -0
- data/lib-opal/js_wrap/three/loaders/GCodeLoader.js +248 -0
- data/lib-opal/js_wrap/three/loaders/GLTFLoader.js +3334 -0
- data/lib-opal/js_wrap/three/loaders/HDRCubeTextureLoader.js +144 -0
- data/lib-opal/js_wrap/three/loaders/IFCLoader.js +2395 -0
- data/lib-opal/js_wrap/three/loaders/KMZLoader.js +142 -0
- data/lib-opal/js_wrap/three/loaders/KTX2Loader.js +535 -0
- data/lib-opal/js_wrap/three/loaders/KTXLoader.js +202 -0
- data/lib-opal/js_wrap/three/loaders/LDrawLoader.js +1737 -0
- data/lib-opal/js_wrap/three/loaders/LUT3dlLoader.js +163 -0
- data/lib-opal/js_wrap/three/loaders/LUTCubeLoader.js +171 -0
- data/lib-opal/js_wrap/three/loaders/LWOLoader.js +831 -0
- data/lib-opal/js_wrap/three/loaders/LogLuvLoader.js +713 -0
- data/lib-opal/js_wrap/three/loaders/LottieLoader.js +103 -0
- data/lib-opal/js_wrap/three/loaders/MD2Loader.js +258 -0
- data/lib-opal/js_wrap/three/loaders/MDDLoader.js +116 -0
- data/lib-opal/js_wrap/three/loaders/MMDLoader.js +1687 -0
- data/lib-opal/js_wrap/three/loaders/MTLLoader.js +465 -0
- data/lib-opal/js_wrap/three/loaders/NRRDLoader.js +554 -0
- data/lib-opal/js_wrap/three/loaders/NodeMaterialLoader.js +248 -0
- data/lib-opal/js_wrap/three/loaders/OBJLoader.js +673 -0
- data/lib-opal/js_wrap/three/loaders/PCDLoader.js +322 -0
- data/lib-opal/js_wrap/three/loaders/PDBLoader.js +318 -0
- data/lib-opal/js_wrap/three/loaders/PLYLoader.js +489 -0
- data/lib-opal/js_wrap/three/loaders/PRWMLoader.js +247 -0
- data/lib-opal/js_wrap/three/loaders/PVRLoader.js +240 -0
- data/lib-opal/js_wrap/three/loaders/RGBELoader.js +462 -0
- data/lib-opal/js_wrap/three/loaders/RGBMLoader.js +1169 -0
- data/lib-opal/js_wrap/three/loaders/STLLoader.js +345 -0
- data/lib-opal/js_wrap/three/loaders/SVGLoader.js +2162 -0
- data/lib-opal/js_wrap/three/loaders/TDSLoader.js +982 -0
- data/lib-opal/js_wrap/three/loaders/TGALoader.js +444 -0
- data/lib-opal/js_wrap/three/loaders/TTFLoader.js +210 -0
- data/lib-opal/js_wrap/three/loaders/TiltLoader.js +391 -0
- data/lib-opal/js_wrap/three/loaders/VOXLoader.js +272 -0
- data/lib-opal/js_wrap/three/loaders/VRMLLoader.js +2685 -0
- data/lib-opal/js_wrap/three/loaders/VRMLoader.js +103 -0
- data/lib-opal/js_wrap/three/loaders/VTKLoader.js +894 -0
- data/lib-opal/js_wrap/three/loaders/XYZLoader.js +136 -0
- data/lib-opal/js_wrap/three/loaders/ifc/web-ifc-api.js +60504 -0
- data/lib-opal/js_wrap/three/loaders/lwo/IFFParser.js +931 -0
- data/lib-opal/js_wrap/three/loaders/lwo/LWO2Parser.js +450 -0
- data/lib-opal/js_wrap/three/loaders/lwo/LWO3Parser.js +406 -0
- data/lib-opal/js_wrap/three/math/Capsule.js +133 -0
- data/lib-opal/js_wrap/three/math/ColorConverter.js +104 -0
- data/lib-opal/js_wrap/three/math/ConvexHull.js +924 -0
- data/lib-opal/js_wrap/three/math/ImprovedNoise.js +86 -0
- data/lib-opal/js_wrap/three/math/Lut.js +170 -0
- data/lib-opal/js_wrap/three/math/MeshSurfaceSampler.js +187 -0
- data/lib-opal/js_wrap/three/math/OBB.js +345 -0
- data/lib-opal/js_wrap/three/math/Octree.js +409 -0
- data/lib-opal/js_wrap/three/math/SimplexNoise.js +425 -0
- data/lib-opal/js_wrap/three/misc/ConvexObjectBreaker.js +447 -0
- data/lib-opal/js_wrap/three/misc/GPUComputationRenderer.js +322 -0
- data/lib-opal/js_wrap/three/misc/Gyroscope.js +94 -0
- data/lib-opal/js_wrap/three/misc/MD2Character.js +225 -0
- data/lib-opal/js_wrap/three/misc/MD2CharacterComplex.js +424 -0
- data/lib-opal/js_wrap/three/misc/MorphAnimMesh.js +109 -0
- data/lib-opal/js_wrap/three/misc/MorphBlendMesh.js +283 -0
- data/lib-opal/js_wrap/three/misc/ProgressiveLightMap.js +324 -0
- data/lib-opal/js_wrap/three/misc/RollerCoaster.js +489 -0
- data/lib-opal/js_wrap/three/misc/TubePainter.js +158 -0
- data/lib-opal/js_wrap/three/misc/Volume.js +427 -0
- data/lib-opal/js_wrap/three/misc/VolumeSlice.js +210 -0
- data/lib-opal/js_wrap/three/modifiers/CurveModifier.js +291 -0
- data/lib-opal/js_wrap/three/modifiers/EdgeSplitModifier.js +308 -0
- data/lib-opal/js_wrap/three/modifiers/SimplifyModifier.js +435 -0
- data/lib-opal/js_wrap/three/modifiers/TessellateModifier.js +264 -0
- data/lib-opal/js_wrap/three/node-editor/NodeEditor.js +402 -0
- data/lib-opal/js_wrap/three/node-editor/accessors/NormalEditor.js +80 -0
- data/lib-opal/js_wrap/three/node-editor/accessors/PositionEditor.js +80 -0
- data/lib-opal/js_wrap/three/node-editor/accessors/UVEditor.js +71 -0
- data/lib-opal/js_wrap/three/node-editor/display/BlendEditor.js +78 -0
- data/lib-opal/js_wrap/three/node-editor/inputs/ColorEditor.js +111 -0
- data/lib-opal/js_wrap/three/node-editor/inputs/FloatEditor.js +69 -0
- data/lib-opal/js_wrap/three/node-editor/inputs/SliderEditor.js +97 -0
- data/lib-opal/js_wrap/three/node-editor/inputs/Vector2Editor.js +73 -0
- data/lib-opal/js_wrap/three/node-editor/inputs/Vector3Editor.js +75 -0
- data/lib-opal/js_wrap/three/node-editor/inputs/Vector4Editor.js +77 -0
- data/lib-opal/js_wrap/three/node-editor/materials/StandardMaterialEditor.js +121 -0
- data/lib-opal/js_wrap/three/node-editor/math/DotEditor.js +76 -0
- data/lib-opal/js_wrap/three/node-editor/math/InvertEditor.js +80 -0
- data/lib-opal/js_wrap/three/node-editor/math/LimiterEditor.js +85 -0
- data/lib-opal/js_wrap/three/node-editor/math/NormalizeEditor.js +69 -0
- data/lib-opal/js_wrap/three/node-editor/math/OperatorEditor.js +91 -0
- data/lib-opal/js_wrap/three/node-editor/math/PowerEditor.js +73 -0
- data/lib-opal/js_wrap/three/node-editor/math/TrigonometryEditor.js +83 -0
- data/lib-opal/js_wrap/three/node-editor/procedural/CheckerEditor.js +69 -0
- data/lib-opal/js_wrap/three/node-editor/utils/OscillatorEditor.js +87 -0
- data/lib-opal/js_wrap/three/node-editor/utils/TimerEditor.js +89 -0
- data/lib-opal/js_wrap/three/nodes/Nodes.js +481 -0
- data/lib-opal/js_wrap/three/nodes/accessors/CameraNode.js +222 -0
- data/lib-opal/js_wrap/three/nodes/accessors/ColorsNode.js +99 -0
- data/lib-opal/js_wrap/three/nodes/accessors/LightNode.js +100 -0
- data/lib-opal/js_wrap/three/nodes/accessors/NormalNode.js +152 -0
- data/lib-opal/js_wrap/three/nodes/accessors/PositionNode.js +163 -0
- data/lib-opal/js_wrap/three/nodes/accessors/ReflectNode.js +161 -0
- data/lib-opal/js_wrap/three/nodes/accessors/ResolutionNode.js +99 -0
- data/lib-opal/js_wrap/three/nodes/accessors/ScreenUVNode.js +101 -0
- data/lib-opal/js_wrap/three/nodes/accessors/UVNode.js +105 -0
- data/lib-opal/js_wrap/three/nodes/core/AttributeNode.js +106 -0
- data/lib-opal/js_wrap/three/nodes/core/ConstNode.js +149 -0
- data/lib-opal/js_wrap/three/nodes/core/ExpressionNode.js +57 -0
- data/lib-opal/js_wrap/three/nodes/core/FunctionCallNode.js +138 -0
- data/lib-opal/js_wrap/three/nodes/core/FunctionNode.js +259 -0
- data/lib-opal/js_wrap/three/nodes/core/InputNode.js +124 -0
- data/lib-opal/js_wrap/three/nodes/core/Node.js +193 -0
- data/lib-opal/js_wrap/three/nodes/core/NodeBuilder.js +782 -0
- data/lib-opal/js_wrap/three/nodes/core/NodeFrame.js +69 -0
- data/lib-opal/js_wrap/three/nodes/core/NodeLib.js +56 -0
- data/lib-opal/js_wrap/three/nodes/core/NodeUniform.js +53 -0
- data/lib-opal/js_wrap/three/nodes/core/NodeUtils.js +60 -0
- data/lib-opal/js_wrap/three/nodes/core/StructNode.js +131 -0
- data/lib-opal/js_wrap/three/nodes/core/TempNode.js +160 -0
- data/lib-opal/js_wrap/three/nodes/core/VarNode.js +105 -0
- data/lib-opal/js_wrap/three/nodes/effects/BlurNode.js +160 -0
- data/lib-opal/js_wrap/three/nodes/effects/ColorAdjustmentNode.js +139 -0
- data/lib-opal/js_wrap/three/nodes/effects/LuminanceNode.js +106 -0
- data/lib-opal/js_wrap/three/nodes/inputs/BoolNode.js +95 -0
- data/lib-opal/js_wrap/three/nodes/inputs/ColorNode.js +99 -0
- data/lib-opal/js_wrap/three/nodes/inputs/CubeTextureNode.js +136 -0
- data/lib-opal/js_wrap/three/nodes/inputs/FloatNode.js +95 -0
- data/lib-opal/js_wrap/three/nodes/inputs/IntNode.js +95 -0
- data/lib-opal/js_wrap/three/nodes/inputs/Matrix3Node.js +102 -0
- data/lib-opal/js_wrap/three/nodes/inputs/Matrix4Node.js +102 -0
- data/lib-opal/js_wrap/three/nodes/inputs/PropertyNode.js +85 -0
- data/lib-opal/js_wrap/three/nodes/inputs/RTTNode.js +164 -0
- data/lib-opal/js_wrap/three/nodes/inputs/ReflectorNode.js +111 -0
- data/lib-opal/js_wrap/three/nodes/inputs/ScreenNode.js +69 -0
- data/lib-opal/js_wrap/three/nodes/inputs/TextureNode.js +140 -0
- data/lib-opal/js_wrap/three/nodes/inputs/Vector2Node.js +98 -0
- data/lib-opal/js_wrap/three/nodes/inputs/Vector3Node.js +99 -0
- data/lib-opal/js_wrap/three/nodes/inputs/Vector4Node.js +100 -0
- data/lib-opal/js_wrap/three/nodes/materials/BasicNodeMaterial.js +63 -0
- data/lib-opal/js_wrap/three/nodes/materials/MeshStandardNodeMaterial.js +63 -0
- data/lib-opal/js_wrap/three/nodes/materials/NodeMaterial.js +202 -0
- data/lib-opal/js_wrap/three/nodes/materials/PhongNodeMaterial.js +63 -0
- data/lib-opal/js_wrap/three/nodes/materials/SpriteNodeMaterial.js +63 -0
- data/lib-opal/js_wrap/three/nodes/materials/StandardNodeMaterial.js +63 -0
- data/lib-opal/js_wrap/three/nodes/materials/nodes/BasicNode.js +146 -0
- data/lib-opal/js_wrap/three/nodes/materials/nodes/MeshStandardNode.js +133 -0
- data/lib-opal/js_wrap/three/nodes/materials/nodes/PhongNode.js +273 -0
- data/lib-opal/js_wrap/three/nodes/materials/nodes/RawNode.js +101 -0
- data/lib-opal/js_wrap/three/nodes/materials/nodes/SpriteNode.js +176 -0
- data/lib-opal/js_wrap/three/nodes/materials/nodes/StandardNode.js +397 -0
- data/lib-opal/js_wrap/three/nodes/math/CondNode.js +151 -0
- data/lib-opal/js_wrap/three/nodes/math/MathNode.js +266 -0
- data/lib-opal/js_wrap/three/nodes/math/OperatorNode.js +120 -0
- data/lib-opal/js_wrap/three/nodes/misc/BumpMapNode.js +139 -0
- data/lib-opal/js_wrap/three/nodes/misc/NormalMapNode.js +122 -0
- data/lib-opal/js_wrap/three/nodes/misc/TextureCubeNode.js +107 -0
- data/lib-opal/js_wrap/three/nodes/misc/TextureCubeUVNode.js +191 -0
- data/lib-opal/js_wrap/three/nodes/postprocessing/NodePass.js +117 -0
- data/lib-opal/js_wrap/three/nodes/postprocessing/NodePostProcessing.js +128 -0
- data/lib-opal/js_wrap/three/nodes/procedural/CheckerNode.js +104 -0
- data/lib-opal/js_wrap/three/nodes/procedural/Fractal3DNode.js +121 -0
- data/lib-opal/js_wrap/three/nodes/procedural/Noise2DNode.js +115 -0
- data/lib-opal/js_wrap/three/nodes/procedural/Noise3DNode.js +112 -0
- data/lib-opal/js_wrap/three/nodes/utils/BypassNode.js +115 -0
- data/lib-opal/js_wrap/three/nodes/utils/ColorSpaceNode.js +214 -0
- data/lib-opal/js_wrap/three/nodes/utils/JoinNode.js +138 -0
- data/lib-opal/js_wrap/three/nodes/utils/MaxMIPLevelNode.js +88 -0
- data/lib-opal/js_wrap/three/nodes/utils/RemapNode.js +117 -0
- data/lib-opal/js_wrap/three/nodes/utils/SpecularMIPLevelNode.js +121 -0
- data/lib-opal/js_wrap/three/nodes/utils/SubSlotNode.js +112 -0
- data/lib-opal/js_wrap/three/nodes/utils/SwitchNode.js +129 -0
- data/lib-opal/js_wrap/three/nodes/utils/TimerNode.js +126 -0
- data/lib-opal/js_wrap/three/nodes/utils/UVTransformNode.js +104 -0
- data/lib-opal/js_wrap/three/nodes/utils/VelocityNode.js +181 -0
- data/lib-opal/js_wrap/three/objects/Lensflare.js +285 -0
- data/lib-opal/js_wrap/three/objects/LightningStorm.js +238 -0
- data/lib-opal/js_wrap/three/objects/MarchingCubes.js +667 -0
- data/lib-opal/js_wrap/three/objects/Reflector.js +205 -0
- data/lib-opal/js_wrap/three/objects/ReflectorForSSRPass.js +288 -0
- data/lib-opal/js_wrap/three/objects/ReflectorRTT.js +63 -0
- data/lib-opal/js_wrap/three/objects/Refractor.js +243 -0
- data/lib-opal/js_wrap/three/objects/ShadowMesh.js +100 -0
- data/lib-opal/js_wrap/three/objects/Sky.js +107 -0
- data/lib-opal/js_wrap/three/objects/Water.js +246 -0
- data/lib-opal/js_wrap/three/objects/Water2.js +238 -0
- data/lib-opal/js_wrap/three/offscreen/jank.js +51 -0
- data/lib-opal/js_wrap/three/offscreen/offscreen.js +24 -0
- data/lib-opal/js_wrap/three/offscreen/scene.js +99 -0
- data/lib-opal/js_wrap/three/physics/AmmoPhysics.js +266 -0
- data/lib-opal/js_wrap/three/physics/OimoPhysics.js +214 -0
- data/lib-opal/js_wrap/three/postprocessing/AdaptiveToneMappingPass.js +307 -0
- data/lib-opal/js_wrap/three/postprocessing/AfterimagePass.js +116 -0
- data/lib-opal/js_wrap/three/postprocessing/BloomPass.js +132 -0
- data/lib-opal/js_wrap/three/postprocessing/BokehPass.js +143 -0
- data/lib-opal/js_wrap/three/postprocessing/ClearPass.js +85 -0
- data/lib-opal/js_wrap/three/postprocessing/CubeTexturePass.js +104 -0
- data/lib-opal/js_wrap/three/postprocessing/DotScreenPass.js +90 -0
- data/lib-opal/js_wrap/three/postprocessing/EffectComposer.js +272 -0
- data/lib-opal/js_wrap/three/postprocessing/FilmPass.js +91 -0
- data/lib-opal/js_wrap/three/postprocessing/GlitchPass.js +140 -0
- data/lib-opal/js_wrap/three/postprocessing/HalftonePass.js +108 -0
- data/lib-opal/js_wrap/three/postprocessing/LUTPass.js +132 -0
- data/lib-opal/js_wrap/three/postprocessing/MaskPass.js +142 -0
- data/lib-opal/js_wrap/three/postprocessing/OutlinePass.js +480 -0
- data/lib-opal/js_wrap/three/postprocessing/Pass.js +101 -0
- data/lib-opal/js_wrap/three/postprocessing/RenderPass.js +109 -0
- data/lib-opal/js_wrap/three/postprocessing/SAOPass.js +384 -0
- data/lib-opal/js_wrap/three/postprocessing/SMAAPass.js +199 -0
- data/lib-opal/js_wrap/three/postprocessing/SSAARenderPass.js +186 -0
- data/lib-opal/js_wrap/three/postprocessing/SSAOPass.js +388 -0
- data/lib-opal/js_wrap/three/postprocessing/SSRPass.js +537 -0
- data/lib-opal/js_wrap/three/postprocessing/SSRrPass.js +481 -0
- data/lib-opal/js_wrap/three/postprocessing/SavePass.js +96 -0
- data/lib-opal/js_wrap/three/postprocessing/ShaderPass.js +98 -0
- data/lib-opal/js_wrap/three/postprocessing/TAARenderPass.js +159 -0
- data/lib-opal/js_wrap/three/postprocessing/TexturePass.js +91 -0
- data/lib-opal/js_wrap/three/postprocessing/UnrealBloomPass.js +335 -0
- data/lib-opal/js_wrap/three/renderers/CSS2DRenderer.js +213 -0
- data/lib-opal/js_wrap/three/renderers/CSS3DRenderer.js +277 -0
- data/lib-opal/js_wrap/three/renderers/Projector.js +733 -0
- data/lib-opal/js_wrap/three/renderers/SVGRenderer.js +470 -0
- data/lib-opal/js_wrap/three/renderers/nodes/Nodes.js +531 -0
- data/lib-opal/js_wrap/three/renderers/nodes/ShaderNode.js +386 -0
- data/lib-opal/js_wrap/three/renderers/nodes/accessors/CameraNode.js +114 -0
- data/lib-opal/js_wrap/three/renderers/nodes/accessors/MaterialNode.js +140 -0
- data/lib-opal/js_wrap/three/renderers/nodes/accessors/MaterialReferenceNode.js +79 -0
- data/lib-opal/js_wrap/three/renderers/nodes/accessors/ModelNode.js +62 -0
- data/lib-opal/js_wrap/three/renderers/nodes/accessors/ModelViewProjectionNode.js +80 -0
- data/lib-opal/js_wrap/three/renderers/nodes/accessors/NormalNode.js +113 -0
- data/lib-opal/js_wrap/three/renderers/nodes/accessors/Object3DNode.js +136 -0
- data/lib-opal/js_wrap/three/renderers/nodes/accessors/PointUVNode.js +70 -0
- data/lib-opal/js_wrap/three/renderers/nodes/accessors/PositionNode.js +117 -0
- data/lib-opal/js_wrap/three/renderers/nodes/accessors/ReferenceNode.js +124 -0
- data/lib-opal/js_wrap/three/renderers/nodes/accessors/SkinningNode.js +129 -0
- data/lib-opal/js_wrap/three/renderers/nodes/accessors/UVNode.js +77 -0
- data/lib-opal/js_wrap/three/renderers/nodes/core/ArrayInputNode.js +74 -0
- data/lib-opal/js_wrap/three/renderers/nodes/core/AttributeNode.js +97 -0
- data/lib-opal/js_wrap/three/renderers/nodes/core/BypassNode.js +84 -0
- data/lib-opal/js_wrap/three/renderers/nodes/core/CodeNode.js +131 -0
- data/lib-opal/js_wrap/three/renderers/nodes/core/ContextNode.js +84 -0
- data/lib-opal/js_wrap/three/renderers/nodes/core/ExpressionNode.js +81 -0
- data/lib-opal/js_wrap/three/renderers/nodes/core/FunctionCallNode.js +123 -0
- data/lib-opal/js_wrap/three/renderers/nodes/core/FunctionNode.js +126 -0
- data/lib-opal/js_wrap/three/renderers/nodes/core/InputNode.js +103 -0
- data/lib-opal/js_wrap/three/renderers/nodes/core/Node.js +120 -0
- data/lib-opal/js_wrap/three/renderers/nodes/core/NodeAttribute.js +37 -0
- data/lib-opal/js_wrap/three/renderers/nodes/core/NodeBuilder.js +650 -0
- data/lib-opal/js_wrap/three/renderers/nodes/core/NodeCode.js +42 -0
- data/lib-opal/js_wrap/three/renderers/nodes/core/NodeFrame.js +70 -0
- data/lib-opal/js_wrap/three/renderers/nodes/core/NodeFunction.js +55 -0
- data/lib-opal/js_wrap/three/renderers/nodes/core/NodeFunctionInput.js +44 -0
- data/lib-opal/js_wrap/three/renderers/nodes/core/NodeKeywords.js +117 -0
- data/lib-opal/js_wrap/three/renderers/nodes/core/NodeParser.js +46 -0
- data/lib-opal/js_wrap/three/renderers/nodes/core/NodeUniform.js +55 -0
- data/lib-opal/js_wrap/three/renderers/nodes/core/NodeVar.js +37 -0
- data/lib-opal/js_wrap/three/renderers/nodes/core/NodeVary.js +37 -0
- data/lib-opal/js_wrap/three/renderers/nodes/core/PropertyNode.js +90 -0
- data/lib-opal/js_wrap/three/renderers/nodes/core/TempNode.js +89 -0
- data/lib-opal/js_wrap/three/renderers/nodes/core/VarNode.js +101 -0
- data/lib-opal/js_wrap/three/renderers/nodes/core/VaryNode.js +101 -0
- data/lib-opal/js_wrap/three/renderers/nodes/core/constants.js +42 -0
- data/lib-opal/js_wrap/three/renderers/nodes/display/ColorSpaceNode.js +165 -0
- data/lib-opal/js_wrap/three/renderers/nodes/display/NormalMapNode.js +120 -0
- data/lib-opal/js_wrap/three/renderers/nodes/functions/BSDFs.js +133 -0
- data/lib-opal/js_wrap/three/renderers/nodes/inputs/BufferNode.js +78 -0
- data/lib-opal/js_wrap/three/renderers/nodes/inputs/ColorNode.js +67 -0
- data/lib-opal/js_wrap/three/renderers/nodes/inputs/FloatNode.js +67 -0
- data/lib-opal/js_wrap/three/renderers/nodes/inputs/IntNode.js +67 -0
- data/lib-opal/js_wrap/three/renderers/nodes/inputs/Matrix3Node.js +67 -0
- data/lib-opal/js_wrap/three/renderers/nodes/inputs/Matrix4Node.js +67 -0
- data/lib-opal/js_wrap/three/renderers/nodes/inputs/TextureNode.js +120 -0
- data/lib-opal/js_wrap/three/renderers/nodes/inputs/Vector2Node.js +67 -0
- data/lib-opal/js_wrap/three/renderers/nodes/inputs/Vector3Node.js +67 -0
- data/lib-opal/js_wrap/three/renderers/nodes/inputs/Vector4Node.js +67 -0
- data/lib-opal/js_wrap/three/renderers/nodes/lights/LightContextNode.js +103 -0
- data/lib-opal/js_wrap/three/renderers/nodes/lights/LightNode.js +115 -0
- data/lib-opal/js_wrap/three/renderers/nodes/lights/LightsNode.js +117 -0
- data/lib-opal/js_wrap/three/renderers/nodes/materials/LineBasicNodeMaterial.js +82 -0
- data/lib-opal/js_wrap/three/renderers/nodes/materials/Materials.js +49 -0
- data/lib-opal/js_wrap/three/renderers/nodes/materials/MeshBasicNodeMaterial.js +82 -0
- data/lib-opal/js_wrap/three/renderers/nodes/materials/MeshStandardNodeMaterial.js +96 -0
- data/lib-opal/js_wrap/three/renderers/nodes/materials/PointsNodeMaterial.js +84 -0
- data/lib-opal/js_wrap/three/renderers/nodes/math/CondNode.js +98 -0
- data/lib-opal/js_wrap/three/renderers/nodes/math/MathNode.js +255 -0
- data/lib-opal/js_wrap/three/renderers/nodes/math/OperatorNode.js +163 -0
- data/lib-opal/js_wrap/three/renderers/nodes/parsers/GLSLNodeFunction.js +158 -0
- data/lib-opal/js_wrap/three/renderers/nodes/parsers/GLSLNodeParser.js +68 -0
- data/lib-opal/js_wrap/three/renderers/nodes/parsers/WGSLNodeFunction.js +126 -0
- data/lib-opal/js_wrap/three/renderers/nodes/parsers/WGSLNodeParser.js +68 -0
- data/lib-opal/js_wrap/three/renderers/nodes/procedural/CheckerNode.js +84 -0
- data/lib-opal/js_wrap/three/renderers/nodes/utils/ArrayElementNode.js +79 -0
- data/lib-opal/js_wrap/three/renderers/nodes/utils/ConvertNode.js +82 -0
- data/lib-opal/js_wrap/three/renderers/nodes/utils/JoinNode.js +88 -0
- data/lib-opal/js_wrap/three/renderers/nodes/utils/OscNode.js +105 -0
- data/lib-opal/js_wrap/three/renderers/nodes/utils/SplitNode.js +96 -0
- data/lib-opal/js_wrap/three/renderers/nodes/utils/SpriteSheetUVNode.js +98 -0
- data/lib-opal/js_wrap/three/renderers/nodes/utils/TimerNode.js +93 -0
- data/lib-opal/js_wrap/three/renderers/webgl/nodes/SlotNode.js +72 -0
- data/lib-opal/js_wrap/three/renderers/webgl/nodes/WebGLNodeBuilder.js +463 -0
- data/lib-opal/js_wrap/three/renderers/webgl/nodes/WebGLNodes.js +62 -0
- data/lib-opal/js_wrap/three/renderers/webgl/nodes/WebGLPhysicalContextNode.js +95 -0
- data/lib-opal/js_wrap/three/renderers/webgpu/WebGPU.js +62 -0
- data/lib-opal/js_wrap/three/renderers/webgpu/WebGPUAttributes.js +118 -0
- data/lib-opal/js_wrap/three/renderers/webgpu/WebGPUBackground.js +109 -0
- data/lib-opal/js_wrap/three/renderers/webgpu/WebGPUBinding.js +52 -0
- data/lib-opal/js_wrap/three/renderers/webgpu/WebGPUBindings.js +254 -0
- data/lib-opal/js_wrap/three/renderers/webgpu/WebGPUBufferUtils.js +39 -0
- data/lib-opal/js_wrap/three/renderers/webgpu/WebGPUComputePipelines.js +82 -0
- data/lib-opal/js_wrap/three/renderers/webgpu/WebGPUGeometries.js +84 -0
- data/lib-opal/js_wrap/three/renderers/webgpu/WebGPUInfo.js +86 -0
- data/lib-opal/js_wrap/three/renderers/webgpu/WebGPUObjects.js +64 -0
- data/lib-opal/js_wrap/three/renderers/webgpu/WebGPUProgrammableStage.js +46 -0
- data/lib-opal/js_wrap/three/renderers/webgpu/WebGPUProperties.js +63 -0
- data/lib-opal/js_wrap/three/renderers/webgpu/WebGPURenderLists.js +180 -0
- data/lib-opal/js_wrap/three/renderers/webgpu/WebGPURenderPipeline.js +662 -0
- data/lib-opal/js_wrap/three/renderers/webgpu/WebGPURenderPipelines.js +275 -0
- data/lib-opal/js_wrap/three/renderers/webgpu/WebGPURenderer.js +883 -0
- data/lib-opal/js_wrap/three/renderers/webgpu/WebGPUSampledTexture.js +139 -0
- data/lib-opal/js_wrap/three/renderers/webgpu/WebGPUSampler.js +76 -0
- data/lib-opal/js_wrap/three/renderers/webgpu/WebGPUStorageBuffer.js +69 -0
- data/lib-opal/js_wrap/three/renderers/webgpu/WebGPUTextureRenderer.js +64 -0
- data/lib-opal/js_wrap/three/renderers/webgpu/WebGPUTextureUtils.js +125 -0
- data/lib-opal/js_wrap/three/renderers/webgpu/WebGPUTextures.js +681 -0
- data/lib-opal/js_wrap/three/renderers/webgpu/WebGPUUniform.js +237 -0
- data/lib-opal/js_wrap/three/renderers/webgpu/WebGPUUniformBuffer.js +90 -0
- data/lib-opal/js_wrap/three/renderers/webgpu/WebGPUUniformsGroup.js +294 -0
- data/lib-opal/js_wrap/three/renderers/webgpu/constants.js +263 -0
- data/lib-opal/js_wrap/three/renderers/webgpu/nodes/WebGPUNodeBuilder.js +619 -0
- data/lib-opal/js_wrap/three/renderers/webgpu/nodes/WebGPUNodeSampledTexture.js +67 -0
- data/lib-opal/js_wrap/three/renderers/webgpu/nodes/WebGPUNodeSampler.js +71 -0
- data/lib-opal/js_wrap/three/renderers/webgpu/nodes/WebGPUNodeUniform.js +229 -0
- data/lib-opal/js_wrap/three/renderers/webgpu/nodes/WebGPUNodeUniformsGroup.js +68 -0
- data/lib-opal/js_wrap/three/renderers/webgpu/nodes/WebGPUNodes.js +106 -0
- data/lib-opal/js_wrap/three/shaders/ACESFilmicToneMappingShader.js +45 -0
- data/lib-opal/js_wrap/three/shaders/AfterimageShader.js +46 -0
- data/lib-opal/js_wrap/three/shaders/BasicShader.js +34 -0
- data/lib-opal/js_wrap/three/shaders/BleachBypassShader.js +43 -0
- data/lib-opal/js_wrap/three/shaders/BlendShader.js +47 -0
- data/lib-opal/js_wrap/three/shaders/BokehShader.js +65 -0
- data/lib-opal/js_wrap/three/shaders/BokehShader2.js +125 -0
- data/lib-opal/js_wrap/three/shaders/BrightnessContrastShader.js +47 -0
- data/lib-opal/js_wrap/three/shaders/ColorCorrectionShader.js +47 -0
- data/lib-opal/js_wrap/three/shaders/ColorifyShader.js +41 -0
- data/lib-opal/js_wrap/three/shaders/ConvolutionShader.js +75 -0
- data/lib-opal/js_wrap/three/shaders/CopyShader.js +41 -0
- data/lib-opal/js_wrap/three/shaders/DOFMipMapShader.js +49 -0
- data/lib-opal/js_wrap/three/shaders/DepthLimitedBlurShader.js +95 -0
- data/lib-opal/js_wrap/three/shaders/DigitalGlitch.js +79 -0
- data/lib-opal/js_wrap/three/shaders/DotScreenShader.js +52 -0
- data/lib-opal/js_wrap/three/shaders/FXAAShader.js +78 -0
- data/lib-opal/js_wrap/three/shaders/FilmShader.js +69 -0
- data/lib-opal/js_wrap/three/shaders/FocusShader.js +52 -0
- data/lib-opal/js_wrap/three/shaders/FreiChenShader.js +44 -0
- data/lib-opal/js_wrap/three/shaders/GammaCorrectionShader.js +39 -0
- data/lib-opal/js_wrap/three/shaders/GodRaysShader.js +140 -0
- data/lib-opal/js_wrap/three/shaders/HalftoneShader.js +77 -0
- data/lib-opal/js_wrap/three/shaders/HorizontalBlurShader.js +47 -0
- data/lib-opal/js_wrap/three/shaders/HorizontalTiltShiftShader.js +49 -0
- data/lib-opal/js_wrap/three/shaders/HueSaturationShader.js +47 -0
- data/lib-opal/js_wrap/three/shaders/KaleidoShader.js +50 -0
- data/lib-opal/js_wrap/three/shaders/LuminosityHighPassShader.js +52 -0
- data/lib-opal/js_wrap/three/shaders/LuminosityShader.js +39 -0
- data/lib-opal/js_wrap/three/shaders/MMDToonShader.js +48 -0
- data/lib-opal/js_wrap/three/shaders/MirrorShader.js +44 -0
- data/lib-opal/js_wrap/three/shaders/NormalMapShader.js +48 -0
- data/lib-opal/js_wrap/three/shaders/PixelShader.js +44 -0
- data/lib-opal/js_wrap/three/shaders/RGBShiftShader.js +50 -0
- data/lib-opal/js_wrap/three/shaders/SAOShader.js +85 -0
- data/lib-opal/js_wrap/three/shaders/SMAAShader.js +95 -0
- data/lib-opal/js_wrap/three/shaders/SSAOShader.js +113 -0
- data/lib-opal/js_wrap/three/shaders/SSRShader.js +126 -0
- data/lib-opal/js_wrap/three/shaders/SSRrShader.js +106 -0
- data/lib-opal/js_wrap/three/shaders/SepiaShader.js +43 -0
- data/lib-opal/js_wrap/three/shaders/SobelOperatorShader.js +44 -0
- data/lib-opal/js_wrap/three/shaders/SubsurfaceScatteringShader.js +64 -0
- data/lib-opal/js_wrap/three/shaders/TechnicolorShader.js +41 -0
- data/lib-opal/js_wrap/three/shaders/ToneMapShader.js +53 -0
- data/lib-opal/js_wrap/three/shaders/ToonShader.js +148 -0
- data/lib-opal/js_wrap/three/shaders/TriangleBlurShader.js +47 -0
- data/lib-opal/js_wrap/three/shaders/UnpackDepthRGBAShader.js +42 -0
- data/lib-opal/js_wrap/three/shaders/VerticalBlurShader.js +47 -0
- data/lib-opal/js_wrap/three/shaders/VerticalTiltShiftShader.js +49 -0
- data/lib-opal/js_wrap/three/shaders/VignetteShader.js +46 -0
- data/lib-opal/js_wrap/three/shaders/VolumeShader.js +55 -0
- data/lib-opal/js_wrap/three/shaders/WaterRefractionShader.js +46 -0
- data/lib-opal/js_wrap/three/textures/FlakesTexture.js +61 -0
- data/lib-opal/js_wrap/three/utils/BufferGeometryUtils.js +683 -0
- data/lib-opal/js_wrap/three/utils/CameraUtils.js +97 -0
- data/lib-opal/js_wrap/three/utils/GPUStatsPanel.js +154 -0
- data/lib-opal/js_wrap/three/utils/GeometryCompressionUtils.js +468 -0
- data/lib-opal/js_wrap/three/utils/GeometryUtils.js +192 -0
- data/lib-opal/js_wrap/three/utils/PackedPhongMaterial.js +77 -0
- data/lib-opal/js_wrap/three/utils/RoughnessMipmapper.js +169 -0
- data/lib-opal/js_wrap/three/utils/SceneUtils.js +62 -0
- data/lib-opal/js_wrap/three/utils/ShadowMapViewer.js +182 -0
- data/lib-opal/js_wrap/three/utils/SkeletonUtils.js +400 -0
- data/lib-opal/js_wrap/three/utils/UVsDebug.js +132 -0
- data/lib-opal/js_wrap/three/utils/WorkerPool.js +130 -0
- data/lib-opal/js_wrap/three/webxr/ARButton.js +203 -0
- data/lib-opal/js_wrap/three/webxr/OculusHandModel.js +131 -0
- data/lib-opal/js_wrap/three/webxr/OculusHandPointerModel.js +328 -0
- data/lib-opal/js_wrap/three/webxr/Text2D.js +54 -0
- data/lib-opal/js_wrap/three/webxr/VRButton.js +181 -0
- data/lib-opal/js_wrap/three/webxr/XRControllerModelFactory.js +266 -0
- data/lib-opal/js_wrap/three/webxr/XREstimatedLight.js +221 -0
- data/lib-opal/js_wrap/three/webxr/XRHandMeshModel.js +93 -0
- data/lib-opal/js_wrap/three/webxr/XRHandModelFactory.js +127 -0
- data/lib-opal/js_wrap/three/webxr/XRHandPrimitiveModel.js +85 -0
- data/opal-js_wrap-three.gemspec +4 -4
- metadata +502 -5
@@ -0,0 +1,924 @@
|
|
1
|
+
(function (global, factory) {
|
2
|
+
if (typeof define === "function" && define.amd) {
|
3
|
+
define(["exports", "three"], factory);
|
4
|
+
} else if (typeof exports !== "undefined") {
|
5
|
+
factory(exports, require("three"));
|
6
|
+
} else {
|
7
|
+
var mod = {
|
8
|
+
exports: {}
|
9
|
+
};
|
10
|
+
factory(mod.exports, global.three);
|
11
|
+
global.ConvexHull = mod.exports;
|
12
|
+
}
|
13
|
+
})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _three) {
|
14
|
+
"use strict";
|
15
|
+
|
16
|
+
Object.defineProperty(_exports, "__esModule", {
|
17
|
+
value: true
|
18
|
+
});
|
19
|
+
_exports.ConvexHull = void 0;
|
20
|
+
|
21
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
22
|
+
|
23
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
24
|
+
|
25
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
26
|
+
|
27
|
+
/**
|
28
|
+
* Ported from: https://github.com/maurizzzio/quickhull3d/ by Mauricio Poppe (https://github.com/maurizzzio)
|
29
|
+
*/
|
30
|
+
var Visible = 0;
|
31
|
+
var Deleted = 1;
|
32
|
+
|
33
|
+
var _v1 = new _three.Vector3();
|
34
|
+
|
35
|
+
var _line3 = new _three.Line3();
|
36
|
+
|
37
|
+
var _plane = new _three.Plane();
|
38
|
+
|
39
|
+
var _closestPoint = new _three.Vector3();
|
40
|
+
|
41
|
+
var _triangle = new _three.Triangle();
|
42
|
+
|
43
|
+
var ConvexHull = /*#__PURE__*/function () {
|
44
|
+
function ConvexHull() {
|
45
|
+
_classCallCheck(this, ConvexHull);
|
46
|
+
|
47
|
+
this.tolerance = -1;
|
48
|
+
this.faces = []; // the generated faces of the convex hull
|
49
|
+
|
50
|
+
this.newFaces = []; // this array holds the faces that are generated within a single iteration
|
51
|
+
// the vertex lists work as follows:
|
52
|
+
//
|
53
|
+
// let 'a' and 'b' be 'Face' instances
|
54
|
+
// let 'v' be points wrapped as instance of 'Vertex'
|
55
|
+
//
|
56
|
+
// [v, v, ..., v, v, v, ...]
|
57
|
+
// ^ ^
|
58
|
+
// | |
|
59
|
+
// a.outside b.outside
|
60
|
+
//
|
61
|
+
|
62
|
+
this.assigned = new VertexList();
|
63
|
+
this.unassigned = new VertexList();
|
64
|
+
this.vertices = []; // vertices of the hull (internal representation of given geometry data)
|
65
|
+
}
|
66
|
+
|
67
|
+
_createClass(ConvexHull, [{
|
68
|
+
key: "setFromPoints",
|
69
|
+
value: function setFromPoints(points) {
|
70
|
+
if (Array.isArray(points) !== true) {
|
71
|
+
console.error('THREE.ConvexHull: Points parameter is not an array.');
|
72
|
+
}
|
73
|
+
|
74
|
+
if (points.length < 4) {
|
75
|
+
console.error('THREE.ConvexHull: The algorithm needs at least four points.');
|
76
|
+
}
|
77
|
+
|
78
|
+
this.makeEmpty();
|
79
|
+
|
80
|
+
for (var i = 0, l = points.length; i < l; i++) {
|
81
|
+
this.vertices.push(new VertexNode(points[i]));
|
82
|
+
}
|
83
|
+
|
84
|
+
this.compute();
|
85
|
+
return this;
|
86
|
+
}
|
87
|
+
}, {
|
88
|
+
key: "setFromObject",
|
89
|
+
value: function setFromObject(object) {
|
90
|
+
var points = [];
|
91
|
+
object.updateMatrixWorld(true);
|
92
|
+
object.traverse(function (node) {
|
93
|
+
var geometry = node.geometry;
|
94
|
+
|
95
|
+
if (geometry !== undefined) {
|
96
|
+
if (geometry.isGeometry) {
|
97
|
+
console.error('THREE.ConvexHull no longer supports Geometry. Use THREE.BufferGeometry instead.');
|
98
|
+
return;
|
99
|
+
} else if (geometry.isBufferGeometry) {
|
100
|
+
var attribute = geometry.attributes.position;
|
101
|
+
|
102
|
+
if (attribute !== undefined) {
|
103
|
+
for (var i = 0, l = attribute.count; i < l; i++) {
|
104
|
+
var point = new _three.Vector3();
|
105
|
+
point.fromBufferAttribute(attribute, i).applyMatrix4(node.matrixWorld);
|
106
|
+
points.push(point);
|
107
|
+
}
|
108
|
+
}
|
109
|
+
}
|
110
|
+
}
|
111
|
+
});
|
112
|
+
return this.setFromPoints(points);
|
113
|
+
}
|
114
|
+
}, {
|
115
|
+
key: "containsPoint",
|
116
|
+
value: function containsPoint(point) {
|
117
|
+
var faces = this.faces;
|
118
|
+
|
119
|
+
for (var i = 0, l = faces.length; i < l; i++) {
|
120
|
+
var face = faces[i]; // compute signed distance and check on what half space the point lies
|
121
|
+
|
122
|
+
if (face.distanceToPoint(point) > this.tolerance) return false;
|
123
|
+
}
|
124
|
+
|
125
|
+
return true;
|
126
|
+
}
|
127
|
+
}, {
|
128
|
+
key: "intersectRay",
|
129
|
+
value: function intersectRay(ray, target) {
|
130
|
+
// based on "Fast Ray-Convex Polyhedron Intersection" by Eric Haines, GRAPHICS GEMS II
|
131
|
+
var faces = this.faces;
|
132
|
+
var tNear = -Infinity;
|
133
|
+
var tFar = Infinity;
|
134
|
+
|
135
|
+
for (var i = 0, l = faces.length; i < l; i++) {
|
136
|
+
var face = faces[i]; // interpret faces as planes for the further computation
|
137
|
+
|
138
|
+
var vN = face.distanceToPoint(ray.origin);
|
139
|
+
var vD = face.normal.dot(ray.direction); // if the origin is on the positive side of a plane (so the plane can "see" the origin) and
|
140
|
+
// the ray is turned away or parallel to the plane, there is no intersection
|
141
|
+
|
142
|
+
if (vN > 0 && vD >= 0) return null; // compute the distance from the ray’s origin to the intersection with the plane
|
143
|
+
|
144
|
+
var t = vD !== 0 ? -vN / vD : 0; // only proceed if the distance is positive. a negative distance means the intersection point
|
145
|
+
// lies "behind" the origin
|
146
|
+
|
147
|
+
if (t <= 0) continue; // now categorized plane as front-facing or back-facing
|
148
|
+
|
149
|
+
if (vD > 0) {
|
150
|
+
// plane faces away from the ray, so this plane is a back-face
|
151
|
+
tFar = Math.min(t, tFar);
|
152
|
+
} else {
|
153
|
+
// front-face
|
154
|
+
tNear = Math.max(t, tNear);
|
155
|
+
}
|
156
|
+
|
157
|
+
if (tNear > tFar) {
|
158
|
+
// if tNear ever is greater than tFar, the ray must miss the convex hull
|
159
|
+
return null;
|
160
|
+
}
|
161
|
+
} // evaluate intersection point
|
162
|
+
// always try tNear first since its the closer intersection point
|
163
|
+
|
164
|
+
|
165
|
+
if (tNear !== -Infinity) {
|
166
|
+
ray.at(tNear, target);
|
167
|
+
} else {
|
168
|
+
ray.at(tFar, target);
|
169
|
+
}
|
170
|
+
|
171
|
+
return target;
|
172
|
+
}
|
173
|
+
}, {
|
174
|
+
key: "intersectsRay",
|
175
|
+
value: function intersectsRay(ray) {
|
176
|
+
return this.intersectRay(ray, _v1) !== null;
|
177
|
+
}
|
178
|
+
}, {
|
179
|
+
key: "makeEmpty",
|
180
|
+
value: function makeEmpty() {
|
181
|
+
this.faces = [];
|
182
|
+
this.vertices = [];
|
183
|
+
return this;
|
184
|
+
} // Adds a vertex to the 'assigned' list of vertices and assigns it to the given face
|
185
|
+
|
186
|
+
}, {
|
187
|
+
key: "addVertexToFace",
|
188
|
+
value: function addVertexToFace(vertex, face) {
|
189
|
+
vertex.face = face;
|
190
|
+
|
191
|
+
if (face.outside === null) {
|
192
|
+
this.assigned.append(vertex);
|
193
|
+
} else {
|
194
|
+
this.assigned.insertBefore(face.outside, vertex);
|
195
|
+
}
|
196
|
+
|
197
|
+
face.outside = vertex;
|
198
|
+
return this;
|
199
|
+
} // Removes a vertex from the 'assigned' list of vertices and from the given face
|
200
|
+
|
201
|
+
}, {
|
202
|
+
key: "removeVertexFromFace",
|
203
|
+
value: function removeVertexFromFace(vertex, face) {
|
204
|
+
if (vertex === face.outside) {
|
205
|
+
// fix face.outside link
|
206
|
+
if (vertex.next !== null && vertex.next.face === face) {
|
207
|
+
// face has at least 2 outside vertices, move the 'outside' reference
|
208
|
+
face.outside = vertex.next;
|
209
|
+
} else {
|
210
|
+
// vertex was the only outside vertex that face had
|
211
|
+
face.outside = null;
|
212
|
+
}
|
213
|
+
}
|
214
|
+
|
215
|
+
this.assigned.remove(vertex);
|
216
|
+
return this;
|
217
|
+
} // Removes all the visible vertices that a given face is able to see which are stored in the 'assigned' vertext list
|
218
|
+
|
219
|
+
}, {
|
220
|
+
key: "removeAllVerticesFromFace",
|
221
|
+
value: function removeAllVerticesFromFace(face) {
|
222
|
+
if (face.outside !== null) {
|
223
|
+
// reference to the first and last vertex of this face
|
224
|
+
var start = face.outside;
|
225
|
+
var end = face.outside;
|
226
|
+
|
227
|
+
while (end.next !== null && end.next.face === face) {
|
228
|
+
end = end.next;
|
229
|
+
}
|
230
|
+
|
231
|
+
this.assigned.removeSubList(start, end); // fix references
|
232
|
+
|
233
|
+
start.prev = end.next = null;
|
234
|
+
face.outside = null;
|
235
|
+
return start;
|
236
|
+
}
|
237
|
+
} // Removes all the visible vertices that 'face' is able to see
|
238
|
+
|
239
|
+
}, {
|
240
|
+
key: "deleteFaceVertices",
|
241
|
+
value: function deleteFaceVertices(face, absorbingFace) {
|
242
|
+
var faceVertices = this.removeAllVerticesFromFace(face);
|
243
|
+
|
244
|
+
if (faceVertices !== undefined) {
|
245
|
+
if (absorbingFace === undefined) {
|
246
|
+
// mark the vertices to be reassigned to some other face
|
247
|
+
this.unassigned.appendChain(faceVertices);
|
248
|
+
} else {
|
249
|
+
// if there's an absorbing face try to assign as many vertices as possible to it
|
250
|
+
var vertex = faceVertices;
|
251
|
+
|
252
|
+
do {
|
253
|
+
// we need to buffer the subsequent vertex at this point because the 'vertex.next' reference
|
254
|
+
// will be changed by upcoming method calls
|
255
|
+
var nextVertex = vertex.next;
|
256
|
+
var distance = absorbingFace.distanceToPoint(vertex.point); // check if 'vertex' is able to see 'absorbingFace'
|
257
|
+
|
258
|
+
if (distance > this.tolerance) {
|
259
|
+
this.addVertexToFace(vertex, absorbingFace);
|
260
|
+
} else {
|
261
|
+
this.unassigned.append(vertex);
|
262
|
+
} // now assign next vertex
|
263
|
+
|
264
|
+
|
265
|
+
vertex = nextVertex;
|
266
|
+
} while (vertex !== null);
|
267
|
+
}
|
268
|
+
}
|
269
|
+
|
270
|
+
return this;
|
271
|
+
} // Reassigns as many vertices as possible from the unassigned list to the new faces
|
272
|
+
|
273
|
+
}, {
|
274
|
+
key: "resolveUnassignedPoints",
|
275
|
+
value: function resolveUnassignedPoints(newFaces) {
|
276
|
+
if (this.unassigned.isEmpty() === false) {
|
277
|
+
var vertex = this.unassigned.first();
|
278
|
+
|
279
|
+
do {
|
280
|
+
// buffer 'next' reference, see .deleteFaceVertices()
|
281
|
+
var nextVertex = vertex.next;
|
282
|
+
var maxDistance = this.tolerance;
|
283
|
+
var maxFace = null;
|
284
|
+
|
285
|
+
for (var i = 0; i < newFaces.length; i++) {
|
286
|
+
var face = newFaces[i];
|
287
|
+
|
288
|
+
if (face.mark === Visible) {
|
289
|
+
var distance = face.distanceToPoint(vertex.point);
|
290
|
+
|
291
|
+
if (distance > maxDistance) {
|
292
|
+
maxDistance = distance;
|
293
|
+
maxFace = face;
|
294
|
+
}
|
295
|
+
|
296
|
+
if (maxDistance > 1000 * this.tolerance) break;
|
297
|
+
}
|
298
|
+
} // 'maxFace' can be null e.g. if there are identical vertices
|
299
|
+
|
300
|
+
|
301
|
+
if (maxFace !== null) {
|
302
|
+
this.addVertexToFace(vertex, maxFace);
|
303
|
+
}
|
304
|
+
|
305
|
+
vertex = nextVertex;
|
306
|
+
} while (vertex !== null);
|
307
|
+
}
|
308
|
+
|
309
|
+
return this;
|
310
|
+
} // Computes the extremes of a simplex which will be the initial hull
|
311
|
+
|
312
|
+
}, {
|
313
|
+
key: "computeExtremes",
|
314
|
+
value: function computeExtremes() {
|
315
|
+
var min = new _three.Vector3();
|
316
|
+
var max = new _three.Vector3();
|
317
|
+
var minVertices = [];
|
318
|
+
var maxVertices = []; // initially assume that the first vertex is the min/max
|
319
|
+
|
320
|
+
for (var i = 0; i < 3; i++) {
|
321
|
+
minVertices[i] = maxVertices[i] = this.vertices[0];
|
322
|
+
}
|
323
|
+
|
324
|
+
min.copy(this.vertices[0].point);
|
325
|
+
max.copy(this.vertices[0].point); // compute the min/max vertex on all six directions
|
326
|
+
|
327
|
+
for (var _i = 0, l = this.vertices.length; _i < l; _i++) {
|
328
|
+
var vertex = this.vertices[_i];
|
329
|
+
var point = vertex.point; // update the min coordinates
|
330
|
+
|
331
|
+
for (var j = 0; j < 3; j++) {
|
332
|
+
if (point.getComponent(j) < min.getComponent(j)) {
|
333
|
+
min.setComponent(j, point.getComponent(j));
|
334
|
+
minVertices[j] = vertex;
|
335
|
+
}
|
336
|
+
} // update the max coordinates
|
337
|
+
|
338
|
+
|
339
|
+
for (var _j = 0; _j < 3; _j++) {
|
340
|
+
if (point.getComponent(_j) > max.getComponent(_j)) {
|
341
|
+
max.setComponent(_j, point.getComponent(_j));
|
342
|
+
maxVertices[_j] = vertex;
|
343
|
+
}
|
344
|
+
}
|
345
|
+
} // use min/max vectors to compute an optimal epsilon
|
346
|
+
|
347
|
+
|
348
|
+
this.tolerance = 3 * Number.EPSILON * (Math.max(Math.abs(min.x), Math.abs(max.x)) + Math.max(Math.abs(min.y), Math.abs(max.y)) + Math.max(Math.abs(min.z), Math.abs(max.z)));
|
349
|
+
return {
|
350
|
+
min: minVertices,
|
351
|
+
max: maxVertices
|
352
|
+
};
|
353
|
+
} // Computes the initial simplex assigning to its faces all the points
|
354
|
+
// that are candidates to form part of the hull
|
355
|
+
|
356
|
+
}, {
|
357
|
+
key: "computeInitialHull",
|
358
|
+
value: function computeInitialHull() {
|
359
|
+
var vertices = this.vertices;
|
360
|
+
var extremes = this.computeExtremes();
|
361
|
+
var min = extremes.min;
|
362
|
+
var max = extremes.max; // 1. Find the two vertices 'v0' and 'v1' with the greatest 1d separation
|
363
|
+
// (max.x - min.x)
|
364
|
+
// (max.y - min.y)
|
365
|
+
// (max.z - min.z)
|
366
|
+
|
367
|
+
var maxDistance = 0;
|
368
|
+
var index = 0;
|
369
|
+
|
370
|
+
for (var i = 0; i < 3; i++) {
|
371
|
+
var distance = max[i].point.getComponent(i) - min[i].point.getComponent(i);
|
372
|
+
|
373
|
+
if (distance > maxDistance) {
|
374
|
+
maxDistance = distance;
|
375
|
+
index = i;
|
376
|
+
}
|
377
|
+
}
|
378
|
+
|
379
|
+
var v0 = min[index];
|
380
|
+
var v1 = max[index];
|
381
|
+
var v2;
|
382
|
+
var v3; // 2. The next vertex 'v2' is the one farthest to the line formed by 'v0' and 'v1'
|
383
|
+
|
384
|
+
maxDistance = 0;
|
385
|
+
|
386
|
+
_line3.set(v0.point, v1.point);
|
387
|
+
|
388
|
+
for (var _i2 = 0, l = this.vertices.length; _i2 < l; _i2++) {
|
389
|
+
var vertex = vertices[_i2];
|
390
|
+
|
391
|
+
if (vertex !== v0 && vertex !== v1) {
|
392
|
+
_line3.closestPointToPoint(vertex.point, true, _closestPoint);
|
393
|
+
|
394
|
+
var _distance = _closestPoint.distanceToSquared(vertex.point);
|
395
|
+
|
396
|
+
if (_distance > maxDistance) {
|
397
|
+
maxDistance = _distance;
|
398
|
+
v2 = vertex;
|
399
|
+
}
|
400
|
+
}
|
401
|
+
} // 3. The next vertex 'v3' is the one farthest to the plane 'v0', 'v1', 'v2'
|
402
|
+
|
403
|
+
|
404
|
+
maxDistance = -1;
|
405
|
+
|
406
|
+
_plane.setFromCoplanarPoints(v0.point, v1.point, v2.point);
|
407
|
+
|
408
|
+
for (var _i3 = 0, _l = this.vertices.length; _i3 < _l; _i3++) {
|
409
|
+
var _vertex = vertices[_i3];
|
410
|
+
|
411
|
+
if (_vertex !== v0 && _vertex !== v1 && _vertex !== v2) {
|
412
|
+
var _distance2 = Math.abs(_plane.distanceToPoint(_vertex.point));
|
413
|
+
|
414
|
+
if (_distance2 > maxDistance) {
|
415
|
+
maxDistance = _distance2;
|
416
|
+
v3 = _vertex;
|
417
|
+
}
|
418
|
+
}
|
419
|
+
}
|
420
|
+
|
421
|
+
var faces = [];
|
422
|
+
|
423
|
+
if (_plane.distanceToPoint(v3.point) < 0) {
|
424
|
+
// the face is not able to see the point so 'plane.normal' is pointing outside the tetrahedron
|
425
|
+
faces.push(Face.create(v0, v1, v2), Face.create(v3, v1, v0), Face.create(v3, v2, v1), Face.create(v3, v0, v2)); // set the twin edge
|
426
|
+
|
427
|
+
for (var _i4 = 0; _i4 < 3; _i4++) {
|
428
|
+
var j = (_i4 + 1) % 3; // join face[ i ] i > 0, with the first face
|
429
|
+
|
430
|
+
faces[_i4 + 1].getEdge(2).setTwin(faces[0].getEdge(j)); // join face[ i ] with face[ i + 1 ], 1 <= i <= 3
|
431
|
+
|
432
|
+
|
433
|
+
faces[_i4 + 1].getEdge(1).setTwin(faces[j + 1].getEdge(0));
|
434
|
+
}
|
435
|
+
} else {
|
436
|
+
// the face is able to see the point so 'plane.normal' is pointing inside the tetrahedron
|
437
|
+
faces.push(Face.create(v0, v2, v1), Face.create(v3, v0, v1), Face.create(v3, v1, v2), Face.create(v3, v2, v0)); // set the twin edge
|
438
|
+
|
439
|
+
for (var _i5 = 0; _i5 < 3; _i5++) {
|
440
|
+
var _j2 = (_i5 + 1) % 3; // join face[ i ] i > 0, with the first face
|
441
|
+
|
442
|
+
|
443
|
+
faces[_i5 + 1].getEdge(2).setTwin(faces[0].getEdge((3 - _i5) % 3)); // join face[ i ] with face[ i + 1 ]
|
444
|
+
|
445
|
+
|
446
|
+
faces[_i5 + 1].getEdge(0).setTwin(faces[_j2 + 1].getEdge(1));
|
447
|
+
}
|
448
|
+
} // the initial hull is the tetrahedron
|
449
|
+
|
450
|
+
|
451
|
+
for (var _i6 = 0; _i6 < 4; _i6++) {
|
452
|
+
this.faces.push(faces[_i6]);
|
453
|
+
} // initial assignment of vertices to the faces of the tetrahedron
|
454
|
+
|
455
|
+
|
456
|
+
for (var _i7 = 0, _l2 = vertices.length; _i7 < _l2; _i7++) {
|
457
|
+
var _vertex2 = vertices[_i7];
|
458
|
+
|
459
|
+
if (_vertex2 !== v0 && _vertex2 !== v1 && _vertex2 !== v2 && _vertex2 !== v3) {
|
460
|
+
maxDistance = this.tolerance;
|
461
|
+
var maxFace = null;
|
462
|
+
|
463
|
+
for (var _j3 = 0; _j3 < 4; _j3++) {
|
464
|
+
var _distance3 = this.faces[_j3].distanceToPoint(_vertex2.point);
|
465
|
+
|
466
|
+
if (_distance3 > maxDistance) {
|
467
|
+
maxDistance = _distance3;
|
468
|
+
maxFace = this.faces[_j3];
|
469
|
+
}
|
470
|
+
}
|
471
|
+
|
472
|
+
if (maxFace !== null) {
|
473
|
+
this.addVertexToFace(_vertex2, maxFace);
|
474
|
+
}
|
475
|
+
}
|
476
|
+
}
|
477
|
+
|
478
|
+
return this;
|
479
|
+
} // Removes inactive faces
|
480
|
+
|
481
|
+
}, {
|
482
|
+
key: "reindexFaces",
|
483
|
+
value: function reindexFaces() {
|
484
|
+
var activeFaces = [];
|
485
|
+
|
486
|
+
for (var i = 0; i < this.faces.length; i++) {
|
487
|
+
var face = this.faces[i];
|
488
|
+
|
489
|
+
if (face.mark === Visible) {
|
490
|
+
activeFaces.push(face);
|
491
|
+
}
|
492
|
+
}
|
493
|
+
|
494
|
+
this.faces = activeFaces;
|
495
|
+
return this;
|
496
|
+
} // Finds the next vertex to create faces with the current hull
|
497
|
+
|
498
|
+
}, {
|
499
|
+
key: "nextVertexToAdd",
|
500
|
+
value: function nextVertexToAdd() {
|
501
|
+
// if the 'assigned' list of vertices is empty, no vertices are left. return with 'undefined'
|
502
|
+
if (this.assigned.isEmpty() === false) {
|
503
|
+
var eyeVertex,
|
504
|
+
maxDistance = 0; // grap the first available face and start with the first visible vertex of that face
|
505
|
+
|
506
|
+
var eyeFace = this.assigned.first().face;
|
507
|
+
var vertex = eyeFace.outside; // now calculate the farthest vertex that face can see
|
508
|
+
|
509
|
+
do {
|
510
|
+
var distance = eyeFace.distanceToPoint(vertex.point);
|
511
|
+
|
512
|
+
if (distance > maxDistance) {
|
513
|
+
maxDistance = distance;
|
514
|
+
eyeVertex = vertex;
|
515
|
+
}
|
516
|
+
|
517
|
+
vertex = vertex.next;
|
518
|
+
} while (vertex !== null && vertex.face === eyeFace);
|
519
|
+
|
520
|
+
return eyeVertex;
|
521
|
+
}
|
522
|
+
} // Computes a chain of half edges in CCW order called the 'horizon'.
|
523
|
+
// For an edge to be part of the horizon it must join a face that can see
|
524
|
+
// 'eyePoint' and a face that cannot see 'eyePoint'.
|
525
|
+
|
526
|
+
}, {
|
527
|
+
key: "computeHorizon",
|
528
|
+
value: function computeHorizon(eyePoint, crossEdge, face, horizon) {
|
529
|
+
// moves face's vertices to the 'unassigned' vertex list
|
530
|
+
this.deleteFaceVertices(face);
|
531
|
+
face.mark = Deleted;
|
532
|
+
var edge;
|
533
|
+
|
534
|
+
if (crossEdge === null) {
|
535
|
+
edge = crossEdge = face.getEdge(0);
|
536
|
+
} else {
|
537
|
+
// start from the next edge since 'crossEdge' was already analyzed
|
538
|
+
// (actually 'crossEdge.twin' was the edge who called this method recursively)
|
539
|
+
edge = crossEdge.next;
|
540
|
+
}
|
541
|
+
|
542
|
+
do {
|
543
|
+
var twinEdge = edge.twin;
|
544
|
+
var oppositeFace = twinEdge.face;
|
545
|
+
|
546
|
+
if (oppositeFace.mark === Visible) {
|
547
|
+
if (oppositeFace.distanceToPoint(eyePoint) > this.tolerance) {
|
548
|
+
// the opposite face can see the vertex, so proceed with next edge
|
549
|
+
this.computeHorizon(eyePoint, twinEdge, oppositeFace, horizon);
|
550
|
+
} else {
|
551
|
+
// the opposite face can't see the vertex, so this edge is part of the horizon
|
552
|
+
horizon.push(edge);
|
553
|
+
}
|
554
|
+
}
|
555
|
+
|
556
|
+
edge = edge.next;
|
557
|
+
} while (edge !== crossEdge);
|
558
|
+
|
559
|
+
return this;
|
560
|
+
} // Creates a face with the vertices 'eyeVertex.point', 'horizonEdge.tail' and 'horizonEdge.head' in CCW order
|
561
|
+
|
562
|
+
}, {
|
563
|
+
key: "addAdjoiningFace",
|
564
|
+
value: function addAdjoiningFace(eyeVertex, horizonEdge) {
|
565
|
+
// all the half edges are created in ccw order thus the face is always pointing outside the hull
|
566
|
+
var face = Face.create(eyeVertex, horizonEdge.tail(), horizonEdge.head());
|
567
|
+
this.faces.push(face); // join face.getEdge( - 1 ) with the horizon's opposite edge face.getEdge( - 1 ) = face.getEdge( 2 )
|
568
|
+
|
569
|
+
face.getEdge(-1).setTwin(horizonEdge.twin);
|
570
|
+
return face.getEdge(0); // the half edge whose vertex is the eyeVertex
|
571
|
+
} // Adds 'horizon.length' faces to the hull, each face will be linked with the
|
572
|
+
// horizon opposite face and the face on the left/right
|
573
|
+
|
574
|
+
}, {
|
575
|
+
key: "addNewFaces",
|
576
|
+
value: function addNewFaces(eyeVertex, horizon) {
|
577
|
+
this.newFaces = [];
|
578
|
+
var firstSideEdge = null;
|
579
|
+
var previousSideEdge = null;
|
580
|
+
|
581
|
+
for (var i = 0; i < horizon.length; i++) {
|
582
|
+
var horizonEdge = horizon[i]; // returns the right side edge
|
583
|
+
|
584
|
+
var sideEdge = this.addAdjoiningFace(eyeVertex, horizonEdge);
|
585
|
+
|
586
|
+
if (firstSideEdge === null) {
|
587
|
+
firstSideEdge = sideEdge;
|
588
|
+
} else {
|
589
|
+
// joins face.getEdge( 1 ) with previousFace.getEdge( 0 )
|
590
|
+
sideEdge.next.setTwin(previousSideEdge);
|
591
|
+
}
|
592
|
+
|
593
|
+
this.newFaces.push(sideEdge.face);
|
594
|
+
previousSideEdge = sideEdge;
|
595
|
+
} // perform final join of new faces
|
596
|
+
|
597
|
+
|
598
|
+
firstSideEdge.next.setTwin(previousSideEdge);
|
599
|
+
return this;
|
600
|
+
} // Adds a vertex to the hull
|
601
|
+
|
602
|
+
}, {
|
603
|
+
key: "addVertexToHull",
|
604
|
+
value: function addVertexToHull(eyeVertex) {
|
605
|
+
var horizon = [];
|
606
|
+
this.unassigned.clear(); // remove 'eyeVertex' from 'eyeVertex.face' so that it can't be added to the 'unassigned' vertex list
|
607
|
+
|
608
|
+
this.removeVertexFromFace(eyeVertex, eyeVertex.face);
|
609
|
+
this.computeHorizon(eyeVertex.point, null, eyeVertex.face, horizon);
|
610
|
+
this.addNewFaces(eyeVertex, horizon); // reassign 'unassigned' vertices to the new faces
|
611
|
+
|
612
|
+
this.resolveUnassignedPoints(this.newFaces);
|
613
|
+
return this;
|
614
|
+
}
|
615
|
+
}, {
|
616
|
+
key: "cleanup",
|
617
|
+
value: function cleanup() {
|
618
|
+
this.assigned.clear();
|
619
|
+
this.unassigned.clear();
|
620
|
+
this.newFaces = [];
|
621
|
+
return this;
|
622
|
+
}
|
623
|
+
}, {
|
624
|
+
key: "compute",
|
625
|
+
value: function compute() {
|
626
|
+
var vertex;
|
627
|
+
this.computeInitialHull(); // add all available vertices gradually to the hull
|
628
|
+
|
629
|
+
while ((vertex = this.nextVertexToAdd()) !== undefined) {
|
630
|
+
this.addVertexToHull(vertex);
|
631
|
+
}
|
632
|
+
|
633
|
+
this.reindexFaces();
|
634
|
+
this.cleanup();
|
635
|
+
return this;
|
636
|
+
}
|
637
|
+
}]);
|
638
|
+
|
639
|
+
return ConvexHull;
|
640
|
+
}(); //
|
641
|
+
|
642
|
+
|
643
|
+
_exports.ConvexHull = ConvexHull;
|
644
|
+
|
645
|
+
var Face = /*#__PURE__*/function () {
|
646
|
+
function Face() {
|
647
|
+
_classCallCheck(this, Face);
|
648
|
+
|
649
|
+
this.normal = new _three.Vector3();
|
650
|
+
this.midpoint = new _three.Vector3();
|
651
|
+
this.area = 0;
|
652
|
+
this.constant = 0; // signed distance from face to the origin
|
653
|
+
|
654
|
+
this.outside = null; // reference to a vertex in a vertex list this face can see
|
655
|
+
|
656
|
+
this.mark = Visible;
|
657
|
+
this.edge = null;
|
658
|
+
}
|
659
|
+
|
660
|
+
_createClass(Face, [{
|
661
|
+
key: "getEdge",
|
662
|
+
value: function getEdge(i) {
|
663
|
+
var edge = this.edge;
|
664
|
+
|
665
|
+
while (i > 0) {
|
666
|
+
edge = edge.next;
|
667
|
+
i--;
|
668
|
+
}
|
669
|
+
|
670
|
+
while (i < 0) {
|
671
|
+
edge = edge.prev;
|
672
|
+
i++;
|
673
|
+
}
|
674
|
+
|
675
|
+
return edge;
|
676
|
+
}
|
677
|
+
}, {
|
678
|
+
key: "compute",
|
679
|
+
value: function compute() {
|
680
|
+
var a = this.edge.tail();
|
681
|
+
var b = this.edge.head();
|
682
|
+
var c = this.edge.next.head();
|
683
|
+
|
684
|
+
_triangle.set(a.point, b.point, c.point);
|
685
|
+
|
686
|
+
_triangle.getNormal(this.normal);
|
687
|
+
|
688
|
+
_triangle.getMidpoint(this.midpoint);
|
689
|
+
|
690
|
+
this.area = _triangle.getArea();
|
691
|
+
this.constant = this.normal.dot(this.midpoint);
|
692
|
+
return this;
|
693
|
+
}
|
694
|
+
}, {
|
695
|
+
key: "distanceToPoint",
|
696
|
+
value: function distanceToPoint(point) {
|
697
|
+
return this.normal.dot(point) - this.constant;
|
698
|
+
}
|
699
|
+
}], [{
|
700
|
+
key: "create",
|
701
|
+
value: function create(a, b, c) {
|
702
|
+
var face = new Face();
|
703
|
+
var e0 = new HalfEdge(a, face);
|
704
|
+
var e1 = new HalfEdge(b, face);
|
705
|
+
var e2 = new HalfEdge(c, face); // join edges
|
706
|
+
|
707
|
+
e0.next = e2.prev = e1;
|
708
|
+
e1.next = e0.prev = e2;
|
709
|
+
e2.next = e1.prev = e0; // main half edge reference
|
710
|
+
|
711
|
+
face.edge = e0;
|
712
|
+
return face.compute();
|
713
|
+
}
|
714
|
+
}]);
|
715
|
+
|
716
|
+
return Face;
|
717
|
+
}(); // Entity for a Doubly-Connected Edge List (DCEL).
|
718
|
+
|
719
|
+
|
720
|
+
var HalfEdge = /*#__PURE__*/function () {
|
721
|
+
function HalfEdge(vertex, face) {
|
722
|
+
_classCallCheck(this, HalfEdge);
|
723
|
+
|
724
|
+
this.vertex = vertex;
|
725
|
+
this.prev = null;
|
726
|
+
this.next = null;
|
727
|
+
this.twin = null;
|
728
|
+
this.face = face;
|
729
|
+
}
|
730
|
+
|
731
|
+
_createClass(HalfEdge, [{
|
732
|
+
key: "head",
|
733
|
+
value: function head() {
|
734
|
+
return this.vertex;
|
735
|
+
}
|
736
|
+
}, {
|
737
|
+
key: "tail",
|
738
|
+
value: function tail() {
|
739
|
+
return this.prev ? this.prev.vertex : null;
|
740
|
+
}
|
741
|
+
}, {
|
742
|
+
key: "length",
|
743
|
+
value: function length() {
|
744
|
+
var head = this.head();
|
745
|
+
var tail = this.tail();
|
746
|
+
|
747
|
+
if (tail !== null) {
|
748
|
+
return tail.point.distanceTo(head.point);
|
749
|
+
}
|
750
|
+
|
751
|
+
return -1;
|
752
|
+
}
|
753
|
+
}, {
|
754
|
+
key: "lengthSquared",
|
755
|
+
value: function lengthSquared() {
|
756
|
+
var head = this.head();
|
757
|
+
var tail = this.tail();
|
758
|
+
|
759
|
+
if (tail !== null) {
|
760
|
+
return tail.point.distanceToSquared(head.point);
|
761
|
+
}
|
762
|
+
|
763
|
+
return -1;
|
764
|
+
}
|
765
|
+
}, {
|
766
|
+
key: "setTwin",
|
767
|
+
value: function setTwin(edge) {
|
768
|
+
this.twin = edge;
|
769
|
+
edge.twin = this;
|
770
|
+
return this;
|
771
|
+
}
|
772
|
+
}]);
|
773
|
+
|
774
|
+
return HalfEdge;
|
775
|
+
}(); // A vertex as a double linked list node.
|
776
|
+
|
777
|
+
|
778
|
+
var VertexNode = /*#__PURE__*/_createClass(function VertexNode(point) {
|
779
|
+
_classCallCheck(this, VertexNode);
|
780
|
+
|
781
|
+
this.point = point;
|
782
|
+
this.prev = null;
|
783
|
+
this.next = null;
|
784
|
+
this.face = null; // the face that is able to see this vertex
|
785
|
+
}); // A double linked list that contains vertex nodes.
|
786
|
+
|
787
|
+
|
788
|
+
var VertexList = /*#__PURE__*/function () {
|
789
|
+
function VertexList() {
|
790
|
+
_classCallCheck(this, VertexList);
|
791
|
+
|
792
|
+
this.head = null;
|
793
|
+
this.tail = null;
|
794
|
+
}
|
795
|
+
|
796
|
+
_createClass(VertexList, [{
|
797
|
+
key: "first",
|
798
|
+
value: function first() {
|
799
|
+
return this.head;
|
800
|
+
}
|
801
|
+
}, {
|
802
|
+
key: "last",
|
803
|
+
value: function last() {
|
804
|
+
return this.tail;
|
805
|
+
}
|
806
|
+
}, {
|
807
|
+
key: "clear",
|
808
|
+
value: function clear() {
|
809
|
+
this.head = this.tail = null;
|
810
|
+
return this;
|
811
|
+
} // Inserts a vertex before the target vertex
|
812
|
+
|
813
|
+
}, {
|
814
|
+
key: "insertBefore",
|
815
|
+
value: function insertBefore(target, vertex) {
|
816
|
+
vertex.prev = target.prev;
|
817
|
+
vertex.next = target;
|
818
|
+
|
819
|
+
if (vertex.prev === null) {
|
820
|
+
this.head = vertex;
|
821
|
+
} else {
|
822
|
+
vertex.prev.next = vertex;
|
823
|
+
}
|
824
|
+
|
825
|
+
target.prev = vertex;
|
826
|
+
return this;
|
827
|
+
} // Inserts a vertex after the target vertex
|
828
|
+
|
829
|
+
}, {
|
830
|
+
key: "insertAfter",
|
831
|
+
value: function insertAfter(target, vertex) {
|
832
|
+
vertex.prev = target;
|
833
|
+
vertex.next = target.next;
|
834
|
+
|
835
|
+
if (vertex.next === null) {
|
836
|
+
this.tail = vertex;
|
837
|
+
} else {
|
838
|
+
vertex.next.prev = vertex;
|
839
|
+
}
|
840
|
+
|
841
|
+
target.next = vertex;
|
842
|
+
return this;
|
843
|
+
} // Appends a vertex to the end of the linked list
|
844
|
+
|
845
|
+
}, {
|
846
|
+
key: "append",
|
847
|
+
value: function append(vertex) {
|
848
|
+
if (this.head === null) {
|
849
|
+
this.head = vertex;
|
850
|
+
} else {
|
851
|
+
this.tail.next = vertex;
|
852
|
+
}
|
853
|
+
|
854
|
+
vertex.prev = this.tail;
|
855
|
+
vertex.next = null; // the tail has no subsequent vertex
|
856
|
+
|
857
|
+
this.tail = vertex;
|
858
|
+
return this;
|
859
|
+
} // Appends a chain of vertices where 'vertex' is the head.
|
860
|
+
|
861
|
+
}, {
|
862
|
+
key: "appendChain",
|
863
|
+
value: function appendChain(vertex) {
|
864
|
+
if (this.head === null) {
|
865
|
+
this.head = vertex;
|
866
|
+
} else {
|
867
|
+
this.tail.next = vertex;
|
868
|
+
}
|
869
|
+
|
870
|
+
vertex.prev = this.tail; // ensure that the 'tail' reference points to the last vertex of the chain
|
871
|
+
|
872
|
+
while (vertex.next !== null) {
|
873
|
+
vertex = vertex.next;
|
874
|
+
}
|
875
|
+
|
876
|
+
this.tail = vertex;
|
877
|
+
return this;
|
878
|
+
} // Removes a vertex from the linked list
|
879
|
+
|
880
|
+
}, {
|
881
|
+
key: "remove",
|
882
|
+
value: function remove(vertex) {
|
883
|
+
if (vertex.prev === null) {
|
884
|
+
this.head = vertex.next;
|
885
|
+
} else {
|
886
|
+
vertex.prev.next = vertex.next;
|
887
|
+
}
|
888
|
+
|
889
|
+
if (vertex.next === null) {
|
890
|
+
this.tail = vertex.prev;
|
891
|
+
} else {
|
892
|
+
vertex.next.prev = vertex.prev;
|
893
|
+
}
|
894
|
+
|
895
|
+
return this;
|
896
|
+
} // Removes a list of vertices whose 'head' is 'a' and whose 'tail' is b
|
897
|
+
|
898
|
+
}, {
|
899
|
+
key: "removeSubList",
|
900
|
+
value: function removeSubList(a, b) {
|
901
|
+
if (a.prev === null) {
|
902
|
+
this.head = b.next;
|
903
|
+
} else {
|
904
|
+
a.prev.next = b.next;
|
905
|
+
}
|
906
|
+
|
907
|
+
if (b.next === null) {
|
908
|
+
this.tail = a.prev;
|
909
|
+
} else {
|
910
|
+
b.next.prev = a.prev;
|
911
|
+
}
|
912
|
+
|
913
|
+
return this;
|
914
|
+
}
|
915
|
+
}, {
|
916
|
+
key: "isEmpty",
|
917
|
+
value: function isEmpty() {
|
918
|
+
return this.head === null;
|
919
|
+
}
|
920
|
+
}]);
|
921
|
+
|
922
|
+
return VertexList;
|
923
|
+
}();
|
924
|
+
});
|