@woosh/meep-engine 2.164.0 → 2.165.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/build/bundle-worker-terrain.js +1 -1
- package/package.json +1 -1
- package/src/core/binary/BitImage2.d.ts +91 -0
- package/src/core/binary/BitImage2.d.ts.map +1 -0
- package/src/core/binary/BitImage2.js +242 -0
- package/src/core/geom/2d/oriented-box/min_area_rect_2d.d.ts +22 -0
- package/src/core/geom/2d/oriented-box/min_area_rect_2d.d.ts.map +1 -0
- package/src/core/geom/2d/oriented-box/min_area_rect_2d.js +69 -0
- package/src/core/geom/2d/packing/skyline.d.ts +116 -0
- package/src/core/geom/2d/packing/skyline.d.ts.map +1 -0
- package/src/core/geom/2d/packing/skyline.js +258 -0
- package/src/core/geom/2d/triangle/tri2_rasterize_conservative.d.ts +18 -0
- package/src/core/geom/2d/triangle/tri2_rasterize_conservative.d.ts.map +1 -0
- package/src/core/geom/2d/triangle/tri2_rasterize_conservative.js +86 -0
- package/src/core/geom/3d/atlas/ATLAS_PORT_PLAN.md +486 -0
- package/src/core/geom/3d/atlas/BFF_PLAN.md +174 -0
- package/src/core/geom/3d/atlas/Chart.d.ts +58 -0
- package/src/core/geom/3d/atlas/Chart.d.ts.map +1 -0
- package/src/core/geom/3d/atlas/Chart.js +77 -0
- package/src/core/geom/3d/atlas/REVIEW_02.md +392 -0
- package/src/core/geom/3d/atlas/atlas_bench_lib.d.ts +73 -0
- package/src/core/geom/3d/atlas/atlas_bench_lib.d.ts.map +1 -0
- package/src/core/geom/3d/atlas/atlas_bench_lib.js +315 -0
- package/src/core/geom/3d/atlas/atlas_chart_type.d.ts +17 -0
- package/src/core/geom/3d/atlas/atlas_chart_type.d.ts.map +1 -0
- package/src/core/geom/3d/atlas/atlas_chart_type.js +16 -0
- package/src/core/geom/3d/atlas/atlas_compute_charts.d.ts +25 -0
- package/src/core/geom/3d/atlas/atlas_compute_charts.d.ts.map +1 -0
- package/src/core/geom/3d/atlas/atlas_compute_charts.js +188 -0
- package/src/core/geom/3d/atlas/atlas_extract_chart.d.ts +17 -0
- package/src/core/geom/3d/atlas/atlas_extract_chart.d.ts.map +1 -0
- package/src/core/geom/3d/atlas/atlas_extract_chart.js +107 -0
- package/src/core/geom/3d/atlas/atlas_generate.d.ts +39 -0
- package/src/core/geom/3d/atlas/atlas_generate.d.ts.map +1 -0
- package/src/core/geom/3d/atlas/atlas_generate.js +43 -0
- package/src/core/geom/3d/atlas/atlas_test_fixtures.d.ts +84 -0
- package/src/core/geom/3d/atlas/atlas_test_fixtures.d.ts.map +1 -0
- package/src/core/geom/3d/atlas/atlas_test_fixtures.js +266 -0
- package/src/core/geom/3d/atlas/atlas_write_chart_uvs.d.ts +25 -0
- package/src/core/geom/3d/atlas/atlas_write_chart_uvs.d.ts.map +1 -0
- package/src/core/geom/3d/atlas/atlas_write_chart_uvs.js +36 -0
- package/src/core/geom/3d/atlas/data/atlas_build_edge_dihedrals.d.ts +22 -0
- package/src/core/geom/3d/atlas/data/atlas_build_edge_dihedrals.d.ts.map +1 -0
- package/src/core/geom/3d/atlas/data/atlas_build_edge_dihedrals.js +62 -0
- package/src/core/geom/3d/atlas/data/atlas_build_edge_lengths.d.ts +9 -0
- package/src/core/geom/3d/atlas/data/atlas_build_edge_lengths.d.ts.map +1 -0
- package/src/core/geom/3d/atlas/data/atlas_build_edge_lengths.js +33 -0
- package/src/core/geom/3d/atlas/data/atlas_build_face_areas.d.ts +9 -0
- package/src/core/geom/3d/atlas/data/atlas_build_face_areas.d.ts.map +1 -0
- package/src/core/geom/3d/atlas/data/atlas_build_face_areas.js +50 -0
- package/src/core/geom/3d/atlas/io/atlas_mesh_weld_colocals.d.ts +27 -0
- package/src/core/geom/3d/atlas/io/atlas_mesh_weld_colocals.d.ts.map +1 -0
- package/src/core/geom/3d/atlas/io/atlas_mesh_weld_colocals.js +39 -0
- package/src/core/geom/3d/atlas/io/bt_loop_uv.d.ts +22 -0
- package/src/core/geom/3d/atlas/io/bt_loop_uv.d.ts.map +1 -0
- package/src/core/geom/3d/atlas/io/bt_loop_uv.js +57 -0
- package/src/core/geom/3d/atlas/pack/ChartPlacement.d.ts +36 -0
- package/src/core/geom/3d/atlas/pack/ChartPlacement.d.ts.map +1 -0
- package/src/core/geom/3d/atlas/pack/ChartPlacement.js +46 -0
- package/src/core/geom/3d/atlas/pack/atlas_pack_charts.d.ts +62 -0
- package/src/core/geom/3d/atlas/pack/atlas_pack_charts.d.ts.map +1 -0
- package/src/core/geom/3d/atlas/pack/atlas_pack_charts.js +551 -0
- package/src/core/geom/3d/atlas/param/atlas_chart_param_validity.d.ts +22 -0
- package/src/core/geom/3d/atlas/param/atlas_chart_param_validity.d.ts.map +1 -0
- package/src/core/geom/3d/atlas/param/atlas_chart_param_validity.js +73 -0
- package/src/core/geom/3d/atlas/param/atlas_chart_parameterize_bff.d.ts +37 -0
- package/src/core/geom/3d/atlas/param/atlas_chart_parameterize_bff.d.ts.map +1 -0
- package/src/core/geom/3d/atlas/param/atlas_chart_parameterize_bff.js +270 -0
- package/src/core/geom/3d/atlas/param/atlas_chart_parameterize_lscm.d.ts +23 -0
- package/src/core/geom/3d/atlas/param/atlas_chart_parameterize_lscm.d.ts.map +1 -0
- package/src/core/geom/3d/atlas/param/atlas_chart_parameterize_lscm.js +224 -0
- package/src/core/geom/3d/atlas/param/atlas_chart_parameterize_ortho.d.ts +14 -0
- package/src/core/geom/3d/atlas/param/atlas_chart_parameterize_ortho.d.ts.map +1 -0
- package/src/core/geom/3d/atlas/param/atlas_chart_parameterize_ortho.js +38 -0
- package/src/core/geom/3d/atlas/param/atlas_chart_stretch_metric.d.ts +22 -0
- package/src/core/geom/3d/atlas/param/atlas_chart_stretch_metric.d.ts.map +1 -0
- package/src/core/geom/3d/atlas/param/atlas_chart_stretch_metric.js +86 -0
- package/src/core/geom/3d/atlas/param/atlas_piecewise_resegment.d.ts +20 -0
- package/src/core/geom/3d/atlas/param/atlas_piecewise_resegment.d.ts.map +1 -0
- package/src/core/geom/3d/atlas/param/atlas_piecewise_resegment.js +183 -0
- package/src/core/geom/3d/atlas/param/fit_plane_basis.d.ts +27 -0
- package/src/core/geom/3d/atlas/param/fit_plane_basis.d.ts.map +1 -0
- package/src/core/geom/3d/atlas/param/fit_plane_basis.js +66 -0
- package/src/core/geom/3d/atlas/segment/RegionGraph.d.ts +31 -0
- package/src/core/geom/3d/atlas/segment/RegionGraph.d.ts.map +1 -0
- package/src/core/geom/3d/atlas/segment/RegionGraph.js +40 -0
- package/src/core/geom/3d/atlas/segment/atlas_build_region_graph.d.ts +23 -0
- package/src/core/geom/3d/atlas/segment/atlas_build_region_graph.d.ts.map +1 -0
- package/src/core/geom/3d/atlas/segment/atlas_build_region_graph.js +136 -0
- package/src/core/geom/3d/atlas/segment/atlas_compute_planar_regions.d.ts +24 -0
- package/src/core/geom/3d/atlas/segment/atlas_compute_planar_regions.d.ts.map +1 -0
- package/src/core/geom/3d/atlas/segment/atlas_compute_planar_regions.js +77 -0
- package/src/core/geom/3d/atlas/segment/atlas_merge_charts.d.ts +27 -0
- package/src/core/geom/3d/atlas/segment/atlas_merge_charts.d.ts.map +1 -0
- package/src/core/geom/3d/atlas/segment/atlas_merge_charts.js +113 -0
- package/src/core/geom/3d/atlas/segment/atlas_segment_charts.d.ts +44 -0
- package/src/core/geom/3d/atlas/segment/atlas_segment_charts.d.ts.map +1 -0
- package/src/core/geom/3d/atlas/segment/atlas_segment_charts.js +275 -0
- package/src/core/geom/3d/atlas/segment/atlas_segment_charts_atomic.d.ts +22 -0
- package/src/core/geom/3d/atlas/segment/atlas_segment_charts_atomic.d.ts.map +1 -0
- package/src/core/geom/3d/atlas/segment/atlas_segment_charts_atomic.js +199 -0
- package/src/core/geom/3d/line/line3_compute_point_segment_point_distance_unfolded.d.ts +32 -0
- package/src/core/geom/3d/line/line3_compute_point_segment_point_distance_unfolded.d.ts.map +1 -0
- package/src/core/geom/3d/line/line3_compute_point_segment_point_distance_unfolded.js +64 -0
- package/src/core/geom/3d/mat4/m4_from_rotation_translation_scale.d.ts +20 -0
- package/src/core/geom/3d/mat4/m4_from_rotation_translation_scale.d.ts.map +1 -0
- package/src/core/geom/3d/mat4/m4_from_rotation_translation_scale.js +66 -0
- package/src/core/geom/3d/sphere/harmonics/sh3_dering_optimize_positive.d.ts.map +1 -1
- package/src/core/geom/3d/sphere/harmonics/sh3_dering_optimize_positive.js +13 -11
- package/src/core/geom/3d/sphere/sphere_compute_bounding_of_2_spheres.d.ts.map +1 -1
- package/src/core/geom/3d/sphere/sphere_compute_bounding_of_2_spheres.js +4 -3
- package/src/core/geom/3d/topology/simplify/decimate_edge_collapse_snap.d.ts.map +1 -1
- package/src/core/geom/3d/topology/simplify/decimate_edge_collapse_snap.js +4 -3
- package/src/core/geom/3d/topology/simplify/quadratic/Quadric3.d.ts.map +1 -1
- package/src/core/geom/3d/topology/simplify/quadratic/Quadric3.js +4 -3
- package/src/core/geom/3d/topology/simplify/quadratic/apply_border_penalty_to_vertex_quadrics.d.ts.map +1 -1
- package/src/core/geom/3d/topology/simplify/quadratic/apply_border_penalty_to_vertex_quadrics.js +10 -6
- package/src/core/geom/3d/topology/struct/TopoMesh.js +2 -2
- package/src/core/geom/3d/topology/struct/TopoTriangle.d.ts +0 -2
- package/src/core/geom/3d/topology/struct/TopoTriangle.d.ts.map +1 -1
- package/src/core/geom/3d/topology/struct/TopoTriangle.js +2 -2
- package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_face_find_path_polyanya.d.ts.map +1 -1
- package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_face_find_path_polyanya.js +8 -27
- package/src/core/geom/vec3/v3_cotangent.d.ts +20 -0
- package/src/core/geom/vec3/v3_cotangent.d.ts.map +1 -0
- package/src/core/geom/vec3/v3_cotangent.js +29 -0
- package/src/core/geom/vec3/v3_matrix3_multiply.d.ts +19 -0
- package/src/core/geom/vec3/v3_matrix3_multiply.d.ts.map +1 -0
- package/src/core/geom/vec3/v3_matrix3_multiply.js +30 -0
- package/src/core/geom/vec3/v3_multiply.d.ts +16 -0
- package/src/core/geom/vec3/v3_multiply.d.ts.map +1 -0
- package/src/core/geom/vec3/v3_multiply.js +19 -0
- package/src/core/math/linalg/cg/cg_solve.d.ts +24 -0
- package/src/core/math/linalg/cg/cg_solve.d.ts.map +1 -0
- package/src/core/math/linalg/cg/cg_solve.js +106 -0
- package/src/core/math/linalg/cg/cg_solve_normal_equations.d.ts +21 -0
- package/src/core/math/linalg/cg/cg_solve_normal_equations.d.ts.map +1 -0
- package/src/core/math/linalg/cg/cg_solve_normal_equations.js +59 -0
- package/src/core/math/linalg/eigen/matrix_symmetric_3x3_eigen.d.ts +19 -0
- package/src/core/math/linalg/eigen/matrix_symmetric_3x3_eigen.d.ts.map +1 -0
- package/src/core/math/linalg/eigen/matrix_symmetric_3x3_eigen.js +117 -0
- package/src/core/math/linalg/sparse/SparseMatrixCSR.d.ts +50 -0
- package/src/core/math/linalg/sparse/SparseMatrixCSR.d.ts.map +1 -0
- package/src/core/math/linalg/sparse/SparseMatrixCSR.js +88 -0
- package/src/core/math/linalg/sparse/spm_matvec.d.ts +9 -0
- package/src/core/math/linalg/sparse/spm_matvec.d.ts.map +1 -0
- package/src/core/math/linalg/sparse/spm_matvec.js +22 -0
- package/src/core/math/linalg/sparse/spm_matvec_transpose.d.ts +12 -0
- package/src/core/math/linalg/sparse/spm_matvec_transpose.d.ts.map +1 -0
- package/src/core/math/linalg/sparse/spm_matvec_transpose.js +29 -0
- package/src/core/math/physics/mie/MIE_PARTICLES_STANDARD_PRECOMPUTED.d.ts +39 -0
- package/src/core/math/physics/mie/MIE_PARTICLES_STANDARD_PRECOMPUTED.js +22 -1
- package/src/core/math/physics/mie/compute_mie_particle_properties_rgb.d.ts.map +1 -1
- package/src/core/math/physics/mie/compute_mie_particle_properties_rgb.js +32 -9
- package/src/core/math/physics/mie/compute_mie_phase.d.ts +2 -3
- package/src/core/math/physics/mie/compute_mie_phase.d.ts.map +1 -1
- package/src/core/math/physics/mie/compute_mie_phase.js +1 -3
- package/src/core/math/physics/mie/lorenz_mie_coefs.d.ts +0 -1
- package/src/core/math/physics/mie/lorenz_mie_coefs.d.ts.map +1 -1
- package/src/core/math/physics/mie/lorenz_mie_coefs.js +0 -7
- package/src/engine/ecs/attachment/TransformAttachmentBinding.js +3 -3
- package/src/engine/ecs/gui/hud/HeadsUpDisplaySystem.js +2 -2
- package/src/engine/ecs/terrain/ecs/Terrain.d.ts.map +1 -1
- package/src/engine/ecs/terrain/ecs/Terrain.js +4 -3
- package/src/engine/ecs/terrain/tiles/TerrainTile.js +2 -2
- package/src/engine/ecs/terrain/tiles/TerrainTileManager.d.ts.map +1 -1
- package/src/engine/ecs/terrain/tiles/TerrainTileManager.js +9 -8
- package/src/engine/graphics/GraphicsEngine.d.ts.map +1 -1
- package/src/engine/graphics/GraphicsEngine.js +2 -1
- package/src/engine/graphics/ecs/decal/v2/FPDecalSystem.js +2 -2
- package/src/engine/graphics/ecs/decal/v2/prototypeDecalSystem.js +2 -2
- package/src/engine/graphics/ecs/mesh-v2/ShadedGeometry.js +2 -2
- package/src/engine/graphics/ecs/mesh-v2/ShadedGeometrySystem.d.ts.map +1 -1
- package/src/engine/graphics/ecs/mesh-v2/ShadedGeometrySystem.js +0 -1
- package/src/engine/graphics/ecs/path/tube/build/computeFrenetFrames.d.ts.map +1 -1
- package/src/engine/graphics/ecs/path/tube/build/computeFrenetFrames.js +8 -7
- package/src/engine/graphics/geometry/MikkT/AvgTSpace.d.ts.map +1 -1
- package/src/engine/graphics/geometry/MikkT/AvgTSpace.js +11 -6
- package/src/engine/graphics/geometry/MikkT/BuildNeighborsFast.d.ts.map +1 -1
- package/src/engine/graphics/geometry/MikkT/BuildNeighborsFast.js +2 -3
- package/src/engine/graphics/geometry/MikkT/CalcTexArea.d.ts.map +1 -1
- package/src/engine/graphics/geometry/MikkT/CalcTexArea.js +3 -4
- package/src/engine/graphics/geometry/MikkT/DegenEpilogue.js +4 -4
- package/src/engine/graphics/geometry/MikkT/EvalTspace.d.ts.map +1 -1
- package/src/engine/graphics/geometry/MikkT/EvalTspace.js +11 -8
- package/src/engine/graphics/geometry/MikkT/GenerateSharedVerticesIndexList.d.ts.map +1 -1
- package/src/engine/graphics/geometry/MikkT/GenerateSharedVerticesIndexList.js +7 -8
- package/src/engine/graphics/geometry/MikkT/GenerateTSpaces.js +8 -8
- package/src/engine/graphics/geometry/MikkT/InitTriInfo.d.ts.map +1 -1
- package/src/engine/graphics/geometry/MikkT/InitTriInfo.js +30 -25
- package/src/engine/graphics/geometry/MikkT/MikkTSpace.js +7 -7
- package/src/engine/graphics/geometry/MikkT/NormalizeSafe.d.ts +0 -1
- package/src/engine/graphics/geometry/MikkT/NormalizeSafe.d.ts.map +1 -1
- package/src/engine/graphics/geometry/MikkT/NormalizeSafe.js +6 -4
- package/src/engine/graphics/geometry/MikkT/STSpace.d.ts +0 -2
- package/src/engine/graphics/geometry/MikkT/STSpace.d.ts.map +1 -1
- package/src/engine/graphics/geometry/MikkT/STSpace.js +3 -3
- package/src/engine/graphics/geometry/MikkT/v3_scale_dot_sub_normalize.d.ts +0 -2
- package/src/engine/graphics/geometry/MikkT/v3_scale_dot_sub_normalize.d.ts.map +1 -1
- package/src/engine/graphics/geometry/MikkT/v3_scale_dot_sub_normalize.js +0 -1
- package/src/engine/graphics/impostors/octahedral/ImpostorBaker.d.ts +0 -2
- package/src/engine/graphics/impostors/octahedral/ImpostorBaker.d.ts.map +1 -1
- package/src/engine/graphics/impostors/octahedral/ImpostorBaker.js +4 -3
- package/src/engine/graphics/impostors/octahedral/grid/HemiOctahedralUvEncoder.js +2 -2
- package/src/engine/graphics/impostors/octahedral/grid/UvEncoder.d.ts +17 -7
- package/src/engine/graphics/impostors/voxel/VoxelImpostorBaker.js +2 -2
- package/src/engine/graphics/particles/particular/engine/utils/volume/ParticleVolume.js +3 -3
- package/src/engine/graphics/particles/particular/engine/utils/volume/prototypeParticleVolume.js +4 -3
- package/src/engine/graphics/render/forward_plus/LightManager.js +2 -2
- package/src/engine/graphics/render/forward_plus/model/Decal.d.ts +0 -2
- package/src/engine/graphics/render/forward_plus/model/Decal.d.ts.map +1 -1
- package/src/engine/graphics/render/forward_plus/model/Decal.js +3 -3
- package/src/engine/graphics/render/forward_plus/prototype/prototypeLightManager.js +4 -3
- package/src/engine/graphics/render/visibility/hiz/prototypeHiZ.js +6 -4
- package/src/engine/graphics/sh3/lightmap/ARTIFACTS_PLAN.md +146 -0
- package/src/engine/graphics/sh3/lightmap/CODE_REVIEW.md +121 -0
- package/src/engine/graphics/sh3/lightmap/LIGHTMAPPER_REVIEW.md +183 -0
- package/src/engine/graphics/sh3/lightmap/bake_lightmap_for_scene.d.ts +90 -0
- package/src/engine/graphics/sh3/lightmap/bake_lightmap_for_scene.d.ts.map +1 -0
- package/src/engine/graphics/sh3/lightmap/bake_lightmap_for_scene.js +678 -0
- package/src/engine/graphics/sh3/lightmap/lightmap_build_geometry.d.ts +32 -0
- package/src/engine/graphics/sh3/lightmap/lightmap_build_geometry.d.ts.map +1 -0
- package/src/engine/graphics/sh3/lightmap/lightmap_build_geometry.js +155 -0
- package/src/engine/graphics/sh3/lightmap/lightmap_denoise.d.ts +49 -0
- package/src/engine/graphics/sh3/lightmap/lightmap_denoise.d.ts.map +1 -0
- package/src/engine/graphics/sh3/lightmap/lightmap_denoise.js +136 -0
- package/src/engine/graphics/sh3/lightmap/lightmap_dilate.d.ts +19 -0
- package/src/engine/graphics/sh3/lightmap/lightmap_dilate.d.ts.map +1 -0
- package/src/engine/graphics/sh3/lightmap/lightmap_dilate.js +89 -0
- package/src/engine/graphics/sh3/lightmap/lightmap_gather.d.ts +54 -0
- package/src/engine/graphics/sh3/lightmap/lightmap_gather.d.ts.map +1 -0
- package/src/engine/graphics/sh3/lightmap/lightmap_gather.js +168 -0
- package/src/engine/graphics/sh3/lightmap/lightmap_rasterize_triangle.d.ts +30 -0
- package/src/engine/graphics/sh3/lightmap/lightmap_rasterize_triangle.d.ts.map +1 -0
- package/src/engine/graphics/sh3/lightmap/lightmap_rasterize_triangle.js +145 -0
- package/src/engine/graphics/sh3/lightmap/lightmap_seam_fix.d.ts +38 -0
- package/src/engine/graphics/sh3/lightmap/lightmap_seam_fix.d.ts.map +1 -0
- package/src/engine/graphics/sh3/lightmap/lightmap_seam_fix.js +152 -0
- package/src/engine/graphics/sh3/lightmap/prototypeLightmapBaker.d.ts +2 -0
- package/src/engine/graphics/sh3/lightmap/prototypeLightmapBaker.d.ts.map +1 -0
- package/src/engine/graphics/sh3/lightmap/prototypeLightmapBaker.js +186 -0
- package/src/engine/graphics/sh3/path_tracer/PathTracedMesh.d.ts.map +1 -1
- package/src/engine/graphics/sh3/path_tracer/PathTracedMesh.js +2 -2
- package/src/engine/graphics/sh3/path_tracer/PathTracer.js +2 -2
- package/src/engine/graphics/sh3/path_tracer/prepare_scene_gltf.d.ts.map +1 -1
- package/src/engine/graphics/sh3/path_tracer/prepare_scene_gltf.js +6 -4
- package/src/engine/graphics/sh3/path_tracer/prototypePathTracer.js +3 -3
- package/src/engine/graphics/sh3/path_tracer/texture/sample_material.d.ts.map +1 -1
- package/src/engine/graphics/sh3/path_tracer/texture/sample_material.js +5 -4
- package/src/engine/graphics/sh3/sky/hosek/prototype_hosek.js +2 -2
- package/src/engine/input/devices/KeyboardDevice.d.ts +61 -14
- package/src/engine/input/devices/KeyboardDevice.d.ts.map +1 -1
- package/src/engine/input/devices/KeyboardDevice.js +41 -15
- package/src/engine/input/devices/isHTMLElementFocusable.d.ts.map +1 -1
- package/src/engine/input/devices/isHTMLElementFocusable.js +2 -9
- package/src/engine/sound/simulation/prototypeAcousticSolver.js +261 -143
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
import { IndexedFloatMinHeap } from "../../../../collection/heap/IndexedFloatMinHeap.js";
|
|
2
|
+
import { NULL_POINTER } from "../../topology/struct/binary/BinaryTopology.js";
|
|
3
|
+
import { ATLAS_SEGMENT_DEFAULTS } from "./atlas_segment_charts.js";
|
|
4
|
+
|
|
5
|
+
// These mirror atlas_segment_charts (the face-granular twin); kept local so the
|
|
6
|
+
// two segmenters stay monomorphic.
|
|
7
|
+
const REJECT = Infinity;
|
|
8
|
+
const NORMAL_DEVIATION_REJECT = 0.707;
|
|
9
|
+
const STALE_EPSILON = 1e-6;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Region-atomic chart segmentation (xatlas grows whole coplanar regions as
|
|
13
|
+
* units). Identical greedy structure and cost to {@link atlas_segment_charts},
|
|
14
|
+
* but the growth nodes are planar regions from {@link atlas_build_region_graph}
|
|
15
|
+
* rather than individual triangles: a chart absorbs an entire region at a time.
|
|
16
|
+
* This keeps coplanar faces together (no seam through a flat surface) and is
|
|
17
|
+
* far cheaper on flat-heavy meshes (the heap holds regions, not triangles).
|
|
18
|
+
*
|
|
19
|
+
* Cost = `normalDeviationWeight·N + normalSeamWeight·NS + roundnessWeight·R`,
|
|
20
|
+
* with the same 73-degree hard reject and optional area/boundary caps. The
|
|
21
|
+
* candidate queue uses the same lazy re-evaluation. Deterministic.
|
|
22
|
+
*
|
|
23
|
+
* @param {RegionGraph} region_graph from atlas_build_region_graph
|
|
24
|
+
* @param {Uint32Array} region_of_face face -> region id (NULL_POINTER if unallocated)
|
|
25
|
+
* @param {object} [options] overrides of ATLAS_SEGMENT_DEFAULTS
|
|
26
|
+
* @returns {{face_chart: Int32Array, chart_count: number}}
|
|
27
|
+
*/
|
|
28
|
+
export function atlas_segment_charts_atomic(region_graph, region_of_face, options = {}) {
|
|
29
|
+
const opt = { ...ATLAS_SEGMENT_DEFAULTS, ...options };
|
|
30
|
+
const rg = region_graph;
|
|
31
|
+
const RC = rg.region_count;
|
|
32
|
+
|
|
33
|
+
const region_chart = new Int32Array(RC).fill(-1);
|
|
34
|
+
const region_cost = new Float32Array(RC);
|
|
35
|
+
const heap = new IndexedFloatMinHeap(Math.max(1, RC));
|
|
36
|
+
|
|
37
|
+
let chart_id = 0;
|
|
38
|
+
let chart_area = 0;
|
|
39
|
+
let chart_boundary = 0;
|
|
40
|
+
let accum_x = 0, accum_y = 0, accum_z = 0;
|
|
41
|
+
|
|
42
|
+
const cn = new Float32Array(3);
|
|
43
|
+
let out_area = 0;
|
|
44
|
+
let out_boundary = 0;
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Normalize the chart's running area-weighted normal accumulator into `cn`.
|
|
48
|
+
*/
|
|
49
|
+
function chart_unit_normal() {
|
|
50
|
+
const len = Math.sqrt(accum_x * accum_x + accum_y * accum_y + accum_z * accum_z) || 1;
|
|
51
|
+
cn[0] = accum_x / len;
|
|
52
|
+
cn[1] = accum_y / len;
|
|
53
|
+
cn[2] = accum_z / len;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Cost of adding region g to the current chart, or REJECT. Side effect: sets
|
|
58
|
+
* out_area / out_boundary for the caller to commit.
|
|
59
|
+
* @param {number} g region id
|
|
60
|
+
* @returns {number}
|
|
61
|
+
*/
|
|
62
|
+
function evaluate(g) {
|
|
63
|
+
const gx = rg.region_normal[g * 3];
|
|
64
|
+
const gy = rg.region_normal[g * 3 + 1];
|
|
65
|
+
const gz = rg.region_normal[g * 3 + 2];
|
|
66
|
+
const glen = Math.sqrt(gx * gx + gy * gy + gz * gz) || 1;
|
|
67
|
+
|
|
68
|
+
chart_unit_normal();
|
|
69
|
+
const dot = (cn[0] * gx + cn[1] * gy + cn[2] * gz) / glen;
|
|
70
|
+
const N = Math.min(1 - dot, 1);
|
|
71
|
+
if (N >= NORMAL_DEVIATION_REJECT) {
|
|
72
|
+
return REJECT;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
const new_area = chart_area + rg.region_area[g];
|
|
76
|
+
if (opt.maxChartArea > 0 && new_area > opt.maxChartArea) {
|
|
77
|
+
return REJECT;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
let shared = 0;
|
|
81
|
+
let seam = 0;
|
|
82
|
+
const start = rg.offsets[g];
|
|
83
|
+
const end = rg.offsets[g + 1];
|
|
84
|
+
for (let k = start; k < end; k++) {
|
|
85
|
+
if (region_chart[rg.adj[k]] === chart_id) {
|
|
86
|
+
shared += rg.adj_shared[k];
|
|
87
|
+
seam += rg.adj_seam[k];
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
const new_boundary = chart_boundary + rg.region_boundary[g] - 2 * shared;
|
|
92
|
+
if (opt.maxBoundaryLength > 0 && new_boundary > opt.maxBoundaryLength) {
|
|
93
|
+
return REJECT;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
const NS = shared > 0 ? seam / shared : 0;
|
|
97
|
+
|
|
98
|
+
let R = 0;
|
|
99
|
+
if (chart_area > 0 && chart_boundary > 0 && new_boundary > 0) {
|
|
100
|
+
const old_ratio = (chart_boundary * chart_boundary) / chart_area;
|
|
101
|
+
const new_ratio = (new_boundary * new_boundary) / new_area;
|
|
102
|
+
R = 1 - old_ratio / new_ratio;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
out_area = new_area;
|
|
106
|
+
out_boundary = new_boundary;
|
|
107
|
+
|
|
108
|
+
return opt.normalDeviationWeight * N + opt.normalSeamWeight * NS + opt.roundnessWeight * R;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* (Re-)evaluate and (re-)queue every unallocated region adjacent to r in the
|
|
113
|
+
* region graph, caching each candidate's cost in `region_cost`.
|
|
114
|
+
* @param {number} r region id just committed to the current chart
|
|
115
|
+
*/
|
|
116
|
+
function push_neighbours(r) {
|
|
117
|
+
const start = rg.offsets[r];
|
|
118
|
+
const end = rg.offsets[r + 1];
|
|
119
|
+
for (let k = start; k < end; k++) {
|
|
120
|
+
const h = rg.adj[k];
|
|
121
|
+
if (region_chart[h] === -1) {
|
|
122
|
+
const c = evaluate(h);
|
|
123
|
+
if (c !== REJECT) {
|
|
124
|
+
if (heap.contains(h)) {
|
|
125
|
+
heap.update(h, c);
|
|
126
|
+
} else {
|
|
127
|
+
heap.insert(h, c);
|
|
128
|
+
}
|
|
129
|
+
region_cost[h] = c;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
let chart_count = 0;
|
|
136
|
+
|
|
137
|
+
for (let seed = 0; seed < RC; seed++) {
|
|
138
|
+
if (region_chart[seed] !== -1) {
|
|
139
|
+
continue;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
chart_id = chart_count;
|
|
143
|
+
chart_count++;
|
|
144
|
+
heap.clear();
|
|
145
|
+
|
|
146
|
+
region_chart[seed] = chart_id;
|
|
147
|
+
accum_x = rg.region_normal[seed * 3];
|
|
148
|
+
accum_y = rg.region_normal[seed * 3 + 1];
|
|
149
|
+
accum_z = rg.region_normal[seed * 3 + 2];
|
|
150
|
+
chart_area = rg.region_area[seed];
|
|
151
|
+
chart_boundary = rg.region_boundary[seed];
|
|
152
|
+
|
|
153
|
+
push_neighbours(seed);
|
|
154
|
+
|
|
155
|
+
for (;;) {
|
|
156
|
+
const g = heap.pop_min();
|
|
157
|
+
if (g === -1) {
|
|
158
|
+
break;
|
|
159
|
+
}
|
|
160
|
+
if (region_chart[g] !== -1) {
|
|
161
|
+
continue;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
const stored = region_cost[g];
|
|
165
|
+
const fresh = evaluate(g);
|
|
166
|
+
if (fresh === REJECT) {
|
|
167
|
+
continue;
|
|
168
|
+
}
|
|
169
|
+
if (Math.abs(fresh - stored) > STALE_EPSILON) {
|
|
170
|
+
region_cost[g] = fresh;
|
|
171
|
+
heap.insert(g, fresh);
|
|
172
|
+
continue;
|
|
173
|
+
}
|
|
174
|
+
if (fresh > opt.maxCost) {
|
|
175
|
+
break;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
region_chart[g] = chart_id;
|
|
179
|
+
chart_area = out_area;
|
|
180
|
+
chart_boundary = out_boundary;
|
|
181
|
+
accum_x += rg.region_normal[g * 3];
|
|
182
|
+
accum_y += rg.region_normal[g * 3 + 1];
|
|
183
|
+
accum_z += rg.region_normal[g * 3 + 2];
|
|
184
|
+
|
|
185
|
+
push_neighbours(g);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
const face_count = region_of_face.length;
|
|
190
|
+
const face_chart = new Int32Array(face_count).fill(-1);
|
|
191
|
+
for (let f = 0; f < face_count; f++) {
|
|
192
|
+
const r = region_of_face[f];
|
|
193
|
+
if (r !== NULL_POINTER) {
|
|
194
|
+
face_chart[f] = region_chart[r];
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
return { face_chart, chart_count };
|
|
199
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shortest "bent string" from point P, touching the segment A->B, then continuing to point Q, with the
|
|
3
|
+
* two legs UNFOLDED flat across the segment's line. This is the 3D form of the classic 2D reflect-and-
|
|
4
|
+
* measure: reflect one point across the line carrying the segment, draw a straight chord; if that chord
|
|
5
|
+
* crosses the segment the chord length is the answer, otherwise the taut path bends around an endpoint.
|
|
6
|
+
*
|
|
7
|
+
* P and Q need not be coplanar with the segment. Each is decomposed against the segment's line into a
|
|
8
|
+
* tangential coordinate (along the line) and a perpendicular distance (to the line); the two perpendiculars
|
|
9
|
+
* are laid on opposite sides of the line (the fold), so the unfolded chord is well defined in 3D without
|
|
10
|
+
* any shared plane or global "up".
|
|
11
|
+
*
|
|
12
|
+
* Because it measures straight chords rather than an on-surface geodesic, the result is always <= the true
|
|
13
|
+
* across-the-edge geodesic distance -- i.e. it is an admissible lower bound (its use as the A* heuristic in
|
|
14
|
+
* navmesh path search). See also {@link line3_compute_segment_point_distance_eikonal} for the related
|
|
15
|
+
* wavefront-update primitive that takes seeded endpoint distances instead of a single source point.
|
|
16
|
+
*
|
|
17
|
+
* @param {number} px
|
|
18
|
+
* @param {number} py
|
|
19
|
+
* @param {number} pz first point (one leg's far end)
|
|
20
|
+
* @param {number} ax
|
|
21
|
+
* @param {number} ay
|
|
22
|
+
* @param {number} az segment endpoint A
|
|
23
|
+
* @param {number} bx
|
|
24
|
+
* @param {number} by
|
|
25
|
+
* @param {number} bz segment endpoint B
|
|
26
|
+
* @param {number} qx
|
|
27
|
+
* @param {number} qy
|
|
28
|
+
* @param {number} qz second point (other leg's far end)
|
|
29
|
+
* @returns {number} length of the shortest unfolded path P -> [A,B] -> Q
|
|
30
|
+
*/
|
|
31
|
+
export function line3_compute_point_segment_point_distance_unfolded(px: number, py: number, pz: number, ax: number, ay: number, az: number, bx: number, by: number, bz: number, qx: number, qy: number, qz: number): number;
|
|
32
|
+
//# sourceMappingURL=line3_compute_point_segment_point_distance_unfolded.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"line3_compute_point_segment_point_distance_unfolded.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/3d/line/line3_compute_point_segment_point_distance_unfolded.js"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wEAdW,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,GACJ,MAAM,CAmClB"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shortest "bent string" from point P, touching the segment A->B, then continuing to point Q, with the
|
|
3
|
+
* two legs UNFOLDED flat across the segment's line. This is the 3D form of the classic 2D reflect-and-
|
|
4
|
+
* measure: reflect one point across the line carrying the segment, draw a straight chord; if that chord
|
|
5
|
+
* crosses the segment the chord length is the answer, otherwise the taut path bends around an endpoint.
|
|
6
|
+
*
|
|
7
|
+
* P and Q need not be coplanar with the segment. Each is decomposed against the segment's line into a
|
|
8
|
+
* tangential coordinate (along the line) and a perpendicular distance (to the line); the two perpendiculars
|
|
9
|
+
* are laid on opposite sides of the line (the fold), so the unfolded chord is well defined in 3D without
|
|
10
|
+
* any shared plane or global "up".
|
|
11
|
+
*
|
|
12
|
+
* Because it measures straight chords rather than an on-surface geodesic, the result is always <= the true
|
|
13
|
+
* across-the-edge geodesic distance -- i.e. it is an admissible lower bound (its use as the A* heuristic in
|
|
14
|
+
* navmesh path search). See also {@link line3_compute_segment_point_distance_eikonal} for the related
|
|
15
|
+
* wavefront-update primitive that takes seeded endpoint distances instead of a single source point.
|
|
16
|
+
*
|
|
17
|
+
* @param {number} px
|
|
18
|
+
* @param {number} py
|
|
19
|
+
* @param {number} pz first point (one leg's far end)
|
|
20
|
+
* @param {number} ax
|
|
21
|
+
* @param {number} ay
|
|
22
|
+
* @param {number} az segment endpoint A
|
|
23
|
+
* @param {number} bx
|
|
24
|
+
* @param {number} by
|
|
25
|
+
* @param {number} bz segment endpoint B
|
|
26
|
+
* @param {number} qx
|
|
27
|
+
* @param {number} qy
|
|
28
|
+
* @param {number} qz second point (other leg's far end)
|
|
29
|
+
* @returns {number} length of the shortest unfolded path P -> [A,B] -> Q
|
|
30
|
+
*/
|
|
31
|
+
export function line3_compute_point_segment_point_distance_unfolded(
|
|
32
|
+
px, py, pz,
|
|
33
|
+
ax, ay, az,
|
|
34
|
+
bx, by, bz,
|
|
35
|
+
qx, qy, qz
|
|
36
|
+
) {
|
|
37
|
+
|
|
38
|
+
const dx = bx - ax, dy = by - ay, dz = bz - az;
|
|
39
|
+
const dlen2 = dx * dx + dy * dy + dz * dz;
|
|
40
|
+
const viaA = Math.hypot(px - ax, py - ay, pz - az) + Math.hypot(qx - ax, qy - ay, qz - az);
|
|
41
|
+
|
|
42
|
+
if (dlen2 < 1e-18) {
|
|
43
|
+
// degenerate segment: A == B, so the only touch point is that vertex
|
|
44
|
+
return viaA;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const dlen = Math.sqrt(dlen2), ux = dx / dlen, uy = dy / dlen, uz = dz / dlen;
|
|
48
|
+
const pt = (px - ax) * ux + (py - ay) * uy + (pz - az) * uz;
|
|
49
|
+
const pperp = Math.hypot(px - ax - pt * ux, py - ay - pt * uy, pz - az - pt * uz);
|
|
50
|
+
const qt = (qx - ax) * ux + (qy - ay) * uy + (qz - az) * uz;
|
|
51
|
+
const qperp = Math.hypot(qx - ax - qt * ux, qy - ay - qt * uy, qz - az - qt * uz);
|
|
52
|
+
|
|
53
|
+
const denom = pperp + qperp;
|
|
54
|
+
const xs = denom < 1e-12 ? pt : pt + (qt - pt) * pperp / denom; // segment crossing of the unfolded line
|
|
55
|
+
|
|
56
|
+
if (xs >= 0 && xs <= dlen) {
|
|
57
|
+
// taut string passes through the segment interior: the answer is the unfolded chord length
|
|
58
|
+
return Math.hypot(qt - pt, denom);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// crossing falls outside the segment: the path must bend around the nearer endpoint
|
|
62
|
+
const viaB = Math.hypot(px - bx, py - by, pz - bz) + Math.hypot(qx - bx, qy - by, qz - bz);
|
|
63
|
+
return Math.min(viaA, viaB);
|
|
64
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Compose a 4x4 transform matrix from a rotation quaternion, a translation and a
|
|
3
|
+
* (non-uniform) scale. `out = T * R * S`.
|
|
4
|
+
*
|
|
5
|
+
* Array-argument companion to {@link m4_compose} (which takes `{x,y,z}` / `{x,y,z,w}`
|
|
6
|
+
* objects): use this when the operands are already laid out as flat arrays. Mirrors
|
|
7
|
+
* gl-matrix `mat4.fromRotationTranslationScale`. The quaternion is assumed to be of
|
|
8
|
+
* unit length. Allocation-free.
|
|
9
|
+
*
|
|
10
|
+
* @param {number[]|Float32Array|Float64Array} out destination 4x4 matrix
|
|
11
|
+
* @param {number[]|Float32Array|Float64Array} q rotation quaternion `[x, y, z, w]`
|
|
12
|
+
* @param {number[]|Float32Array|Float64Array} v translation `[x, y, z]`
|
|
13
|
+
* @param {number[]|Float32Array|Float64Array} s scale `[x, y, z]`
|
|
14
|
+
* @returns {number[]|Float32Array|Float64Array} `out`, for convenience
|
|
15
|
+
*
|
|
16
|
+
* @author Alex Goldring
|
|
17
|
+
* @copyright Company Named Limited (c) 2026
|
|
18
|
+
*/
|
|
19
|
+
export function m4_from_rotation_translation_scale(out: number[] | Float32Array | Float64Array, q: number[] | Float32Array | Float64Array, v: number[] | Float32Array | Float64Array, s: number[] | Float32Array | Float64Array): number[] | Float32Array | Float64Array;
|
|
20
|
+
//# sourceMappingURL=m4_from_rotation_translation_scale.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"m4_from_rotation_translation_scale.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/3d/mat4/m4_from_rotation_translation_scale.js"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,wDATW,MAAM,EAAE,GAAC,YAAY,GAAC,YAAY,KAClC,MAAM,EAAE,GAAC,YAAY,GAAC,YAAY,KAClC,MAAM,EAAE,GAAC,YAAY,GAAC,YAAY,KAClC,MAAM,EAAE,GAAC,YAAY,GAAC,YAAY,GAChC,MAAM,EAAE,GAAC,YAAY,GAAC,YAAY,CAoD9C"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Compose a 4x4 transform matrix from a rotation quaternion, a translation and a
|
|
3
|
+
* (non-uniform) scale. `out = T * R * S`.
|
|
4
|
+
*
|
|
5
|
+
* Array-argument companion to {@link m4_compose} (which takes `{x,y,z}` / `{x,y,z,w}`
|
|
6
|
+
* objects): use this when the operands are already laid out as flat arrays. Mirrors
|
|
7
|
+
* gl-matrix `mat4.fromRotationTranslationScale`. The quaternion is assumed to be of
|
|
8
|
+
* unit length. Allocation-free.
|
|
9
|
+
*
|
|
10
|
+
* @param {number[]|Float32Array|Float64Array} out destination 4x4 matrix
|
|
11
|
+
* @param {number[]|Float32Array|Float64Array} q rotation quaternion `[x, y, z, w]`
|
|
12
|
+
* @param {number[]|Float32Array|Float64Array} v translation `[x, y, z]`
|
|
13
|
+
* @param {number[]|Float32Array|Float64Array} s scale `[x, y, z]`
|
|
14
|
+
* @returns {number[]|Float32Array|Float64Array} `out`, for convenience
|
|
15
|
+
*
|
|
16
|
+
* @author Alex Goldring
|
|
17
|
+
* @copyright Company Named Limited (c) 2026
|
|
18
|
+
*/
|
|
19
|
+
export function m4_from_rotation_translation_scale(out, q, v, s) {
|
|
20
|
+
const x = q[0];
|
|
21
|
+
const y = q[1];
|
|
22
|
+
const z = q[2];
|
|
23
|
+
const w = q[3];
|
|
24
|
+
|
|
25
|
+
const x2 = x + x;
|
|
26
|
+
const y2 = y + y;
|
|
27
|
+
const z2 = z + z;
|
|
28
|
+
|
|
29
|
+
const xx = x * x2;
|
|
30
|
+
const xy = x * y2;
|
|
31
|
+
const xz = x * z2;
|
|
32
|
+
|
|
33
|
+
const yy = y * y2;
|
|
34
|
+
const yz = y * z2;
|
|
35
|
+
const zz = z * z2;
|
|
36
|
+
|
|
37
|
+
const wx = w * x2;
|
|
38
|
+
const wy = w * y2;
|
|
39
|
+
const wz = w * z2;
|
|
40
|
+
|
|
41
|
+
const sx = s[0];
|
|
42
|
+
const sy = s[1];
|
|
43
|
+
const sz = s[2];
|
|
44
|
+
|
|
45
|
+
out[0] = (1 - (yy + zz)) * sx;
|
|
46
|
+
out[1] = (xy + wz) * sx;
|
|
47
|
+
out[2] = (xz - wy) * sx;
|
|
48
|
+
out[3] = 0;
|
|
49
|
+
|
|
50
|
+
out[4] = (xy - wz) * sy;
|
|
51
|
+
out[5] = (1 - (xx + zz)) * sy;
|
|
52
|
+
out[6] = (yz + wx) * sy;
|
|
53
|
+
out[7] = 0;
|
|
54
|
+
|
|
55
|
+
out[8] = (xz + wy) * sz;
|
|
56
|
+
out[9] = (yz - wx) * sz;
|
|
57
|
+
out[10] = (1 - (xx + yy)) * sz;
|
|
58
|
+
out[11] = 0;
|
|
59
|
+
|
|
60
|
+
out[12] = v[0];
|
|
61
|
+
out[13] = v[1];
|
|
62
|
+
out[14] = v[2];
|
|
63
|
+
out[15] = 1;
|
|
64
|
+
|
|
65
|
+
return out;
|
|
66
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sh3_dering_optimize_positive.d.ts","sourceRoot":"","sources":["../../../../../../../src/core/geom/3d/sphere/harmonics/sh3_dering_optimize_positive.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"sh3_dering_optimize_positive.d.ts","sourceRoot":"","sources":["../../../../../../../src/core/geom/3d/sphere/harmonics/sh3_dering_optimize_positive.js"],"names":[],"mappings":"AAmTA;;;;;;;GAOG;AACH,qDANW,MAAM,EAAE,GAAC,YAAY,GAAC,YAAY,iBAClC,MAAM,aACN,MAAM,EAAE,GAAC,YAAY,GAAC,YAAY,oBAClC,MAAM,oBACN,MAAM,QAIhB"}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { v3_normalize_array } from "../../../vec3/v3_normalize_array.js";
|
|
2
|
+
import { v3_negate_array } from "../../../vec3/v3_negate_array.js";
|
|
3
|
+
import { v3_cross } from "../../../vec3/v3_cross.js";
|
|
2
4
|
import { assert } from "../../../../assert.js";
|
|
3
5
|
import { array_copy } from "../../../../collection/array/array_copy.js";
|
|
4
6
|
import { min2 } from "../../../../math/min2.js";
|
|
@@ -56,21 +58,21 @@ function sh3_min(input_sh3) {
|
|
|
56
58
|
|
|
57
59
|
|
|
58
60
|
// first this to do is to rotate the SH to align Z with the optimal linear direction
|
|
59
|
-
const dir =
|
|
61
|
+
const dir = Float32Array.of(-input_sh3[3], -input_sh3[1], input_sh3[2]);
|
|
60
62
|
|
|
61
|
-
|
|
63
|
+
v3_normalize_array(dir, 0, dir, 0);
|
|
62
64
|
|
|
63
|
-
const z_axis =
|
|
64
|
-
|
|
65
|
+
const z_axis = new Float32Array(3);
|
|
66
|
+
v3_negate_array(z_axis, 0, dir, 0);
|
|
65
67
|
|
|
66
|
-
const x_axis =
|
|
67
|
-
|
|
68
|
-
|
|
68
|
+
const x_axis = new Float32Array(3);
|
|
69
|
+
v3_cross(x_axis, 0, z_axis[0], z_axis[1], z_axis[2], 0, 1, 0);
|
|
70
|
+
v3_normalize_array(x_axis, 0, x_axis, 0);
|
|
69
71
|
|
|
70
|
-
const y_axis =
|
|
71
|
-
|
|
72
|
+
const y_axis = new Float32Array(3);
|
|
73
|
+
v3_cross(y_axis, 0, x_axis[0], x_axis[1], x_axis[2], z_axis[0], z_axis[1], z_axis[2]);
|
|
72
74
|
|
|
73
|
-
const M =
|
|
75
|
+
const M = new Float32Array(9);
|
|
74
76
|
array_copy(x_axis, 0, M, 0, 3);
|
|
75
77
|
array_copy(y_axis, 0, M, 3, 3);
|
|
76
78
|
array_copy(dir, 0, M, 6, 3);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sphere_compute_bounding_of_2_spheres.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/3d/sphere/sphere_compute_bounding_of_2_spheres.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"sphere_compute_bounding_of_2_spheres.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/3d/sphere/sphere_compute_bounding_of_2_spheres.js"],"names":[],"mappings":"AAkBA;;;;;GAKG;AACH,6DAJW,YAAY,UAAM,MAAM,EAAE,KAC1B,YAAY,UAAM,MAAM,EAAE,KAC1B,YAAY,UAAM,MAAM,EAAE,QAoDpC"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
//
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import { v3_subtract } from "../../vec3/v3_subtract.js";
|
|
5
|
+
import { v3_normalize_array } from "../../vec3/v3_normalize_array.js";
|
|
5
6
|
import { max2 } from "../../../math/max2.js";
|
|
6
7
|
import { Miniball } from "../../packing/miniball/Miniball.js";
|
|
7
8
|
import { PointSet } from "../../packing/miniball/PointSet.js";
|
|
@@ -23,7 +24,7 @@ const outer_points = new Float32Array(12);
|
|
|
23
24
|
*/
|
|
24
25
|
export function sphere_compute_bounding_of_2_spheres(result, a, b) {
|
|
25
26
|
// compute distance between the spheres
|
|
26
|
-
|
|
27
|
+
v3_subtract(delta_direction, 0, a[0], a[1], a[2], b[0], b[1], b[2]);
|
|
27
28
|
|
|
28
29
|
if (delta_direction[0] === 0 && delta_direction[1] === 0 && delta_direction[2] === 0) {
|
|
29
30
|
// sphere centers overlap
|
|
@@ -34,7 +35,7 @@ export function sphere_compute_bounding_of_2_spheres(result, a, b) {
|
|
|
34
35
|
return;
|
|
35
36
|
}
|
|
36
37
|
|
|
37
|
-
|
|
38
|
+
v3_normalize_array(delta_direction, 0, delta_direction, 0);
|
|
38
39
|
|
|
39
40
|
// compute outer points on the spheres along the line between their centers
|
|
40
41
|
const a_radius = a[3];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decimate_edge_collapse_snap.d.ts","sourceRoot":"","sources":["../../../../../../../src/core/geom/3d/topology/simplify/decimate_edge_collapse_snap.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"decimate_edge_collapse_snap.d.ts","sourceRoot":"","sources":["../../../../../../../src/core/geom/3d/topology/simplify/decimate_edge_collapse_snap.js"],"names":[],"mappings":"AAiDA;;;;GAIG;AACH,kFASC;AAED;;;;;GAKG;AACH,sFAHW,IAAI,MAAM,CAAC,GACT,aAAW,SAAS,CA0ChC;AAqBD;;;;;GAKG;AACH,uEAHW,IAAI,MAAM,WAAU,uBACpB,IAAI,MAAM,CAAC,UAsBrB;AAsBD;;;;;;;;;GASG;AACH,4GALW,IAAI,MAAM,WAAU,yCAEpB,IAAI,MAAM,CAAC,GACT,OAAO,CAmFnB"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { v3_distance_sqr } from "../../../vec3/v3_distance_sqr.js";
|
|
2
|
+
import { v3_dot } from "../../../vec3/v3_dot.js";
|
|
2
3
|
import { array_get_index_in_range } from "../../../../collection/array/array_get_index_in_range.js";
|
|
3
4
|
import { EPSILON } from "../../../../math/EPSILON.js";
|
|
4
5
|
import { min2 } from "../../../../math/min2.js";
|
|
@@ -119,9 +120,9 @@ function build_edge_cost_squared_topology(edge) {
|
|
|
119
120
|
tm_vertex_compute_normal(scratch_v3_0, 0, edge.v0);
|
|
120
121
|
tm_vertex_compute_normal(scratch_v3_1, 0, edge.v1);
|
|
121
122
|
|
|
122
|
-
const distance_sqr =
|
|
123
|
+
const distance_sqr = v3_distance_sqr(edge.v0.x, edge.v0.y, edge.v0.z, edge.v1.x, edge.v1.y, edge.v1.z);
|
|
123
124
|
|
|
124
|
-
let cost = Math.abs(
|
|
125
|
+
let cost = Math.abs(v3_dot(scratch_v3_0[0], scratch_v3_0[1], scratch_v3_0[2], scratch_v3_1[0], scratch_v3_1[1], scratch_v3_1[2]))
|
|
125
126
|
/ min2(-distance_sqr, -EPSILON);
|
|
126
127
|
|
|
127
128
|
return cost;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Quadric3.d.ts","sourceRoot":"","sources":["../../../../../../../../src/core/geom/3d/topology/simplify/quadratic/Quadric3.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Quadric3.d.ts","sourceRoot":"","sources":["../../../../../../../../src/core/geom/3d/topology/simplify/quadratic/Quadric3.js"],"names":[],"mappings":"AAMA;;;;;;;;;GASG;AACH;IACI,cAEC;IAMD,iBAEC;IAND,cAEC;IAGG,OAAW;IAOf,iBAEC;IAND,cAEC;IAGG,OAAW;IAOf,iBAEC;IAND,cAEC;IAGG,OAAW;IAOf,iBAEC;IAND,cAEC;IAGG,OAAW;IAOf,iBAEC;IAND,cAEC;IAGG,OAAW;IAOf,iBAEC;IAND,cAEC;IAGG,OAAW;IAOf,iBAEC;IAND,cAEC;IAGG,OAAW;IAOf,iBAEC;IAND,cAEC;IAGG,OAAW;IAOf,iBAEC;IAND,cAEC;IAGG,OAAW;IAOf,iBAEC;IAND,cAEC;IAGG,OAAW;IAGf;;;OAGG;IACH,kBAFW,UAAU,MAAM,CAAC,GAAC,MAAM,EAAE,GAAC,YAAY,QAMjD;IAED;;;OAGG;IACH,eAFW,UAAU,MAAM,CAAC,GAAC,MAAM,EAAE,GAAC,YAAY,QAkBjD;IAED;;;;;OAKG;IACH,sBAJW,UAAU,MAAM,CAAC,GAAC,MAAM,EAAE,GAAC,YAAY,WACvC,MAAM,GACJ,OAAO,CAqCnB;IAED;;;;;;OAMG;IACH,kBALW,MAAM,KACN,MAAM,KACN,MAAM,KACN,MAAM,QAgBhB;IAED;;;;;;OAMG;IACH,YALW,MAAM,KACN,MAAM,KACN,MAAM,GACJ,MAAM,CASlB;IAED;;;;;OAKG;IACH,cAHW,MAAM,EAAE,GACN,OAAO,CAkBnB;IAED;;;OAGG;IACH,OAFW,QAAQ,QAalB;IAED;;;OAGG;IACH,kBAFW,MAAM,QAahB;IAED;;;OAGG;IACH,SAFa,QAAQ,CAQpB;IAED;;;OAGG;IACH,YAFW,QAAQ,QAIlB;IAED;;OAEG;IACH,cAEC;IAGL;;;;OAIG;IACH,qBAFU,OAAO,CAEY;CAP5B"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { v3_matrix3_multiply } from "../../../../vec3/v3_matrix3_multiply.js";
|
|
2
|
+
import { v3_negate_array } from "../../../../vec3/v3_negate_array.js";
|
|
2
3
|
import { EPSILON } from "../../../../../math/EPSILON.js";
|
|
3
4
|
|
|
4
5
|
const scratch_m3 = new Float32Array(9);
|
|
@@ -226,8 +227,8 @@ export class Quadric3 extends Float64Array {
|
|
|
226
227
|
|
|
227
228
|
this.toVector3(out);
|
|
228
229
|
|
|
229
|
-
|
|
230
|
-
|
|
230
|
+
v3_matrix3_multiply(out, 0, out, 0, scratch_m3);
|
|
231
|
+
v3_negate_array(out, 0, out, 0);
|
|
231
232
|
|
|
232
233
|
return true;
|
|
233
234
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apply_border_penalty_to_vertex_quadrics.d.ts","sourceRoot":"","sources":["../../../../../../../../src/core/geom/3d/topology/simplify/quadratic/apply_border_penalty_to_vertex_quadrics.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"apply_border_penalty_to_vertex_quadrics.d.ts","sourceRoot":"","sources":["../../../../../../../../src/core/geom/3d/topology/simplify/quadratic/apply_border_penalty_to_vertex_quadrics.js"],"names":[],"mappings":"AASA;;;;;;GAMG;AACH,gFAHW,MAAM,mBACN,IAAI,MAAM,EAAE,QAAQ,CAAC,QAoC/B;yBA3CwB,eAAe"}
|
package/src/core/geom/3d/topology/simplify/quadratic/apply_border_penalty_to_vertex_quadrics.js
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { v3_subtract } from "../../../../vec3/v3_subtract.js";
|
|
2
|
+
import { v3_cross } from "../../../../vec3/v3_cross.js";
|
|
3
|
+
import { v3_normalize_array } from "../../../../vec3/v3_normalize_array.js";
|
|
4
|
+
import { v3_dot } from "../../../../vec3/v3_dot.js";
|
|
5
|
+
import { v3_length } from "../../../../vec3/v3_length.js";
|
|
2
6
|
import { assert } from "../../../../../assert.js";
|
|
3
7
|
import { tm_face_normal } from "../../tm_face_normal.js";
|
|
4
8
|
import { Quadric3 } from "./Quadric3.js";
|
|
@@ -15,7 +19,7 @@ export function apply_border_penalty_to_vertex_quadrics(edge, weight, vertex_qua
|
|
|
15
19
|
const v1 = edge.v1;
|
|
16
20
|
|
|
17
21
|
const edge_vector = [];
|
|
18
|
-
|
|
22
|
+
v3_subtract(edge_vector, 0, v0.x, v0.y, v0.z, v1.x, v1.y, v1.z);
|
|
19
23
|
|
|
20
24
|
// Edge must have exactly 1 triangle attached
|
|
21
25
|
const edge_faces = edge.faces;
|
|
@@ -29,14 +33,14 @@ export function apply_border_penalty_to_vertex_quadrics(edge, weight, vertex_qua
|
|
|
29
33
|
|
|
30
34
|
const abc = [];
|
|
31
35
|
|
|
32
|
-
|
|
33
|
-
|
|
36
|
+
v3_cross(abc, 0, edge_vector[0], edge_vector[1], edge_vector[2], normal[0], normal[1], normal[2]);
|
|
37
|
+
v3_normalize_array(abc, 0, abc, 0);
|
|
34
38
|
|
|
35
|
-
const d = -
|
|
39
|
+
const d = -v3_dot(abc[0], abc[1], abc[2], v0.x, v0.y, v0.z);
|
|
36
40
|
|
|
37
41
|
const constraint = new Quadric3();
|
|
38
42
|
constraint.setFromVector4(abc[0], abc[1], abc[2], d);
|
|
39
|
-
constraint.multiplyScalar(
|
|
43
|
+
constraint.multiplyScalar(v3_length(edge_vector[0], edge_vector[1], edge_vector[2]) * weight);
|
|
40
44
|
|
|
41
45
|
// apply constraint
|
|
42
46
|
const v0_quadric = vertex_quadrics.get(v0.index);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { v3_copy_array } from "../../../vec3/v3_copy_array.js";
|
|
2
2
|
import { assert } from "../../../../assert.js";
|
|
3
3
|
import { array_push_if_unique } from "../../../../collection/array/array_push_if_unique.js";
|
|
4
4
|
import { noop } from "../../../../function/noop.js";
|
|
@@ -267,7 +267,7 @@ export class TopoMesh {
|
|
|
267
267
|
const f = new TopoTriangle();
|
|
268
268
|
|
|
269
269
|
// copy face normal
|
|
270
|
-
|
|
270
|
+
v3_copy_array(f.normal, 0, face.normal, 0);
|
|
271
271
|
|
|
272
272
|
const face_vertices = face.vertices;
|
|
273
273
|
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="gl-matrix/index.js" />
|
|
2
1
|
export class TopoTriangle {
|
|
3
2
|
/**
|
|
4
3
|
* Utility constructor
|
|
@@ -122,5 +121,4 @@ export class TopoTriangle {
|
|
|
122
121
|
}
|
|
123
122
|
import { TopoVertex } from "./TopoVertex.js";
|
|
124
123
|
import { TopoEdge } from "./TopoEdge.js";
|
|
125
|
-
import { vec3 } from "gl-matrix";
|
|
126
124
|
//# sourceMappingURL=TopoTriangle.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TopoTriangle.d.ts","sourceRoot":"","sources":["../../../../../../../src/core/geom/3d/topology/struct/TopoTriangle.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"TopoTriangle.d.ts","sourceRoot":"","sources":["../../../../../../../src/core/geom/3d/topology/struct/TopoTriangle.js"],"names":[],"mappings":"AAWA;IAmRI;;;;;;;;;;;;OAYG;IACH,sBAXW,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,GACL,YAAY,CA4CvB;IAzUD;;;OAGG;IACH,OAFU,MAAM,CAEQ;IACxB;;;OAGG;IACH,UAFU,UAAU,EAAE,CAER;IACd;;;OAGG;IACH,OAFU,QAAQ,EAAE,CAET;IAEX;;;OAGG;IACH,QAFU,MAAM,EAAE,OAAK,CAEJ;IAEnB,uBAEC;IAED;;;OAGG;IACH,YAFW,YAAY,QAQtB;IAED,sBAMC;IAED;;;;OAIG;IACH,+BAFY,OAAO,CA0ClB;IAED;;;OAGG;IACH,YAFY,OAAO,CAKlB;IAED;;;;OAIG;IACH,sBAHW,QAAQ,eACR,QAAQ,QAIlB;IAED;;;;OAIG;IACH,wBAHW,UAAU,eACV,UAAU,QAMpB;IAED;;OAEG;IACH,gCASC;IAED;;OAEG;IACH,eAmBC;IAED;;;OAGG;IACH,WAFW,QAAQ,QAMlB;IAED;;;;OAIG;IACH,iBAHW,QAAQ,GACP,OAAO,CAIlB;IAED;;;OAGG;IACH,cAFW,QAAQ,QAQlB;IAED;;;;OAIG;IACH,mBAHW,QAAQ,GACN,OAAO,CAKnB;IAED,sBAaC;IAGD;;;;OAIG;IACH,mBAHW,MAAM,UACN,UAAU,QAOpB;IAED;;;;OAIG;IACH,uBAHW,UAAU,GACT,OAAO,CAIlB;IAED;;;;;OAKG;IACH,0BAJW,YAAY,EAAE,iBACd,MAAM,GACJ,MAAM,CA8BlB;IA4DL;;;OAGG;IACH,qBAFU,OAAO,CAEgB;CANhC;2BA/U0B,iBAAiB;yBADnB,eAAe"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { v3_copy_array } from "../../../vec3/v3_copy_array.js";
|
|
2
2
|
import { assert } from "../../../../assert.js";
|
|
3
3
|
import { array_push_if_unique } from "../../../../collection/array/array_push_if_unique.js";
|
|
4
4
|
import { array_remove_first } from "../../../../collection/array/array_remove_first.js";
|
|
@@ -45,7 +45,7 @@ export class TopoTriangle {
|
|
|
45
45
|
this.vertices = other.vertices.slice();
|
|
46
46
|
this.edges = other.edges.slice();
|
|
47
47
|
|
|
48
|
-
|
|
48
|
+
v3_copy_array(this.normal, 0, other.normal, 0);
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
clone() {
|
package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_face_find_path_polyanya.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bt_mesh_face_find_path_polyanya.d.ts","sourceRoot":"","sources":["../../../../../../../../../src/core/geom/3d/topology/struct/binary/query/bt_mesh_face_find_path_polyanya.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"bt_mesh_face_find_path_polyanya.d.ts","sourceRoot":"","sources":["../../../../../../../../../src/core/geom/3d/topology/struct/binary/query/bt_mesh_face_find_path_polyanya.js"],"names":[],"mappings":"AAwSA;;;;;;;;;;;;;;GAcG;AACH,wDAZW,MAAM,EAAE,GAAC,YAAY,GAAC,YAAY,gCAElC,MAAM,MACN,MAAM,MACN,MAAM,cACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,aACN,MAAM,GACJ,MAAM,CA+HlB"}
|