chili3d 0.6.1 → 0.6.3
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/README.md +14 -175
- package/{packages/chili → chili}/package.json +6 -1
- package/{packages/chili-builder → chili-builder}/package.json +6 -1
- package/{packages/chili-controls → chili-controls}/package.json +6 -1
- package/{packages/chili-core → chili-core}/package.json +6 -1
- package/{packages/chili-geo → chili-geo}/package.json +6 -1
- package/{packages/chili-i18n → chili-i18n}/package.json +6 -1
- package/{packages/chili-storage → chili-storage}/package.json +6 -1
- package/{packages/chili-three → chili-three}/package.json +6 -1
- package/{packages/chili-ui → chili-ui}/package.json +6 -1
- package/{packages/chili-vis → chili-vis}/package.json +6 -1
- package/{packages/chili-wasm → chili-wasm}/package.json +6 -1
- package/{packages/chili-web → chili-web}/package.json +6 -1
- package/package.json +18 -48
- package/.github/workflows/main.yml +0 -26
- package/.vscode/c_cpp_properties.json +0 -30
- package/.vscode/launch.json +0 -21
- package/.vscode/settings.json +0 -8
- package/Dockerfile +0 -7
- package/LICENSE +0 -661
- package/biome.json +0 -67
- package/compose.yml +0 -7
- package/cpp/CMakeLists.txt +0 -96
- package/cpp/CMakePresets.json +0 -43
- package/cpp/README.md +0 -21
- package/cpp/src/converter.cpp +0 -413
- package/cpp/src/factory.cpp +0 -612
- package/cpp/src/geometry.cpp +0 -204
- package/cpp/src/mesher.cpp +0 -330
- package/cpp/src/opencascade.cpp +0 -414
- package/cpp/src/shape.cpp +0 -447
- package/cpp/src/shared.cpp +0 -83
- package/cpp/src/shared.hpp +0 -211
- package/cpp/src/transient.cpp +0 -29
- package/cpp/src/utils.cpp +0 -114
- package/cpp/src/utils.hpp +0 -25
- package/cpp/test/index.html +0 -146
- package/packages/chili/test/command.test.ts +0 -4
- package/packages/chili-controls/test/converter.test.ts +0 -70
- package/packages/chili-controls/test/styleMock.js +0 -4
- package/packages/chili-core/test/binding.test.ts +0 -95
- package/packages/chili-core/test/boundingBox.test.ts +0 -60
- package/packages/chili-core/test/collection.test.ts +0 -53
- package/packages/chili-core/test/history.test.ts +0 -42
- package/packages/chili-core/test/line.test.ts +0 -75
- package/packages/chili-core/test/linesegment.test.ts +0 -98
- package/packages/chili-core/test/linkedList.test.ts +0 -82
- package/packages/chili-core/test/math.test.ts +0 -34
- package/packages/chili-core/test/matrix.test.ts +0 -129
- package/packages/chili-core/test/node.test.ts +0 -122
- package/packages/chili-core/test/nodeList.test.ts +0 -247
- package/packages/chili-core/test/observer.test.ts +0 -91
- package/packages/chili-core/test/plane.test.ts +0 -31
- package/packages/chili-core/test/quaternion.test.ts +0 -14
- package/packages/chili-core/test/result.test.ts +0 -24
- package/packages/chili-core/test/serializer.test.ts +0 -58
- package/packages/chili-core/test/snapType.test.ts +0 -10
- package/packages/chili-core/test/task.test.ts +0 -41
- package/packages/chili-core/test/testDocument.ts +0 -70
- package/packages/chili-core/test/transaction.test.ts +0 -42
- package/packages/chili-core/test/visual.test.ts +0 -42
- package/packages/chili-core/test/xyz.test.ts +0 -260
- package/packages/chili-three/test/cameraControls.ts +0 -10
- package/packages/chili-three/test/testDocument.ts +0 -68
- package/packages/chili-three/test/testEdge.ts +0 -171
- package/packages/chili-three/test/testView.ts +0 -78
- package/packages/chili-three/test/three.test.ts +0 -44
- package/packages/chili-three/test/viewGizmo.ts +0 -12
- package/packages/global.d.ts +0 -31
- package/public/favicon.svg +0 -10
- package/public/fonts/fzhei.json +0 -46120
- package/public/iconfont.js +0 -1
- package/public/images/wechat.jpg +0 -0
- package/public/index.css +0 -13
- package/public/index.html +0 -24
- package/rspack.config.ts +0 -93
- package/rstest.config.ts +0 -27
- package/screenshots/screenshot.png +0 -0
- package/scripts/add_copyright.mjs +0 -59
- package/scripts/build-npm.mjs +0 -105
- package/scripts/common.mjs +0 -24
- package/scripts/release.mjs +0 -92
- package/scripts/restore-package-json.mjs +0 -27
- package/scripts/setup_wasm_deps.mjs +0 -97
- package/scripts/update-package-json.mjs +0 -27
- package/tsconfig.build.json +0 -14
- package/tsconfig.build.tsbuildinfo +0 -1
- package/tsconfig.json +0 -19
- /package/{packages/chili → chili}/src/application.ts +0 -0
- /package/{packages/chili → chili}/src/bodys/arc.ts +0 -0
- /package/{packages/chili → chili}/src/bodys/boolean.ts +0 -0
- /package/{packages/chili → chili}/src/bodys/box.ts +0 -0
- /package/{packages/chili → chili}/src/bodys/circle.ts +0 -0
- /package/{packages/chili → chili}/src/bodys/cone.ts +0 -0
- /package/{packages/chili → chili}/src/bodys/cylinder.ts +0 -0
- /package/{packages/chili → chili}/src/bodys/ellipse.ts +0 -0
- /package/{packages/chili → chili}/src/bodys/face.ts +0 -0
- /package/{packages/chili → chili}/src/bodys/fuse.ts +0 -0
- /package/{packages/chili → chili}/src/bodys/index.ts +0 -0
- /package/{packages/chili → chili}/src/bodys/line.ts +0 -0
- /package/{packages/chili → chili}/src/bodys/polygon.ts +0 -0
- /package/{packages/chili → chili}/src/bodys/prism.ts +0 -0
- /package/{packages/chili → chili}/src/bodys/pyramid.ts +0 -0
- /package/{packages/chili → chili}/src/bodys/rect.ts +0 -0
- /package/{packages/chili → chili}/src/bodys/revolve.ts +0 -0
- /package/{packages/chili → chili}/src/bodys/sphere.ts +0 -0
- /package/{packages/chili → chili}/src/bodys/sweep.ts +0 -0
- /package/{packages/chili → chili}/src/bodys/wire.ts +0 -0
- /package/{packages/chili → chili}/src/commands/application/index.ts +0 -0
- /package/{packages/chili → chili}/src/commands/application/newDocument.ts +0 -0
- /package/{packages/chili → chili}/src/commands/application/openDocument.ts +0 -0
- /package/{packages/chili → chili}/src/commands/application/performanceTest.ts +0 -0
- /package/{packages/chili → chili}/src/commands/application/saveDocument.ts +0 -0
- /package/{packages/chili → chili}/src/commands/application/toFile.ts +0 -0
- /package/{packages/chili → chili}/src/commands/application/toggleDynamicWorkplane.ts +0 -0
- /package/{packages/chili → chili}/src/commands/application/wechatGroup.ts +0 -0
- /package/{packages/chili → chili}/src/commands/boolean.ts +0 -0
- /package/{packages/chili → chili}/src/commands/create/arc.ts +0 -0
- /package/{packages/chili → chili}/src/commands/create/bezier.ts +0 -0
- /package/{packages/chili → chili}/src/commands/create/box.ts +0 -0
- /package/{packages/chili → chili}/src/commands/create/circle.ts +0 -0
- /package/{packages/chili → chili}/src/commands/create/cone.ts +0 -0
- /package/{packages/chili → chili}/src/commands/create/converter.ts +0 -0
- /package/{packages/chili → chili}/src/commands/create/copySubShape.ts +0 -0
- /package/{packages/chili → chili}/src/commands/create/curveProjection.ts +0 -0
- /package/{packages/chili → chili}/src/commands/create/cylinder.ts +0 -0
- /package/{packages/chili → chili}/src/commands/create/ellipse.ts +0 -0
- /package/{packages/chili → chili}/src/commands/create/group.ts +0 -0
- /package/{packages/chili → chili}/src/commands/create/index.ts +0 -0
- /package/{packages/chili → chili}/src/commands/create/line.ts +0 -0
- /package/{packages/chili → chili}/src/commands/create/loft.ts +0 -0
- /package/{packages/chili → chili}/src/commands/create/offset.ts +0 -0
- /package/{packages/chili → chili}/src/commands/create/polygon.ts +0 -0
- /package/{packages/chili → chili}/src/commands/create/prism.ts +0 -0
- /package/{packages/chili → chili}/src/commands/create/pyramid.ts +0 -0
- /package/{packages/chili → chili}/src/commands/create/rect.ts +0 -0
- /package/{packages/chili → chili}/src/commands/create/revolve.ts +0 -0
- /package/{packages/chili → chili}/src/commands/create/section.ts +0 -0
- /package/{packages/chili → chili}/src/commands/create/sphere.ts +0 -0
- /package/{packages/chili → chili}/src/commands/create/sweep.ts +0 -0
- /package/{packages/chili → chili}/src/commands/create/thickSolid.ts +0 -0
- /package/{packages/chili → chili}/src/commands/createActCommand.ts +0 -0
- /package/{packages/chili → chili}/src/commands/createCommand.ts +0 -0
- /package/{packages/chili → chili}/src/commands/delete.ts +0 -0
- /package/{packages/chili → chili}/src/commands/folder.ts +0 -0
- /package/{packages/chili → chili}/src/commands/importExport.ts +0 -0
- /package/{packages/chili → chili}/src/commands/index.ts +0 -0
- /package/{packages/chili → chili}/src/commands/measure/angle.ts +0 -0
- /package/{packages/chili → chili}/src/commands/measure/index.ts +0 -0
- /package/{packages/chili → chili}/src/commands/measure/length.ts +0 -0
- /package/{packages/chili → chili}/src/commands/measure/select.module.css +0 -0
- /package/{packages/chili → chili}/src/commands/measure/select.ts +0 -0
- /package/{packages/chili → chili}/src/commands/modify/array.ts +0 -0
- /package/{packages/chili → chili}/src/commands/modify/break.ts +0 -0
- /package/{packages/chili → chili}/src/commands/modify/brush.ts +0 -0
- /package/{packages/chili → chili}/src/commands/modify/chamfer.ts +0 -0
- /package/{packages/chili → chili}/src/commands/modify/explode.ts +0 -0
- /package/{packages/chili → chili}/src/commands/modify/fillet.ts +0 -0
- /package/{packages/chili → chili}/src/commands/modify/index.ts +0 -0
- /package/{packages/chili → chili}/src/commands/modify/mirror.ts +0 -0
- /package/{packages/chili → chili}/src/commands/modify/move.ts +0 -0
- /package/{packages/chili → chili}/src/commands/modify/removeFeature.ts +0 -0
- /package/{packages/chili → chili}/src/commands/modify/removeSubShapes.ts +0 -0
- /package/{packages/chili → chili}/src/commands/modify/rotate.ts +0 -0
- /package/{packages/chili → chili}/src/commands/modify/split.ts +0 -0
- /package/{packages/chili → chili}/src/commands/modify/transformedCommand.ts +0 -0
- /package/{packages/chili → chili}/src/commands/modify/trim.ts +0 -0
- /package/{packages/chili → chili}/src/commands/multistepCommand.ts +0 -0
- /package/{packages/chili → chili}/src/commands/redo.ts +0 -0
- /package/{packages/chili → chili}/src/commands/undo.ts +0 -0
- /package/{packages/chili → chili}/src/commands/workingPlane.ts +0 -0
- /package/{packages/chili → chili}/src/comparers/NumberEqualityComparer.ts +0 -0
- /package/{packages/chili → chili}/src/comparers/XYZEqualityComparer.ts +0 -0
- /package/{packages/chili → chili}/src/comparers/index.ts +0 -0
- /package/{packages/chili → chili}/src/document.ts +0 -0
- /package/{packages/chili → chili}/src/editEventHandler.ts +0 -0
- /package/{packages/chili → chili}/src/index.ts +0 -0
- /package/{packages/chili → chili}/src/selection.ts +0 -0
- /package/{packages/chili → chili}/src/services/commandService.ts +0 -0
- /package/{packages/chili → chili}/src/services/editorService.ts +0 -0
- /package/{packages/chili → chili}/src/services/hotkeyService.ts +0 -0
- /package/{packages/chili → chili}/src/services/index.ts +0 -0
- /package/{packages/chili → chili}/src/snap/dimension.ts +0 -0
- /package/{packages/chili → chili}/src/snap/handlers/angleSnapEventHandler.ts +0 -0
- /package/{packages/chili → chili}/src/snap/handlers/index.ts +0 -0
- /package/{packages/chili → chili}/src/snap/handlers/lengthSnapEventHandler.ts +0 -0
- /package/{packages/chili → chili}/src/snap/handlers/pointSnapEventHandler.ts +0 -0
- /package/{packages/chili → chili}/src/snap/handlers/snapEventHandler.ts +0 -0
- /package/{packages/chili → chili}/src/snap/index.ts +0 -0
- /package/{packages/chili → chili}/src/snap/snap.ts +0 -0
- /package/{packages/chili → chili}/src/snap/snaps/axisSnap.ts +0 -0
- /package/{packages/chili → chili}/src/snap/snaps/baseSnap.ts +0 -0
- /package/{packages/chili → chili}/src/snap/snaps/featurePointStrategy.ts +0 -0
- /package/{packages/chili → chili}/src/snap/snaps/index.ts +0 -0
- /package/{packages/chili → chili}/src/snap/snaps/objectSnap.ts +0 -0
- /package/{packages/chili → chili}/src/snap/snaps/planeSnap.ts +0 -0
- /package/{packages/chili → chili}/src/snap/snaps/pointOnCurveSnap.ts +0 -0
- /package/{packages/chili → chili}/src/snap/tracking/axis.ts +0 -0
- /package/{packages/chili → chili}/src/snap/tracking/axisTracking.ts +0 -0
- /package/{packages/chili → chili}/src/snap/tracking/index.ts +0 -0
- /package/{packages/chili → chili}/src/snap/tracking/objectTracking.ts +0 -0
- /package/{packages/chili → chili}/src/snap/tracking/trackingBase.ts +0 -0
- /package/{packages/chili → chili}/src/snap/tracking/trackingSnap.ts +0 -0
- /package/{packages/chili → chili}/src/step/angleStep.ts +0 -0
- /package/{packages/chili → chili}/src/step/index.ts +0 -0
- /package/{packages/chili → chili}/src/step/lengthStep.ts +0 -0
- /package/{packages/chili → chili}/src/step/pointStep.ts +0 -0
- /package/{packages/chili → chili}/src/step/selectStep.ts +0 -0
- /package/{packages/chili → chili}/src/step/step.ts +0 -0
- /package/{packages/chili → chili}/src/utils.ts +0 -0
- /package/{packages/chili-builder → chili-builder}/src/additionalModule.ts +0 -0
- /package/{packages/chili-builder → chili-builder}/src/appBuilder.ts +0 -0
- /package/{packages/chili-builder → chili-builder}/src/defaultDataExchange.ts +0 -0
- /package/{packages/chili-builder → chili-builder}/src/index.ts +0 -0
- /package/{packages/chili-builder → chili-builder}/src/ribbon.ts +0 -0
- /package/{packages/chili-controls → chili-controls}/src/collection.ts +0 -0
- /package/{packages/chili-controls → chili-controls}/src/controls.ts +0 -0
- /package/{packages/chili-controls → chili-controls}/src/converters/colorConverter.ts +0 -0
- /package/{packages/chili-controls → chili-controls}/src/converters/index.ts +0 -0
- /package/{packages/chili-controls → chili-controls}/src/converters/numberConverter.ts +0 -0
- /package/{packages/chili-controls → chili-controls}/src/converters/stringConverter.ts +0 -0
- /package/{packages/chili-controls → chili-controls}/src/converters/urlConverter.ts +0 -0
- /package/{packages/chili-controls → chili-controls}/src/converters/xyzConverter.ts +0 -0
- /package/{packages/chili-controls → chili-controls}/src/expander/expander.module.css +0 -0
- /package/{packages/chili-controls → chili-controls}/src/expander/expander.ts +0 -0
- /package/{packages/chili-controls → chili-controls}/src/expander/index.ts +0 -0
- /package/{packages/chili-controls → chili-controls}/src/htmlProps.ts +0 -0
- /package/{packages/chili-controls → chili-controls}/src/index.ts +0 -0
- /package/{packages/chili-controls → chili-controls}/src/radioGroup.module.css +0 -0
- /package/{packages/chili-controls → chili-controls}/src/radioGroup.ts +0 -0
- /package/{packages/chili-controls → chili-controls}/src/utils.ts +0 -0
- /package/{packages/chili-core → chili-core}/src/application.ts +0 -0
- /package/{packages/chili-core → chili-core}/src/command/command.ts +0 -0
- /package/{packages/chili-core → chili-core}/src/command/commandKeys.ts +0 -0
- /package/{packages/chili-core → chili-core}/src/command/decarator.ts +0 -0
- /package/{packages/chili-core → chili-core}/src/command/index.ts +0 -0
- /package/{packages/chili-core → chili-core}/src/config.ts +0 -0
- /package/{packages/chili-core → chili-core}/src/constants.ts +0 -0
- /package/{packages/chili-core → chili-core}/src/dataExchange.ts +0 -0
- /package/{packages/chili-core → chili-core}/src/document.ts +0 -0
- /package/{packages/chili-core → chili-core}/src/editor.ts +0 -0
- /package/{packages/chili-core → chili-core}/src/foundation/asyncController.ts +0 -0
- /package/{packages/chili-core → chili-core}/src/foundation/binding.ts +0 -0
- /package/{packages/chili-core → chili-core}/src/foundation/collection.ts +0 -0
- /package/{packages/chili-core → chili-core}/src/foundation/converter.ts +0 -0
- /package/{packages/chili-core → chili-core}/src/foundation/deepObserver.ts +0 -0
- /package/{packages/chili-core → chili-core}/src/foundation/disposable.ts +0 -0
- /package/{packages/chili-core → chili-core}/src/foundation/dto/index.ts +0 -0
- /package/{packages/chili-core → chili-core}/src/foundation/equalityComparer.ts +0 -0
- /package/{packages/chili-core → chili-core}/src/foundation/gc.ts +0 -0
- /package/{packages/chili-core → chili-core}/src/foundation/history.ts +0 -0
- /package/{packages/chili-core → chili-core}/src/foundation/id.ts +0 -0
- /package/{packages/chili-core → chili-core}/src/foundation/index.ts +0 -0
- /package/{packages/chili-core → chili-core}/src/foundation/lazy.ts +0 -0
- /package/{packages/chili-core → chili-core}/src/foundation/linkedList.ts +0 -0
- /package/{packages/chili-core → chili-core}/src/foundation/logger.ts +0 -0
- /package/{packages/chili-core → chili-core}/src/foundation/messageType.ts +0 -0
- /package/{packages/chili-core → chili-core}/src/foundation/objectStorage.ts +0 -0
- /package/{packages/chili-core → chili-core}/src/foundation/observer.ts +0 -0
- /package/{packages/chili-core → chili-core}/src/foundation/precision.ts +0 -0
- /package/{packages/chili-core → chili-core}/src/foundation/pubsub.ts +0 -0
- /package/{packages/chili-core → chili-core}/src/foundation/result.ts +0 -0
- /package/{packages/chili-core → chili-core}/src/foundation/storage.ts +0 -0
- /package/{packages/chili-core → chili-core}/src/foundation/transaction.ts +0 -0
- /package/{packages/chili-core → chili-core}/src/foundation/utils/debounce.ts +0 -0
- /package/{packages/chili-core → chili-core}/src/foundation/utils/download.ts +0 -0
- /package/{packages/chili-core → chili-core}/src/foundation/utils/index.ts +0 -0
- /package/{packages/chili-core → chili-core}/src/foundation/utils/readFileAsync.ts +0 -0
- /package/{packages/chili-core → chili-core}/src/i18n/i18n.ts +0 -0
- /package/{packages/chili-core → chili-core}/src/i18n/index.ts +0 -0
- /package/{packages/chili-core → chili-core}/src/i18n/keys.ts +0 -0
- /package/{packages/chili-core → chili-core}/src/index.ts +0 -0
- /package/{packages/chili-core → chili-core}/src/material.ts +0 -0
- /package/{packages/chili-core → chili-core}/src/math/boundingBox.ts +0 -0
- /package/{packages/chili-core → chili-core}/src/math/index.ts +0 -0
- /package/{packages/chili-core → chili-core}/src/math/line.ts +0 -0
- /package/{packages/chili-core → chili-core}/src/math/lineSegment.ts +0 -0
- /package/{packages/chili-core → chili-core}/src/math/mathUtils.ts +0 -0
- /package/{packages/chili-core → chili-core}/src/math/matrix4.ts +0 -0
- /package/{packages/chili-core → chili-core}/src/math/plane.ts +0 -0
- /package/{packages/chili-core → chili-core}/src/math/planeAngle.ts +0 -0
- /package/{packages/chili-core → chili-core}/src/math/quaternion.ts +0 -0
- /package/{packages/chili-core → chili-core}/src/math/ray.ts +0 -0
- /package/{packages/chili-core → chili-core}/src/math/xy.ts +0 -0
- /package/{packages/chili-core → chili-core}/src/math/xyz.ts +0 -0
- /package/{packages/chili-core → chili-core}/src/model/component.ts +0 -0
- /package/{packages/chili-core → chili-core}/src/model/facebaseNode.ts +0 -0
- /package/{packages/chili-core → chili-core}/src/model/folderNode.ts +0 -0
- /package/{packages/chili-core → chili-core}/src/model/geometryNode.ts +0 -0
- /package/{packages/chili-core → chili-core}/src/model/groupNode.ts +0 -0
- /package/{packages/chili-core → chili-core}/src/model/index.ts +0 -0
- /package/{packages/chili-core → chili-core}/src/model/meshNode.ts +0 -0
- /package/{packages/chili-core → chili-core}/src/model/node.ts +0 -0
- /package/{packages/chili-core → chili-core}/src/model/shapeNode.ts +0 -0
- /package/{packages/chili-core → chili-core}/src/model/visualNode.ts +0 -0
- /package/{packages/chili-core → chili-core}/src/modelManager.ts +0 -0
- /package/{packages/chili-core → chili-core}/src/navigation.ts +0 -0
- /package/{packages/chili-core → chili-core}/src/property.ts +0 -0
- /package/{packages/chili-core → chili-core}/src/selection.ts +0 -0
- /package/{packages/chili-core → chili-core}/src/selectionFilter.ts +0 -0
- /package/{packages/chili-core → chili-core}/src/serialize/index.ts +0 -0
- /package/{packages/chili-core → chili-core}/src/serialize/serializer.ts +0 -0
- /package/{packages/chili-core → chili-core}/src/service.ts +0 -0
- /package/{packages/chili-core → chili-core}/src/shape/curve.ts +0 -0
- /package/{packages/chili-core → chili-core}/src/shape/geometry.ts +0 -0
- /package/{packages/chili-core → chili-core}/src/shape/index.ts +0 -0
- /package/{packages/chili-core → chili-core}/src/shape/lineType.ts +0 -0
- /package/{packages/chili-core → chili-core}/src/shape/meshData.ts +0 -0
- /package/{packages/chili-core → chili-core}/src/shape/shape.ts +0 -0
- /package/{packages/chili-core → chili-core}/src/shape/shapeConverter.ts +0 -0
- /package/{packages/chili-core → chili-core}/src/shape/shapeFactory.ts +0 -0
- /package/{packages/chili-core → chili-core}/src/shape/shapeType.ts +0 -0
- /package/{packages/chili-core → chili-core}/src/shape/surface.ts +0 -0
- /package/{packages/chili-core → chili-core}/src/snapType.ts +0 -0
- /package/{packages/chili-core → chili-core}/src/ui/button.ts +0 -0
- /package/{packages/chili-core → chili-core}/src/ui/combobox.ts +0 -0
- /package/{packages/chili-core → chili-core}/src/ui/dialog.ts +0 -0
- /package/{packages/chili-core → chili-core}/src/ui/index.ts +0 -0
- /package/{packages/chili-core → chili-core}/src/ui/ribbon.ts +0 -0
- /package/{packages/chili-core → chili-core}/src/ui/window.ts +0 -0
- /package/{packages/chili-core → chili-core}/src/visual/act.ts +0 -0
- /package/{packages/chili-core → chili-core}/src/visual/cameraController.ts +0 -0
- /package/{packages/chili-core → chili-core}/src/visual/cursorType.ts +0 -0
- /package/{packages/chili-core → chili-core}/src/visual/detectedData.ts +0 -0
- /package/{packages/chili-core → chili-core}/src/visual/eventHandler.ts +0 -0
- /package/{packages/chili-core → chili-core}/src/visual/highlighter.ts +0 -0
- /package/{packages/chili-core → chili-core}/src/visual/index.ts +0 -0
- /package/{packages/chili-core → chili-core}/src/visual/meshExporter.ts +0 -0
- /package/{packages/chili-core → chili-core}/src/visual/meshUtils.ts +0 -0
- /package/{packages/chili-core → chili-core}/src/visual/textGenerator.ts +0 -0
- /package/{packages/chili-core → chili-core}/src/visual/view.ts +0 -0
- /package/{packages/chili-core → chili-core}/src/visual/viewGizmo.ts +0 -0
- /package/{packages/chili-core → chili-core}/src/visual/viewport.ts +0 -0
- /package/{packages/chili-core → chili-core}/src/visual/visual.ts +0 -0
- /package/{packages/chili-core → chili-core}/src/visual/visualContext.ts +0 -0
- /package/{packages/chili-core → chili-core}/src/visual/visualFactory.ts +0 -0
- /package/{packages/chili-core → chili-core}/src/visual/visualObject.ts +0 -0
- /package/{packages/chili-core → chili-core}/src/visual/visualShape.ts +0 -0
- /package/{packages/chili-geo → chili-geo}/src/index.ts +0 -0
- /package/{packages/chili-geo → chili-geo}/src/utils.ts +0 -0
- /package/{packages/chili-i18n → chili-i18n}/src/en.ts +0 -0
- /package/{packages/chili-i18n → chili-i18n}/src/index.ts +0 -0
- /package/{packages/chili-i18n → chili-i18n}/src/pt-br.ts +0 -0
- /package/{packages/chili-i18n → chili-i18n}/src/zh-cn.ts +0 -0
- /package/{packages/chili-storage → chili-storage}/src/index.ts +0 -0
- /package/{packages/chili-storage → chili-storage}/src/indexedDBStorage.ts +0 -0
- /package/{packages/chili-three → chili-three}/src/cameraController.ts +0 -0
- /package/{packages/chili-three → chili-three}/src/common.ts +0 -0
- /package/{packages/chili-three → chili-three}/src/constants.ts +0 -0
- /package/{packages/chili-three → chili-three}/src/highlightable.ts +0 -0
- /package/{packages/chili-three → chili-three}/src/index.ts +0 -0
- /package/{packages/chili-three → chili-three}/src/meshExporter.ts +0 -0
- /package/{packages/chili-three → chili-three}/src/outlinePass.js +0 -0
- /package/{packages/chili-three → chili-three}/src/texture_points.jpg +0 -0
- /package/{packages/chili-three → chili-three}/src/threeGeometry.ts +0 -0
- /package/{packages/chili-three → chili-three}/src/threeGeometryFactory.ts +0 -0
- /package/{packages/chili-three → chili-three}/src/threeHelper.ts +0 -0
- /package/{packages/chili-three → chili-three}/src/threeHighlighter.ts +0 -0
- /package/{packages/chili-three → chili-three}/src/threeView.module.css +0 -0
- /package/{packages/chili-three → chili-three}/src/threeView.ts +0 -0
- /package/{packages/chili-three → chili-three}/src/threeViewEventHandler.ts +0 -0
- /package/{packages/chili-three → chili-three}/src/threeVisual.ts +0 -0
- /package/{packages/chili-three → chili-three}/src/threeVisualContext.ts +0 -0
- /package/{packages/chili-three → chili-three}/src/threeVisualFactory.ts +0 -0
- /package/{packages/chili-three → chili-three}/src/threeVisualObject.ts +0 -0
- /package/{packages/chili-three → chili-three}/src/viewGizmo.ts +0 -0
- /package/{packages/chili-ui → chili-ui}/src/cursor/draw.cur +0 -0
- /package/{packages/chili-ui → chili-ui}/src/cursor/index.ts +0 -0
- /package/{packages/chili-ui → chili-ui}/src/dialog.module.css +0 -0
- /package/{packages/chili-ui → chili-ui}/src/dialog.ts +0 -0
- /package/{packages/chili-ui → chili-ui}/src/editor.module.css +0 -0
- /package/{packages/chili-ui → chili-ui}/src/editor.ts +0 -0
- /package/{packages/chili-ui → chili-ui}/src/home/home.module.css +0 -0
- /package/{packages/chili-ui → chili-ui}/src/home/home.ts +0 -0
- /package/{packages/chili-ui → chili-ui}/src/home/index.ts +0 -0
- /package/{packages/chili-ui → chili-ui}/src/home/languageSelector.ts +0 -0
- /package/{packages/chili-ui → chili-ui}/src/home/navigation3DSelector.ts +0 -0
- /package/{packages/chili-ui → chili-ui}/src/home/themeSelector.ts +0 -0
- /package/{packages/chili-ui → chili-ui}/src/index.ts +0 -0
- /package/{packages/chili-ui → chili-ui}/src/mainWindow.module.css +0 -0
- /package/{packages/chili-ui → chili-ui}/src/mainWindow.ts +0 -0
- /package/{packages/chili-ui → chili-ui}/src/okCancel.module.css +0 -0
- /package/{packages/chili-ui → chili-ui}/src/okCancel.ts +0 -0
- /package/{packages/chili-ui → chili-ui}/src/permanent.module.css +0 -0
- /package/{packages/chili-ui → chili-ui}/src/permanent.ts +0 -0
- /package/{packages/chili-ui → chili-ui}/src/project/index.ts +0 -0
- /package/{packages/chili-ui → chili-ui}/src/project/projectView.module.css +0 -0
- /package/{packages/chili-ui → chili-ui}/src/project/projectView.ts +0 -0
- /package/{packages/chili-ui → chili-ui}/src/project/toolBar.module.css +0 -0
- /package/{packages/chili-ui → chili-ui}/src/project/toolBar.ts +0 -0
- /package/{packages/chili-ui → chili-ui}/src/project/tree/index.ts +0 -0
- /package/{packages/chili-ui → chili-ui}/src/project/tree/tree.module.css +0 -0
- /package/{packages/chili-ui → chili-ui}/src/project/tree/tree.ts +0 -0
- /package/{packages/chili-ui → chili-ui}/src/project/tree/treeItem.module.css +0 -0
- /package/{packages/chili-ui → chili-ui}/src/project/tree/treeItem.ts +0 -0
- /package/{packages/chili-ui → chili-ui}/src/project/tree/treeItemGroup.module.css +0 -0
- /package/{packages/chili-ui → chili-ui}/src/project/tree/treeItemGroup.ts +0 -0
- /package/{packages/chili-ui → chili-ui}/src/project/tree/treeModel.module.css +0 -0
- /package/{packages/chili-ui → chili-ui}/src/project/tree/treeModel.ts +0 -0
- /package/{packages/chili-ui → chili-ui}/src/property/check.ts +0 -0
- /package/{packages/chili-ui → chili-ui}/src/property/colorPorperty.module.css +0 -0
- /package/{packages/chili-ui → chili-ui}/src/property/colorProperty.ts +0 -0
- /package/{packages/chili-ui → chili-ui}/src/property/common.module.css +0 -0
- /package/{packages/chili-ui → chili-ui}/src/property/index.ts +0 -0
- /package/{packages/chili-ui → chili-ui}/src/property/input.module.css +0 -0
- /package/{packages/chili-ui → chili-ui}/src/property/input.ts +0 -0
- /package/{packages/chili-ui → chili-ui}/src/property/material/index.ts +0 -0
- /package/{packages/chili-ui → chili-ui}/src/property/material/materialDataContent.ts +0 -0
- /package/{packages/chili-ui → chili-ui}/src/property/material/materialEditor.module.css +0 -0
- /package/{packages/chili-ui → chili-ui}/src/property/material/materialEditor.ts +0 -0
- /package/{packages/chili-ui → chili-ui}/src/property/material/textureEditor.module.css +0 -0
- /package/{packages/chili-ui → chili-ui}/src/property/material/textureEditor.ts +0 -0
- /package/{packages/chili-ui → chili-ui}/src/property/materialProperty.module.css +0 -0
- /package/{packages/chili-ui → chili-ui}/src/property/materialProperty.ts +0 -0
- /package/{packages/chili-ui → chili-ui}/src/property/matrixProperty.ts +0 -0
- /package/{packages/chili-ui → chili-ui}/src/property/propertyBase.module.css +0 -0
- /package/{packages/chili-ui → chili-ui}/src/property/propertyBase.ts +0 -0
- /package/{packages/chili-ui → chili-ui}/src/property/propertyView.module.css +0 -0
- /package/{packages/chili-ui → chili-ui}/src/property/propertyView.ts +0 -0
- /package/{packages/chili-ui → chili-ui}/src/property/utils.ts +0 -0
- /package/{packages/chili-ui → chili-ui}/src/ribbon/commandContext.module.css +0 -0
- /package/{packages/chili-ui → chili-ui}/src/ribbon/commandContext.ts +0 -0
- /package/{packages/chili-ui → chili-ui}/src/ribbon/index.ts +0 -0
- /package/{packages/chili-ui → chili-ui}/src/ribbon/ribbon.module.css +0 -0
- /package/{packages/chili-ui → chili-ui}/src/ribbon/ribbon.ts +0 -0
- /package/{packages/chili-ui → chili-ui}/src/ribbon/ribbonButton.module.css +0 -0
- /package/{packages/chili-ui → chili-ui}/src/ribbon/ribbonButton.ts +0 -0
- /package/{packages/chili-ui → chili-ui}/src/ribbon/ribbonData.ts +0 -0
- /package/{packages/chili-ui → chili-ui}/src/ribbon/ribbonStack.module.css +0 -0
- /package/{packages/chili-ui → chili-ui}/src/ribbon/ribbonStack.ts +0 -0
- /package/{packages/chili-ui → chili-ui}/src/ribbon/ribbonToggleButton.module.css +0 -0
- /package/{packages/chili-ui → chili-ui}/src/ribbon/ribbonToggleButton.ts +0 -0
- /package/{packages/chili-ui → chili-ui}/src/statusbar/index.ts +0 -0
- /package/{packages/chili-ui → chili-ui}/src/statusbar/snapConfig.module.css +0 -0
- /package/{packages/chili-ui → chili-ui}/src/statusbar/snapConfig.ts +0 -0
- /package/{packages/chili-ui → chili-ui}/src/statusbar/statusbar.module.css +0 -0
- /package/{packages/chili-ui → chili-ui}/src/statusbar/statusbar.ts +0 -0
- /package/{packages/chili-ui → chili-ui}/src/toast/index.ts +0 -0
- /package/{packages/chili-ui → chili-ui}/src/toast/toast.module.css +0 -0
- /package/{packages/chili-ui → chili-ui}/src/toast/toast.ts +0 -0
- /package/{packages/chili-ui → chili-ui}/src/viewport/flyout/flyout.module.css +0 -0
- /package/{packages/chili-ui → chili-ui}/src/viewport/flyout/flyout.ts +0 -0
- /package/{packages/chili-ui → chili-ui}/src/viewport/flyout/index.ts +0 -0
- /package/{packages/chili-ui → chili-ui}/src/viewport/flyout/input.module.css +0 -0
- /package/{packages/chili-ui → chili-ui}/src/viewport/flyout/input.ts +0 -0
- /package/{packages/chili-ui → chili-ui}/src/viewport/flyout/tip.module.css +0 -0
- /package/{packages/chili-ui → chili-ui}/src/viewport/flyout/tip.ts +0 -0
- /package/{packages/chili-ui → chili-ui}/src/viewport/index.ts +0 -0
- /package/{packages/chili-ui → chili-ui}/src/viewport/layoutViewport.module.css +0 -0
- /package/{packages/chili-ui → chili-ui}/src/viewport/layoutViewport.ts +0 -0
- /package/{packages/chili-ui → chili-ui}/src/viewport/viewport.module.css +0 -0
- /package/{packages/chili-ui → chili-ui}/src/viewport/viewport.ts +0 -0
- /package/{packages/chili-vis → chili-vis}/src/index.ts +0 -0
- /package/{packages/chili-vis → chili-vis}/src/nodeSelectionEventHandler.ts +0 -0
- /package/{packages/chili-vis → chili-vis}/src/selectionEventHandler.ts +0 -0
- /package/{packages/chili-vis → chili-vis}/src/shapeSelectionEventHandler.ts +0 -0
- /package/{packages/chili-vis → chili-vis}/src/viewUtils.ts +0 -0
- /package/{packages/chili-wasm → chili-wasm}/lib/chili-wasm.d.ts +0 -0
- /package/{packages/chili-wasm → chili-wasm}/lib/chili-wasm.js +0 -0
- /package/{packages/chili-wasm → chili-wasm}/lib/chili-wasm.wasm +0 -0
- /package/{packages/chili-wasm → chili-wasm}/src/converter.ts +0 -0
- /package/{packages/chili-wasm → chili-wasm}/src/curve.ts +0 -0
- /package/{packages/chili-wasm → chili-wasm}/src/factory.ts +0 -0
- /package/{packages/chili-wasm → chili-wasm}/src/geometry.ts +0 -0
- /package/{packages/chili-wasm → chili-wasm}/src/helper.ts +0 -0
- /package/{packages/chili-wasm → chili-wasm}/src/index.ts +0 -0
- /package/{packages/chili-wasm → chili-wasm}/src/mesher.ts +0 -0
- /package/{packages/chili-wasm → chili-wasm}/src/shape.ts +0 -0
- /package/{packages/chili-wasm → chili-wasm}/src/surface.ts +0 -0
- /package/{packages/chili-wasm → chili-wasm}/src/wasm.ts +0 -0
- /package/{packages/chili-web → chili-web}/src/index.ts +0 -0
- /package/{packages/chili-web → chili-web}/src/loading.ts +0 -0
|
@@ -1,95 +0,0 @@
|
|
|
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 { Observable, PathBinding } from "../src";
|
|
5
|
-
|
|
6
|
-
class TestObjectValue extends Observable {
|
|
7
|
-
get value(): string | undefined {
|
|
8
|
-
return this.getPrivateValue("value", "value");
|
|
9
|
-
}
|
|
10
|
-
set value(value: string | undefined) {
|
|
11
|
-
this.setProperty("value", value);
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
class TestObjectA extends Observable {
|
|
16
|
-
get propA(): TestObjectValue | undefined {
|
|
17
|
-
return this.getPrivateValue("propA");
|
|
18
|
-
}
|
|
19
|
-
set propA(value: TestObjectValue | undefined) {
|
|
20
|
-
this.setProperty("propA", value);
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
class TestObjectB extends Observable {
|
|
25
|
-
get propB(): TestObjectA | undefined {
|
|
26
|
-
return this.getPrivateValue("propB");
|
|
27
|
-
}
|
|
28
|
-
set propB(value: TestObjectA | undefined) {
|
|
29
|
-
this.setProperty("propB", value);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
get propC(): string | undefined {
|
|
33
|
-
return this.getPrivateValue("propC", "propC");
|
|
34
|
-
}
|
|
35
|
-
set propC(value: string | undefined) {
|
|
36
|
-
this.setProperty("propC", value);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
describe("PathBinding test", () => {
|
|
41
|
-
test("test PathBinding1", () => {
|
|
42
|
-
const obj2 = new TestObjectB();
|
|
43
|
-
const binding = new PathBinding(obj2, "propB.propA.value");
|
|
44
|
-
const target = { value: "v1" };
|
|
45
|
-
binding.setBinding(target, "value");
|
|
46
|
-
expect(target.value).toBe("v1");
|
|
47
|
-
obj2.propB = new TestObjectA();
|
|
48
|
-
expect(target.value).toBe("v1");
|
|
49
|
-
|
|
50
|
-
const obj3 = new TestObjectValue();
|
|
51
|
-
obj2.propB.propA = obj3;
|
|
52
|
-
expect(target.value).toBe("value");
|
|
53
|
-
obj2.propB.propA.value = "value2";
|
|
54
|
-
expect(target.value).toBe("value2");
|
|
55
|
-
|
|
56
|
-
obj2.propB = undefined;
|
|
57
|
-
expect(target.value).toBe("value2");
|
|
58
|
-
obj3.value = "value3";
|
|
59
|
-
expect(target.value).toBe("value2");
|
|
60
|
-
|
|
61
|
-
obj2.propB = new TestObjectA();
|
|
62
|
-
expect(target.value).toBe("value2");
|
|
63
|
-
obj2.propB.propA = new TestObjectValue();
|
|
64
|
-
expect(target.value).toBe("value");
|
|
65
|
-
obj2.propB.propA = obj3;
|
|
66
|
-
expect(target.value).toBe("value3");
|
|
67
|
-
|
|
68
|
-
obj2.propB = undefined;
|
|
69
|
-
expect(target.value).toBe("value3");
|
|
70
|
-
obj3.value = "value";
|
|
71
|
-
expect(target.value).toBe("value3");
|
|
72
|
-
|
|
73
|
-
obj2.propB = new TestObjectA();
|
|
74
|
-
obj2.propB.propA = obj3;
|
|
75
|
-
expect(target.value).toBe("value");
|
|
76
|
-
obj3.value = "value4";
|
|
77
|
-
expect(target.value).toBe("value4");
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
test("test PathBinding2", () => {
|
|
81
|
-
const obj = new TestObjectB();
|
|
82
|
-
obj.propB = new TestObjectA();
|
|
83
|
-
obj.propB.propA = new TestObjectValue();
|
|
84
|
-
const target = { value1: "v1", value2: "v2" };
|
|
85
|
-
const binding1 = new PathBinding(obj, "propB.propA.value");
|
|
86
|
-
binding1.setBinding(target, "value1");
|
|
87
|
-
expect(target.value1).toBe("value");
|
|
88
|
-
|
|
89
|
-
const binding2 = new PathBinding(obj, "propC");
|
|
90
|
-
binding2.setBinding(target, "value2");
|
|
91
|
-
expect(target.value2).toBe("propC");
|
|
92
|
-
obj.propC = "propC2";
|
|
93
|
-
expect(target.value2).toBe("propC2");
|
|
94
|
-
});
|
|
95
|
-
});
|
|
@@ -1,60 +0,0 @@
|
|
|
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 { BoundingBox, type PointLike } from "../src/math/boundingBox";
|
|
5
|
-
|
|
6
|
-
describe("BoundingBox.isIntersect", () => {
|
|
7
|
-
function box(min: PointLike, max: PointLike) {
|
|
8
|
-
return new BoundingBox(min, max);
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
it("returns true for overlapping boxes", () => {
|
|
12
|
-
const a = box({ x: 0, y: 0, z: 0 }, { x: 2, y: 2, z: 2 });
|
|
13
|
-
const b = box({ x: 1, y: 1, z: 1 }, { x: 3, y: 3, z: 3 });
|
|
14
|
-
expect(BoundingBox.isIntersect(a, b)).toBe(true);
|
|
15
|
-
expect(BoundingBox.isIntersect(b, a)).toBe(true);
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
it("returns false for non-overlapping boxes", () => {
|
|
19
|
-
const a = box({ x: 0, y: 0, z: 0 }, { x: 1, y: 1, z: 1 });
|
|
20
|
-
const b = box({ x: 2, y: 2, z: 2 }, { x: 3, y: 3, z: 3 });
|
|
21
|
-
expect(BoundingBox.isIntersect(a, b)).toBe(false);
|
|
22
|
-
expect(BoundingBox.isIntersect(b, a)).toBe(false);
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
it("returns false for boxes touching at the edge within tolerance", () => {
|
|
26
|
-
const a = box({ x: 0, y: 0, z: 0 }, { x: 1, y: 1, z: 1 });
|
|
27
|
-
const b = box({ x: 1, y: 1, z: 1 }, { x: 2, y: 2, z: 2 });
|
|
28
|
-
expect(BoundingBox.isIntersect(a, b, -0.0001)).toBe(false);
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
it("returns false for boxes just outside tolerance", () => {
|
|
32
|
-
const a = box({ x: 0, y: 0, z: 0 }, { x: 1, y: 1, z: 1 });
|
|
33
|
-
const b = box({ x: 1.002, y: 1.002, z: 1.002 }, { x: 2, y: 2, z: 2 });
|
|
34
|
-
expect(BoundingBox.isIntersect(a, b)).toBe(false);
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
it("returns true for boxes just within tolerance", () => {
|
|
38
|
-
const a = box({ x: 0, y: 0, z: 0 }, { x: 1, y: 1, z: 1 });
|
|
39
|
-
const b = box({ x: 1.0005, y: 1.0005, z: 1.0005 }, { x: 2, y: 2, z: 2 });
|
|
40
|
-
expect(BoundingBox.isIntersect(a, b, 0.001)).toBe(true);
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
it("works with negative coordinates", () => {
|
|
44
|
-
const a = box({ x: -3, y: -3, z: -3 }, { x: -1, y: -1, z: -1 });
|
|
45
|
-
const b = box({ x: -2, y: -2, z: -2 }, { x: 0, y: 0, z: 0 });
|
|
46
|
-
expect(BoundingBox.isIntersect(a, b)).toBe(true);
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
it("returns true for identical boxes", () => {
|
|
50
|
-
const a = box({ x: 1, y: 1, z: 1 }, { x: 2, y: 2, z: 2 });
|
|
51
|
-
expect(BoundingBox.isIntersect(a, a)).toBe(true);
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
it("respects custom tolerance", () => {
|
|
55
|
-
const a = box({ x: 0, y: 0, z: 0 }, { x: 1, y: 1, z: 1 });
|
|
56
|
-
const b = box({ x: 1.01, y: 1.01, z: 1.01 }, { x: 2, y: 2, z: 2 });
|
|
57
|
-
expect(BoundingBox.isIntersect(a, b, 0.02)).toBe(true);
|
|
58
|
-
expect(BoundingBox.isIntersect(a, b, 0.001)).toBe(false);
|
|
59
|
-
});
|
|
60
|
-
});
|
|
@@ -1,53 +0,0 @@
|
|
|
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 { CollectionAction, type CollectionChangedArgs, ObservableCollection } from "../src";
|
|
5
|
-
|
|
6
|
-
describe("ObservableCollection test", () => {
|
|
7
|
-
test("test add", () => {
|
|
8
|
-
const collection = new ObservableCollection<number>();
|
|
9
|
-
collection.onCollectionChanged((arg: CollectionChangedArgs) => {
|
|
10
|
-
if (arg.action === CollectionAction.add) {
|
|
11
|
-
expect(arg.items.length).toBe(1);
|
|
12
|
-
}
|
|
13
|
-
});
|
|
14
|
-
collection.push(1);
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
test("test remove", () => {
|
|
18
|
-
const collection = new ObservableCollection<number>(1, 2, 3);
|
|
19
|
-
collection.onCollectionChanged((arg: CollectionChangedArgs) => {
|
|
20
|
-
if (arg.action === CollectionAction.remove) {
|
|
21
|
-
expect(arg.items).toStrictEqual([1, 3]);
|
|
22
|
-
expect(arg.items.length).toBe(2);
|
|
23
|
-
}
|
|
24
|
-
});
|
|
25
|
-
collection.remove(1, 3);
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
test("test move", () => {
|
|
29
|
-
const collection = new ObservableCollection<number>(1, 2, 3);
|
|
30
|
-
collection.onCollectionChanged((arg: CollectionChangedArgs) => {
|
|
31
|
-
if (arg.action === CollectionAction.move) {
|
|
32
|
-
expect(collection.items).toStrictEqual([2, 1, 3]);
|
|
33
|
-
expect(collection.items.length).toBe(3);
|
|
34
|
-
expect(arg.from).toBe(0);
|
|
35
|
-
expect(arg.to).toBe(2);
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
collection.move(0, 2);
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
test("test replace", () => {
|
|
42
|
-
const collection = new ObservableCollection<number>(1, 2, 3);
|
|
43
|
-
collection.onCollectionChanged((arg: CollectionChangedArgs) => {
|
|
44
|
-
if (arg.action === CollectionAction.replace) {
|
|
45
|
-
expect(collection.items).toStrictEqual([1, 3, 2, 3]);
|
|
46
|
-
expect(arg.items).toStrictEqual([3, 2]);
|
|
47
|
-
expect(arg.items.length).toBe(2);
|
|
48
|
-
expect(arg.item).toBe(2);
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
|
-
collection.replace(1, 3, 2);
|
|
52
|
-
});
|
|
53
|
-
});
|
|
@@ -1,42 +0,0 @@
|
|
|
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 { ArrayRecord, History, PropertyHistoryRecord } from "chili-core";
|
|
5
|
-
|
|
6
|
-
describe("test history", () => {
|
|
7
|
-
class TestClass {
|
|
8
|
-
property: string;
|
|
9
|
-
arrItems: number[];
|
|
10
|
-
setItems: Set<number>;
|
|
11
|
-
|
|
12
|
-
constructor() {
|
|
13
|
-
this.property = "p1";
|
|
14
|
-
this.arrItems = [1];
|
|
15
|
-
this.setItems = new Set();
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
test("test modify history", () => {
|
|
20
|
-
const obj = new TestClass();
|
|
21
|
-
const history = new History();
|
|
22
|
-
const h: PropertyHistoryRecord = new PropertyHistoryRecord(obj, "property", "p1", "p2");
|
|
23
|
-
const action = new ArrayRecord("test");
|
|
24
|
-
action.records.push(h);
|
|
25
|
-
history.add(action);
|
|
26
|
-
expect(history.undoCount()).toBe(1);
|
|
27
|
-
expect(history.redoCount()).toBe(0);
|
|
28
|
-
history.undo();
|
|
29
|
-
expect(obj.property).toBe("p1");
|
|
30
|
-
expect(history.undoCount()).toBe(0);
|
|
31
|
-
expect(history.redoCount()).toBe(1);
|
|
32
|
-
history.redo();
|
|
33
|
-
expect(obj.property).toBe("p2");
|
|
34
|
-
expect(history.undoCount()).toBe(1);
|
|
35
|
-
expect(history.redoCount()).toBe(0);
|
|
36
|
-
history.undo();
|
|
37
|
-
expect(history.redoCount()).toBe(1);
|
|
38
|
-
history.add(action);
|
|
39
|
-
expect(history.undoCount()).toBe(1);
|
|
40
|
-
expect(history.redoCount()).toBe(0);
|
|
41
|
-
});
|
|
42
|
-
});
|
|
@@ -1,75 +0,0 @@
|
|
|
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 { Line, XYZ } from "../src";
|
|
5
|
-
|
|
6
|
-
describe("test line", () => {
|
|
7
|
-
test("test constructor", () => {
|
|
8
|
-
expect(() => new Line(XYZ.zero, XYZ.zero)).toThrow();
|
|
9
|
-
const line = new Line(XYZ.zero, XYZ.unitX);
|
|
10
|
-
expect(line.point).toStrictEqual(XYZ.zero);
|
|
11
|
-
expect(line.direction).toStrictEqual(XYZ.unitX);
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
test("test nearest", () => {
|
|
15
|
-
const r1 = new Line(XYZ.zero, XYZ.unitX);
|
|
16
|
-
expect(r1.nearestToPoint(XYZ.zero)).toStrictEqual(XYZ.zero);
|
|
17
|
-
expect(r1.nearestToPoint(new XYZ(-1, 0, 0))).toStrictEqual(new XYZ(-1, 0, 0));
|
|
18
|
-
expect(r1.nearestToPoint(new XYZ(-1, 1, 0))).toStrictEqual(new XYZ(-1, 0, 0));
|
|
19
|
-
expect(r1.nearestTo(new Line(XYZ.unitZ, XYZ.unitX))).toStrictEqual(XYZ.zero);
|
|
20
|
-
expect(r1.nearestTo(new Line(XYZ.unitZ, XYZ.unitZ.reverse()))).toStrictEqual(XYZ.zero);
|
|
21
|
-
expect(r1.nearestTo(new Line(XYZ.unitZ, XYZ.unitX.add(XYZ.unitZ)))).toStrictEqual(new XYZ(-1, 0, 0));
|
|
22
|
-
expect(r1.nearestTo(new Line(XYZ.unitZ, XYZ.unitX.add(XYZ.unitZ.reverse())))).toStrictEqual(
|
|
23
|
-
new XYZ(1, 0, 0),
|
|
24
|
-
);
|
|
25
|
-
expect(r1.nearestTo(new Line(new XYZ(0.5, -0.5, 0), XYZ.unitY))).toStrictEqual(new XYZ(0.5, 0, 0));
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
test("test intersect", () => {
|
|
29
|
-
const r1 = new Line(XYZ.zero, XYZ.unitX);
|
|
30
|
-
const r11 = new Line(XYZ.zero, XYZ.unitY);
|
|
31
|
-
const r2 = new Line(XYZ.unitX.add(XYZ.unitY), XYZ.unitY);
|
|
32
|
-
expect(r1.intersect(r2)).toStrictEqual(XYZ.unitX);
|
|
33
|
-
expect(r1.intersect(r11)).toStrictEqual(XYZ.zero);
|
|
34
|
-
|
|
35
|
-
const r3 = new Line(XYZ.zero, XYZ.unitX);
|
|
36
|
-
const r4 = new Line(XYZ.unitY, XYZ.unitX);
|
|
37
|
-
expect(r3.intersect(r4)).toBeUndefined();
|
|
38
|
-
|
|
39
|
-
const r5 = new Line(new XYZ(0, 0, 0), new XYZ(1, 0, 0));
|
|
40
|
-
const r6 = new Line(new XYZ(2, 1, 0), new XYZ(0, 1, 0));
|
|
41
|
-
expect(r5.intersect(r6)).toStrictEqual(new XYZ(2, 0, 0));
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
test("test distanceTo", () => {
|
|
45
|
-
const r1 = new Line(XYZ.zero, XYZ.unitX);
|
|
46
|
-
const r2 = new Line(XYZ.unitX, XYZ.unitY);
|
|
47
|
-
expect(r1.distanceTo(r2)).toBeCloseTo(0);
|
|
48
|
-
|
|
49
|
-
const r3 = new Line(XYZ.zero, XYZ.unitX);
|
|
50
|
-
const r4 = new Line(XYZ.unitY, XYZ.unitX);
|
|
51
|
-
expect(r3.distanceTo(r4)).toBeCloseTo(1);
|
|
52
|
-
|
|
53
|
-
const r5 = new Line(new XYZ(0, 0, 0), new XYZ(1, 1, 0).normalize()!);
|
|
54
|
-
const r6 = new Line(new XYZ(2, 0, 0), new XYZ(0, 1, 0));
|
|
55
|
-
expect(r5.distanceTo(r6)).toBeCloseTo(0);
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
test("test nearestToPoint", () => {
|
|
59
|
-
const line = new Line(XYZ.zero, XYZ.unitX);
|
|
60
|
-
|
|
61
|
-
expect(line.nearestToPoint(XYZ.zero)).toStrictEqual(XYZ.zero);
|
|
62
|
-
expect(line.nearestToPoint(XYZ.unitX)).toStrictEqual(XYZ.unitX);
|
|
63
|
-
|
|
64
|
-
expect(line.nearestToPoint(new XYZ(0, 1, 0))).toStrictEqual(XYZ.zero);
|
|
65
|
-
expect(line.nearestToPoint(new XYZ(2, 3, 0))).toStrictEqual(new XYZ(2, 0, 0));
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
test("test direction normalization", () => {
|
|
69
|
-
const line = new Line(XYZ.zero, new XYZ(2, 0, 0));
|
|
70
|
-
expect(line.direction).toStrictEqual(XYZ.unitX);
|
|
71
|
-
|
|
72
|
-
const line2 = new Line(XYZ.zero, new XYZ(3, 4, 0));
|
|
73
|
-
expect(line2.direction.length()).toBeCloseTo(1);
|
|
74
|
-
});
|
|
75
|
-
});
|
|
@@ -1,98 +0,0 @@
|
|
|
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 { LineSegment, XYZ } from "../src";
|
|
5
|
-
|
|
6
|
-
describe("test linesegment", () => {
|
|
7
|
-
test("test constructor", () => {
|
|
8
|
-
const start = new XYZ(0, 0, 0);
|
|
9
|
-
const end = new XYZ(1, 0, 0);
|
|
10
|
-
const segment = new LineSegment(start, end);
|
|
11
|
-
expect(segment.start).toStrictEqual(start);
|
|
12
|
-
expect(segment.end).toStrictEqual(end);
|
|
13
|
-
|
|
14
|
-
expect(() => new LineSegment(start, start)).toThrow("start and end can not be equal");
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
test("test distanceTo with parallel segments", () => {
|
|
18
|
-
const seg1 = new LineSegment(new XYZ(0, 0, 0), new XYZ(1, 0, 0));
|
|
19
|
-
const seg2 = new LineSegment(new XYZ(0, 1, 0), new XYZ(1, 1, 0));
|
|
20
|
-
const result1 = seg1.distanceTo(seg2);
|
|
21
|
-
expect(result1.distance).toBeCloseTo(1);
|
|
22
|
-
expect(result1.pointOnThis).toStrictEqual(new XYZ(0, 0, 0));
|
|
23
|
-
expect(result1.pointOnRight).toStrictEqual(new XYZ(0, 1, 0));
|
|
24
|
-
|
|
25
|
-
const seg3 = new LineSegment(new XYZ(0, 0, 0), new XYZ(3, 0, 0));
|
|
26
|
-
const seg4 = new LineSegment(new XYZ(1, 1, 0), new XYZ(2, 1, 0));
|
|
27
|
-
const result2 = seg3.distanceTo(seg4);
|
|
28
|
-
expect(result2.distance).toBeCloseTo(1);
|
|
29
|
-
|
|
30
|
-
const result3 = seg1.distanceTo(seg4);
|
|
31
|
-
expect(result3.distance).toBeCloseTo(1);
|
|
32
|
-
|
|
33
|
-
const seg5 = new LineSegment(new XYZ(2, 1, 0), new XYZ(3, 1, 0));
|
|
34
|
-
const result4 = seg5.distanceTo(seg1);
|
|
35
|
-
expect(result4.distance).toBeCloseTo(Math.sqrt(2));
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
test("test distanceTo with intersecting segments", () => {
|
|
39
|
-
const seg1 = new LineSegment(new XYZ(-1, 0, 0), new XYZ(1, 0, 0));
|
|
40
|
-
const seg2 = new LineSegment(new XYZ(0, -1, 0), new XYZ(0, 1, 0));
|
|
41
|
-
const result = seg1.distanceTo(seg2);
|
|
42
|
-
expect(result.distance).toBeCloseTo(0);
|
|
43
|
-
expect(result.pointOnThis).toStrictEqual(new XYZ(0, 0, 0));
|
|
44
|
-
expect(result.pointOnRight).toStrictEqual(new XYZ(0, 0, 0));
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
test("test distanceTo with skew segments", () => {
|
|
48
|
-
const seg1 = new LineSegment(new XYZ(0, 0, 0), new XYZ(1, 0, 0));
|
|
49
|
-
const seg2 = new LineSegment(new XYZ(0, 1, 1), new XYZ(1, 1, 1));
|
|
50
|
-
const seg3 = new LineSegment(new XYZ(0.5, 0.5, 0), new XYZ(1, 1, 0));
|
|
51
|
-
|
|
52
|
-
const result1 = seg1.distanceTo(seg2);
|
|
53
|
-
expect(result1.distance).toBeCloseTo(Math.sqrt(2));
|
|
54
|
-
|
|
55
|
-
const result2 = seg1.distanceTo(seg3);
|
|
56
|
-
expect(result2.distance).toBeCloseTo(0.5);
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
test("test distanceTo with collinear segments", () => {
|
|
60
|
-
const seg1 = new LineSegment(new XYZ(0, 0, 0), new XYZ(1, 0, 0));
|
|
61
|
-
const seg2 = new LineSegment(new XYZ(2, 0, 0), new XYZ(3, 0, 0));
|
|
62
|
-
const result1 = seg1.distanceTo(seg2);
|
|
63
|
-
expect(result1.distance).toBeCloseTo(1);
|
|
64
|
-
expect(result1.pointOnThis).toStrictEqual(new XYZ(1, 0, 0));
|
|
65
|
-
expect(result1.pointOnRight).toStrictEqual(new XYZ(2, 0, 0));
|
|
66
|
-
|
|
67
|
-
const seg3 = new LineSegment(new XYZ(0, 0, 0), new XYZ(2, 0, 0));
|
|
68
|
-
const seg4 = new LineSegment(new XYZ(1, 0, 0), new XYZ(3, 0, 0));
|
|
69
|
-
const result2 = seg3.distanceTo(seg4);
|
|
70
|
-
expect(result2.pointOnThis).toStrictEqual(new XYZ(1, 0, 0));
|
|
71
|
-
expect(result2.pointOnRight).toStrictEqual(new XYZ(1, 0, 0));
|
|
72
|
-
expect(result2.distance).toBeCloseTo(0);
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
test("test distanceToPoint", () => {
|
|
76
|
-
// Test point closest to the middle of the segment
|
|
77
|
-
const segment = new LineSegment(new XYZ(0, 0, 0), new XYZ(2, 0, 0));
|
|
78
|
-
const point1 = new XYZ(1, 1, 0);
|
|
79
|
-
expect(segment.distanceToPoint(point1)).toBeCloseTo(1);
|
|
80
|
-
|
|
81
|
-
// Test point closest to start of segment
|
|
82
|
-
const point2 = new XYZ(-1, 1, 0);
|
|
83
|
-
expect(segment.distanceToPoint(point2)).toBeCloseTo(Math.sqrt(2));
|
|
84
|
-
|
|
85
|
-
// Test point closest to end of segment
|
|
86
|
-
const point3 = new XYZ(3, 1, 0);
|
|
87
|
-
expect(segment.distanceToPoint(point3)).toBeCloseTo(Math.sqrt(2));
|
|
88
|
-
|
|
89
|
-
// Test point on the segment
|
|
90
|
-
const point4 = new XYZ(1, 0, 0);
|
|
91
|
-
expect(segment.distanceToPoint(point4)).toBeCloseTo(0);
|
|
92
|
-
|
|
93
|
-
// Test with 3D points
|
|
94
|
-
const segment3D = new LineSegment(new XYZ(0, 0, 0), new XYZ(0, 0, 2));
|
|
95
|
-
const point3D = new XYZ(1, 0, 1);
|
|
96
|
-
expect(segment3D.distanceToPoint(point3D)).toBeCloseTo(1);
|
|
97
|
-
});
|
|
98
|
-
});
|
|
@@ -1,82 +0,0 @@
|
|
|
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 { LinkedList } from "../src";
|
|
5
|
-
|
|
6
|
-
describe("LinkedList", () => {
|
|
7
|
-
let linkedList: LinkedList<number>;
|
|
8
|
-
|
|
9
|
-
beforeEach(() => {
|
|
10
|
-
linkedList = new LinkedList();
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
describe("push", () => {
|
|
14
|
-
test("should add items to the end of the list", () => {
|
|
15
|
-
linkedList.push(1, 2, 3);
|
|
16
|
-
expect(linkedList.size).toBe(3);
|
|
17
|
-
expect(linkedList.head).toBe(1);
|
|
18
|
-
expect(linkedList.tail).toBe(3);
|
|
19
|
-
});
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
describe("insert", () => {
|
|
23
|
-
test("should insert an item at the specified index", () => {
|
|
24
|
-
linkedList.push(1, 2, 3);
|
|
25
|
-
linkedList.insert(1, 4);
|
|
26
|
-
expect(linkedList.size).toBe(4);
|
|
27
|
-
expect(linkedList.head).toBe(1);
|
|
28
|
-
expect(linkedList.tail).toBe(3);
|
|
29
|
-
expect([...linkedList]).toEqual([1, 4, 2, 3]);
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
test("should not insert an item if the index is out of range", () => {
|
|
33
|
-
linkedList.push(1, 2, 3);
|
|
34
|
-
linkedList.insert(5, 4);
|
|
35
|
-
expect(linkedList.size).toBe(3);
|
|
36
|
-
expect([...linkedList]).toEqual([1, 2, 3]);
|
|
37
|
-
});
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
describe("remove", () => {
|
|
41
|
-
test("should remove all occurrences of an item from the list", () => {
|
|
42
|
-
linkedList.push(1, 2, 3, 2);
|
|
43
|
-
linkedList.remove(2);
|
|
44
|
-
expect(linkedList.size).toBe(3);
|
|
45
|
-
expect([...linkedList]).toEqual([1, 3, 2]);
|
|
46
|
-
});
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
describe("removeAt", () => {
|
|
50
|
-
test("should remove an item at the specified index", () => {
|
|
51
|
-
linkedList.push(1, 2, 3);
|
|
52
|
-
linkedList.removeAt(1);
|
|
53
|
-
expect(linkedList.size).toBe(2);
|
|
54
|
-
expect([...linkedList]).toEqual([1, 3]);
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
test("should not remove an item if the index is out of range", () => {
|
|
58
|
-
linkedList.push(1, 2, 3);
|
|
59
|
-
linkedList.removeAt(5);
|
|
60
|
-
expect(linkedList.size).toBe(3);
|
|
61
|
-
expect([...linkedList]).toEqual([1, 2, 3]);
|
|
62
|
-
});
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
describe("clear", () => {
|
|
66
|
-
test("should remove all items from the list", () => {
|
|
67
|
-
linkedList.push(1, 2, 3);
|
|
68
|
-
linkedList.clear();
|
|
69
|
-
expect(linkedList.size).toBe(0);
|
|
70
|
-
expect(linkedList.head).toBeUndefined();
|
|
71
|
-
expect(linkedList.tail).toBeUndefined();
|
|
72
|
-
});
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
describe("reverse", () => {
|
|
76
|
-
test("should reverse the order of items in the list", () => {
|
|
77
|
-
linkedList.push(1, 2, 3);
|
|
78
|
-
linkedList.reverse();
|
|
79
|
-
expect([...linkedList]).toEqual([3, 2, 1]);
|
|
80
|
-
});
|
|
81
|
-
});
|
|
82
|
-
});
|
|
@@ -1,34 +0,0 @@
|
|
|
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 { MathUtils, Precision, XYZ } from "../src";
|
|
5
|
-
|
|
6
|
-
describe("test math", () => {
|
|
7
|
-
test("test anyEqualZero", () => {
|
|
8
|
-
expect(MathUtils.anyEqualZero(0.00000000000000000001)).toBeTruthy();
|
|
9
|
-
expect(MathUtils.anyEqualZero(1)).toBeFalsy();
|
|
10
|
-
expect(MathUtils.anyEqualZero(1, 1, 1)).toBeFalsy();
|
|
11
|
-
expect(MathUtils.anyEqualZero(1, 0, 1)).toBeTruthy();
|
|
12
|
-
expect(MathUtils.anyEqualZero(1, 0.0000000000000000001, 1)).toBeTruthy();
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
test("test allEqualZero", () => {
|
|
16
|
-
expect(MathUtils.allEqualZero(0.00000000000000000001)).toBeTruthy();
|
|
17
|
-
expect(MathUtils.allEqualZero(1)).toBeFalsy();
|
|
18
|
-
expect(MathUtils.allEqualZero(1, 1, 1)).toBeFalsy();
|
|
19
|
-
expect(MathUtils.allEqualZero(0, 0, 0.000000000000000001)).toBeTruthy();
|
|
20
|
-
expect(MathUtils.allEqualZero(0, 0, 0)).toBeTruthy();
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
test("test almostEqual", () => {
|
|
24
|
-
expect(MathUtils.almostEqual(1, 1, 0.01)).toBeTruthy();
|
|
25
|
-
expect(MathUtils.almostEqual(1.001, 1.002, 0.01)).toBeTruthy();
|
|
26
|
-
expect(MathUtils.almostEqual(1.001, 1.002, 0.001)).toBeFalsy();
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
test("test clamp", () => {
|
|
30
|
-
expect(MathUtils.clamp(1, 2, 3)).toBe(2);
|
|
31
|
-
expect(MathUtils.clamp(2.5, 2, 3)).toBe(2.5);
|
|
32
|
-
expect(MathUtils.clamp(4, 2, 3)).toBe(3);
|
|
33
|
-
});
|
|
34
|
-
});
|
|
@@ -1,129 +0,0 @@
|
|
|
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 { MathUtils, Matrix4, Plane, XYZ } from "../src";
|
|
5
|
-
|
|
6
|
-
describe("test Transform", () => {
|
|
7
|
-
test("test constructor", () => {
|
|
8
|
-
const transform = new Matrix4();
|
|
9
|
-
expect(transform.toArray().length).toBe(16);
|
|
10
|
-
expect(transform.toArray()).toStrictEqual([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]);
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
test("test operation", () => {
|
|
14
|
-
const t1 = Matrix4.fromTranslation(10, 0, 0);
|
|
15
|
-
const p1 = XYZ.zero;
|
|
16
|
-
const v1 = XYZ.unitY;
|
|
17
|
-
const p2 = t1.ofPoint(p1);
|
|
18
|
-
const v2 = t1.ofVector(v1);
|
|
19
|
-
expect(p2).toStrictEqual(new XYZ(10, 0, 0));
|
|
20
|
-
expect(v2).toStrictEqual(v1);
|
|
21
|
-
const t2 = t1.invert();
|
|
22
|
-
expect(t2!.ofPoint(p2)).toStrictEqual(p1);
|
|
23
|
-
|
|
24
|
-
const t3 = Matrix4.fromAxisRad(XYZ.zero, XYZ.unitZ, Math.PI * 0.5);
|
|
25
|
-
expect(t3.ofVector(v1).isEqualTo(new XYZ(-1, 0, 0))).toBeTruthy();
|
|
26
|
-
|
|
27
|
-
const t4 = Matrix4.fromScale(0.5, 1.5, 0);
|
|
28
|
-
const p3 = new XYZ(1, 1, 0);
|
|
29
|
-
expect(t4.ofPoint(p3)).toStrictEqual(new XYZ(0.5, 1.5, 0));
|
|
30
|
-
|
|
31
|
-
const t5 = t1.multiply(t3);
|
|
32
|
-
expect(t5.ofPoint(XYZ.unitY).isEqualTo(new XYZ(-1, 10, 0))).toBeTruthy();
|
|
33
|
-
const t6 = t5.invert();
|
|
34
|
-
expect(t6!.ofPoint(new XYZ(-1, 10, 0)).isEqualTo(XYZ.unitY)).toBeTruthy();
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
test("test mirror", () => {
|
|
38
|
-
let mirror = Matrix4.createMirrorWithPlane(new Plane(XYZ.zero, XYZ.unitX, XYZ.unitY));
|
|
39
|
-
expect(mirror.ofPoint(new XYZ(-1, 0, 0)).isEqualTo(XYZ.unitX)).toBeTruthy();
|
|
40
|
-
|
|
41
|
-
mirror = Matrix4.createMirrorWithPlane(new Plane(XYZ.unitX, XYZ.unitX, XYZ.unitY));
|
|
42
|
-
expect(mirror.ofPoint(new XYZ(-1, 0, 0)).isEqualTo(new XYZ(3, 0, 0))).toBeTruthy();
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
test("test translationPart", () => {
|
|
46
|
-
const matrix = Matrix4.fromTranslation(1, 2, 3);
|
|
47
|
-
expect(matrix.translationPart().isEqualTo(new XYZ(1, 2, 3))).toBeTruthy();
|
|
48
|
-
|
|
49
|
-
const point = matrix.ofPoint(new XYZ(0, 0, 0));
|
|
50
|
-
expect(point.distanceTo(new XYZ(1, 2, 3)) < 0.0001).toBeTruthy();
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
test("test getScale", () => {
|
|
54
|
-
const matrix = Matrix4.fromScale(2, 3, 4);
|
|
55
|
-
expect(matrix.getScale().isEqualTo(new XYZ(2, 3, 4))).toBeTruthy();
|
|
56
|
-
|
|
57
|
-
const point = matrix.ofPoint(new XYZ(1, 1, 1));
|
|
58
|
-
expect(point.distanceTo(new XYZ(2, 3, 4)) < 0.0001).toBeTruthy();
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
test("test getEulerAngles", () => {
|
|
62
|
-
const xRot = Matrix4.fromAxisRad(XYZ.zero, XYZ.unitX, Math.PI / 4);
|
|
63
|
-
let angles = xRot.getEulerAngles();
|
|
64
|
-
|
|
65
|
-
expect(MathUtils.almostEqual(angles.pitch, Math.PI / 4)).toBeTruthy();
|
|
66
|
-
expect(MathUtils.almostEqual(angles.yaw, 0)).toBeTruthy();
|
|
67
|
-
expect(MathUtils.almostEqual(angles.roll, 0)).toBeTruthy();
|
|
68
|
-
|
|
69
|
-
const yRot = Matrix4.fromAxisRad(XYZ.zero, XYZ.unitY, Math.PI / 3);
|
|
70
|
-
angles = yRot.getEulerAngles();
|
|
71
|
-
expect(MathUtils.almostEqual(angles.yaw, Math.PI / 3)).toBeTruthy();
|
|
72
|
-
expect(MathUtils.almostEqual(angles.pitch, 0)).toBeTruthy();
|
|
73
|
-
expect(MathUtils.almostEqual(angles.roll, 0)).toBeTruthy();
|
|
74
|
-
|
|
75
|
-
const zRot = Matrix4.fromAxisRad(XYZ.zero, XYZ.unitZ, Math.PI / 2);
|
|
76
|
-
angles = zRot.getEulerAngles();
|
|
77
|
-
expect(MathUtils.almostEqual(angles.roll, Math.PI / 2)).toBeTruthy();
|
|
78
|
-
expect(MathUtils.almostEqual(angles.pitch, 0)).toBeTruthy();
|
|
79
|
-
expect(MathUtils.almostEqual(angles.yaw, 0)).toBeTruthy();
|
|
80
|
-
|
|
81
|
-
const combined = Matrix4.fromEuler(Math.PI / 4, Math.PI / 3, Math.PI / 2);
|
|
82
|
-
angles = combined.getEulerAngles();
|
|
83
|
-
|
|
84
|
-
expect(MathUtils.almostEqual(angles.pitch, Math.PI / 4)).toBeTruthy();
|
|
85
|
-
expect(MathUtils.almostEqual(angles.yaw, Math.PI / 3)).toBeTruthy();
|
|
86
|
-
expect(MathUtils.almostEqual(angles.roll, Math.PI / 2)).toBeTruthy();
|
|
87
|
-
|
|
88
|
-
const edgeCase = Matrix4.fromAxisRad(XYZ.zero, XYZ.unitX, Math.PI);
|
|
89
|
-
angles = edgeCase.getEulerAngles();
|
|
90
|
-
expect(MathUtils.almostEqual(angles.pitch, Math.PI)).toBeTruthy();
|
|
91
|
-
});
|
|
92
|
-
|
|
93
|
-
test("test createFromTRS - translation only", () => {
|
|
94
|
-
const matrix = Matrix4.createFromTRS(
|
|
95
|
-
new XYZ(1, 2, 3),
|
|
96
|
-
{ pitch: 0, yaw: 0, roll: 0 },
|
|
97
|
-
new XYZ(1, 1, 1),
|
|
98
|
-
);
|
|
99
|
-
|
|
100
|
-
expect(matrix.translationPart().isEqualTo(new XYZ(1, 2, 3))).toBeTruthy();
|
|
101
|
-
expect(matrix.getScale().isEqualTo(new XYZ(1, 1, 1))).toBeTruthy();
|
|
102
|
-
});
|
|
103
|
-
|
|
104
|
-
test("test createFromTRS - rotation only", () => {
|
|
105
|
-
const matrix = Matrix4.createFromTRS(
|
|
106
|
-
XYZ.zero,
|
|
107
|
-
{ pitch: Math.PI / 2, yaw: 0, roll: 0 },
|
|
108
|
-
new XYZ(1, 1, 1),
|
|
109
|
-
);
|
|
110
|
-
|
|
111
|
-
const angles = matrix.getEulerAngles();
|
|
112
|
-
expect(MathUtils.almostEqual(angles.pitch, Math.PI / 2)).toBeTruthy();
|
|
113
|
-
expect(MathUtils.almostEqual(angles.yaw, 0)).toBeTruthy();
|
|
114
|
-
expect(MathUtils.almostEqual(angles.roll, 0)).toBeTruthy();
|
|
115
|
-
});
|
|
116
|
-
|
|
117
|
-
test("test createFromTRS - scale only", () => {
|
|
118
|
-
const matrix = Matrix4.createFromTRS(XYZ.zero, { pitch: 0, yaw: 0, roll: 0 }, new XYZ(2, 3, 4));
|
|
119
|
-
|
|
120
|
-
expect(matrix.getScale().isEqualTo(new XYZ(2, 3, 4))).toBeTruthy();
|
|
121
|
-
});
|
|
122
|
-
|
|
123
|
-
test("test createFromTRS - zero values", () => {
|
|
124
|
-
const matrix = Matrix4.createFromTRS(XYZ.zero, { pitch: 0, yaw: 0, roll: 0 }, new XYZ(0, 0, 0));
|
|
125
|
-
|
|
126
|
-
expect(matrix.translationPart().isEqualTo(XYZ.zero)).toBeTruthy();
|
|
127
|
-
expect(matrix.getScale().isEqualTo(new XYZ(0, 0, 0))).toBeTruthy();
|
|
128
|
-
});
|
|
129
|
-
});
|