chili3d 0.6.1
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/.github/workflows/main.yml +26 -0
- package/.vscode/c_cpp_properties.json +30 -0
- package/.vscode/launch.json +21 -0
- package/.vscode/settings.json +8 -0
- package/Dockerfile +7 -0
- package/LICENSE +661 -0
- package/README.md +184 -0
- package/biome.json +67 -0
- package/compose.yml +7 -0
- package/cpp/CMakeLists.txt +96 -0
- package/cpp/CMakePresets.json +43 -0
- package/cpp/README.md +21 -0
- package/cpp/src/converter.cpp +413 -0
- package/cpp/src/factory.cpp +612 -0
- package/cpp/src/geometry.cpp +204 -0
- package/cpp/src/mesher.cpp +330 -0
- package/cpp/src/opencascade.cpp +414 -0
- package/cpp/src/shape.cpp +447 -0
- package/cpp/src/shared.cpp +83 -0
- package/cpp/src/shared.hpp +211 -0
- package/cpp/src/transient.cpp +29 -0
- package/cpp/src/utils.cpp +114 -0
- package/cpp/src/utils.hpp +25 -0
- package/cpp/test/index.html +146 -0
- package/package.json +49 -0
- package/packages/chili/package.json +11 -0
- package/packages/chili/src/application.ts +200 -0
- package/packages/chili/src/bodys/arc.ts +61 -0
- package/packages/chili/src/bodys/boolean.ts +32 -0
- package/packages/chili/src/bodys/box.ts +73 -0
- package/packages/chili/src/bodys/circle.ts +57 -0
- package/packages/chili/src/bodys/cone.ts +64 -0
- package/packages/chili/src/bodys/cylinder.ts +69 -0
- package/packages/chili/src/bodys/ellipse.ts +85 -0
- package/packages/chili/src/bodys/face.ts +72 -0
- package/packages/chili/src/bodys/fuse.ts +44 -0
- package/packages/chili/src/bodys/index.ts +16 -0
- package/packages/chili/src/bodys/line.ts +48 -0
- package/packages/chili/src/bodys/polygon.ts +40 -0
- package/packages/chili/src/bodys/prism.ts +49 -0
- package/packages/chili/src/bodys/pyramid.ts +64 -0
- package/packages/chili/src/bodys/rect.ts +69 -0
- package/packages/chili/src/bodys/revolve.ts +54 -0
- package/packages/chili/src/bodys/sphere.ts +48 -0
- package/packages/chili/src/bodys/sweep.ts +67 -0
- package/packages/chili/src/bodys/wire.ts +36 -0
- package/packages/chili/src/commands/application/index.ts +10 -0
- package/packages/chili/src/commands/application/newDocument.ts +17 -0
- package/packages/chili/src/commands/application/openDocument.ts +35 -0
- package/packages/chili/src/commands/application/performanceTest.ts +64 -0
- package/packages/chili/src/commands/application/saveDocument.ts +24 -0
- package/packages/chili/src/commands/application/toFile.ts +35 -0
- package/packages/chili/src/commands/application/toggleDynamicWorkplane.ts +15 -0
- package/packages/chili/src/commands/application/wechatGroup.ts +42 -0
- package/packages/chili/src/commands/boolean.ts +109 -0
- package/packages/chili/src/commands/create/arc.ts +110 -0
- package/packages/chili/src/commands/create/bezier.ts +116 -0
- package/packages/chili/src/commands/create/box.ts +59 -0
- package/packages/chili/src/commands/create/circle.ts +54 -0
- package/packages/chili/src/commands/create/cone.ts +104 -0
- package/packages/chili/src/commands/create/converter.ts +159 -0
- package/packages/chili/src/commands/create/copySubShape.ts +37 -0
- package/packages/chili/src/commands/create/curveProjection.ts +61 -0
- package/packages/chili/src/commands/create/cylinder.ts +96 -0
- package/packages/chili/src/commands/create/ellipse.ts +95 -0
- package/packages/chili/src/commands/create/group.ts +205 -0
- package/packages/chili/src/commands/create/index.ts +26 -0
- package/packages/chili/src/commands/create/line.ts +61 -0
- package/packages/chili/src/commands/create/loft.ts +149 -0
- package/packages/chili/src/commands/create/offset.ts +131 -0
- package/packages/chili/src/commands/create/polygon.ts +104 -0
- package/packages/chili/src/commands/create/prism.ts +52 -0
- package/packages/chili/src/commands/create/pyramid.ts +56 -0
- package/packages/chili/src/commands/create/rect.ts +105 -0
- package/packages/chili/src/commands/create/revolve.ts +62 -0
- package/packages/chili/src/commands/create/section.ts +31 -0
- package/packages/chili/src/commands/create/sphere.ts +48 -0
- package/packages/chili/src/commands/create/sweep.ts +39 -0
- package/packages/chili/src/commands/create/thickSolid.ts +50 -0
- package/packages/chili/src/commands/createActCommand.ts +26 -0
- package/packages/chili/src/commands/createCommand.ts +41 -0
- package/packages/chili/src/commands/delete.ts +38 -0
- package/packages/chili/src/commands/folder.ts +18 -0
- package/packages/chili/src/commands/importExport.ts +97 -0
- package/packages/chili/src/commands/index.ts +17 -0
- package/packages/chili/src/commands/measure/angle.ts +130 -0
- package/packages/chili/src/commands/measure/index.ts +6 -0
- package/packages/chili/src/commands/measure/length.ts +57 -0
- package/packages/chili/src/commands/measure/select.module.css +68 -0
- package/packages/chili/src/commands/measure/select.ts +228 -0
- package/packages/chili/src/commands/modify/array.ts +447 -0
- package/packages/chili/src/commands/modify/break.ts +78 -0
- package/packages/chili/src/commands/modify/brush.ts +100 -0
- package/packages/chili/src/commands/modify/chamfer.ts +70 -0
- package/packages/chili/src/commands/modify/explode.ts +91 -0
- package/packages/chili/src/commands/modify/fillet.ts +69 -0
- package/packages/chili/src/commands/modify/index.ts +16 -0
- package/packages/chili/src/commands/modify/mirror.ts +49 -0
- package/packages/chili/src/commands/modify/move.ts +39 -0
- package/packages/chili/src/commands/modify/removeFeature.ts +56 -0
- package/packages/chili/src/commands/modify/removeSubShapes.ts +44 -0
- package/packages/chili/src/commands/modify/rotate.ts +112 -0
- package/packages/chili/src/commands/modify/split.ts +81 -0
- package/packages/chili/src/commands/modify/transformedCommand.ts +100 -0
- package/packages/chili/src/commands/modify/trim.ts +254 -0
- package/packages/chili/src/commands/multistepCommand.ts +125 -0
- package/packages/chili/src/commands/redo.ts +16 -0
- package/packages/chili/src/commands/undo.ts +16 -0
- package/packages/chili/src/commands/workingPlane.ts +150 -0
- package/packages/chili/src/comparers/NumberEqualityComparer.ts +12 -0
- package/packages/chili/src/comparers/XYZEqualityComparer.ts +12 -0
- package/packages/chili/src/comparers/index.ts +5 -0
- package/packages/chili/src/document.ts +145 -0
- package/packages/chili/src/editEventHandler.ts +20 -0
- package/packages/chili/src/index.ts +12 -0
- package/packages/chili/src/selection.ts +178 -0
- package/packages/chili/src/services/commandService.ts +105 -0
- package/packages/chili/src/services/editorService.ts +46 -0
- package/packages/chili/src/services/hotkeyService.ts +102 -0
- package/packages/chili/src/services/index.ts +6 -0
- package/packages/chili/src/snap/dimension.ts +33 -0
- package/packages/chili/src/snap/handlers/angleSnapEventHandler.ts +60 -0
- package/packages/chili/src/snap/handlers/index.ts +7 -0
- package/packages/chili/src/snap/handlers/lengthSnapEventHandler.ts +117 -0
- package/packages/chili/src/snap/handlers/pointSnapEventHandler.ts +176 -0
- package/packages/chili/src/snap/handlers/snapEventHandler.ts +288 -0
- package/packages/chili/src/snap/index.ts +6 -0
- package/packages/chili/src/snap/snap.ts +50 -0
- package/packages/chili/src/snap/snaps/axisSnap.ts +57 -0
- package/packages/chili/src/snap/snaps/baseSnap.ts +69 -0
- package/packages/chili/src/snap/snaps/featurePointStrategy.ts +64 -0
- package/packages/chili/src/snap/snaps/index.ts +7 -0
- package/packages/chili/src/snap/snaps/objectSnap.ts +264 -0
- package/packages/chili/src/snap/snaps/planeSnap.ts +55 -0
- package/packages/chili/src/snap/snaps/pointOnCurveSnap.ts +24 -0
- package/packages/chili/src/snap/tracking/axis.ts +32 -0
- package/packages/chili/src/snap/tracking/axisTracking.ts +46 -0
- package/packages/chili/src/snap/tracking/index.ts +6 -0
- package/packages/chili/src/snap/tracking/objectTracking.ts +90 -0
- package/packages/chili/src/snap/tracking/trackingBase.ts +40 -0
- package/packages/chili/src/snap/tracking/trackingSnap.ts +201 -0
- package/packages/chili/src/step/angleStep.ts +32 -0
- package/packages/chili/src/step/index.ts +8 -0
- package/packages/chili/src/step/lengthStep.ts +32 -0
- package/packages/chili/src/step/pointStep.ts +87 -0
- package/packages/chili/src/step/selectStep.ts +130 -0
- package/packages/chili/src/step/step.ts +55 -0
- package/packages/chili/src/utils.ts +19 -0
- package/packages/chili/test/command.test.ts +4 -0
- package/packages/chili-builder/package.json +13 -0
- package/packages/chili-builder/src/additionalModule.ts +15 -0
- package/packages/chili-builder/src/appBuilder.ts +176 -0
- package/packages/chili-builder/src/defaultDataExchange.ts +152 -0
- package/packages/chili-builder/src/index.ts +5 -0
- package/packages/chili-builder/src/ribbon.ts +129 -0
- package/packages/chili-controls/package.json +9 -0
- package/packages/chili-controls/src/collection.ts +96 -0
- package/packages/chili-controls/src/controls.ts +83 -0
- package/packages/chili-controls/src/converters/colorConverter.ts +39 -0
- package/packages/chili-controls/src/converters/index.ts +8 -0
- package/packages/chili-controls/src/converters/numberConverter.ts +15 -0
- package/packages/chili-controls/src/converters/stringConverter.ts +13 -0
- package/packages/chili-controls/src/converters/urlConverter.ts +10 -0
- package/packages/chili-controls/src/converters/xyzConverter.ts +28 -0
- package/packages/chili-controls/src/expander/expander.module.css +38 -0
- package/packages/chili-controls/src/expander/expander.ts +59 -0
- package/packages/chili-controls/src/expander/index.ts +4 -0
- package/packages/chili-controls/src/htmlProps.ts +10 -0
- package/packages/chili-controls/src/index.ts +10 -0
- package/packages/chili-controls/src/radioGroup.module.css +20 -0
- package/packages/chili-controls/src/radioGroup.ts +54 -0
- package/packages/chili-controls/src/utils.ts +20 -0
- package/packages/chili-controls/test/converter.test.ts +70 -0
- package/packages/chili-controls/test/styleMock.js +4 -0
- package/packages/chili-core/package.json +7 -0
- package/packages/chili-core/src/application.ts +38 -0
- package/packages/chili-core/src/command/command.ts +154 -0
- package/packages/chili-core/src/command/commandKeys.ts +8 -0
- package/packages/chili-core/src/command/decarator.ts +43 -0
- package/packages/chili-core/src/command/index.ts +6 -0
- package/packages/chili-core/src/config.ts +145 -0
- package/packages/chili-core/src/constants.ts +8 -0
- package/packages/chili-core/src/dataExchange.ts +12 -0
- package/packages/chili-core/src/document.ts +25 -0
- package/packages/chili-core/src/editor.ts +12 -0
- package/packages/chili-core/src/foundation/asyncController.ts +55 -0
- package/packages/chili-core/src/foundation/binding.ts +132 -0
- package/packages/chili-core/src/foundation/collection.ts +208 -0
- package/packages/chili-core/src/foundation/converter.ts +9 -0
- package/packages/chili-core/src/foundation/deepObserver.ts +154 -0
- package/packages/chili-core/src/foundation/disposable.ts +18 -0
- package/packages/chili-core/src/foundation/dto/index.ts +9 -0
- package/packages/chili-core/src/foundation/equalityComparer.ts +6 -0
- package/packages/chili-core/src/foundation/gc.ts +36 -0
- package/packages/chili-core/src/foundation/history.ts +237 -0
- package/packages/chili-core/src/foundation/id.ts +25 -0
- package/packages/chili-core/src/foundation/index.ts +26 -0
- package/packages/chili-core/src/foundation/lazy.ts +18 -0
- package/packages/chili-core/src/foundation/linkedList.ts +141 -0
- package/packages/chili-core/src/foundation/logger.ts +45 -0
- package/packages/chili-core/src/foundation/messageType.ts +8 -0
- package/packages/chili-core/src/foundation/objectStorage.ts +50 -0
- package/packages/chili-core/src/foundation/observer.ts +147 -0
- package/packages/chili-core/src/foundation/precision.ts +8 -0
- package/packages/chili-core/src/foundation/pubsub.ts +74 -0
- package/packages/chili-core/src/foundation/result.ts +69 -0
- package/packages/chili-core/src/foundation/storage.ts +10 -0
- package/packages/chili-core/src/foundation/transaction.ts +77 -0
- package/packages/chili-core/src/foundation/utils/debounce.ts +15 -0
- package/packages/chili-core/src/foundation/utils/download.ts +16 -0
- package/packages/chili-core/src/foundation/utils/index.ts +6 -0
- package/packages/chili-core/src/foundation/utils/readFileAsync.ts +84 -0
- package/packages/chili-core/src/i18n/i18n.ts +107 -0
- package/packages/chili-core/src/i18n/index.ts +5 -0
- package/packages/chili-core/src/i18n/keys.ts +265 -0
- package/packages/chili-core/src/index.ts +26 -0
- package/packages/chili-core/src/material.ts +269 -0
- package/packages/chili-core/src/math/boundingBox.ts +226 -0
- package/packages/chili-core/src/math/index.ts +14 -0
- package/packages/chili-core/src/math/line.ts +55 -0
- package/packages/chili-core/src/math/lineSegment.ts +166 -0
- package/packages/chili-core/src/math/mathUtils.ts +45 -0
- package/packages/chili-core/src/math/matrix4.ts +414 -0
- package/packages/chili-core/src/math/plane.ts +96 -0
- package/packages/chili-core/src/math/planeAngle.ts +53 -0
- package/packages/chili-core/src/math/quaternion.ts +131 -0
- package/packages/chili-core/src/math/ray.ts +30 -0
- package/packages/chili-core/src/math/xy.ts +104 -0
- package/packages/chili-core/src/math/xyz.ts +181 -0
- package/packages/chili-core/src/model/component.ts +305 -0
- package/packages/chili-core/src/model/facebaseNode.ts +17 -0
- package/packages/chili-core/src/model/folderNode.ts +289 -0
- package/packages/chili-core/src/model/geometryNode.ts +185 -0
- package/packages/chili-core/src/model/groupNode.ts +19 -0
- package/packages/chili-core/src/model/index.ts +12 -0
- package/packages/chili-core/src/model/meshNode.ts +53 -0
- package/packages/chili-core/src/model/node.ts +315 -0
- package/packages/chili-core/src/model/shapeNode.ts +195 -0
- package/packages/chili-core/src/model/visualNode.ts +39 -0
- package/packages/chili-core/src/modelManager.ts +147 -0
- package/packages/chili-core/src/navigation.ts +58 -0
- package/packages/chili-core/src/property.ts +60 -0
- package/packages/chili-core/src/selection.ts +33 -0
- package/packages/chili-core/src/selectionFilter.ts +28 -0
- package/packages/chili-core/src/serialize/index.ts +4 -0
- package/packages/chili-core/src/serialize/serializer.ts +231 -0
- package/packages/chili-core/src/service.ts +10 -0
- package/packages/chili-core/src/shape/curve.ts +174 -0
- package/packages/chili-core/src/shape/geometry.ts +17 -0
- package/packages/chili-core/src/shape/index.ts +12 -0
- package/packages/chili-core/src/shape/lineType.ts +7 -0
- package/packages/chili-core/src/shape/meshData.ts +347 -0
- package/packages/chili-core/src/shape/shape.ts +104 -0
- package/packages/chili-core/src/shape/shapeConverter.ts +17 -0
- package/packages/chili-core/src/shape/shapeFactory.ts +58 -0
- package/packages/chili-core/src/shape/shapeType.ts +75 -0
- package/packages/chili-core/src/shape/surface.ts +154 -0
- package/packages/chili-core/src/snapType.ts +32 -0
- package/packages/chili-core/src/ui/button.ts +16 -0
- package/packages/chili-core/src/ui/combobox.ts +27 -0
- package/packages/chili-core/src/ui/dialog.ts +7 -0
- package/packages/chili-core/src/ui/index.ts +8 -0
- package/packages/chili-core/src/ui/ribbon.ts +15 -0
- package/packages/chili-core/src/ui/window.ts +13 -0
- package/packages/chili-core/src/visual/act.ts +59 -0
- package/packages/chili-core/src/visual/cameraController.ts +22 -0
- package/packages/chili-core/src/visual/cursorType.ts +4 -0
- package/packages/chili-core/src/visual/detectedData.ts +14 -0
- package/packages/chili-core/src/visual/eventHandler.ts +15 -0
- package/packages/chili-core/src/visual/highlighter.ts +16 -0
- package/packages/chili-core/src/visual/index.ts +20 -0
- package/packages/chili-core/src/visual/meshExporter.ts +11 -0
- package/packages/chili-core/src/visual/meshUtils.ts +276 -0
- package/packages/chili-core/src/visual/textGenerator.ts +8 -0
- package/packages/chili-core/src/visual/view.ts +80 -0
- package/packages/chili-core/src/visual/viewGizmo.ts +8 -0
- package/packages/chili-core/src/visual/viewport.ts +10 -0
- package/packages/chili-core/src/visual/visual.ts +24 -0
- package/packages/chili-core/src/visual/visualContext.ts +29 -0
- package/packages/chili-core/src/visual/visualFactory.ts +10 -0
- package/packages/chili-core/src/visual/visualObject.ts +25 -0
- package/packages/chili-core/src/visual/visualShape.ts +30 -0
- package/packages/chili-core/test/binding.test.ts +95 -0
- package/packages/chili-core/test/boundingBox.test.ts +60 -0
- package/packages/chili-core/test/collection.test.ts +53 -0
- package/packages/chili-core/test/history.test.ts +42 -0
- package/packages/chili-core/test/line.test.ts +75 -0
- package/packages/chili-core/test/linesegment.test.ts +98 -0
- package/packages/chili-core/test/linkedList.test.ts +82 -0
- package/packages/chili-core/test/math.test.ts +34 -0
- package/packages/chili-core/test/matrix.test.ts +129 -0
- package/packages/chili-core/test/node.test.ts +122 -0
- package/packages/chili-core/test/nodeList.test.ts +247 -0
- package/packages/chili-core/test/observer.test.ts +91 -0
- package/packages/chili-core/test/plane.test.ts +31 -0
- package/packages/chili-core/test/quaternion.test.ts +14 -0
- package/packages/chili-core/test/result.test.ts +24 -0
- package/packages/chili-core/test/serializer.test.ts +58 -0
- package/packages/chili-core/test/snapType.test.ts +10 -0
- package/packages/chili-core/test/task.test.ts +41 -0
- package/packages/chili-core/test/testDocument.ts +70 -0
- package/packages/chili-core/test/transaction.test.ts +42 -0
- package/packages/chili-core/test/visual.test.ts +42 -0
- package/packages/chili-core/test/xyz.test.ts +260 -0
- package/packages/chili-geo/package.json +9 -0
- package/packages/chili-geo/src/index.ts +4 -0
- package/packages/chili-geo/src/utils.ts +113 -0
- package/packages/chili-i18n/package.json +9 -0
- package/packages/chili-i18n/src/en.ts +270 -0
- package/packages/chili-i18n/src/index.ts +8 -0
- package/packages/chili-i18n/src/pt-br.ts +67 -0
- package/packages/chili-i18n/src/zh-cn.ts +269 -0
- package/packages/chili-storage/package.json +9 -0
- package/packages/chili-storage/src/index.ts +4 -0
- package/packages/chili-storage/src/indexedDBStorage.ts +150 -0
- package/packages/chili-three/package.json +13 -0
- package/packages/chili-three/src/cameraController.ts +335 -0
- package/packages/chili-three/src/common.ts +65 -0
- package/packages/chili-three/src/constants.ts +12 -0
- package/packages/chili-three/src/highlightable.ts +13 -0
- package/packages/chili-three/src/index.ts +4 -0
- package/packages/chili-three/src/meshExporter.ts +69 -0
- package/packages/chili-three/src/outlinePass.js +340 -0
- package/packages/chili-three/src/texture_points.jpg +0 -0
- package/packages/chili-three/src/threeGeometry.ts +207 -0
- package/packages/chili-three/src/threeGeometryFactory.ts +120 -0
- package/packages/chili-three/src/threeHelper.ts +174 -0
- package/packages/chili-three/src/threeHighlighter.ts +257 -0
- package/packages/chili-three/src/threeView.module.css +39 -0
- package/packages/chili-three/src/threeView.ts +669 -0
- package/packages/chili-three/src/threeViewEventHandler.ts +193 -0
- package/packages/chili-three/src/threeVisual.ts +92 -0
- package/packages/chili-three/src/threeVisualContext.ts +435 -0
- package/packages/chili-three/src/threeVisualFactory.ts +12 -0
- package/packages/chili-three/src/threeVisualObject.ts +442 -0
- package/packages/chili-three/src/viewGizmo.ts +305 -0
- package/packages/chili-three/test/cameraControls.ts +10 -0
- package/packages/chili-three/test/testDocument.ts +68 -0
- package/packages/chili-three/test/testEdge.ts +171 -0
- package/packages/chili-three/test/testView.ts +78 -0
- package/packages/chili-three/test/three.test.ts +44 -0
- package/packages/chili-three/test/viewGizmo.ts +12 -0
- package/packages/chili-ui/package.json +12 -0
- package/packages/chili-ui/src/cursor/draw.cur +0 -0
- package/packages/chili-ui/src/cursor/index.ts +17 -0
- package/packages/chili-ui/src/dialog.module.css +63 -0
- package/packages/chili-ui/src/dialog.ts +42 -0
- package/packages/chili-ui/src/editor.module.css +83 -0
- package/packages/chili-ui/src/editor.ts +142 -0
- package/packages/chili-ui/src/home/home.module.css +301 -0
- package/packages/chili-ui/src/home/home.ts +243 -0
- package/packages/chili-ui/src/home/index.ts +4 -0
- package/packages/chili-ui/src/home/languageSelector.ts +27 -0
- package/packages/chili-ui/src/home/navigation3DSelector.ts +27 -0
- package/packages/chili-ui/src/home/themeSelector.ts +34 -0
- package/packages/chili-ui/src/index.ts +5 -0
- package/packages/chili-ui/src/mainWindow.module.css +144 -0
- package/packages/chili-ui/src/mainWindow.ts +154 -0
- package/packages/chili-ui/src/okCancel.module.css +54 -0
- package/packages/chili-ui/src/okCancel.ts +58 -0
- package/packages/chili-ui/src/permanent.module.css +44 -0
- package/packages/chili-ui/src/permanent.ts +31 -0
- package/packages/chili-ui/src/project/index.ts +4 -0
- package/packages/chili-ui/src/project/projectView.module.css +37 -0
- package/packages/chili-ui/src/project/projectView.ts +77 -0
- package/packages/chili-ui/src/project/toolBar.module.css +16 -0
- package/packages/chili-ui/src/project/toolBar.ts +73 -0
- package/packages/chili-ui/src/project/tree/index.ts +5 -0
- package/packages/chili-ui/src/project/tree/tree.module.css +16 -0
- package/packages/chili-ui/src/project/tree/tree.ts +265 -0
- package/packages/chili-ui/src/project/tree/treeItem.module.css +21 -0
- package/packages/chili-ui/src/project/tree/treeItem.ts +89 -0
- package/packages/chili-ui/src/project/tree/treeItemGroup.module.css +33 -0
- package/packages/chili-ui/src/project/tree/treeItemGroup.ts +85 -0
- package/packages/chili-ui/src/project/tree/treeModel.module.css +11 -0
- package/packages/chili-ui/src/project/tree/treeModel.ts +20 -0
- package/packages/chili-ui/src/property/check.ts +39 -0
- package/packages/chili-ui/src/property/colorPorperty.module.css +6 -0
- package/packages/chili-ui/src/property/colorProperty.ts +63 -0
- package/packages/chili-ui/src/property/common.module.css +14 -0
- package/packages/chili-ui/src/property/index.ts +4 -0
- package/packages/chili-ui/src/property/input.module.css +19 -0
- package/packages/chili-ui/src/property/input.ts +140 -0
- package/packages/chili-ui/src/property/material/index.ts +5 -0
- package/packages/chili-ui/src/property/material/materialDataContent.ts +44 -0
- package/packages/chili-ui/src/property/material/materialEditor.module.css +98 -0
- package/packages/chili-ui/src/property/material/materialEditor.ts +147 -0
- package/packages/chili-ui/src/property/material/textureEditor.module.css +46 -0
- package/packages/chili-ui/src/property/material/textureEditor.ts +61 -0
- package/packages/chili-ui/src/property/materialProperty.module.css +30 -0
- package/packages/chili-ui/src/property/materialProperty.ts +86 -0
- package/packages/chili-ui/src/property/matrixProperty.ts +147 -0
- package/packages/chili-ui/src/property/propertyBase.module.css +3 -0
- package/packages/chili-ui/src/property/propertyBase.ts +14 -0
- package/packages/chili-ui/src/property/propertyView.module.css +36 -0
- package/packages/chili-ui/src/property/propertyView.ts +115 -0
- package/packages/chili-ui/src/property/utils.ts +48 -0
- package/packages/chili-ui/src/ribbon/commandContext.module.css +73 -0
- package/packages/chili-ui/src/ribbon/commandContext.ts +239 -0
- package/packages/chili-ui/src/ribbon/index.ts +4 -0
- package/packages/chili-ui/src/ribbon/ribbon.module.css +286 -0
- package/packages/chili-ui/src/ribbon/ribbon.ts +288 -0
- package/packages/chili-ui/src/ribbon/ribbonButton.module.css +75 -0
- package/packages/chili-ui/src/ribbon/ribbonButton.ts +88 -0
- package/packages/chili-ui/src/ribbon/ribbonData.ts +66 -0
- package/packages/chili-ui/src/ribbon/ribbonStack.module.css +6 -0
- package/packages/chili-ui/src/ribbon/ribbonStack.ts +13 -0
- package/packages/chili-ui/src/ribbon/ribbonToggleButton.module.css +3 -0
- package/packages/chili-ui/src/ribbon/ribbonToggleButton.ts +6 -0
- package/packages/chili-ui/src/statusbar/index.ts +4 -0
- package/packages/chili-ui/src/statusbar/snapConfig.module.css +25 -0
- package/packages/chili-ui/src/statusbar/snapConfig.ts +92 -0
- package/packages/chili-ui/src/statusbar/statusbar.module.css +28 -0
- package/packages/chili-ui/src/statusbar/statusbar.ts +54 -0
- package/packages/chili-ui/src/toast/index.ts +4 -0
- package/packages/chili-ui/src/toast/toast.module.css +27 -0
- package/packages/chili-ui/src/toast/toast.ts +39 -0
- package/packages/chili-ui/src/viewport/flyout/flyout.module.css +9 -0
- package/packages/chili-ui/src/viewport/flyout/flyout.ts +77 -0
- package/packages/chili-ui/src/viewport/flyout/index.ts +6 -0
- package/packages/chili-ui/src/viewport/flyout/input.module.css +21 -0
- package/packages/chili-ui/src/viewport/flyout/input.ts +89 -0
- package/packages/chili-ui/src/viewport/flyout/tip.module.css +21 -0
- package/packages/chili-ui/src/viewport/flyout/tip.ts +45 -0
- package/packages/chili-ui/src/viewport/index.ts +4 -0
- package/packages/chili-ui/src/viewport/layoutViewport.module.css +21 -0
- package/packages/chili-ui/src/viewport/layoutViewport.ts +76 -0
- package/packages/chili-ui/src/viewport/viewport.module.css +179 -0
- package/packages/chili-ui/src/viewport/viewport.ts +296 -0
- package/packages/chili-vis/package.json +9 -0
- package/packages/chili-vis/src/index.ts +7 -0
- package/packages/chili-vis/src/nodeSelectionEventHandler.ts +122 -0
- package/packages/chili-vis/src/selectionEventHandler.ts +145 -0
- package/packages/chili-vis/src/shapeSelectionEventHandler.ts +176 -0
- package/packages/chili-vis/src/viewUtils.ts +64 -0
- package/packages/chili-wasm/lib/chili-wasm.d.ts +827 -0
- package/packages/chili-wasm/lib/chili-wasm.js +5275 -0
- package/packages/chili-wasm/lib/chili-wasm.wasm +0 -0
- package/packages/chili-wasm/package.json +10 -0
- package/packages/chili-wasm/src/converter.ts +124 -0
- package/packages/chili-wasm/src/curve.ts +589 -0
- package/packages/chili-wasm/src/factory.ts +331 -0
- package/packages/chili-wasm/src/geometry.ts +51 -0
- package/packages/chili-wasm/src/helper.ts +435 -0
- package/packages/chili-wasm/src/index.ts +5 -0
- package/packages/chili-wasm/src/mesher.ts +114 -0
- package/packages/chili-wasm/src/shape.ts +481 -0
- package/packages/chili-wasm/src/surface.ts +510 -0
- package/packages/chili-wasm/src/wasm.ts +13 -0
- package/packages/chili-web/package.json +9 -0
- package/packages/chili-web/src/index.ts +33 -0
- package/packages/chili-web/src/loading.ts +67 -0
- package/packages/global.d.ts +31 -0
- package/public/favicon.svg +10 -0
- package/public/fonts/fzhei.json +46120 -0
- package/public/iconfont.js +1 -0
- package/public/images/wechat.jpg +0 -0
- package/public/index.css +13 -0
- package/public/index.html +24 -0
- package/rspack.config.ts +93 -0
- package/rstest.config.ts +27 -0
- package/screenshots/screenshot.png +0 -0
- package/scripts/add_copyright.mjs +59 -0
- package/scripts/build-npm.mjs +105 -0
- package/scripts/common.mjs +24 -0
- package/scripts/release.mjs +92 -0
- package/scripts/restore-package-json.mjs +27 -0
- package/scripts/setup_wasm_deps.mjs +97 -0
- package/scripts/update-package-json.mjs +27 -0
- package/tsconfig.build.json +14 -0
- package/tsconfig.build.tsbuildinfo +1 -0
- package/tsconfig.json +19 -0
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
// Part of the Chili3d Project, under the AGPL-3.0 License.
|
|
2
|
+
// See LICENSE file in the project root for full license information.
|
|
3
|
+
|
|
4
|
+
import { Precision, XY, XYZ } from "../src";
|
|
5
|
+
|
|
6
|
+
describe("XYZ class tests", () => {
|
|
7
|
+
describe("Basic properties and constructor", () => {
|
|
8
|
+
test("should create XYZ instance with given values", () => {
|
|
9
|
+
const point = new XYZ(1, 2, 3);
|
|
10
|
+
expect(point.x).toBe(1);
|
|
11
|
+
expect(point.y).toBe(2);
|
|
12
|
+
expect(point.z).toBe(3);
|
|
13
|
+
|
|
14
|
+
expect(XYZ.fromArray(undefined as any)).toEqual(XYZ.zero);
|
|
15
|
+
expect(XYZ.fromArray([1, 2, 3])).toEqual(point);
|
|
16
|
+
expect(XYZ.fromArray([1, 2])).toEqual(new XYZ(1, 2, 0));
|
|
17
|
+
expect(XYZ.fromArray([1, 2, 3, 4])).toEqual(new XYZ(1, 2, 3));
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
test("should have correct static properties", () => {
|
|
21
|
+
expect(XYZ.zero).toEqual(new XYZ(0, 0, 0));
|
|
22
|
+
expect(XYZ.unitX).toEqual(new XYZ(1, 0, 0));
|
|
23
|
+
expect(XYZ.unitY).toEqual(new XYZ(0, 1, 0));
|
|
24
|
+
expect(XYZ.unitZ).toEqual(new XYZ(0, 0, 1));
|
|
25
|
+
expect(XYZ.unitNX).toEqual(new XYZ(-1, 0, 0));
|
|
26
|
+
expect(XYZ.unitNY).toEqual(new XYZ(0, -1, 0));
|
|
27
|
+
expect(XYZ.unitNZ).toEqual(new XYZ(0, 0, -1));
|
|
28
|
+
expect(XYZ.one).toEqual(new XYZ(1, 1, 1));
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
test("should convert to string and array correctly", () => {
|
|
32
|
+
const point = new XYZ(1, 2, 3);
|
|
33
|
+
expect(point.toString()).toBe("1, 2, 3");
|
|
34
|
+
expect(point.toArray()).toEqual([1, 2, 3]);
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
describe("Arithmetic operations", () => {
|
|
39
|
+
test("should add vectors correctly", () => {
|
|
40
|
+
const a = new XYZ(1, 2, 3);
|
|
41
|
+
const b = new XYZ(4, 5, 6);
|
|
42
|
+
const result = a.add(b);
|
|
43
|
+
expect(result).toEqual(new XYZ(5, 7, 9));
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
test("should subtract vectors correctly", () => {
|
|
47
|
+
const a = new XYZ(5, 7, 9);
|
|
48
|
+
const b = new XYZ(1, 2, 3);
|
|
49
|
+
const result = a.sub(b);
|
|
50
|
+
expect(result).toEqual(new XYZ(4, 5, 6));
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
test("should multiply by scalar correctly", () => {
|
|
54
|
+
const point = new XYZ(1, 2, 3);
|
|
55
|
+
const result = point.multiply(3);
|
|
56
|
+
expect(result).toEqual(new XYZ(3, 6, 9));
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
test("should divide by scalar correctly", () => {
|
|
60
|
+
const point = new XYZ(10, 20, 30);
|
|
61
|
+
const result = point.divided(2);
|
|
62
|
+
expect(result).toEqual(new XYZ(5, 10, 15));
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
test("should return undefined when dividing by zero", () => {
|
|
66
|
+
const point = new XYZ(10, 20, 30);
|
|
67
|
+
const result = point.divided(0);
|
|
68
|
+
expect(result).toBeUndefined();
|
|
69
|
+
|
|
70
|
+
const result2 = point.divided(Precision.Float / 2); // very small number
|
|
71
|
+
expect(result2).toBeUndefined();
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
test("should reverse the vector correctly", () => {
|
|
75
|
+
const point = new XYZ(1, 2, 3);
|
|
76
|
+
const reversed = point.reverse();
|
|
77
|
+
expect(reversed).toEqual(new XYZ(-1, -2, -3));
|
|
78
|
+
|
|
79
|
+
const zero = XYZ.zero.reverse();
|
|
80
|
+
expect(zero).toEqual(new XYZ(0, 0, 0));
|
|
81
|
+
});
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
describe("Mathematical operations", () => {
|
|
85
|
+
test("should calculate cross product correctly", () => {
|
|
86
|
+
const a = new XYZ(1, 0, 0);
|
|
87
|
+
const b = new XYZ(0, 1, 0);
|
|
88
|
+
const result = a.cross(b);
|
|
89
|
+
expect(result).toEqual(new XYZ(0, 0, 1));
|
|
90
|
+
|
|
91
|
+
const c = new XYZ(2, 3, 4);
|
|
92
|
+
const d = new XYZ(5, 6, 7);
|
|
93
|
+
const result2 = c.cross(d);
|
|
94
|
+
expect(result2).toEqual(new XYZ(-3, 6, -3)); // (3*7-4*6, 4*5-2*7, 2*6-3*5)
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
test("should calculate dot product correctly", () => {
|
|
98
|
+
const a = new XYZ(1, 2, 3);
|
|
99
|
+
const b = new XYZ(4, 5, 6);
|
|
100
|
+
expect(a.dot(b)).toBe(32); // 1*4 + 2*5 + 3*6 = 4 + 10 + 18 = 32
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
test("should calculate length and length squared correctly", () => {
|
|
104
|
+
const point = new XYZ(3, 4, 5);
|
|
105
|
+
expect(point.lengthSq()).toBe(50); // 9 + 16 + 25
|
|
106
|
+
expect(point.length()).toBe(Math.sqrt(50));
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
test("should normalize vector correctly", () => {
|
|
110
|
+
const point = new XYZ(3, 0, 0);
|
|
111
|
+
const normalized = point.normalize();
|
|
112
|
+
expect(normalized).toEqual(new XYZ(1, 0, 0));
|
|
113
|
+
|
|
114
|
+
const unit = new XYZ(1, 1, 1);
|
|
115
|
+
const normalized2 = unit.normalize();
|
|
116
|
+
const length = Math.sqrt(3);
|
|
117
|
+
expect(normalized2).toEqual(new XYZ(1 / length, 1 / length, 1 / length));
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
test("should return undefined for zero vector normalization", () => {
|
|
121
|
+
const normalized = XYZ.zero.normalize();
|
|
122
|
+
expect(normalized).toBeUndefined();
|
|
123
|
+
});
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
describe("Distance and geometric operations", () => {
|
|
127
|
+
test("should calculate distance correctly", () => {
|
|
128
|
+
const a = new XYZ(0, 0, 0);
|
|
129
|
+
const b = new XYZ(3, 4, 0);
|
|
130
|
+
expect(a.distanceTo(b)).toBe(5); // 3-4-5 triangle
|
|
131
|
+
|
|
132
|
+
const c = new XYZ(1, 1, 1);
|
|
133
|
+
const d = new XYZ(4, 5, 1);
|
|
134
|
+
expect(c.distanceTo(d)).toBe(5); // 3-4-5 triangle in xy plane
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
test("should calculate center correctly", () => {
|
|
138
|
+
const p1 = new XYZ(0, 0, 0);
|
|
139
|
+
const p2 = new XYZ(4, 6, 8);
|
|
140
|
+
const center = XYZ.center(p1, p2);
|
|
141
|
+
expect(center).toEqual(new XYZ(2, 3, 4));
|
|
142
|
+
});
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
describe("Angle operations", () => {
|
|
146
|
+
test("should calculate angle correctly", () => {
|
|
147
|
+
const a = new XYZ(10, 0, 0);
|
|
148
|
+
const b = new XYZ(0, 10, 0);
|
|
149
|
+
expect(a.angleTo(b)).toBe(Math.PI / 2);
|
|
150
|
+
expect(a.angleTo(new XYZ(10, 0, 0))).toBe(0);
|
|
151
|
+
expect(a.angleTo(new XYZ(10, 10, 0))).toBe(Math.PI / 4);
|
|
152
|
+
expect(a.angleTo(new XYZ(0, 10, 0))).toBe(Math.PI / 2);
|
|
153
|
+
expect(a.angleTo(new XYZ(-10, 10, 0))).toBe((Math.PI * 3) / 4);
|
|
154
|
+
expect(a.angleTo(new XYZ(-10, 0, 0))).toBe(Math.PI);
|
|
155
|
+
expect(a.angleTo(new XYZ(-10, -10, 0))).toBe((Math.PI * 3) / 4);
|
|
156
|
+
expect(a.angleTo(new XYZ(10, -10, 0))).toBe(Math.PI / 4);
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
test("should return undefined for zero vector angle", () => {
|
|
160
|
+
expect(XYZ.zero.angleTo(new XYZ(0, 0, 0))).toBe(undefined);
|
|
161
|
+
expect(XYZ.zero.angleTo(new XYZ(1, 0, 0))).toBeUndefined();
|
|
162
|
+
expect(new XYZ(1, 0, 0).angleTo(XYZ.zero)).toBeUndefined();
|
|
163
|
+
});
|
|
164
|
+
|
|
165
|
+
test("should calculate angle on plane correctly", () => {
|
|
166
|
+
const a = new XYZ(10, 0, 0);
|
|
167
|
+
const b = new XYZ(0, 10, 0);
|
|
168
|
+
expect(a.angleOnPlaneTo(b, XYZ.unitZ)).toBe(Math.PI / 2);
|
|
169
|
+
expect(a.angleOnPlaneTo(new XYZ(10, 0, 0), XYZ.unitZ)).toBe(0);
|
|
170
|
+
expect(a.angleOnPlaneTo(new XYZ(10, 10, 0), XYZ.unitZ)).toBe(Math.PI / 4);
|
|
171
|
+
expect(a.angleOnPlaneTo(new XYZ(0, 10, 0), XYZ.unitZ)).toBe(Math.PI / 2);
|
|
172
|
+
expect(a.angleOnPlaneTo(new XYZ(-10, 10, 0), XYZ.unitZ)).toBe((Math.PI * 3) / 4);
|
|
173
|
+
expect(a.angleOnPlaneTo(new XYZ(-10, 0, 0), XYZ.unitZ)).toBe(Math.PI);
|
|
174
|
+
expect(a.angleOnPlaneTo(new XYZ(-10, -10, 0), XYZ.unitZ)).toBe((Math.PI * 5) / 4);
|
|
175
|
+
expect(a.angleOnPlaneTo(new XYZ(10, -10, 0), XYZ.unitZ)).toBe((Math.PI * 7) / 4);
|
|
176
|
+
|
|
177
|
+
expect(new XYZ(10, 10, 0).angleOnPlaneTo(a, XYZ.unitZ)).toBe((Math.PI * 7) / 4);
|
|
178
|
+
expect(a.angleOnPlaneTo(new XYZ(10, 10, 0), new XYZ(0, 0, -1))).toBe((Math.PI * 7) / 4);
|
|
179
|
+
});
|
|
180
|
+
|
|
181
|
+
test("should return undefined for zero normal in angleOnPlaneTo", () => {
|
|
182
|
+
const a = new XYZ(1, 0, 0);
|
|
183
|
+
const b = new XYZ(0, 1, 0);
|
|
184
|
+
expect(a.angleOnPlaneTo(b, XYZ.zero)).toBeUndefined();
|
|
185
|
+
expect(XYZ.zero.angleOnPlaneTo(XYZ.zero, XYZ.unitZ)).toBe(undefined);
|
|
186
|
+
});
|
|
187
|
+
});
|
|
188
|
+
|
|
189
|
+
describe("Rotation operations", () => {
|
|
190
|
+
test("should rotate vector correctly", () => {
|
|
191
|
+
const v = XYZ.unitX.add(XYZ.unitZ);
|
|
192
|
+
expect(v.rotate(v, 90)?.isEqualTo(v)).toBeTruthy();
|
|
193
|
+
expect(
|
|
194
|
+
XYZ.unitX.rotate(XYZ.unitZ, Math.PI / 4)?.isEqualTo(new XYZ(1, 1, 0).normalize()!),
|
|
195
|
+
).toBeTruthy();
|
|
196
|
+
expect(XYZ.unitX.rotate(XYZ.unitZ, Math.PI / 2)?.isEqualTo(new XYZ(0, 1, 0))).toBeTruthy();
|
|
197
|
+
expect(XYZ.unitX.rotate(XYZ.unitZ, Math.PI / 1)?.isEqualTo(new XYZ(-1, 0, 0))).toBeTruthy();
|
|
198
|
+
expect(XYZ.unitX.rotate(XYZ.unitZ, Math.PI * 1.5)?.isEqualTo(new XYZ(0, -1, 0))).toBeTruthy();
|
|
199
|
+
|
|
200
|
+
const result = XYZ.unitX.rotate(XYZ.unitZ, Math.PI / 2);
|
|
201
|
+
expect(result?.isEqualTo(XYZ.unitY, 1e-10)).toBeTruthy();
|
|
202
|
+
|
|
203
|
+
const result2 = XYZ.unitY.rotate(XYZ.unitZ, Math.PI / 2);
|
|
204
|
+
expect(result2?.isEqualTo(XYZ.unitX.reverse(), 1e-10)).toBeTruthy();
|
|
205
|
+
});
|
|
206
|
+
|
|
207
|
+
test("should handle edge cases for rotation", () => {
|
|
208
|
+
const result = XYZ.unitX.rotate(XYZ.zero, Math.PI / 2);
|
|
209
|
+
expect(result).toBeUndefined();
|
|
210
|
+
});
|
|
211
|
+
});
|
|
212
|
+
|
|
213
|
+
describe("Comparison methods", () => {
|
|
214
|
+
test("isEqualTo should work correctly", () => {
|
|
215
|
+
const a = new XYZ(1, 2, 3);
|
|
216
|
+
const b = new XYZ(1, 2, 3);
|
|
217
|
+
expect(a.isEqualTo(b)).toBeTruthy();
|
|
218
|
+
|
|
219
|
+
const c = new XYZ(1.1, 2, 3);
|
|
220
|
+
expect(a.isEqualTo(c, 0.2)).toBeTruthy(); // within tolerance
|
|
221
|
+
expect(a.isEqualTo(c, 0.05)).toBeFalsy(); // outside tolerance
|
|
222
|
+
});
|
|
223
|
+
|
|
224
|
+
test("isPerpendicularTo should work correctly", () => {
|
|
225
|
+
const a = new XYZ(1, 0, 0);
|
|
226
|
+
const b = new XYZ(0, 1, 0);
|
|
227
|
+
expect(a.isPerpendicularTo(b)).toBeTruthy();
|
|
228
|
+
expect(a.isPerpendicularTo(b.reverse())).toBeTruthy();
|
|
229
|
+
|
|
230
|
+
const c = new XYZ(1, 1, 0);
|
|
231
|
+
expect(a.isPerpendicularTo(c, 0.1)).toBeFalsy();
|
|
232
|
+
});
|
|
233
|
+
|
|
234
|
+
test("isParallelTo should work correctly", () => {
|
|
235
|
+
const a = new XYZ(1, 0, 0);
|
|
236
|
+
const b = new XYZ(2, 0, 0);
|
|
237
|
+
expect(a.isParallelTo(b)).toBeTruthy();
|
|
238
|
+
|
|
239
|
+
const c = new XYZ(-1, 0, 0);
|
|
240
|
+
expect(a.isParallelTo(c)).toBeTruthy(); // opposite direction is still parallel
|
|
241
|
+
});
|
|
242
|
+
|
|
243
|
+
test("isOppositeTo should work correctly", () => {
|
|
244
|
+
const a = new XYZ(1, 0, 0);
|
|
245
|
+
const b = new XYZ(-1, 0, 0);
|
|
246
|
+
expect(a.isOppositeTo(b)).toBeTruthy();
|
|
247
|
+
|
|
248
|
+
const c = new XYZ(0, 1, 0);
|
|
249
|
+
expect(a.isOppositeTo(c)).toBeFalsy();
|
|
250
|
+
});
|
|
251
|
+
});
|
|
252
|
+
|
|
253
|
+
describe("XY class tests", () => {
|
|
254
|
+
test("should calculate angle for XY vectors", () => {
|
|
255
|
+
const v1 = XY.unitX;
|
|
256
|
+
const v2 = XY.unitY;
|
|
257
|
+
expect(v1.angleTo(v2)).toBe(Math.PI / 2);
|
|
258
|
+
});
|
|
259
|
+
});
|
|
260
|
+
});
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
// Part of the Chili3d Project, under the AGPL-3.0 License.
|
|
2
|
+
// See LICENSE file in the project root for full license information.
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
ICurve,
|
|
6
|
+
type IEdge,
|
|
7
|
+
type IFace,
|
|
8
|
+
type IWire,
|
|
9
|
+
Orientation,
|
|
10
|
+
Precision,
|
|
11
|
+
Result,
|
|
12
|
+
ShapeType,
|
|
13
|
+
XYZ,
|
|
14
|
+
} from "chili-core";
|
|
15
|
+
|
|
16
|
+
export class GeoUtils {
|
|
17
|
+
static nearestPoint(wire: IWire, point: XYZ): { edge: IEdge; point: XYZ } {
|
|
18
|
+
let minDistance = Number.MAX_VALUE;
|
|
19
|
+
let nearest: { edge: IEdge; point: XYZ } | undefined;
|
|
20
|
+
|
|
21
|
+
for (const edge of wire.findSubShapes(ShapeType.Edge) as IEdge[]) {
|
|
22
|
+
const tempPoint = edge.curve.nearestFromPoint(point);
|
|
23
|
+
if (tempPoint.distance < minDistance) {
|
|
24
|
+
nearest = { edge, point: tempPoint.point };
|
|
25
|
+
minDistance = tempPoint.distance;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return nearest!;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
static curveNormal(curve: ICurve) {
|
|
32
|
+
if (ICurve.isTrimmed(curve)) {
|
|
33
|
+
curve = curve.basisCurve;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
if (ICurve.isConic(curve)) {
|
|
37
|
+
return curve.axis;
|
|
38
|
+
}
|
|
39
|
+
const vec = curve.dn(0, 1);
|
|
40
|
+
if (vec.isParallelTo(XYZ.unitX)) return XYZ.unitZ;
|
|
41
|
+
return vec.cross(XYZ.unitX).normalize()!;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
private static wireNormal(wire: IWire): XYZ {
|
|
45
|
+
const edges = wire.findSubShapes(ShapeType.Edge) as IEdge[];
|
|
46
|
+
if (edges.length === 0) {
|
|
47
|
+
console.warn("Empty wire");
|
|
48
|
+
return XYZ.unitZ;
|
|
49
|
+
} else if (edges.length === 1) {
|
|
50
|
+
return GeoUtils.curveNormal(edges[0].curve);
|
|
51
|
+
} else {
|
|
52
|
+
const curve1 = edges[0].curve;
|
|
53
|
+
const curve2 = edges[1].curve;
|
|
54
|
+
const p1 = curve1.value(curve1.firstParameter());
|
|
55
|
+
const p2 = curve1.value(curve1.lastParameter());
|
|
56
|
+
const p3 = curve2.value(curve2.firstParameter());
|
|
57
|
+
const p4 = curve2.value(curve2.lastParameter());
|
|
58
|
+
const v1 = p2.sub(p1);
|
|
59
|
+
const v2 = p4.sub(p3);
|
|
60
|
+
const normal = v1.cross(v2).normalize()!;
|
|
61
|
+
if (wire.orientation() === Orientation.REVERSED) {
|
|
62
|
+
return normal.reverse();
|
|
63
|
+
}
|
|
64
|
+
return normal;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
static isCCW(normal: XYZ, wire: IWire): boolean {
|
|
69
|
+
const testNormal = GeoUtils.wireNormal(wire);
|
|
70
|
+
return testNormal.dot(normal) > 0.001;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
static findNextEdge(wire: IWire, edge: IEdge): Result<IEdge> {
|
|
74
|
+
const curve = edge.curve;
|
|
75
|
+
const point = curve.value(curve.lastParameter());
|
|
76
|
+
|
|
77
|
+
for (const e of wire.findSubShapes(ShapeType.Edge)) {
|
|
78
|
+
if (e.isEqual(edge)) continue;
|
|
79
|
+
const testCurve = (e as IEdge).curve;
|
|
80
|
+
if (
|
|
81
|
+
point.distanceTo(testCurve.value(testCurve.firstParameter())) < Precision.Distance ||
|
|
82
|
+
point.distanceTo(testCurve.value(testCurve.lastParameter())) < Precision.Distance
|
|
83
|
+
) {
|
|
84
|
+
return Result.ok(e as IEdge);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
return Result.err("Cannot find next edge");
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
static normal(shape: IFace | IWire | IEdge): XYZ {
|
|
91
|
+
if (shape.shapeType === ShapeType.Face) {
|
|
92
|
+
return (shape as IFace).normal(0, 0)[1];
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
if (shape.shapeType === ShapeType.Edge) {
|
|
96
|
+
const curve = (shape as IEdge).curve;
|
|
97
|
+
return GeoUtils.curveNormal(curve);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
return GeoUtils.wireNormal(shape as IWire);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
static intersects(edge: IEdge, otherEdges: IEdge[]): { point: XYZ; parameter: number }[] {
|
|
104
|
+
const result: { point: XYZ; parameter: number }[] = [];
|
|
105
|
+
otherEdges.forEach((e) => {
|
|
106
|
+
const intersect = edge.intersect(e);
|
|
107
|
+
if (intersect.length > 0) {
|
|
108
|
+
result.push(...intersect);
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
return result;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
// Part of the Chili3d Project, under the AGPL-3.0 License.
|
|
2
|
+
// See LICENSE file in the project root for full license information.
|
|
3
|
+
|
|
4
|
+
import type { Locale } from "chili-core";
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
display: "English",
|
|
8
|
+
language: "en",
|
|
9
|
+
translation: {
|
|
10
|
+
"arc.angle": "Angle",
|
|
11
|
+
"arc.start": "Start",
|
|
12
|
+
"axis.x": "X Axis",
|
|
13
|
+
"axis.y": "Y Axis",
|
|
14
|
+
"axis.z": "Z Axis",
|
|
15
|
+
"body.arc": "Arc",
|
|
16
|
+
"body.bolean": "Boolean",
|
|
17
|
+
"body.box": "Box",
|
|
18
|
+
"body.pyramid": "Pyramid",
|
|
19
|
+
"body.cylinder": "Cylinder",
|
|
20
|
+
"body.cone": "Cone",
|
|
21
|
+
"body.group": "Group",
|
|
22
|
+
"body.sphere": "Sphere",
|
|
23
|
+
"body.ellipse": "Ellipse",
|
|
24
|
+
"body.circle": "Circle",
|
|
25
|
+
"body.face": "Face",
|
|
26
|
+
"body.fuse": "Fuse",
|
|
27
|
+
"body.imported": "Imported",
|
|
28
|
+
"body.line": "Line",
|
|
29
|
+
"body.polygon": "Pline",
|
|
30
|
+
"body.prism": "Prism",
|
|
31
|
+
"body.rect": "Rectangle",
|
|
32
|
+
"body.revol": "Revolve",
|
|
33
|
+
"body.sweep": "Sweep",
|
|
34
|
+
"body.wire": "Wire",
|
|
35
|
+
"box.dx": "Length",
|
|
36
|
+
"box.dy": "Width",
|
|
37
|
+
"box.dz": "Height",
|
|
38
|
+
"body.editableShape": "Editable Shape",
|
|
39
|
+
"body.meshNode": "Mesh Node",
|
|
40
|
+
"body.multiShape": "Multi Shape",
|
|
41
|
+
"circle.center": "Center",
|
|
42
|
+
"circle.radius": "Radius",
|
|
43
|
+
"ellipsoid.radiusX": "RadiusX",
|
|
44
|
+
"ellipsoid.radiusY": "RadiusY",
|
|
45
|
+
"ellipsoid.radiusZ": "RadiusZ",
|
|
46
|
+
"ellipse.majorRadius": "major Radius",
|
|
47
|
+
"ellipse.minorRadius": "minor Radius",
|
|
48
|
+
"command.act.alignCamera": "Align Camera",
|
|
49
|
+
"command.boolean.common": "Intersect",
|
|
50
|
+
"command.boolean.cut": "Cut",
|
|
51
|
+
"command.boolean.join": "Join",
|
|
52
|
+
"command.convert.fuse": "Fuse",
|
|
53
|
+
"command.create.revol": "Revolve",
|
|
54
|
+
"command.create.sweep": "Sweep",
|
|
55
|
+
"command.convert.toFace": "To Face",
|
|
56
|
+
"command.convert.toShell": "To Shell",
|
|
57
|
+
"command.convert.toSolid": "To Solid",
|
|
58
|
+
"command.convert.toWire": "To Wire",
|
|
59
|
+
"command.convert.curveProjection": "Projection",
|
|
60
|
+
"command.create.arc": "Arc",
|
|
61
|
+
"command.create.bezier": "Bezier",
|
|
62
|
+
"command.create.box": "Box",
|
|
63
|
+
"command.create.circle": "Circle",
|
|
64
|
+
"command.create.cone": "Cone",
|
|
65
|
+
"command.create.copyShape": "Copy Shape",
|
|
66
|
+
"command.create.cylinder": "Cylinder",
|
|
67
|
+
"command.create.ellipse": "Ellipse",
|
|
68
|
+
"command.create.ellipsoid": "Ellipsoid",
|
|
69
|
+
"command.create.extrude": "Extrude",
|
|
70
|
+
"command.create.folder": "Folder",
|
|
71
|
+
"command.create.group": "Group",
|
|
72
|
+
"command.create.line": "Line",
|
|
73
|
+
"command.create.loft": "Loft",
|
|
74
|
+
"command.create.offset": "Offset",
|
|
75
|
+
"command.create.polygon": "Pline",
|
|
76
|
+
"command.create.pyramid": "Pyramid",
|
|
77
|
+
"command.create.rect": "Rectangle",
|
|
78
|
+
"command.create.section": "Section",
|
|
79
|
+
"command.create.sphere": "Sphere",
|
|
80
|
+
"command.create.thickSolid": "Thick Solid",
|
|
81
|
+
"command.doc.new": "New Document",
|
|
82
|
+
"command.doc.open": "Open Document",
|
|
83
|
+
"command.doc.save": "Save Document",
|
|
84
|
+
"command.doc.saveToFile": "Save To File",
|
|
85
|
+
"command.edit.redo": "Redo",
|
|
86
|
+
"command.edit.undo": "Undo",
|
|
87
|
+
"command.file.export": "Export",
|
|
88
|
+
"command.file.import": "Import",
|
|
89
|
+
"command.measure.angle": "Angle",
|
|
90
|
+
"command.measure.length": "Length",
|
|
91
|
+
"command.measure.select": "Select",
|
|
92
|
+
"command.modify.array": "Array",
|
|
93
|
+
"command.modify.break": "Break",
|
|
94
|
+
"command.modify.brushAdd": "Brush Add",
|
|
95
|
+
"command.modify.brushRemove": "Brush Remove",
|
|
96
|
+
"command.modify.brushClear": "Brush Clear",
|
|
97
|
+
"command.modify.chamfer": "Chamfer",
|
|
98
|
+
"command.modify.deleteNode": "Delete Node",
|
|
99
|
+
"command.modify.explode": "Explode",
|
|
100
|
+
"command.modify.fillet": "Fillet",
|
|
101
|
+
"command.modify.mirror": "Mirror",
|
|
102
|
+
"command.modify.move": "Move",
|
|
103
|
+
"command.modify.removeFeature": "Remove Feature",
|
|
104
|
+
"command.modify.removeShapes": "Remove Shapes",
|
|
105
|
+
"command.modify.rotate": "Rotate",
|
|
106
|
+
"command.modify.split": "Split",
|
|
107
|
+
"command.modify.trim": "Trim",
|
|
108
|
+
"command.special.last": "__Last_COMMAND__",
|
|
109
|
+
"command.test.performance": "Performance Test",
|
|
110
|
+
"command.wechat.group": "Wechat",
|
|
111
|
+
"command.workingPlane.alignToPlane": "Align",
|
|
112
|
+
"command.workingPlane.fromSection": "Section",
|
|
113
|
+
"command.workingPlane.set": "Set",
|
|
114
|
+
"command.workingPlane.toggleDynamic": "Toggle",
|
|
115
|
+
"common.angle": "Angle",
|
|
116
|
+
"common.area": "Area",
|
|
117
|
+
"common.back": "Back",
|
|
118
|
+
"common.isGroup": "Group",
|
|
119
|
+
"common.language": "Language",
|
|
120
|
+
"common.location": "Location",
|
|
121
|
+
"common.3DNavigation": "3D Navigation",
|
|
122
|
+
"common.theme": "Theme",
|
|
123
|
+
"common.theme.light": "Light",
|
|
124
|
+
"common.theme.dark": "Dark",
|
|
125
|
+
"common.theme.system": "System",
|
|
126
|
+
"common.cancel": "Cancel",
|
|
127
|
+
"common.clone": "Clone",
|
|
128
|
+
"common.color": "Color",
|
|
129
|
+
"common.count": "Count",
|
|
130
|
+
"common.confirm": "Confirm",
|
|
131
|
+
"common.general": "General",
|
|
132
|
+
"common.length": "Length",
|
|
133
|
+
"common.dir": "Direction",
|
|
134
|
+
"common.material": "Material",
|
|
135
|
+
"common.matrix": "Matrix",
|
|
136
|
+
"common.name": "Name",
|
|
137
|
+
"common.normal": "Normal",
|
|
138
|
+
"common.numberX": "Number X",
|
|
139
|
+
"common.numberY": "Number Y",
|
|
140
|
+
"common.numberZ": "Number Z",
|
|
141
|
+
"common.opacity": "Opacity",
|
|
142
|
+
"common.thickness": "Thickness",
|
|
143
|
+
"common.type": "Type",
|
|
144
|
+
"common.volume": "Volume",
|
|
145
|
+
"dialog.title.selectWorkingPlane": "Select Working Plane",
|
|
146
|
+
"entity.editable": "Editable Entity",
|
|
147
|
+
"entity.parameter": "Parameter Entity",
|
|
148
|
+
"error.default:{0}": "error: {0}",
|
|
149
|
+
"error.input.cannotInputANumber": "Overlap with reference point, 1 number cannot be entered",
|
|
150
|
+
"error.input.invalidNumber": "Please enter a valid number, separated by ,",
|
|
151
|
+
"error.input.threeNumberCanBeInput": "Reference point is empty, only 3 numbers can be entered",
|
|
152
|
+
"error.input.unsupportedInputs": "Exceeds the maximum number of inputs",
|
|
153
|
+
"error.import.unsupportedFileType:{0}": "Unsupported file type: {0}",
|
|
154
|
+
"error.export.noNodeCanBeExported": "No node can be exported",
|
|
155
|
+
"file.format": "Format",
|
|
156
|
+
"home.recent": "Recent",
|
|
157
|
+
"home.welcome": "Welcome to chili3d",
|
|
158
|
+
"items.header": "Items",
|
|
159
|
+
"items.tool.delete": "Delete",
|
|
160
|
+
"items.tool.expandAll": "Expand All",
|
|
161
|
+
"items.tool.newFolder": "New Folder",
|
|
162
|
+
"items.tool.unexpandAll": "Unexpand all",
|
|
163
|
+
"line.end": "End",
|
|
164
|
+
"line.start": "Start",
|
|
165
|
+
"line.type.line": "Line",
|
|
166
|
+
"line.type.xline": "XLine",
|
|
167
|
+
"material.texture.image": "Image",
|
|
168
|
+
"material.texture.rotation": "Rotation",
|
|
169
|
+
"material.texture.wrapS": "Wrap S",
|
|
170
|
+
"material.texture.wrapT": "Wrap T",
|
|
171
|
+
"material.texture.repeat": "Repeat",
|
|
172
|
+
"material.texture.offset": "Offset",
|
|
173
|
+
"material.map": "Map",
|
|
174
|
+
"material.specular": "Specular",
|
|
175
|
+
"material.shininess": "Shininess",
|
|
176
|
+
"material.emissive": "Emissive",
|
|
177
|
+
"material.specularMap": "Specular Map",
|
|
178
|
+
"material.normalMap": "Normal Map",
|
|
179
|
+
"material.bumpMap": "BumpMap",
|
|
180
|
+
"material.roughnessMap": "Roughness Map",
|
|
181
|
+
"material.emissiveMap": "Emissive Map",
|
|
182
|
+
"material.metalness": "Metalness",
|
|
183
|
+
"material.metalnessMap": "Metalness Map",
|
|
184
|
+
"material.roughness": "Roughness",
|
|
185
|
+
"model.visible": "Visible",
|
|
186
|
+
"option.command.continuity": "Continuity",
|
|
187
|
+
"option.command.circularPattern": "Circular Pattern",
|
|
188
|
+
"option.command.repeat": "Repeat",
|
|
189
|
+
"option.command.isFace": "Face",
|
|
190
|
+
"option.command.isSolid": "Solid",
|
|
191
|
+
"option.command.isRuled": "Ruled",
|
|
192
|
+
"option.command.isRoundCorner": "Round Corner",
|
|
193
|
+
"option.command.thickness": "Thickness",
|
|
194
|
+
"option.command.isConnected": "Connected",
|
|
195
|
+
"option.command.isConvertInstance": "Convert Instance",
|
|
196
|
+
"option.command.insertPoint": "Insert Point",
|
|
197
|
+
"polygon.points": "Points",
|
|
198
|
+
"prompt.default{0}{1}":
|
|
199
|
+
"{0} to pan the view, {1} to rotate the view, Mouse wheel to scroll the zoom view",
|
|
200
|
+
"prompt.deleteDocument{0}": "Do you want to delete {0}?",
|
|
201
|
+
"prompt.pickCircleCenter": "pick center, ESC key to cancel",
|
|
202
|
+
"prompt.pickFistPoint": "Pick first point, ESC key to cancel",
|
|
203
|
+
"prompt.pickNextPoint": "pick next point, ESC key to cancel",
|
|
204
|
+
"prompt.pickRadius": "input radius, ESC key to cancel",
|
|
205
|
+
"prompt.polygon.close": "Close",
|
|
206
|
+
"prompt.saveDocument{0}": "Do you want to save the changes to {0}?",
|
|
207
|
+
"prompt.select.edges": "Please select edges",
|
|
208
|
+
"prompt.select.faces": "Please select faces",
|
|
209
|
+
"prompt.select.models": "Please select models",
|
|
210
|
+
"prompt.select.noModelSelected": "No model selected",
|
|
211
|
+
"prompt.select.section": "Please select section",
|
|
212
|
+
"prompt.select.shape": "Please select shape",
|
|
213
|
+
"prompt.select.solids": "Please select solids",
|
|
214
|
+
"prompt.select.path": "Please select path",
|
|
215
|
+
"prompt.select.vertexes": "Please select vertexes",
|
|
216
|
+
"prompt.select.wires": "Please select wires",
|
|
217
|
+
"toast.snap.notFoundValidPoint": "No valid point",
|
|
218
|
+
"properties.group.transform": "Transform",
|
|
219
|
+
"properties.header": "Properties",
|
|
220
|
+
"properties.multivalue": "Multi Value",
|
|
221
|
+
"rect.dx": "Length",
|
|
222
|
+
"rect.dy": "Width",
|
|
223
|
+
"ribbon.group.2d": "2D",
|
|
224
|
+
"ribbon.group.3d": "3D",
|
|
225
|
+
"ribbon.group.act": "Act",
|
|
226
|
+
"ribbon.group.boolean": "Boolean",
|
|
227
|
+
"ribbon.group.converter": "Converter",
|
|
228
|
+
"ribbon.group.draw": "Sketch",
|
|
229
|
+
"ribbon.group.importExport": "Import/Export",
|
|
230
|
+
"ribbon.group.measure": "Measure",
|
|
231
|
+
"ribbon.group.modify": "Modify",
|
|
232
|
+
"ribbon.group.other": "Other",
|
|
233
|
+
"ribbon.group.selection": "Selection",
|
|
234
|
+
"ribbon.group.tools": "Tools",
|
|
235
|
+
"ribbon.group.workingPlane": "Working Plane",
|
|
236
|
+
"ribbon.tab.draw": "Sketch",
|
|
237
|
+
"ribbon.tab.file": "File",
|
|
238
|
+
"ribbon.tab.tools": "Tools",
|
|
239
|
+
"ribbon.tab.startup": "Startup",
|
|
240
|
+
"snap.center": "Center",
|
|
241
|
+
"snap.end": "End",
|
|
242
|
+
"snap.intersection": "Intersection",
|
|
243
|
+
"snap.mid": "Middle",
|
|
244
|
+
"snap.perpendicular": "Perpendicular",
|
|
245
|
+
"snap.nearest": "Nearest",
|
|
246
|
+
"statusBar.snap": "Snap",
|
|
247
|
+
"statusBar.tracking": "Tracking",
|
|
248
|
+
"toast.command.{0}excuting": "Command {0} is runing",
|
|
249
|
+
"toast.converter.error": "Converter error",
|
|
250
|
+
"toast.converter.invalidColor": "The color is invalid",
|
|
251
|
+
"toast.delete{0}Objects": "Deleted {0} objects",
|
|
252
|
+
"toast.document.noActivated": "No document activated",
|
|
253
|
+
"toast.document.saved": "Document saved",
|
|
254
|
+
"toast.downloading": "Downloading",
|
|
255
|
+
"toast.excuting{0}": "Excuting {0}",
|
|
256
|
+
"toast.fail": "Fail",
|
|
257
|
+
"toast.read.error": "Read error",
|
|
258
|
+
"toast.select.noSelected": "No selected",
|
|
259
|
+
"toast.success": "Success",
|
|
260
|
+
"transform.rotation": "Rotation",
|
|
261
|
+
"transform.scale": "Scale",
|
|
262
|
+
"transform.translation": "Translation",
|
|
263
|
+
"vertex.point": "Point",
|
|
264
|
+
"viewport.orthographic": "Orthographic",
|
|
265
|
+
"viewport.perspective": "Perspective",
|
|
266
|
+
"viewport.fitContent": "Fit Content",
|
|
267
|
+
"viewport.zoomIn": "Zoom In",
|
|
268
|
+
"viewport.zoomOut": "Zoom Out",
|
|
269
|
+
},
|
|
270
|
+
} satisfies Locale;
|