@pinkaphant/kolmo 0.2.3 → 0.4.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/LICENSE +1 -1
- package/README.md +36 -36
- package/bin/kolmo.mjs +12 -6
- package/dist/engine/causewayBridge.d.ts +14 -0
- package/dist/engine/causewayBridge.js +166 -0
- package/dist/engine/causewayBridge.js.map +1 -0
- package/dist/engine/index.d.ts +6 -4
- package/dist/engine/index.js +19 -12
- package/dist/engine/index.js.map +1 -0
- package/dist/engine/islandSettlementMesh.d.ts +26 -0
- package/dist/engine/islandSettlementMesh.js +166 -0
- package/dist/engine/islandSettlementMesh.js.map +1 -0
- package/dist/engine/kolmoActions.d.ts +23 -0
- package/dist/engine/kolmoActions.js +164 -0
- package/dist/engine/kolmoActions.js.map +1 -0
- package/dist/engine/kolmoActor.js +242 -165
- package/dist/engine/kolmoActor.js.map +1 -0
- package/dist/engine/kolmoFloatingOrigin.d.ts +17 -0
- package/dist/engine/kolmoFloatingOrigin.js +98 -0
- package/dist/engine/kolmoFloatingOrigin.js.map +1 -0
- package/dist/engine/kolmoGame.d.ts +27 -0
- package/dist/engine/kolmoGame.js +80 -0
- package/dist/engine/kolmoGame.js.map +1 -0
- package/dist/engine/kolmoHud.d.ts +23 -0
- package/dist/engine/kolmoHud.js +195 -0
- package/dist/engine/kolmoHud.js.map +1 -0
- package/dist/engine/kolmoInput.d.ts +1 -1
- package/dist/engine/kolmoInput.js +57 -30
- package/dist/engine/kolmoInput.js.map +1 -0
- package/dist/engine/kolmoIsland.d.ts +5 -10
- package/dist/engine/kolmoIsland.js +182 -250
- package/dist/engine/kolmoIsland.js.map +1 -0
- package/dist/engine/kolmoLongDrive.d.ts +3 -4
- package/dist/engine/kolmoLongDrive.js +140 -205
- package/dist/engine/kolmoLongDrive.js.map +1 -0
- package/dist/engine/kolmoPilotMesh.d.ts +2 -0
- package/dist/engine/kolmoPilotMesh.js +64 -0
- package/dist/engine/kolmoPilotMesh.js.map +1 -0
- package/dist/engine/kolmoProcedural.d.ts +13 -0
- package/dist/engine/kolmoProcedural.js +101 -0
- package/dist/engine/kolmoProcedural.js.map +1 -0
- package/dist/engine/kolmoRigs.d.ts +1 -1
- package/dist/engine/kolmoRigs.js +88 -47
- package/dist/engine/kolmoRigs.js.map +1 -0
- package/dist/engine/kolmoStore.d.ts +3 -100
- package/dist/engine/kolmoSurface.d.ts +2 -2
- package/dist/engine/kolmoSurface.js +150 -134
- package/dist/engine/kolmoSurface.js.map +1 -0
- package/dist/engine/kolmoTraits.d.ts +128 -0
- package/dist/engine/kolmoTraits.js +140 -0
- package/dist/engine/kolmoTraits.js.map +1 -0
- package/dist/engine/kolmoVehicle.d.ts +3 -33
- package/dist/engine/kolmoVehicle.js +66 -240
- package/dist/engine/kolmoVehicle.js.map +1 -0
- package/dist/engine/kolmoVehicleConfig.d.ts +54 -0
- package/dist/engine/kolmoVehicleConfig.js +80 -0
- package/dist/engine/kolmoVehicleConfig.js.map +1 -0
- package/dist/engine/kolmoVehicleDriver.d.ts +4 -1
- package/dist/engine/kolmoVehicleDriver.js +116 -22
- package/dist/engine/kolmoVehicleDriver.js.map +1 -0
- package/dist/engine/kolmoVehicleInner.d.ts +7 -0
- package/dist/engine/kolmoVehicleInner.js +261 -0
- package/dist/engine/kolmoVehicleInner.js.map +1 -0
- package/dist/engine/kolmoWorld.d.ts +6 -4
- package/dist/engine/kolmoWorld.js +134 -116
- package/dist/engine/kolmoWorld.js.map +1 -0
- package/dist/engine/longDriveKit.d.ts +5 -12
- package/dist/engine/longDriveKit.js +121 -233
- package/dist/engine/longDriveKit.js.map +1 -0
- package/dist/engine/longDriveRoadside.d.ts +16 -0
- package/dist/engine/longDriveRoadside.js +171 -0
- package/dist/engine/longDriveRoadside.js.map +1 -0
- package/dist/engine/macroCellBuilder.d.ts +34 -0
- package/dist/engine/macroCellBuilder.js +145 -0
- package/dist/engine/macroCellBuilder.js.map +1 -0
- package/dist/engine/mainlandMacroCell.d.ts +2 -2
- package/dist/engine/mainlandMacroCell.js +77 -165
- package/dist/engine/mainlandMacroCell.js.map +1 -0
- package/dist/engine/shiftedFixedBody.d.ts +1 -1
- package/dist/engine/shiftedFixedBody.js +55 -28
- package/dist/engine/shiftedFixedBody.js.map +1 -0
- package/dist/importer/ChopShopPanel.d.ts +9 -1
- package/dist/importer/ChopShopPanel.js +303 -359
- package/dist/importer/ChopShopPanel.js.map +1 -0
- package/dist/importer/DomainWorkshopPanel.d.ts +2 -1
- package/dist/importer/DomainWorkshopPanel.js +172 -242
- package/dist/importer/DomainWorkshopPanel.js.map +1 -0
- package/dist/importer/GateHudBar.d.ts +8 -0
- package/dist/importer/GateHudBar.js +290 -279
- package/dist/importer/GateHudBar.js.map +1 -0
- package/dist/importer/GlbImportGate.d.ts +2 -1
- package/dist/importer/GlbImportGate.js +252 -225
- package/dist/importer/GlbImportGate.js.map +1 -0
- package/dist/importer/ImperativeVehicleRig.d.ts +2 -2
- package/dist/importer/ImperativeVehicleRig.js +223 -284
- package/dist/importer/ImperativeVehicleRig.js.map +1 -0
- package/dist/importer/LiveDrivePads.d.ts +20 -0
- package/dist/importer/LiveDrivePads.js +169 -0
- package/dist/importer/LiveDrivePads.js.map +1 -0
- package/dist/importer/PaperShellDebrisRig.d.ts +25 -0
- package/dist/importer/PaperShellDebrisRig.js +143 -0
- package/dist/importer/PaperShellDebrisRig.js.map +1 -0
- package/dist/importer/R2VaultDrawer.d.ts +12 -0
- package/dist/importer/R2VaultDrawer.js +90 -0
- package/dist/importer/R2VaultDrawer.js.map +1 -0
- package/dist/importer/Step1CalibrationPlinth.d.ts +23 -5
- package/dist/importer/Step1CalibrationPlinth.js +180 -251
- package/dist/importer/Step1CalibrationPlinth.js.map +1 -0
- package/dist/importer/Step1ExplodedIslands.d.ts +31 -0
- package/dist/importer/Step1ExplodedIslands.js +144 -0
- package/dist/importer/Step1ExplodedIslands.js.map +1 -0
- package/dist/importer/Step2UniversalPad.d.ts +7 -7
- package/dist/importer/Step2UniversalPad.js +49 -170
- package/dist/importer/Step2UniversalPad.js.map +1 -0
- package/dist/importer/VfxEmitterPool.js +59 -86
- package/dist/importer/VfxEmitterPool.js.map +1 -0
- package/dist/importer/WheelRingHandles3D.d.ts +11 -0
- package/dist/importer/WheelRingHandles3D.js +318 -0
- package/dist/importer/WheelRingHandles3D.js.map +1 -0
- package/dist/importer/archLinerGeom.d.ts +2 -0
- package/dist/importer/archLinerGeom.js +51 -0
- package/dist/importer/archLinerGeom.js.map +1 -0
- package/dist/importer/{vehiclePanelAnim.d.ts → chopHingeHelpers.d.ts} +0 -10
- package/dist/importer/chopHingeHelpers.js +193 -0
- package/dist/importer/chopHingeHelpers.js.map +1 -0
- package/dist/importer/chopShopActions.d.ts +20 -26
- package/dist/importer/chopShopActions.js +135 -210
- package/dist/importer/chopShopActions.js.map +1 -0
- package/dist/importer/chopShopHandlers.d.ts +26 -0
- package/dist/importer/chopShopHandlers.js +276 -0
- package/dist/importer/chopShopHandlers.js.map +1 -0
- package/dist/importer/chopShopIoActions.d.ts +15 -0
- package/dist/importer/chopShopIoActions.js +137 -0
- package/dist/importer/chopShopIoActions.js.map +1 -0
- package/dist/importer/chopShopMcpAction.d.ts +18 -0
- package/dist/importer/chopShopMcpAction.js +58 -0
- package/dist/importer/chopShopMcpAction.js.map +1 -0
- package/dist/importer/cylinderBooleanSlice.d.ts +14 -0
- package/dist/importer/cylinderBooleanSlice.js +110 -0
- package/dist/importer/cylinderBooleanSlice.js.map +1 -0
- package/dist/importer/cylinderSliceMath.d.ts +14 -0
- package/dist/importer/cylinderSliceMath.js +251 -0
- package/dist/importer/cylinderSliceMath.js.map +1 -0
- package/dist/importer/fusedWheelDetect.d.ts +4 -0
- package/dist/importer/fusedWheelDetect.js +175 -0
- package/dist/importer/fusedWheelDetect.js.map +1 -0
- package/dist/importer/fusedWheelFit.d.ts +13 -0
- package/dist/importer/fusedWheelFit.js +138 -0
- package/dist/importer/fusedWheelFit.js.map +1 -0
- package/dist/importer/gateStore.d.ts +1 -1
- package/dist/importer/gateStore.js +36 -27
- package/dist/importer/gateStore.js.map +1 -0
- package/dist/importer/glbNormalizer.js +118 -79
- package/dist/importer/glbNormalizer.js.map +1 -0
- package/dist/importer/importerWebMcp.d.ts +4 -3
- package/dist/importer/importerWebMcp.js +41 -336
- package/dist/importer/importerWebMcp.js.map +1 -0
- package/dist/importer/importerWebMcpTools.d.ts +2 -0
- package/dist/importer/importerWebMcpTools.js +340 -0
- package/dist/importer/importerWebMcpTools.js.map +1 -0
- package/dist/importer/index.d.ts +4 -0
- package/dist/importer/index.js +32 -22
- package/dist/importer/index.js.map +1 -0
- package/dist/importer/khrCarPlanHelpers.d.ts +28 -0
- package/dist/importer/khrCarPlanHelpers.js +221 -0
- package/dist/importer/khrCarPlanHelpers.js.map +1 -0
- package/dist/importer/khrCarPlanner.d.ts +7 -0
- package/dist/importer/khrCarPlanner.js +279 -0
- package/dist/importer/khrCarPlanner.js.map +1 -0
- package/dist/importer/khrCompiler.d.ts +4 -22
- package/dist/importer/khrCompiler.js +56 -424
- package/dist/importer/khrCompiler.js.map +1 -0
- package/dist/importer/khrCraftPropCompiler.d.ts +40 -0
- package/dist/importer/khrCraftPropCompiler.js +250 -0
- package/dist/importer/khrCraftPropCompiler.js.map +1 -0
- package/dist/importer/launcherBake.js +76 -35
- package/dist/importer/launcherBake.js.map +1 -0
- package/dist/importer/meshIslands.d.ts +4 -46
- package/dist/importer/meshIslands.js +84 -283
- package/dist/importer/meshIslands.js.map +1 -0
- package/dist/importer/meshSliceBuffers.d.ts +15 -0
- package/dist/importer/meshSliceBuffers.js +159 -0
- package/dist/importer/meshSliceBuffers.js.map +1 -0
- package/dist/importer/polygonEarClipYZ.d.ts +3 -0
- package/dist/importer/polygonEarClipYZ.js +67 -0
- package/dist/importer/polygonEarClipYZ.js.map +1 -0
- package/dist/importer/sceneSiNormalize.d.ts +19 -0
- package/dist/importer/sceneSiNormalize.js +138 -0
- package/dist/importer/sceneSiNormalize.js.map +1 -0
- package/dist/importer/starterScene.d.ts +3 -0
- package/dist/importer/starterScene.js +76 -0
- package/dist/importer/starterScene.js.map +1 -0
- package/dist/importer/surfaceCutter.d.ts +4 -15
- package/dist/importer/surfaceCutter.js +69 -240
- package/dist/importer/surfaceCutter.js.map +1 -0
- package/dist/importer/surfaceGeodesic.d.ts +7 -0
- package/dist/importer/surfaceGeodesic.js +130 -0
- package/dist/importer/surfaceGeodesic.js.map +1 -0
- package/dist/importer/surfaceLoopRefine.d.ts +6 -0
- package/dist/importer/surfaceLoopRefine.js +171 -0
- package/dist/importer/surfaceLoopRefine.js.map +1 -0
- package/dist/importer/surfacePeel.d.ts +11 -0
- package/dist/importer/surfacePeel.js +119 -0
- package/dist/importer/surfacePeel.js.map +1 -0
- package/dist/importer/surfaceTopology.d.ts +2 -6
- package/dist/importer/surfaceTopology.js +93 -133
- package/dist/importer/surfaceTopology.js.map +1 -0
- package/dist/importer/universalGateBake.d.ts +7 -3
- package/dist/importer/universalGateBake.js +104 -106
- package/dist/importer/universalGateBake.js.map +1 -0
- package/dist/importer/usdPhysicsSpecs.d.ts +3 -0
- package/dist/importer/usdPhysicsSpecs.js +245 -0
- package/dist/importer/usdPhysicsSpecs.js.map +1 -0
- package/dist/importer/usdTextParse.d.ts +12 -0
- package/dist/importer/usdTextParse.js +118 -0
- package/dist/importer/usdTextParse.js.map +1 -0
- package/dist/importer/usdToGlb.d.ts +3 -2
- package/dist/importer/usdToGlb.js +80 -280
- package/dist/importer/usdToGlb.js.map +1 -0
- package/dist/importer/useChopShopController.d.ts +50 -47
- package/dist/importer/useChopShopController.js +156 -338
- package/dist/importer/useChopShopController.js.map +1 -0
- package/dist/importer/useChopShopState.d.ts +103 -0
- package/dist/importer/useChopShopState.js +319 -0
- package/dist/importer/useChopShopState.js.map +1 -0
- package/dist/importer/useWasdKeyRef.d.ts +9 -0
- package/dist/importer/useWasdKeyRef.js +35 -0
- package/dist/importer/useWasdKeyRef.js.map +1 -0
- package/dist/importer/vehiclePartSplit.d.ts +33 -0
- package/dist/importer/vehiclePartSplit.js +178 -0
- package/dist/importer/vehiclePartSplit.js.map +1 -0
- package/dist/importer/wheelAxlePairing.js +106 -70
- package/dist/importer/wheelAxlePairing.js.map +1 -0
- package/dist/importer/wheelCutterHelpers.d.ts +42 -0
- package/dist/importer/wheelCutterHelpers.js +178 -0
- package/dist/importer/wheelCutterHelpers.js.map +1 -0
- package/dist/importer/wheelRingHandleMath.d.ts +20 -0
- package/dist/importer/wheelRingHandleMath.js +66 -0
- package/dist/importer/wheelRingHandleMath.js.map +1 -0
- package/dist/index.d.ts +3 -2
- package/dist/index.js +90 -66
- package/dist/index.js.map +1 -0
- package/dist/junk/DestructibleTarget.d.ts +3 -3
- package/dist/junk/DestructibleTarget.js +177 -114
- package/dist/junk/DestructibleTarget.js.map +1 -0
- package/dist/junk/KolmoJunk.js +55 -44
- package/dist/junk/KolmoJunk.js.map +1 -0
- package/dist/junk/ShardPieces.d.ts +2 -1
- package/dist/junk/ShardPieces.js +80 -61
- package/dist/junk/ShardPieces.js.map +1 -0
- package/dist/junk/TargetDecals.d.ts +6 -15
- package/dist/junk/TargetDecals.js +66 -40
- package/dist/junk/TargetDecals.js.map +1 -0
- package/dist/junk/bvhShatter.d.ts +2 -6
- package/dist/junk/bvhShatter.js +89 -43
- package/dist/junk/bvhShatter.js.map +1 -0
- package/dist/junk/bvhTriCollector.d.ts +2 -6
- package/dist/junk/bvhTriCollector.js +111 -62
- package/dist/junk/bvhTriCollector.js.map +1 -0
- package/dist/junk/index.d.ts +2 -2
- package/dist/junk/index.js +11 -11
- package/dist/junk/index.js.map +1 -0
- package/dist/junk/junkGeometry.d.ts +5 -26
- package/dist/junk/junkGeometry.js +61 -43
- package/dist/junk/junkGeometry.js.map +1 -0
- package/dist/junk/junkImportSanitize.d.ts +4 -5
- package/dist/junk/junkImportSanitize.js +57 -37
- package/dist/junk/junkImportSanitize.js.map +1 -0
- package/dist/junk/junkImporter.d.ts +2 -13
- package/dist/junk/junkImporter.js +105 -76
- package/dist/junk/junkImporter.js.map +1 -0
- package/dist/junk/junkLabelCanvas.d.ts +1 -6
- package/dist/junk/junkLabelCanvas.js +147 -29
- package/dist/junk/junkLabelCanvas.js.map +1 -0
- package/dist/junk/junkLabels.d.ts +4 -26
- package/dist/junk/junkLabels.js +42 -28
- package/dist/junk/junkLabels.js.map +1 -0
- package/dist/junk/targetHelpers.d.ts +3 -4
- package/dist/junk/targetHelpers.js +121 -67
- package/dist/junk/targetHelpers.js.map +1 -0
- package/dist/junk/targetHitLogic.d.ts +8 -8
- package/dist/junk/targetHitLogic.js +131 -95
- package/dist/junk/targetHitLogic.js.map +1 -0
- package/dist/junk/useTargetAssets.d.ts +9 -14
- package/dist/junk/useTargetAssets.js +113 -85
- package/dist/junk/useTargetAssets.js.map +1 -0
- package/dist/physics/index.d.ts +1 -1
- package/dist/physics/index.js +79 -58
- package/dist/physics/index.js.map +1 -0
- package/dist/schema/kolmoSchema.d.ts +3 -64
- package/dist/schema/kolmoSchema.js +75 -149
- package/dist/schema/kolmoSchema.js.map +1 -0
- package/dist/schema/kolmoStamp.d.ts +6 -0
- package/dist/schema/kolmoStamp.js +71 -0
- package/dist/schema/kolmoStamp.js.map +1 -0
- package/dist/schema/kolmoTypes.d.ts +63 -0
- package/dist/schema/kolmoTypes.js +66 -0
- package/dist/schema/kolmoTypes.js.map +1 -0
- package/dist/shaders/celestialBackdrop.d.ts +2 -10
- package/dist/shaders/celestialBackdrop.js +128 -291
- package/dist/shaders/celestialBackdrop.js.map +1 -0
- package/dist/shaders/emitterShaders.d.ts +9 -0
- package/dist/shaders/emitterShaders.js +114 -0
- package/dist/shaders/emitterShaders.js.map +1 -0
- package/dist/shaders/index.d.ts +1 -1
- package/dist/shaders/index.js +12 -9
- package/dist/shaders/index.js.map +1 -0
- package/dist/shaders/plumeAndSparkle.d.ts +2 -4
- package/dist/shaders/plumeAndSparkle.js +152 -191
- package/dist/shaders/plumeAndSparkle.js.map +1 -0
- package/dist/shaders/ps2GlslShared.js +29 -2
- package/dist/shaders/ps2GlslShared.js.map +1 -0
- package/dist/shaders/ps2MaterialsTSL.js +132 -51
- package/dist/shaders/ps2MaterialsTSL.js.map +1 -0
- package/dist/shaders/ps2MaterialsWebGL.js +45 -28
- package/dist/shaders/ps2MaterialsWebGL.js.map +1 -0
- package/dist/shaders/ps2RoadWebGL.js +69 -32
- package/dist/shaders/ps2RoadWebGL.js.map +1 -0
- package/dist/shaders/ps2TerrainWebGL.js +107 -30
- package/dist/shaders/ps2TerrainWebGL.js.map +1 -0
- package/dist/shaders/ps2Textures.d.ts +1 -1
- package/dist/shaders/ps2Textures.js +116 -41
- package/dist/shaders/ps2Textures.js.map +1 -0
- package/dist/shaders/retroPalettes.d.ts +1 -1
- package/dist/shaders/retroPalettes.js +90 -57
- package/dist/shaders/retroPalettes.js.map +1 -0
- package/dist/shaders/retroShader.d.ts +2 -86
- package/dist/shaders/retroShader.js +65 -196
- package/dist/shaders/retroShader.js.map +1 -0
- package/dist/shaders/retroUniforms.d.ts +60 -0
- package/dist/shaders/retroUniforms.js +215 -0
- package/dist/shaders/retroUniforms.js.map +1 -0
- package/dist/shaders/skyboxShaders.d.ts +16 -0
- package/dist/shaders/skyboxShaders.js +266 -0
- package/dist/shaders/skyboxShaders.js.map +1 -0
- package/dist/shaders/tsl.d.ts +1 -1
- package/dist/shaders/tsl.js.map +1 -0
- package/dist/vite/index.js +39 -23
- package/dist/vite/index.js.map +1 -0
- package/dist/world/frontage.js +25 -21
- package/dist/world/frontage.js.map +1 -0
- package/dist/world/index.d.ts +4 -4
- package/dist/world/index.js +12 -11
- package/dist/world/index.js.map +1 -0
- package/dist/world/infiniteWorld2D.d.ts +0 -5
- package/dist/world/infiniteWorld2D.js +175 -200
- package/dist/world/infiniteWorld2D.js.map +1 -0
- package/dist/world/island.js +81 -166
- package/dist/world/island.js.map +1 -0
- package/dist/world/islandPathing.d.ts +6 -0
- package/dist/world/islandPathing.js +166 -0
- package/dist/world/islandPathing.js.map +1 -0
- package/dist/world/macroCellSchema.js +15 -8
- package/dist/world/macroCellSchema.js.map +1 -0
- package/dist/world/macroKnightAStar.js +140 -71
- package/dist/world/macroKnightAStar.js.map +1 -0
- package/dist/world/macroSettlementZones.d.ts +9 -0
- package/dist/world/macroSettlementZones.js +108 -0
- package/dist/world/macroSettlementZones.js.map +1 -0
- package/dist/world/random.js +50 -24
- package/dist/world/random.js.map +1 -0
- package/dist/world/road.js +152 -90
- package/dist/world/road.js.map +1 -0
- package/dist/world/roadRibbon.d.ts +4 -19
- package/dist/world/roadRibbon.js +129 -124
- package/dist/world/roadRibbon.js.map +1 -0
- package/dist/world/terrain.d.ts +1 -1
- package/dist/world/terrain.js +111 -65
- package/dist/world/terrain.js.map +1 -0
- package/dist/world/terrainGeometry.d.ts +14 -0
- package/dist/world/terrainGeometry.js +76 -0
- package/dist/world/terrainGeometry.js.map +1 -0
- package/dist/world/worldTypes.d.ts +3 -3
- package/dist/world/worldTypes.js +133 -67
- package/dist/world/worldTypes.js.map +1 -0
- package/docs/api-reference.md +187 -0
- package/package.json +58 -32
- package/dist/engine/kolmoStore.js +0 -211
- package/dist/importer/ImporterPlinthUikitTags.d.ts +0 -19
- package/dist/importer/ImporterPlinthUikitTags.js +0 -112
- package/dist/importer/vehiclePanelAnim.js +0 -214
|
@@ -1,254 +1,83 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { CHOP_ROLES
|
|
3
|
-
import
|
|
1
|
+
import { edgeKey, edgeLength, edgeWeight, mirrorTriangles, shortestEdgePath, snapToVertex } from "./surfaceGeodesic.js";
|
|
2
|
+
import { CHOP_ROLES, buildSurfaceTopology, floodFillByCrease, floodTriangles, getIslandTopology } from "./surfaceTopology.js";
|
|
3
|
+
import { refineMeshAlongLoop } from "./surfaceLoopRefine.js";
|
|
4
|
+
import { buildSelectionOverlayGeometry, createFleet12GonWheelGroup, findMirrorIslandId, peelIslandSelection, remapIslandIds } from "./surfacePeel.js";
|
|
4
5
|
// src/importer/surfaceCutter.ts
|
|
5
|
-
function
|
|
6
|
-
let
|
|
7
|
-
for (
|
|
8
|
-
|
|
9
|
-
for (let
|
|
10
|
-
|
|
6
|
+
function meanSelectionX(topo, tris) {
|
|
7
|
+
let sumX = 0, totalArea = 0;
|
|
8
|
+
for (const tri of tris) {
|
|
9
|
+
const area = topo.areas[tri];
|
|
10
|
+
for (let k = 0; k < 3; k++) sumX += topo.points[topo.corners[tri * 3 + k] * 3] * area / 3;
|
|
11
|
+
totalArea += area;
|
|
11
12
|
}
|
|
12
|
-
return
|
|
13
|
+
return totalArea > 0 ? sumX / totalArea : 0;
|
|
13
14
|
}
|
|
14
|
-
function
|
|
15
|
-
|
|
15
|
+
function finalizeSelection(island, tris, mirrorX) {
|
|
16
|
+
const topo = getIslandTopology(island);
|
|
17
|
+
const uniqueSorted = [...new Set(tris)].sort((a, b) => a - b);
|
|
18
|
+
const mirrored = mirrorX && Math.abs(meanSelectionX(topo, uniqueSorted)) > .08 ? mirrorTriangles(topo, uniqueSorted) : [];
|
|
16
19
|
return {
|
|
17
|
-
islandId:
|
|
18
|
-
triangles:
|
|
19
|
-
mirrored
|
|
20
|
+
islandId: island.id,
|
|
21
|
+
triangles: uniqueSorted,
|
|
22
|
+
mirrored
|
|
20
23
|
};
|
|
21
24
|
}
|
|
22
|
-
function
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
25
|
+
function selectFacesByClick(island, faceIndex, mode, opts) {
|
|
26
|
+
const topo = getIslandTopology(island);
|
|
27
|
+
const patch = mode === "crease" ? floodFillByCrease(topo, faceIndex, opts.creaseDeg) : [faceIndex];
|
|
28
|
+
const next = opts.current?.islandId === island.id ? new Set(opts.current.triangles) : /* @__PURE__ */ new Set();
|
|
29
|
+
for (const tri of patch) if (opts.remove) next.delete(tri);
|
|
30
|
+
else next.add(tri);
|
|
31
|
+
return finalizeSelection(island, [...next], opts.mirrorX);
|
|
26
32
|
}
|
|
27
|
-
function
|
|
28
|
-
if (
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
33
|
+
function previewLoopPolyline(island, dots) {
|
|
34
|
+
if (dots.length < 2) return dots.map((p) => [
|
|
35
|
+
p[0],
|
|
36
|
+
p[1],
|
|
37
|
+
p[2]
|
|
32
38
|
]);
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
39
|
+
const topo = getIslandTopology(island);
|
|
40
|
+
const verts = dots.map((pt) => snapToVertex(topo, pt));
|
|
41
|
+
const poly = [];
|
|
42
|
+
const segCount = dots.length >= 3 ? verts.length : verts.length - 1;
|
|
43
|
+
for (let i = 0; i < segCount; i++) {
|
|
44
|
+
const path = shortestEdgePath(topo, verts[i], verts[(i + 1) % verts.length]) ?? [verts[i], verts[(i + 1) % verts.length]];
|
|
45
|
+
const stop = i === segCount - 1 && dots.length < 3 ? void 0 : -1;
|
|
46
|
+
for (const vid of path.slice(0, stop)) poly.push([
|
|
47
|
+
topo.points[vid * 3],
|
|
48
|
+
topo.points[vid * 3 + 1],
|
|
49
|
+
topo.points[vid * 3 + 2]
|
|
40
50
|
]);
|
|
41
51
|
}
|
|
42
|
-
|
|
52
|
+
if (dots.length >= 3 && poly.length > 0) poly.push([...poly[0]]);
|
|
53
|
+
return poly;
|
|
43
54
|
}
|
|
44
|
-
function
|
|
45
|
-
if (
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
let _ = s(o, g[0], (e) => !m.has(e));
|
|
59
|
-
if (new Set(_).has(g[1])) throw Error("Loop didn't enclose an isolated patch — add another dot along the shutline.");
|
|
60
|
-
let v = s(o, g[1], (e) => !m.has(e)), y = (e) => e.reduce((e, t) => e + o.areas[t], 0);
|
|
61
|
-
return h(e, y(_) <= y(v) ? _ : v, n.mirrorX);
|
|
62
|
-
}
|
|
63
|
-
function y(e, t, i = .28) {
|
|
64
|
-
let a = e.index ? e.toNonIndexed() : e.clone(), o = Object.keys(a.attributes), s = o.map((e) => a.getAttribute(e).itemSize), c = o.slice(0, o.indexOf("position")).reduce((e, t, n) => e + s[n], 0), l = a.getAttribute("position").count, u = (e) => {
|
|
65
|
-
let t = [];
|
|
66
|
-
return o.forEach((n, r) => {
|
|
67
|
-
let i = a.getAttribute(n);
|
|
68
|
-
for (let n = 0; n < s[r]; n++) t.push(i.getComponent(e, n));
|
|
69
|
-
}), t;
|
|
70
|
-
}, d = [];
|
|
71
|
-
for (let e = 0; e * 3 + 2 < l; e++) d.push([
|
|
72
|
-
u(e * 3),
|
|
73
|
-
u(e * 3 + 1),
|
|
74
|
-
u(e * 3 + 2)
|
|
75
|
-
]);
|
|
76
|
-
let m = d.length, h = (e) => new p.Vector3(e[c], e[c + 1], e[c + 2]), g = (e, t, n) => e.map((e, r) => e + (t[r] - e) * n), _ = n(a);
|
|
77
|
-
for (let e = 0; e < t.length; e++) {
|
|
78
|
-
let n = new p.Vector3(...t[e]), a = new p.Vector3(...t[(e + 1) % t.length]), o = a.clone().sub(n), s = o.length();
|
|
79
|
-
if (s < 1e-7) continue;
|
|
80
|
-
o.divideScalar(s);
|
|
81
|
-
let c = n.clone().add(a).multiplyScalar(.5), l = new p.Vector3(), u = new p.Vector3();
|
|
82
|
-
for (let e = 0; e < _.triangleCount; e++) {
|
|
83
|
-
u.set(0, 0, 0);
|
|
84
|
-
for (let t = 0; t < 3; t++) u.add(new p.Vector3().fromArray(_.points, _.corners[e * 3 + t] * 3));
|
|
85
|
-
u.multiplyScalar(1 / 3).distanceTo(c) <= Math.max(s, .25) && l.addScaledVector(new p.Vector3().fromArray(_.normals, e * 3), _.areas[e]);
|
|
86
|
-
}
|
|
87
|
-
let m = l.lengthSq() > 0 ? l.normalize() : new p.Vector3(0, 1, 0), v = new p.Vector3().crossVectors(o, m);
|
|
88
|
-
if (v.lengthSq() < 1e-12) continue;
|
|
89
|
-
v.normalize();
|
|
90
|
-
let y = (e) => v.dot(e) - v.dot(n), b = 1e-6, x = /* @__PURE__ */ new Map(), S = (e) => {
|
|
91
|
-
let t = h(e), n = f(t.x, t.y, t.z), r = x.get(n);
|
|
92
|
-
return r === void 0 && (r = x.size, x.set(n, r)), r;
|
|
93
|
-
}, C = d.map((e) => {
|
|
94
|
-
let t = e.map((e) => y(h(e))), n = t.filter((e) => e > b).length, i = t.filter((e) => e < -1e-6).length;
|
|
95
|
-
if (n === 0 || i === 0) return null;
|
|
96
|
-
let a = n === 1 ? t.findIndex((e) => e > b) : t.findIndex((e) => e < -1e-6), [o, s, c] = [
|
|
97
|
-
0,
|
|
98
|
-
1,
|
|
99
|
-
2
|
|
100
|
-
].map((t) => e[(a + t) % 3]), [l, u, d] = [
|
|
101
|
-
0,
|
|
102
|
-
1,
|
|
103
|
-
2
|
|
104
|
-
].map((e) => t[(a + e) % 3]), f = Math.abs(u) <= b ? null : g(o, s, l / (l - u)), p = Math.abs(d) <= b ? null : g(o, c, l / (l - d));
|
|
105
|
-
return {
|
|
106
|
-
c0: o,
|
|
107
|
-
c1: s,
|
|
108
|
-
c2: c,
|
|
109
|
-
p01: f,
|
|
110
|
-
p02: p,
|
|
111
|
-
k01: f ? r(S(o), S(s)) : -1,
|
|
112
|
-
k02: p ? r(S(o), S(c)) : -1,
|
|
113
|
-
chord: [f ?? s, p ?? c]
|
|
114
|
-
};
|
|
115
|
-
}), w = /* @__PURE__ */ new Set();
|
|
116
|
-
for (let e of C) {
|
|
117
|
-
if (!e) continue;
|
|
118
|
-
let t = Infinity, r = -Infinity, a = Infinity;
|
|
119
|
-
for (let i of e.chord) {
|
|
120
|
-
let e = h(i).sub(n), s = e.dot(o);
|
|
121
|
-
t = Math.min(t, s), r = Math.max(r, s), a = Math.min(a, Math.abs(e.dot(m)));
|
|
122
|
-
}
|
|
123
|
-
r >= -1e-6 && t <= s + b && a <= i && (e.p01 && w.add(e.k01), e.p02 && w.add(e.k02));
|
|
124
|
-
}
|
|
125
|
-
let T = [];
|
|
126
|
-
d.forEach((e, t) => {
|
|
127
|
-
let n = C[t], r = n?.p01 && w.has(n.k01) ? n.p01 : null, i = n?.p02 && w.has(n.k02) ? n.p02 : null;
|
|
128
|
-
if (!n || !r && !i) {
|
|
129
|
-
T.push(e);
|
|
130
|
-
return;
|
|
131
|
-
}
|
|
132
|
-
let { c0: a, c1: o, c2: s } = n;
|
|
133
|
-
r && i ? T.push([
|
|
134
|
-
a,
|
|
135
|
-
r,
|
|
136
|
-
i
|
|
137
|
-
], [
|
|
138
|
-
r,
|
|
139
|
-
o,
|
|
140
|
-
s
|
|
141
|
-
], [
|
|
142
|
-
r,
|
|
143
|
-
s,
|
|
144
|
-
i
|
|
145
|
-
]) : r ? T.push([
|
|
146
|
-
a,
|
|
147
|
-
r,
|
|
148
|
-
s
|
|
149
|
-
], [
|
|
150
|
-
r,
|
|
151
|
-
o,
|
|
152
|
-
s
|
|
153
|
-
]) : T.push([
|
|
154
|
-
a,
|
|
155
|
-
o,
|
|
156
|
-
i
|
|
157
|
-
], [
|
|
158
|
-
i,
|
|
159
|
-
o,
|
|
160
|
-
s
|
|
161
|
-
]);
|
|
162
|
-
}), d = T;
|
|
163
|
-
}
|
|
164
|
-
let v = new p.BufferGeometry(), y = 0;
|
|
165
|
-
return o.forEach((e, t) => {
|
|
166
|
-
let n = s[t], r = new Float32Array(d.length * 3 * n);
|
|
167
|
-
d.forEach((e, t) => {
|
|
168
|
-
for (let i = 0; i < 3; i++) for (let a = 0; a < n; a++) r[(t * 3 + i) * n + a] = e[i][y + a];
|
|
169
|
-
}), v.setAttribute(e, new p.BufferAttribute(r, n, a.getAttribute(e).normalized)), y += n;
|
|
170
|
-
}), v.getAttribute("normal") || v.computeVertexNormals(), v.computeBoundingBox(), v.computeBoundingSphere(), {
|
|
171
|
-
geometry: v,
|
|
172
|
-
added: d.length - m
|
|
173
|
-
};
|
|
174
|
-
}
|
|
175
|
-
function b(t, n, r) {
|
|
176
|
-
let i = t.mesh, a = i.parent;
|
|
177
|
-
if (!a) throw Error("Selected island mesh has no parent scene.");
|
|
178
|
-
let o = i.geometry, s = o.getAttribute("position"), c = o.getIndex(), l = s ? Math.floor((c ? c.count : s.count) / 3) : 0, u = (e) => e.map((e) => t.triangleIndices[e]), d = u(n.triangles), f = u(n.mirrored), m = /* @__PURE__ */ new Set([...d, ...f]), h = [], g = (t, n) => {
|
|
179
|
-
if (t.length === 0) return;
|
|
180
|
-
let r = new p.Mesh(e(o, t), i.material);
|
|
181
|
-
r.name = n, r.position.copy(i.position), r.quaternion.copy(i.quaternion), r.scale.copy(i.scale), a.add(r), h.push(r);
|
|
182
|
-
};
|
|
183
|
-
g(d, r), g(f, `${r}_mirror`);
|
|
184
|
-
let _ = [];
|
|
185
|
-
for (let e = 0; e < l; e++) m.has(e) || _.push(e);
|
|
186
|
-
return i.geometry = _.length > 0 ? e(o, _) : new p.BufferGeometry(), {
|
|
187
|
-
mintedMeshes: h,
|
|
188
|
-
undo: () => {
|
|
189
|
-
i.geometry = o;
|
|
190
|
-
for (let e of h) e.removeFromParent(), e.geometry.dispose();
|
|
55
|
+
function selectFacesByLoop(island, dots, opts) {
|
|
56
|
+
if (dots.length < 3) throw new Error("Place at least 3 seam dots around the panel first.");
|
|
57
|
+
const topo = getIslandTopology(island);
|
|
58
|
+
const verts = dots.map((pt) => snapToVertex(topo, pt));
|
|
59
|
+
if (new Set(verts).size !== verts.length) throw new Error("Two dots snapped to the same vertex — spread dots apart or enable Split Coarse Edges.");
|
|
60
|
+
const loopVerts = [];
|
|
61
|
+
const blocked = /* @__PURE__ */ new Set();
|
|
62
|
+
const weightFn = opts.exact ? edgeLength : edgeWeight;
|
|
63
|
+
for (let i = 0; i < verts.length; i++) {
|
|
64
|
+
const path = shortestEdgePath(topo, verts[i], verts[(i + 1) % verts.length], blocked, weightFn);
|
|
65
|
+
if (!path) throw new Error(`No mesh edge path connects dot ${i + 1} to dot ${(i + 1) % verts.length + 1}.`);
|
|
66
|
+
for (const vid of path.slice(0, -1)) {
|
|
67
|
+
loopVerts.push(vid);
|
|
68
|
+
blocked.add(vid);
|
|
191
69
|
}
|
|
192
|
-
};
|
|
193
|
-
}
|
|
194
|
-
function x(e, t) {
|
|
195
|
-
let n = (e) => `${e.mesh.uuid}|${e.triangleIndices.length}|${e.center.map((e) => e.toFixed(4)).join(",")}`, r = /* @__PURE__ */ new Map();
|
|
196
|
-
for (let e of t) {
|
|
197
|
-
let t = n(e), i = r.get(t);
|
|
198
|
-
i ? i.push(e.id) : r.set(t, [e.id]);
|
|
199
|
-
}
|
|
200
|
-
let i = /* @__PURE__ */ new Map();
|
|
201
|
-
for (let t of e) i.set(t.id, r.get(n(t))?.shift() ?? null);
|
|
202
|
-
return i;
|
|
203
|
-
}
|
|
204
|
-
function S(e, t, n) {
|
|
205
|
-
let r = e.find((e) => e.id === t);
|
|
206
|
-
if (!r || Math.abs(r.center[0]) <= .08) return null;
|
|
207
|
-
let i = Math.max(...r.size, .15), a = null, o = .55;
|
|
208
|
-
for (let s of e) {
|
|
209
|
-
if (s.id === t || n?.has(s.id)) continue;
|
|
210
|
-
let e = Math.hypot(s.center[0] + r.center[0], s.center[1] - r.center[1], s.center[2] - r.center[2]) / i, c = (Math.abs(s.size[0] - r.size[0]) + Math.abs(s.size[1] - r.size[1]) + Math.abs(s.size[2] - r.size[2])) / (r.size[0] + r.size[1] + r.size[2] + 1e-5);
|
|
211
|
-
e + c < o && (o = e + c, a = s.id);
|
|
212
|
-
}
|
|
213
|
-
return a;
|
|
214
|
-
}
|
|
215
|
-
function C(t, n, r = .004) {
|
|
216
|
-
let i = e(t, n), a = i.getAttribute("position"), o = i.getAttribute("normal");
|
|
217
|
-
if (a && o) {
|
|
218
|
-
for (let e = 0; e < a.count; e++) a.setXYZ(e, a.getX(e) + o.getX(e) * r, a.getY(e) + o.getY(e) * r, a.getZ(e) + o.getZ(e) * r);
|
|
219
|
-
a.needsUpdate = !0;
|
|
220
70
|
}
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
let o = new p.CylinderGeometry(e * .22, e * .22, t * 1.1, 6, 1);
|
|
231
|
-
o.rotateZ(Math.PI * .5);
|
|
232
|
-
let s = new p.Mesh(i, new p.MeshStandardMaterial({
|
|
233
|
-
color: "#1b2028",
|
|
234
|
-
roughness: .92,
|
|
235
|
-
metalness: .05,
|
|
236
|
-
flatShading: !0
|
|
237
|
-
}));
|
|
238
|
-
s.name = `${n}_tire`;
|
|
239
|
-
let c = new p.Mesh(a, new p.MeshStandardMaterial({
|
|
240
|
-
color: "#cbd5e1",
|
|
241
|
-
roughness: .36,
|
|
242
|
-
metalness: .72,
|
|
243
|
-
flatShading: !0
|
|
244
|
-
}));
|
|
245
|
-
c.name = `${n}_rim`;
|
|
246
|
-
let l = new p.Mesh(o, new p.MeshStandardMaterial({
|
|
247
|
-
color: "#f59e0b",
|
|
248
|
-
roughness: .45,
|
|
249
|
-
metalness: .6,
|
|
250
|
-
flatShading: !0
|
|
251
|
-
}));
|
|
252
|
-
return l.name = `${n}_hub`, r.add(s, c, l), r;
|
|
71
|
+
const seamEdges = /* @__PURE__ */ new Set();
|
|
72
|
+
for (let i = 0; i < loopVerts.length; i++) seamEdges.add(edgeKey(loopVerts[i], loopVerts[(i + 1) % loopVerts.length]));
|
|
73
|
+
const interiorPair = [...seamEdges].map((ek) => topo.edgeTriangles.get(ek) ?? []).find((tris) => tris.length === 2);
|
|
74
|
+
if (!interiorPair) throw new Error("Loop runs only along open mesh border — nothing enclosed to peel.");
|
|
75
|
+
const sideA = floodTriangles(topo, interiorPair[0], (edge) => !seamEdges.has(edge));
|
|
76
|
+
if (new Set(sideA).has(interiorPair[1])) throw new Error("Loop didn't enclose an isolated patch — add another dot along the shutline.");
|
|
77
|
+
const sideB = floodTriangles(topo, interiorPair[1], (edge) => !seamEdges.has(edge));
|
|
78
|
+
const areaOf = (list) => list.reduce((acc, tri) => acc + topo.areas[tri], 0);
|
|
79
|
+
return finalizeSelection(island, areaOf(sideA) <= areaOf(sideB) ? sideA : sideB, opts.mirrorX);
|
|
253
80
|
}
|
|
254
|
-
export {
|
|
81
|
+
export { CHOP_ROLES, buildSelectionOverlayGeometry, buildSurfaceTopology, createFleet12GonWheelGroup, findMirrorIslandId, floodFillByCrease, getIslandTopology, mirrorTriangles, peelIslandSelection, previewLoopPolyline, refineMeshAlongLoop, remapIslandIds, selectFacesByClick, selectFacesByLoop };
|
|
82
|
+
|
|
83
|
+
//# sourceMappingURL=surfaceCutter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"surfaceCutter.js","names":[],"sources":["../../src/importer/surfaceCutter.ts"],"sourcesContent":["import type { MeshIsland } from \"./meshIslands.js\";\nimport { refineMeshAlongLoop } from \"./surfaceLoopRefine.js\";\nimport {\n buildSelectionOverlayGeometry,\n createFleet12GonWheelGroup,\n findMirrorIslandId,\n peelIslandSelection,\n remapIslandIds,\n} from \"./surfacePeel.js\";\nimport {\n CHOP_ROLES,\n MIRROR_OFF_CENTER_M,\n buildSurfaceTopology,\n edgeKey,\n edgeLength,\n edgeWeight,\n floodFillByCrease,\n floodTriangles,\n getIslandTopology,\n mirrorTriangles,\n shortestEdgePath,\n snapToVertex,\n type ActiveChopRole,\n type ChopPartRole,\n type CutVec3,\n type FaceSelection,\n type SurfaceSelectMode,\n type SurfaceTopology,\n} from \"./surfaceTopology.js\";\n\nexport {\n CHOP_ROLES,\n buildSelectionOverlayGeometry,\n buildSurfaceTopology,\n createFleet12GonWheelGroup,\n findMirrorIslandId,\n floodFillByCrease,\n getIslandTopology,\n mirrorTriangles,\n peelIslandSelection,\n refineMeshAlongLoop,\n remapIslandIds,\n type ActiveChopRole,\n type ChopPartRole,\n type CutVec3,\n type FaceSelection,\n type SurfaceSelectMode,\n type SurfaceTopology,\n};\n\nfunction meanSelectionX(topo: SurfaceTopology, tris: readonly number[]): number {\n let sumX = 0, totalArea = 0;\n for (const tri of tris) {\n const area = topo.areas[tri];\n for (let k = 0; k < 3; k++) sumX += (topo.points[topo.corners[tri * 3 + k] * 3] * area) / 3;\n totalArea += area;\n }\n return totalArea > 0 ? sumX / totalArea : 0;\n}\n\nfunction finalizeSelection(island: MeshIsland, tris: number[], mirrorX: boolean): FaceSelection {\n const topo = getIslandTopology(island);\n const uniqueSorted = [...new Set(tris)].sort((a, b) => a - b);\n const mirrored =\n mirrorX && Math.abs(meanSelectionX(topo, uniqueSorted)) > MIRROR_OFF_CENTER_M\n ? mirrorTriangles(topo, uniqueSorted)\n : [];\n return { islandId: island.id, triangles: uniqueSorted, mirrored };\n}\n\nexport function selectFacesByClick(\n island: MeshIsland,\n faceIndex: number,\n mode: Exclude<SurfaceSelectMode, \"island\" | \"loop\">,\n opts: { creaseDeg: number; mirrorX: boolean; current: FaceSelection | null; remove?: boolean },\n): FaceSelection {\n const topo = getIslandTopology(island);\n const patch = mode === \"crease\" ? floodFillByCrease(topo, faceIndex, opts.creaseDeg) : [faceIndex];\n const next = opts.current?.islandId === island.id ? new Set(opts.current.triangles) : new Set<number>();\n for (const tri of patch) {\n if (opts.remove) next.delete(tri);\n else next.add(tri);\n }\n return finalizeSelection(island, [...next], opts.mirrorX);\n}\n\nexport function previewLoopPolyline(island: MeshIsland, dots: readonly CutVec3[]): [number, number, number][] {\n if (dots.length < 2) return dots.map((p) => [p[0], p[1], p[2]]);\n const topo = getIslandTopology(island);\n const verts = dots.map((pt) => snapToVertex(topo, pt));\n const poly: [number, number, number][] = [];\n const segCount = dots.length >= 3 ? verts.length : verts.length - 1;\n\n for (let i = 0; i < segCount; i++) {\n const path = shortestEdgePath(topo, verts[i], verts[(i + 1) % verts.length]) ?? [verts[i], verts[(i + 1) % verts.length]];\n const stop = i === segCount - 1 && dots.length < 3 ? undefined : -1;\n for (const vid of path.slice(0, stop))\n poly.push([topo.points[vid * 3], topo.points[vid * 3 + 1], topo.points[vid * 3 + 2]]);\n }\n if (dots.length >= 3 && poly.length > 0) poly.push([...poly[0]]);\n return poly;\n}\n\nexport function selectFacesByLoop(\n island: MeshIsland,\n dots: readonly CutVec3[],\n opts: { mirrorX: boolean; exact?: boolean },\n): FaceSelection {\n if (dots.length < 3) throw new Error(\"Place at least 3 seam dots around the panel first.\");\n const topo = getIslandTopology(island);\n const verts = dots.map((pt) => snapToVertex(topo, pt));\n if (new Set(verts).size !== verts.length)\n throw new Error(\"Two dots snapped to the same vertex — spread dots apart or enable Split Coarse Edges.\");\n\n const loopVerts: number[] = [];\n const blocked = new Set<number>();\n const weightFn = opts.exact ? edgeLength : edgeWeight;\n\n for (let i = 0; i < verts.length; i++) {\n const path = shortestEdgePath(topo, verts[i], verts[(i + 1) % verts.length], blocked, weightFn);\n if (!path) throw new Error(`No mesh edge path connects dot ${i + 1} to dot ${((i + 1) % verts.length) + 1}.`);\n for (const vid of path.slice(0, -1)) {\n loopVerts.push(vid);\n blocked.add(vid);\n }\n }\n\n const seamEdges = new Set<number>();\n for (let i = 0; i < loopVerts.length; i++) seamEdges.add(edgeKey(loopVerts[i], loopVerts[(i + 1) % loopVerts.length]));\n\n const interiorPair = [...seamEdges].map((ek) => topo.edgeTriangles.get(ek) ?? []).find((tris) => tris.length === 2);\n if (!interiorPair) throw new Error(\"Loop runs only along open mesh border — nothing enclosed to peel.\");\n\n const sideA = floodTriangles(topo, interiorPair[0], (edge) => !seamEdges.has(edge));\n if (new Set(sideA).has(interiorPair[1]))\n throw new Error(\"Loop didn't enclose an isolated patch — add another dot along the shutline.\");\n\n const sideB = floodTriangles(topo, interiorPair[1], (edge) => !seamEdges.has(edge));\n const areaOf = (list: number[]): number => list.reduce((acc, tri) => acc + topo.areas[tri], 0);\n return finalizeSelection(island, areaOf(sideA) <= areaOf(sideB) ? sideA : sideB, opts.mirrorX);\n}\n"],"mappings":";;;;;AAkDA,SAAS,eAAe,MAAuB,MAAi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,EAAE,EAAE;EAC5G,KAAK,MAAM,OAAO,KAAK,MAAM,GAAG,EAAE,GAAG;GACjC,UAAU,KAAK,GAAG;GAClB,QAAQ,IAAI,GAAG;EACnB;CACJ;CAEA,MAAM,4BAAY,IAAI,IAAY;CAClC,KAAK,IAAI,IAAI,GAAG,IAAI,UAAU,QAAQ,KAAK,UAAU,IAAI,QAAQ,UAAU,IAAI,WAAW,IAAI,KAAK,UAAU,OAAO,CAAC;CAErH,MAAM,eAAe,CAAC,GAAG,SAAS,CAAC,CAAC,KAAK,OAAO,KAAK,cAAc,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,SAAS,KAAK,WAAW,CAAC;CAClH,IAAI,CAAC,cAAc,MAAM,IAAI,MAAM,mEAAmE;CAEtG,MAAM,QAAQ,eAAe,MAAM,aAAa,KAAK,SAAS,CAAC,UAAU,IAAI,IAAI,CAAC;CAClF,IAAI,IAAI,IAAI,KAAK,CAAC,CAAC,IAAI,aAAa,EAAE,GAClC,MAAM,IAAI,MAAM,6EAA6E;CAEjG,MAAM,QAAQ,eAAe,MAAM,aAAa,KAAK,SAAS,CAAC,UAAU,IAAI,IAAI,CAAC;CAClF,MAAM,UAAU,SAA2B,KAAK,QAAQ,KAAK,QAAQ,MAAM,KAAK,MAAM,MAAM,CAAC;CAC7F,OAAO,kBAAkB,QAAQ,OAAO,KAAK,KAAK,OAAO,KAAK,IAAI,QAAQ,OAAO,KAAK,OAAO;AACjG"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { CutVec3, SurfaceTopology } from "./surfaceTopology.js";
|
|
2
|
+
export declare const edgeKey: (a: number, b: number) => number;
|
|
3
|
+
export declare function mirrorTriangles(topo: SurfaceTopology, triangles: Iterable<number>, tolerance?: number): number[];
|
|
4
|
+
export declare function edgeLength(topo: SurfaceTopology, a: number, b: number): number;
|
|
5
|
+
export declare function edgeWeight(topo: SurfaceTopology, a: number, b: number): number;
|
|
6
|
+
export declare function snapToVertex(topo: SurfaceTopology, pt: CutVec3): number;
|
|
7
|
+
export declare function shortestEdgePath(topo: SurfaceTopology, from: number, to: number, blocked?: ReadonlySet<number>, weight?: (tp: SurfaceTopology, a: number, b: number) => number): number[] | null;
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
// src/importer/surfaceGeodesic.ts
|
|
2
|
+
var EDGE_STRIDE = 2 ** 26;
|
|
3
|
+
var SEAM_BIAS = .65;
|
|
4
|
+
var edgeKey = (a, b) => a < b ? a * EDGE_STRIDE + b : b * EDGE_STRIDE + a;
|
|
5
|
+
function mirrorTriangles(topo, triangles, tolerance = .03) {
|
|
6
|
+
const cellSize = Math.max(tolerance, 1e-4);
|
|
7
|
+
const cellKey = (x, y, z) => `${Math.floor(x / cellSize)},${Math.floor(y / cellSize)},${Math.floor(z / cellSize)}`;
|
|
8
|
+
const buckets = /* @__PURE__ */ new Map();
|
|
9
|
+
const centroids = new Float32Array(topo.triangleCount * 3);
|
|
10
|
+
for (let t = 0; t < topo.triangleCount; t++) {
|
|
11
|
+
let cx = 0, cy = 0, cz = 0;
|
|
12
|
+
for (let i = 0; i < 3; i++) {
|
|
13
|
+
const pOff = topo.corners[t * 3 + i] * 3;
|
|
14
|
+
cx += topo.points[pOff];
|
|
15
|
+
cy += topo.points[pOff + 1];
|
|
16
|
+
cz += topo.points[pOff + 2];
|
|
17
|
+
}
|
|
18
|
+
cx /= 3;
|
|
19
|
+
cy /= 3;
|
|
20
|
+
cz /= 3;
|
|
21
|
+
centroids[t * 3] = cx;
|
|
22
|
+
centroids[t * 3 + 1] = cy;
|
|
23
|
+
centroids[t * 3 + 2] = cz;
|
|
24
|
+
const key = cellKey(cx, cy, cz);
|
|
25
|
+
let list = buckets.get(key);
|
|
26
|
+
if (!list) {
|
|
27
|
+
list = [];
|
|
28
|
+
buckets.set(key, list);
|
|
29
|
+
}
|
|
30
|
+
list.push(t);
|
|
31
|
+
}
|
|
32
|
+
const srcSet = new Set(triangles);
|
|
33
|
+
const mirrored = /* @__PURE__ */ new Set();
|
|
34
|
+
for (const tri of srcSet) {
|
|
35
|
+
const mx = -centroids[tri * 3], my = centroids[tri * 3 + 1], mz = centroids[tri * 3 + 2];
|
|
36
|
+
let bestTri = -1, bestDist = tolerance;
|
|
37
|
+
for (let dx = -1; dx <= 1; dx++) for (let dy = -1; dy <= 1; dy++) for (let dz = -1; dz <= 1; dz++) for (const cand of buckets.get(cellKey(mx + dx * cellSize, my + dy * cellSize, mz + dz * cellSize)) ?? []) {
|
|
38
|
+
if (cand === tri || srcSet.has(cand)) continue;
|
|
39
|
+
const dist = Math.hypot(centroids[cand * 3] - mx, centroids[cand * 3 + 1] - my, centroids[cand * 3 + 2] - mz);
|
|
40
|
+
if (dist <= bestDist) {
|
|
41
|
+
bestDist = dist;
|
|
42
|
+
bestTri = cand;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
if (bestTri >= 0) mirrored.add(bestTri);
|
|
46
|
+
}
|
|
47
|
+
return [...mirrored].sort((a, b) => a - b);
|
|
48
|
+
}
|
|
49
|
+
function edgeLength(topo, a, b) {
|
|
50
|
+
const p = topo.points;
|
|
51
|
+
return Math.hypot(p[a * 3] - p[b * 3], p[a * 3 + 1] - p[b * 3 + 1], p[a * 3 + 2] - p[b * 3 + 2]);
|
|
52
|
+
}
|
|
53
|
+
function edgeWeight(topo, a, b) {
|
|
54
|
+
const tris = topo.edgeTriangles.get(edgeKey(a, b));
|
|
55
|
+
let creaseFactor = 1;
|
|
56
|
+
if (tris && tris.length === 2) {
|
|
57
|
+
const n = topo.normals, t0 = tris[0], t1 = tris[1];
|
|
58
|
+
const dot = n[t0 * 3] * n[t1 * 3] + n[t0 * 3 + 1] * n[t1 * 3 + 1] + n[t0 * 3 + 2] * n[t1 * 3 + 2];
|
|
59
|
+
creaseFactor = Math.min(1, Math.acos(Math.max(-1, Math.min(1, dot))) / (Math.PI / 2));
|
|
60
|
+
}
|
|
61
|
+
return edgeLength(topo, a, b) * (1 - SEAM_BIAS * creaseFactor);
|
|
62
|
+
}
|
|
63
|
+
function snapToVertex(topo, pt) {
|
|
64
|
+
let best = 0, bestD2 = Infinity;
|
|
65
|
+
for (let i = 0; i < topo.vertexCount; i++) {
|
|
66
|
+
const d2 = (topo.points[i * 3] - pt[0]) ** 2 + (topo.points[i * 3 + 1] - pt[1]) ** 2 + (topo.points[i * 3 + 2] - pt[2]) ** 2;
|
|
67
|
+
if (d2 < bestD2) {
|
|
68
|
+
bestD2 = d2;
|
|
69
|
+
best = i;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
return best;
|
|
73
|
+
}
|
|
74
|
+
function shortestEdgePath(topo, from, to, blocked, weight = edgeWeight) {
|
|
75
|
+
if (from === to) return [from];
|
|
76
|
+
const dist = new Float64Array(topo.vertexCount).fill(Infinity);
|
|
77
|
+
const prev = new Int32Array(topo.vertexCount).fill(-1);
|
|
78
|
+
const heap = [[0, from]];
|
|
79
|
+
dist[from] = 0;
|
|
80
|
+
const push = (item) => {
|
|
81
|
+
heap.push(item);
|
|
82
|
+
for (let i = heap.length - 1; i > 0;) {
|
|
83
|
+
const p = i - 1 >> 1;
|
|
84
|
+
if (heap[p][0] <= heap[i][0]) break;
|
|
85
|
+
[heap[p], heap[i]] = [heap[i], heap[p]];
|
|
86
|
+
i = p;
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
const pop = () => {
|
|
90
|
+
const top = heap[0];
|
|
91
|
+
const last = heap.pop();
|
|
92
|
+
if (heap.length > 0) {
|
|
93
|
+
heap[0] = last;
|
|
94
|
+
for (let i = 0;;) {
|
|
95
|
+
const l = i * 2 + 1, r = l + 1;
|
|
96
|
+
let s = i;
|
|
97
|
+
if (l < heap.length && heap[l][0] < heap[s][0]) s = l;
|
|
98
|
+
if (r < heap.length && heap[r][0] < heap[s][0]) s = r;
|
|
99
|
+
if (s === i) break;
|
|
100
|
+
[heap[s], heap[i]] = [heap[i], heap[s]];
|
|
101
|
+
i = s;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
return top;
|
|
105
|
+
};
|
|
106
|
+
while (heap.length > 0) {
|
|
107
|
+
const [d, u] = pop();
|
|
108
|
+
if (d > dist[u]) continue;
|
|
109
|
+
if (u === to) break;
|
|
110
|
+
for (const v of topo.neighbors[u]) {
|
|
111
|
+
if (v !== to && blocked?.has(v)) continue;
|
|
112
|
+
const alt = d + weight(topo, u, v);
|
|
113
|
+
if (alt < dist[v]) {
|
|
114
|
+
dist[v] = alt;
|
|
115
|
+
prev[v] = u;
|
|
116
|
+
push([alt, v]);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
if (!Number.isFinite(dist[to])) return null;
|
|
121
|
+
const path = [to];
|
|
122
|
+
for (let v = to; v !== from;) {
|
|
123
|
+
v = prev[v];
|
|
124
|
+
path.push(v);
|
|
125
|
+
}
|
|
126
|
+
return path.reverse();
|
|
127
|
+
}
|
|
128
|
+
export { edgeKey, edgeLength, edgeWeight, mirrorTriangles, shortestEdgePath, snapToVertex };
|
|
129
|
+
|
|
130
|
+
//# sourceMappingURL=surfaceGeodesic.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"surfaceGeodesic.js","names":[],"sources":["../../src/importer/surfaceGeodesic.ts"],"sourcesContent":["import type { CutVec3, SurfaceTopology } from \"./surfaceTopology.js\";\n\nconst EDGE_STRIDE = 2 ** 26;\nconst SEAM_BIAS = 0.65;\n\nexport const edgeKey = (a: number, b: number): number =>\n a < b ? a * EDGE_STRIDE + b : b * EDGE_STRIDE + a;\n\nexport function mirrorTriangles(\n topo: SurfaceTopology,\n triangles: Iterable<number>,\n tolerance = 0.03,\n): number[] {\n const cellSize = Math.max(tolerance, 1e-4);\n const cellKey = (x: number, y: number, z: number): string =>\n `${Math.floor(x / cellSize)},${Math.floor(y / cellSize)},${Math.floor(z / cellSize)}`;\n const buckets = new Map<string, number[]>();\n const centroids = new Float32Array(topo.triangleCount * 3);\n\n for (let t = 0; t < topo.triangleCount; t++) {\n let cx = 0, cy = 0, cz = 0;\n for (let i = 0; i < 3; i++) {\n const pOff = topo.corners[t * 3 + i] * 3;\n cx += topo.points[pOff];\n cy += topo.points[pOff + 1];\n cz += topo.points[pOff + 2];\n }\n cx /= 3; cy /= 3; cz /= 3;\n centroids[t * 3] = cx;\n centroids[t * 3 + 1] = cy;\n centroids[t * 3 + 2] = cz;\n const key = cellKey(cx, cy, cz);\n let list = buckets.get(key);\n if (!list) { list = []; buckets.set(key, list); }\n list.push(t);\n }\n\n const srcSet = new Set(triangles);\n const mirrored = new Set<number>();\n for (const tri of srcSet) {\n const mx = -centroids[tri * 3], my = centroids[tri * 3 + 1], mz = centroids[tri * 3 + 2];\n let bestTri = -1, bestDist = tolerance;\n for (let dx = -1; dx <= 1; dx++) {\n for (let dy = -1; dy <= 1; dy++) {\n for (let dz = -1; dz <= 1; dz++) {\n for (const cand of buckets.get(cellKey(mx + dx * cellSize, my + dy * cellSize, mz + dz * cellSize)) ?? []) {\n if (cand === tri || srcSet.has(cand)) continue;\n const dist = Math.hypot(centroids[cand * 3] - mx, centroids[cand * 3 + 1] - my, centroids[cand * 3 + 2] - mz);\n if (dist <= bestDist) { bestDist = dist; bestTri = cand; }\n }\n }\n }\n }\n if (bestTri >= 0) mirrored.add(bestTri);\n }\n return [...mirrored].sort((a, b) => a - b);\n}\n\nexport function edgeLength(topo: SurfaceTopology, a: number, b: number): number {\n const p = topo.points;\n return Math.hypot(p[a * 3] - p[b * 3], p[a * 3 + 1] - p[b * 3 + 1], p[a * 3 + 2] - p[b * 3 + 2]);\n}\n\nexport function edgeWeight(topo: SurfaceTopology, a: number, b: number): number {\n const tris = topo.edgeTriangles.get(edgeKey(a, b));\n let creaseFactor = 1;\n if (tris && tris.length === 2) {\n const n = topo.normals, t0 = tris[0], t1 = tris[1];\n const dot = n[t0 * 3] * n[t1 * 3] + n[t0 * 3 + 1] * n[t1 * 3 + 1] + n[t0 * 3 + 2] * n[t1 * 3 + 2];\n creaseFactor = Math.min(1, Math.acos(Math.max(-1, Math.min(1, dot))) / (Math.PI / 2));\n }\n return edgeLength(topo, a, b) * (1 - SEAM_BIAS * creaseFactor);\n}\n\nexport function snapToVertex(topo: SurfaceTopology, pt: CutVec3): number {\n let best = 0, bestD2 = Infinity;\n for (let i = 0; i < topo.vertexCount; i++) {\n const d2 = (topo.points[i * 3] - pt[0]) ** 2 + (topo.points[i * 3 + 1] - pt[1]) ** 2 + (topo.points[i * 3 + 2] - pt[2]) ** 2;\n if (d2 < bestD2) { bestD2 = d2; best = i; }\n }\n return best;\n}\n\nexport function shortestEdgePath(\n topo: SurfaceTopology,\n from: number,\n to: number,\n blocked?: ReadonlySet<number>,\n weight: (tp: SurfaceTopology, a: number, b: number) => number = edgeWeight,\n): number[] | null {\n if (from === to) return [from];\n const dist = new Float64Array(topo.vertexCount).fill(Infinity);\n const prev = new Int32Array(topo.vertexCount).fill(-1);\n const heap: [number, number][] = [[0, from]];\n dist[from] = 0;\n\n const push = (item: [number, number]): void => {\n heap.push(item);\n for (let i = heap.length - 1; i > 0; ) {\n const p = (i - 1) >> 1;\n if (heap[p][0] <= heap[i][0]) break;\n [heap[p], heap[i]] = [heap[i], heap[p]];\n i = p;\n }\n };\n\n const pop = (): [number, number] => {\n const top = heap[0];\n const last = heap.pop()!;\n if (heap.length > 0) {\n heap[0] = last;\n for (let i = 0; ; ) {\n const l = i * 2 + 1, r = l + 1;\n let s = i;\n if (l < heap.length && heap[l][0] < heap[s][0]) s = l;\n if (r < heap.length && heap[r][0] < heap[s][0]) s = r;\n if (s === i) break;\n [heap[s], heap[i]] = [heap[i], heap[s]];\n i = s;\n }\n }\n return top;\n };\n\n while (heap.length > 0) {\n const [d, u] = pop();\n if (d > dist[u]) continue;\n if (u === to) break;\n for (const v of topo.neighbors[u]) {\n if (v !== to && blocked?.has(v)) continue;\n const alt = d + weight(topo, u, v);\n if (alt < dist[v]) { dist[v] = alt; prev[v] = u; push([alt, v]); }\n }\n }\n if (!Number.isFinite(dist[to])) return null;\n const path = [to];\n for (let v = to; v !== from; ) { v = prev[v]; path.push(v); }\n return path.reverse();\n}\n"],"mappings":";AAEA,IAAM,cAAc,KAAK;AACzB,IAAM,YAAY;AAElB,IAAa,WAAW,GAAW,MAC/B,IAAI,IAAI,IAAI,cAAc,IAAI,IAAI,cAAc;AAEpD,SAAgB,gBACZ,MACA,WACA,YAAY,KACJ;CACR,MAAM,WAAW,KAAK,IAAI,WAAW,IAAI;CACzC,MAAM,WAAW,GAAW,GAAW,MACnC,GAAG,KAAK,MAAM,IAAI,QAAQ,EAAE,GAAG,KAAK,MAAM,IAAI,QAAQ,EAAE,GAAG,KAAK,MAAM,IAAI,QAAQ;CACtF,MAAM,0BAAU,IAAI,IAAsB;CAC1C,MAAM,YAAY,IAAI,aAAa,KAAK,gBAAgB,CAAC;CAEzD,KAAK,IAAI,IAAI,GAAG,IAAI,KAAK,eAAe,KAAK;EACzC,IAAI,KAAK,GAAG,KAAK,GAAG,KAAK;EACzB,KAAK,IAAI,IAAI,GAAG,IAAI,GAAG,KAAK;GACxB,MAAM,OAAO,KAAK,QAAQ,IAAI,IAAI,KAAK;GACvC,MAAM,KAAK,OAAO;GAClB,MAAM,KAAK,OAAO,OAAO;GACzB,MAAM,KAAK,OAAO,OAAO;EAC7B;EACA,MAAM;EAAG,MAAM;EAAG,MAAM;EACxB,UAAU,IAAI,KAAK;EACnB,UAAU,IAAI,IAAI,KAAK;EACvB,UAAU,IAAI,IAAI,KAAK;EACvB,MAAM,MAAM,QAAQ,IAAI,IAAI,EAAE;EAC9B,IAAI,OAAO,QAAQ,IAAI,GAAG;EAC1B,IAAI,CAAC,MAAM;GAAE,OAAO,CAAC;GAAG,QAAQ,IAAI,KAAK,IAAI;EAAG;EAChD,KAAK,KAAK,CAAC;CACf;CAEA,MAAM,SAAS,IAAI,IAAI,SAAS;CAChC,MAAM,2BAAW,IAAI,IAAY;CACjC,KAAK,MAAM,OAAO,QAAQ;EACtB,MAAM,KAAK,C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