fluidcad 0.0.32 → 0.0.34
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 +3 -2
- package/bin/commands/init.js +55 -0
- package/bin/commands/mcp.js +33 -0
- package/bin/commands/serve.js +77 -0
- package/bin/fluidcad.js +15 -107
- package/lib/dist/common/scene-object.d.ts +4 -1
- package/lib/dist/common/scene-object.js +9 -2
- package/lib/dist/common/solid.d.ts +4 -1
- package/lib/dist/common/solid.js +13 -0
- package/lib/dist/core/2d/tarc.d.ts +20 -2
- package/lib/dist/core/2d/tarc.js +24 -0
- package/lib/dist/core/index.d.ts +2 -1
- package/lib/dist/core/index.js +1 -0
- package/lib/dist/core/interfaces.d.ts +107 -2
- package/lib/dist/core/load.d.ts +2 -2
- package/lib/dist/core/repeat.js +62 -46
- package/lib/dist/core/rib.d.ts +18 -0
- package/lib/dist/core/rib.js +37 -0
- package/lib/dist/features/2d/arc.d.ts +8 -2
- package/lib/dist/features/2d/arc.js +94 -17
- package/lib/dist/features/2d/back.js +3 -2
- package/lib/dist/features/2d/sketch.d.ts +4 -0
- package/lib/dist/features/2d/sketch.js +21 -0
- package/lib/dist/features/2d/tarc-constrained.d.ts +2 -0
- package/lib/dist/features/2d/tarc-constrained.js +8 -0
- package/lib/dist/features/2d/tarc-radius-to-object.d.ts +16 -0
- package/lib/dist/features/2d/tarc-radius-to-object.js +58 -0
- package/lib/dist/features/2d/tarc-to-object.d.ts +18 -0
- package/lib/dist/features/2d/tarc-to-object.js +66 -0
- package/lib/dist/features/2d/tarc-to-point-tangent.d.ts +2 -0
- package/lib/dist/features/2d/tarc-to-point-tangent.js +3 -0
- package/lib/dist/features/2d/tarc-to-point.d.ts +2 -0
- package/lib/dist/features/2d/tarc-to-point.js +3 -0
- package/lib/dist/features/2d/tarc-with-tangent.d.ts +2 -0
- package/lib/dist/features/2d/tarc-with-tangent.js +3 -0
- package/lib/dist/features/2d/tarc.d.ts +2 -0
- package/lib/dist/features/2d/tarc.js +3 -0
- package/lib/dist/features/extrude-base.d.ts +9 -0
- package/lib/dist/features/extrude-base.js +22 -0
- package/lib/dist/features/extrude-to-face.js +1 -5
- package/lib/dist/features/extrude-two-distances.js +1 -2
- package/lib/dist/features/extrude.js +1 -2
- package/lib/dist/features/load.d.ts +6 -0
- package/lib/dist/features/load.js +53 -1
- package/lib/dist/features/mirror-feature.d.ts +3 -2
- package/lib/dist/features/mirror-feature.js +1 -1
- package/lib/dist/features/repeat-circular.d.ts +3 -3
- package/lib/dist/features/repeat-circular.js +8 -1
- package/lib/dist/features/repeat-linear.d.ts +4 -2
- package/lib/dist/features/repeat-linear.js +10 -1
- package/lib/dist/features/repeat-matrix.d.ts +3 -1
- package/lib/dist/features/repeat-matrix.js +7 -2
- package/lib/dist/features/rib.d.ts +31 -0
- package/lib/dist/features/rib.js +321 -0
- package/lib/dist/features/select.d.ts +1 -0
- package/lib/dist/features/select.js +81 -10
- package/lib/dist/features/shell.d.ts +4 -1
- package/lib/dist/features/shell.js +14 -3
- package/lib/dist/filters/edge/belongs-to-face.d.ts +12 -9
- package/lib/dist/filters/edge/belongs-to-face.js +64 -15
- package/lib/dist/filters/filter-builder-base.d.ts +25 -0
- package/lib/dist/filters/filter-builder-base.js +47 -0
- package/lib/dist/filters/filter.js +39 -14
- package/lib/dist/filters/from-object.d.ts +4 -0
- package/lib/dist/filters/from-object.js +10 -0
- package/lib/dist/helpers/clone-transform.d.ts +2 -1
- package/lib/dist/helpers/scene-helpers.d.ts +1 -1
- package/lib/dist/helpers/scene-helpers.js +146 -12
- package/lib/dist/index.d.ts +7 -1
- package/lib/dist/index.js +3 -3
- package/lib/dist/io/file-import.d.ts +5 -1
- package/lib/dist/io/file-import.js +29 -18
- package/lib/dist/math/lazy-matrix.d.ts +31 -0
- package/lib/dist/math/lazy-matrix.js +66 -0
- package/lib/dist/oc/color-transfer.d.ts +19 -8
- package/lib/dist/oc/color-transfer.js +70 -12
- package/lib/dist/oc/constraints/constraint-solver-adaptor.d.ts +5 -0
- package/lib/dist/oc/constraints/constraint-solver-adaptor.js +16 -0
- package/lib/dist/oc/constraints/constraint-solver.d.ts +4 -0
- package/lib/dist/oc/constraints/curve/curve-constraint-solver.d.ts +4 -0
- package/lib/dist/oc/constraints/curve/curve-constraint-solver.js +3 -0
- package/lib/dist/oc/constraints/geometric/geometric-constraint-solver.d.ts +6 -1
- package/lib/dist/oc/constraints/geometric/geometric-constraint-solver.js +4 -0
- package/lib/dist/oc/constraints/geometric/tangent-arc-from-point-tangent.d.ts +8 -0
- package/lib/dist/oc/constraints/geometric/tangent-arc-from-point-tangent.js +111 -0
- package/lib/dist/oc/constraints/geometric/tangent-arc-radius-to-object.d.ts +8 -0
- package/lib/dist/oc/constraints/geometric/tangent-arc-radius-to-object.js +161 -0
- package/lib/dist/oc/extrude-ops.d.ts +2 -1
- package/lib/dist/oc/extrude-ops.js +51 -2
- package/lib/dist/oc/mesh.d.ts +9 -4
- package/lib/dist/oc/mesh.js +14 -13
- package/lib/dist/oc/rib-ops.d.ts +35 -0
- package/lib/dist/oc/rib-ops.js +619 -0
- package/lib/dist/oc/shell-ops.d.ts +2 -1
- package/lib/dist/oc/shell-ops.js +5 -2
- package/lib/dist/oc/topology-index.d.ts +6 -0
- package/lib/dist/oc/topology-index.js +36 -0
- package/lib/dist/rendering/mesh-builder.d.ts +3 -0
- package/lib/dist/rendering/mesh-builder.js +8 -4
- package/lib/dist/rendering/render-edge.d.ts +2 -1
- package/lib/dist/rendering/render-edge.js +2 -2
- package/lib/dist/rendering/render-face.d.ts +2 -1
- package/lib/dist/rendering/render-face.js +2 -2
- package/lib/dist/rendering/render-solid.d.ts +2 -1
- package/lib/dist/rendering/render-solid.js +3 -5
- package/lib/dist/rendering/render-wire.d.ts +2 -1
- package/lib/dist/rendering/render-wire.js +2 -2
- package/lib/dist/rendering/render.d.ts +4 -0
- package/lib/dist/rendering/render.js +50 -2
- package/lib/dist/rendering/scene-compare.js +3 -0
- package/lib/dist/rendering/scene.d.ts +1 -0
- package/lib/dist/rendering/scene.js +4 -0
- package/lib/dist/scene-manager.d.ts +4 -2
- package/lib/dist/scene-manager.js +12 -4
- package/lib/dist/tests/features/2d/arc.test.js +64 -0
- package/lib/dist/tests/features/2d/back.test.js +17 -1
- package/lib/dist/tests/features/2d/tarc.test.js +157 -0
- package/lib/dist/tests/features/color-lineage.test.js +18 -0
- package/lib/dist/tests/features/filter-positional.test.d.ts +1 -0
- package/lib/dist/tests/features/filter-positional.test.js +129 -0
- package/lib/dist/tests/features/repeat-user-repro.test.d.ts +1 -0
- package/lib/dist/tests/features/repeat-user-repro.test.js +60 -0
- package/lib/dist/tests/features/rib.test.d.ts +1 -0
- package/lib/dist/tests/features/rib.test.js +598 -0
- package/lib/dist/tests/features/shell.test.js +36 -0
- package/lib/dist/tests/global-setup.js +2 -1
- package/lib/dist/tests/helpers/extract-blocks.d.ts +9 -0
- package/lib/dist/tests/helpers/extract-blocks.js +56 -0
- package/lib/dist/tests/llm-docs-examples.test.d.ts +1 -0
- package/lib/dist/tests/llm-docs-examples.test.js +62 -0
- package/lib/dist/tests/scene-compare.test.d.ts +1 -0
- package/lib/dist/tests/scene-compare.test.js +77 -0
- package/lib/dist/tests/setup.js +2 -1
- package/lib/dist/tsconfig.tsbuildinfo +1 -1
- package/llm-docs/.coverage-allowlist.txt +9 -0
- package/llm-docs/api/arc.md +48 -0
- package/llm-docs/api/axis.md +42 -0
- package/llm-docs/api/bezier.md +42 -0
- package/llm-docs/api/booleans.md +44 -0
- package/llm-docs/api/chamfer.md +40 -0
- package/llm-docs/api/circle.md +36 -0
- package/llm-docs/api/color.md +34 -0
- package/llm-docs/api/connect.md +41 -0
- package/llm-docs/api/constraint-qualifiers.md +48 -0
- package/llm-docs/api/copy.md +63 -0
- package/llm-docs/api/cursor-lines.md +50 -0
- package/llm-docs/api/cursor-move.md +61 -0
- package/llm-docs/api/cut.md +55 -0
- package/llm-docs/api/draft.md +36 -0
- package/llm-docs/api/edge-filter.md +57 -0
- package/llm-docs/api/ellipse.md +34 -0
- package/llm-docs/api/extrude.md +74 -0
- package/llm-docs/api/face-filter.md +61 -0
- package/llm-docs/api/fillet.md +51 -0
- package/llm-docs/api/index.json +139 -0
- package/llm-docs/api/line.md +42 -0
- package/llm-docs/api/load.md +37 -0
- package/llm-docs/api/local.md +38 -0
- package/llm-docs/api/loft.md +37 -0
- package/llm-docs/api/mirror.md +44 -0
- package/llm-docs/api/offset.md +36 -0
- package/llm-docs/api/part.md +40 -0
- package/llm-docs/api/plane.md +44 -0
- package/llm-docs/api/polygon.md +37 -0
- package/llm-docs/api/primitive-solids.md +39 -0
- package/llm-docs/api/project-intersect.md +48 -0
- package/llm-docs/api/rect.md +48 -0
- package/llm-docs/api/remove.md +32 -0
- package/llm-docs/api/repeat.md +79 -0
- package/llm-docs/api/revolve.md +38 -0
- package/llm-docs/api/rib.md +40 -0
- package/llm-docs/api/rotate.md +37 -0
- package/llm-docs/api/select.md +41 -0
- package/llm-docs/api/shell.md +41 -0
- package/llm-docs/api/sketch.md +76 -0
- package/llm-docs/api/slot.md +36 -0
- package/llm-docs/api/split-trim.md +42 -0
- package/llm-docs/api/sweep.md +43 -0
- package/llm-docs/api/tarc.md +45 -0
- package/llm-docs/api/tcircle.md +38 -0
- package/llm-docs/api/tline.md +42 -0
- package/llm-docs/api/translate.md +40 -0
- package/llm-docs/api/types/aline.md +35 -0
- package/llm-docs/api/types/arc-angles.md +29 -0
- package/llm-docs/api/types/arc-points.md +48 -0
- package/llm-docs/api/types/axis-like.md +38 -0
- package/llm-docs/api/types/axis.md +21 -0
- package/llm-docs/api/types/boolean-operation.md +50 -0
- package/llm-docs/api/types/circular-repeat-options.md +31 -0
- package/llm-docs/api/types/common.md +32 -0
- package/llm-docs/api/types/cut.md +125 -0
- package/llm-docs/api/types/draft.md +21 -0
- package/llm-docs/api/types/extrudable-geometry.md +23 -0
- package/llm-docs/api/types/extrude.md +194 -0
- package/llm-docs/api/types/geometry.md +51 -0
- package/llm-docs/api/types/hline.md +35 -0
- package/llm-docs/api/types/linear-repeat-options.md +31 -0
- package/llm-docs/api/types/loft.md +154 -0
- package/llm-docs/api/types/mirror.md +35 -0
- package/llm-docs/api/types/offset.md +31 -0
- package/llm-docs/api/types/plane-like.md +35 -0
- package/llm-docs/api/types/plane-transform-options.md +29 -0
- package/llm-docs/api/types/plane.md +21 -0
- package/llm-docs/api/types/point-like.md +22 -0
- package/llm-docs/api/types/point2dlike.md +26 -0
- package/llm-docs/api/types/polygon.md +46 -0
- package/llm-docs/api/types/rect.md +128 -0
- package/llm-docs/api/types/revolve.md +102 -0
- package/llm-docs/api/types/rib.md +133 -0
- package/llm-docs/api/types/scene-object.md +33 -0
- package/llm-docs/api/types/select.md +21 -0
- package/llm-docs/api/types/shell.md +54 -0
- package/llm-docs/api/types/slot.md +43 -0
- package/llm-docs/api/types/sweep.md +189 -0
- package/llm-docs/api/types/tangent-arc-two-objects.md +46 -0
- package/llm-docs/api/types/transformable.md +93 -0
- package/llm-docs/api/types/trim.md +27 -0
- package/llm-docs/api/types/two-objects-tangent-line.md +46 -0
- package/llm-docs/api/types/vertex.md +17 -0
- package/llm-docs/api/types/vline.md +35 -0
- package/llm-docs/concepts/coordinate-system.md +45 -0
- package/llm-docs/concepts/history-and-rollback.md +40 -0
- package/llm-docs/concepts/last-selection.md +49 -0
- package/llm-docs/concepts/scene-graph.md +37 -0
- package/llm-docs/index.json +1750 -0
- package/mcp/dist/client.d.ts +64 -0
- package/mcp/dist/client.js +248 -0
- package/mcp/dist/discovery.d.ts +11 -0
- package/mcp/dist/discovery.js +78 -0
- package/mcp/dist/docs-index.d.ts +81 -0
- package/mcp/dist/docs-index.js +261 -0
- package/mcp/dist/resources.d.ts +4 -0
- package/mcp/dist/resources.js +115 -0
- package/mcp/dist/server.d.ts +12 -0
- package/mcp/dist/server.js +489 -0
- package/mcp/dist/tools/coordination.d.ts +9 -0
- package/mcp/dist/tools/coordination.js +46 -0
- package/mcp/dist/tools/docs.d.ts +66 -0
- package/mcp/dist/tools/docs.js +122 -0
- package/mcp/dist/tools/engine.d.ts +56 -0
- package/mcp/dist/tools/engine.js +145 -0
- package/mcp/dist/tools/inspection.d.ts +75 -0
- package/mcp/dist/tools/inspection.js +121 -0
- package/mcp/dist/tools/screenshot.d.ts +63 -0
- package/mcp/dist/tools/screenshot.js +263 -0
- package/mcp/dist/tools/source.d.ts +84 -0
- package/mcp/dist/tools/source.js +434 -0
- package/mcp/dist/tools/workspaces.d.ts +13 -0
- package/mcp/dist/tools/workspaces.js +33 -0
- package/mcp/dist/types.d.ts +18 -0
- package/mcp/dist/types.js +11 -0
- package/package.json +19 -5
- package/server/dist/code-editor.d.ts +36 -0
- package/server/dist/code-editor.js +8 -0
- package/server/dist/fluidcad-server.d.ts +50 -0
- package/server/dist/fluidcad-server.js +153 -1
- package/server/dist/global-registry.d.ts +30 -0
- package/server/dist/global-registry.js +126 -0
- package/server/dist/index.js +171 -26
- package/server/dist/instance-file.d.ts +31 -0
- package/server/dist/instance-file.js +73 -0
- package/server/dist/lint-fluid-js.d.ts +15 -0
- package/server/dist/lint-fluid-js.js +271 -0
- package/server/dist/routes/editor.d.ts +24 -0
- package/server/dist/routes/editor.js +44 -0
- package/server/dist/routes/export.d.ts +1 -1
- package/server/dist/routes/export.js +45 -8
- package/server/dist/routes/health.d.ts +7 -0
- package/server/dist/routes/health.js +14 -0
- package/server/dist/routes/lint.d.ts +10 -0
- package/server/dist/routes/lint.js +28 -0
- package/server/dist/routes/render.d.ts +33 -0
- package/server/dist/routes/render.js +34 -0
- package/server/dist/routes/scene.d.ts +5 -0
- package/server/dist/routes/scene.js +48 -0
- package/server/dist/routes/screenshot.js +68 -1
- package/server/dist/ws-protocol.d.ts +56 -2
- package/ui/dist/assets/{index-DMw0OYCF.js → index-BdqrMDRu.js} +30 -30
- package/ui/dist/index.html +1 -1
|
@@ -9,8 +9,9 @@ export class Back extends GeometrySceneObject {
|
|
|
9
9
|
return 'back';
|
|
10
10
|
}
|
|
11
11
|
build() {
|
|
12
|
-
const
|
|
13
|
-
this.setCurrentPosition(
|
|
12
|
+
const { position, tangent } = this.sketch.getPreviousState(this, this.count);
|
|
13
|
+
this.setCurrentPosition(position);
|
|
14
|
+
this.setTangent(tangent);
|
|
14
15
|
}
|
|
15
16
|
getDependencies() {
|
|
16
17
|
return [];
|
|
@@ -15,6 +15,10 @@ export declare class Sketch extends SceneObject implements Extrudable {
|
|
|
15
15
|
getTangentAt(currentObj: GeometrySceneObject): Point2D;
|
|
16
16
|
getPositionAt(currentObj: GeometrySceneObject): Point2D;
|
|
17
17
|
getPreviousPosition(currentObj: GeometrySceneObject, count?: number): Point2D;
|
|
18
|
+
getPreviousState(currentObj: GeometrySceneObject, count?: number): {
|
|
19
|
+
position: Point2D;
|
|
20
|
+
tangent: Point2D;
|
|
21
|
+
};
|
|
18
22
|
getLastPosition(scope?: Set<SceneObject>): Point2D;
|
|
19
23
|
build(context?: BuildSceneObjectContext): void;
|
|
20
24
|
getEdges(): Edge[];
|
|
@@ -78,6 +78,27 @@ export class Sketch extends SceneObject {
|
|
|
78
78
|
}
|
|
79
79
|
return this.getStartPoint();
|
|
80
80
|
}
|
|
81
|
+
getPreviousState(currentObj, count = 1) {
|
|
82
|
+
const children = this.getChildren();
|
|
83
|
+
const previous = children.slice(0, children.indexOf(currentObj));
|
|
84
|
+
let remaining = count;
|
|
85
|
+
for (let i = previous.length - 1; i >= 0; i--) {
|
|
86
|
+
const pos = previous[i].getState('current-position');
|
|
87
|
+
if (pos) {
|
|
88
|
+
if (remaining === 0) {
|
|
89
|
+
for (let j = i; j >= 0; j--) {
|
|
90
|
+
const t = previous[j].getTangent();
|
|
91
|
+
if (t) {
|
|
92
|
+
return { position: pos, tangent: t };
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
return { position: pos, tangent: new Point2D(1, 0) };
|
|
96
|
+
}
|
|
97
|
+
remaining--;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
return { position: this.getStartPoint(), tangent: new Point2D(1, 0) };
|
|
101
|
+
}
|
|
81
102
|
getLastPosition(scope) {
|
|
82
103
|
let children = this.getChildren().slice();
|
|
83
104
|
if (scope) {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { GeometrySceneObject } from "./geometry.js";
|
|
2
|
+
import { SceneObject } from "../../common/scene-object.js";
|
|
2
3
|
import { LazyVertex } from "../lazy-vertex.js";
|
|
3
4
|
import { QualifiedSceneObject } from "./constraints/qualified-geometry.js";
|
|
4
5
|
import { ITangentArcTwoObjects } from "../../core/interfaces.js";
|
|
@@ -11,6 +12,7 @@ export declare class TangentArcTwoObjects extends GeometrySceneObject implements
|
|
|
11
12
|
build(): void;
|
|
12
13
|
start(index?: number): LazyVertex;
|
|
13
14
|
end(index?: number): LazyVertex;
|
|
15
|
+
createCopy(remap: Map<SceneObject, SceneObject>): SceneObject;
|
|
14
16
|
compareTo(other: TangentArcTwoObjects): boolean;
|
|
15
17
|
getType(): string;
|
|
16
18
|
getUniqueType(): string;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { GeometrySceneObject } from "./geometry.js";
|
|
2
2
|
import { LazyVertex } from "../lazy-vertex.js";
|
|
3
3
|
import { Vertex } from "../../common/vertex.js";
|
|
4
|
+
import { QualifiedSceneObject } from "./constraints/qualified-geometry.js";
|
|
4
5
|
import { createConstraintSolver } from "../../oc/constraints/create-solver.js";
|
|
5
6
|
export class TangentArcTwoObjects extends GeometrySceneObject {
|
|
6
7
|
c1;
|
|
@@ -41,6 +42,13 @@ export class TangentArcTwoObjects extends GeometrySceneObject {
|
|
|
41
42
|
end(index = 0) {
|
|
42
43
|
return new LazyVertex(this.generateUniqueName(`end-vertex-${index}`), () => [this.getState('end')]);
|
|
43
44
|
}
|
|
45
|
+
createCopy(remap) {
|
|
46
|
+
const remappedC1Object = remap.get(this.c1.object) || this.c1.object;
|
|
47
|
+
const remappedC2Object = remap.get(this.c2.object) || this.c2.object;
|
|
48
|
+
const c1 = new QualifiedSceneObject(remappedC1Object, this.c1.qualifier);
|
|
49
|
+
const c2 = new QualifiedSceneObject(remappedC2Object, this.c2.qualifier);
|
|
50
|
+
return new TangentArcTwoObjects(c1, c2, this.radius, this.mustTouch);
|
|
51
|
+
}
|
|
44
52
|
compareTo(other) {
|
|
45
53
|
if (!(other instanceof TangentArcTwoObjects)) {
|
|
46
54
|
return false;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { GeometrySceneObject } from "./geometry.js";
|
|
2
|
+
import { SceneObject } from "../../common/scene-object.js";
|
|
3
|
+
import { QualifiedSceneObject } from "./constraints/qualified-geometry.js";
|
|
4
|
+
export declare class TangentArcRadiusToObject extends GeometrySceneObject {
|
|
5
|
+
radius: number;
|
|
6
|
+
target: QualifiedSceneObject;
|
|
7
|
+
constructor(radius: number, target: QualifiedSceneObject);
|
|
8
|
+
build(): void;
|
|
9
|
+
createCopy(remap: Map<SceneObject, SceneObject>): SceneObject;
|
|
10
|
+
compareTo(other: TangentArcRadiusToObject): boolean;
|
|
11
|
+
getType(): string;
|
|
12
|
+
getUniqueType(): string;
|
|
13
|
+
serialize(): {
|
|
14
|
+
radius: number;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { GeometrySceneObject } from "./geometry.js";
|
|
2
|
+
import { Vertex } from "../../common/vertex.js";
|
|
3
|
+
import { QualifiedSceneObject } from "./constraints/qualified-geometry.js";
|
|
4
|
+
import { solveTangentArcRadiusToObject } from "../../oc/constraints/geometric/tangent-arc-radius-to-object.js";
|
|
5
|
+
export class TangentArcRadiusToObject extends GeometrySceneObject {
|
|
6
|
+
radius;
|
|
7
|
+
target;
|
|
8
|
+
constructor(radius, target) {
|
|
9
|
+
super();
|
|
10
|
+
this.radius = radius;
|
|
11
|
+
this.target = target;
|
|
12
|
+
}
|
|
13
|
+
build() {
|
|
14
|
+
const plane = this.sketch.getPlane();
|
|
15
|
+
const startPoint = this.getCurrentPosition();
|
|
16
|
+
const startTangent = this.sketch.getTangentAt(this);
|
|
17
|
+
const targetShape = this.target.toQualifiedShape();
|
|
18
|
+
const result = solveTangentArcRadiusToObject(plane, startPoint, startTangent, this.radius, targetShape);
|
|
19
|
+
for (let i = 0; i < result.edges.length; i++) {
|
|
20
|
+
this.setState(`edge-${i}`, result.edges[i]);
|
|
21
|
+
}
|
|
22
|
+
if (result.edges.length > 0) {
|
|
23
|
+
const lastEdge = result.edges[result.edges.length - 1];
|
|
24
|
+
const localStart = plane.worldToLocal(lastEdge.getFirstVertex().toPoint());
|
|
25
|
+
const localEnd = plane.worldToLocal(lastEdge.getLastVertex().toPoint());
|
|
26
|
+
this.setState('start', Vertex.fromPoint2D(localStart));
|
|
27
|
+
this.setState('end', Vertex.fromPoint2D(localEnd));
|
|
28
|
+
if (result.endTangent) {
|
|
29
|
+
this.setTangent(result.endTangent);
|
|
30
|
+
}
|
|
31
|
+
this.setCurrentPosition(localEnd);
|
|
32
|
+
}
|
|
33
|
+
this.addShapes(result.edges);
|
|
34
|
+
}
|
|
35
|
+
createCopy(remap) {
|
|
36
|
+
const remappedObject = remap.get(this.target.object) || this.target.object;
|
|
37
|
+
const target = new QualifiedSceneObject(remappedObject, this.target.qualifier);
|
|
38
|
+
return new TangentArcRadiusToObject(this.radius, target);
|
|
39
|
+
}
|
|
40
|
+
compareTo(other) {
|
|
41
|
+
if (!(other instanceof TangentArcRadiusToObject)) {
|
|
42
|
+
return false;
|
|
43
|
+
}
|
|
44
|
+
if (!super.compareTo(other)) {
|
|
45
|
+
return false;
|
|
46
|
+
}
|
|
47
|
+
return this.radius === other.radius && this.target.compareTo(other.target);
|
|
48
|
+
}
|
|
49
|
+
getType() {
|
|
50
|
+
return 'tarc';
|
|
51
|
+
}
|
|
52
|
+
getUniqueType() {
|
|
53
|
+
return 'tarc-radius-to-object';
|
|
54
|
+
}
|
|
55
|
+
serialize() {
|
|
56
|
+
return { radius: this.radius };
|
|
57
|
+
}
|
|
58
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { GeometrySceneObject } from "./geometry.js";
|
|
2
|
+
import { SceneObject } from "../../common/scene-object.js";
|
|
3
|
+
import { QualifiedSceneObject } from "./constraints/qualified-geometry.js";
|
|
4
|
+
import { ITangentArcToObject } from "../../core/interfaces.js";
|
|
5
|
+
export declare class TangentArcToObject extends GeometrySceneObject implements ITangentArcToObject {
|
|
6
|
+
target: QualifiedSceneObject;
|
|
7
|
+
private flipped;
|
|
8
|
+
constructor(target: QualifiedSceneObject);
|
|
9
|
+
flip(): this;
|
|
10
|
+
build(): void;
|
|
11
|
+
createCopy(remap: Map<SceneObject, SceneObject>): SceneObject;
|
|
12
|
+
compareTo(other: TangentArcToObject): boolean;
|
|
13
|
+
getType(): string;
|
|
14
|
+
getUniqueType(): string;
|
|
15
|
+
serialize(): {
|
|
16
|
+
flipped: boolean;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { GeometrySceneObject } from "./geometry.js";
|
|
2
|
+
import { Vertex } from "../../common/vertex.js";
|
|
3
|
+
import { QualifiedSceneObject } from "./constraints/qualified-geometry.js";
|
|
4
|
+
import { createConstraintSolver } from "../../oc/constraints/create-solver.js";
|
|
5
|
+
export class TangentArcToObject extends GeometrySceneObject {
|
|
6
|
+
target;
|
|
7
|
+
flipped = false;
|
|
8
|
+
constructor(target) {
|
|
9
|
+
super();
|
|
10
|
+
this.target = target;
|
|
11
|
+
}
|
|
12
|
+
flip() {
|
|
13
|
+
this.flipped = true;
|
|
14
|
+
return this;
|
|
15
|
+
}
|
|
16
|
+
build() {
|
|
17
|
+
const plane = this.sketch.getPlane();
|
|
18
|
+
const startPoint = this.getCurrentPosition();
|
|
19
|
+
const startTangent = this.sketch.getTangentAt(this);
|
|
20
|
+
const targetShape = this.target.toQualifiedShape();
|
|
21
|
+
const solver = createConstraintSolver(false);
|
|
22
|
+
const result = solver.getTangentArcFromPointTangent(plane, startPoint, startTangent, targetShape, this.flipped);
|
|
23
|
+
for (let i = 0; i < result.edges.length; i++) {
|
|
24
|
+
this.setState(`edge-${i}`, result.edges[i]);
|
|
25
|
+
}
|
|
26
|
+
if (result.edges.length > 0) {
|
|
27
|
+
const lastEdge = result.edges[result.edges.length - 1];
|
|
28
|
+
const localStart = plane.worldToLocal(lastEdge.getFirstVertex().toPoint());
|
|
29
|
+
const localEnd = plane.worldToLocal(lastEdge.getLastVertex().toPoint());
|
|
30
|
+
this.setState('start', Vertex.fromPoint2D(localStart));
|
|
31
|
+
this.setState('end', Vertex.fromPoint2D(localEnd));
|
|
32
|
+
if (result.endTangent) {
|
|
33
|
+
this.setTangent(result.endTangent);
|
|
34
|
+
}
|
|
35
|
+
this.setCurrentPosition(localEnd);
|
|
36
|
+
}
|
|
37
|
+
this.addShapes(result.edges);
|
|
38
|
+
}
|
|
39
|
+
createCopy(remap) {
|
|
40
|
+
const remappedObject = remap.get(this.target.object) || this.target.object;
|
|
41
|
+
const target = new QualifiedSceneObject(remappedObject, this.target.qualifier);
|
|
42
|
+
const copy = new TangentArcToObject(target);
|
|
43
|
+
if (this.flipped) {
|
|
44
|
+
copy.flip();
|
|
45
|
+
}
|
|
46
|
+
return copy;
|
|
47
|
+
}
|
|
48
|
+
compareTo(other) {
|
|
49
|
+
if (!(other instanceof TangentArcToObject)) {
|
|
50
|
+
return false;
|
|
51
|
+
}
|
|
52
|
+
if (!super.compareTo(other)) {
|
|
53
|
+
return false;
|
|
54
|
+
}
|
|
55
|
+
return this.target.compareTo(other.target) && this.flipped === other.flipped;
|
|
56
|
+
}
|
|
57
|
+
getType() {
|
|
58
|
+
return 'tarc';
|
|
59
|
+
}
|
|
60
|
+
getUniqueType() {
|
|
61
|
+
return 'tarc-to-object';
|
|
62
|
+
}
|
|
63
|
+
serialize() {
|
|
64
|
+
return { flipped: this.flipped };
|
|
65
|
+
}
|
|
66
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { SceneObject } from "../../common/scene-object.js";
|
|
1
2
|
import { GeometrySceneObject } from "./geometry.js";
|
|
2
3
|
import { LazyVertex } from "../lazy-vertex.js";
|
|
3
4
|
export declare class TangentArcToPointTangent extends GeometrySceneObject {
|
|
@@ -5,6 +6,7 @@ export declare class TangentArcToPointTangent extends GeometrySceneObject {
|
|
|
5
6
|
startTangent: LazyVertex;
|
|
6
7
|
constructor(endPoint: LazyVertex, startTangent: LazyVertex);
|
|
7
8
|
build(): void;
|
|
9
|
+
createCopy(remap: Map<SceneObject, SceneObject>): SceneObject;
|
|
8
10
|
compareTo(other: TangentArcToPointTangent): boolean;
|
|
9
11
|
getType(): string;
|
|
10
12
|
getUniqueType(): string;
|
|
@@ -62,6 +62,9 @@ export class TangentArcToPointTangent extends GeometrySceneObject {
|
|
|
62
62
|
this.addShape(edge);
|
|
63
63
|
this.setCurrentPosition(targetPoint);
|
|
64
64
|
}
|
|
65
|
+
createCopy(remap) {
|
|
66
|
+
return new TangentArcToPointTangent(this.endPoint, this.startTangent);
|
|
67
|
+
}
|
|
65
68
|
compareTo(other) {
|
|
66
69
|
if (!(other instanceof TangentArcToPointTangent)) {
|
|
67
70
|
return false;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
import { SceneObject } from "../../common/scene-object.js";
|
|
1
2
|
import { GeometrySceneObject } from "./geometry.js";
|
|
2
3
|
import { LazyVertex } from "../lazy-vertex.js";
|
|
3
4
|
export declare class TangentArcToPoint extends GeometrySceneObject {
|
|
4
5
|
endPoint: LazyVertex;
|
|
5
6
|
constructor(endPoint: LazyVertex);
|
|
6
7
|
build(): void;
|
|
8
|
+
createCopy(remap: Map<SceneObject, SceneObject>): SceneObject;
|
|
7
9
|
compareTo(other: TangentArcToPoint): boolean;
|
|
8
10
|
getType(): string;
|
|
9
11
|
getUniqueType(): string;
|
|
@@ -60,6 +60,9 @@ export class TangentArcToPoint extends GeometrySceneObject {
|
|
|
60
60
|
this.addShape(edge);
|
|
61
61
|
this.setCurrentPosition(targetPoint);
|
|
62
62
|
}
|
|
63
|
+
createCopy(remap) {
|
|
64
|
+
return new TangentArcToPoint(this.endPoint);
|
|
65
|
+
}
|
|
63
66
|
compareTo(other) {
|
|
64
67
|
if (!(other instanceof TangentArcToPoint)) {
|
|
65
68
|
return false;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { SceneObject } from "../../common/scene-object.js";
|
|
1
2
|
import { LazyVertex } from "../lazy-vertex.js";
|
|
2
3
|
import { GeometrySceneObject } from "./geometry.js";
|
|
3
4
|
export declare class TangentArcWithTangent extends GeometrySceneObject {
|
|
@@ -6,6 +7,7 @@ export declare class TangentArcWithTangent extends GeometrySceneObject {
|
|
|
6
7
|
startTangent: LazyVertex;
|
|
7
8
|
constructor(radius: number, endAngle: number, startTangent: LazyVertex);
|
|
8
9
|
build(): void;
|
|
10
|
+
createCopy(remap: Map<SceneObject, SceneObject>): SceneObject;
|
|
9
11
|
compareTo(other: TangentArcWithTangent): boolean;
|
|
10
12
|
getType(): string;
|
|
11
13
|
getUniqueType(): string;
|
|
@@ -46,6 +46,9 @@ export class TangentArcWithTangent extends GeometrySceneObject {
|
|
|
46
46
|
this.addShape(edge);
|
|
47
47
|
this.setCurrentPosition(endPoint);
|
|
48
48
|
}
|
|
49
|
+
createCopy(remap) {
|
|
50
|
+
return new TangentArcWithTangent(this.radius, this.endAngle, this.startTangent);
|
|
51
|
+
}
|
|
49
52
|
compareTo(other) {
|
|
50
53
|
if (!(other instanceof TangentArcWithTangent)) {
|
|
51
54
|
return false;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
import { SceneObject } from "../../common/scene-object.js";
|
|
1
2
|
import { GeometrySceneObject } from "./geometry.js";
|
|
2
3
|
export declare class TangentArc extends GeometrySceneObject {
|
|
3
4
|
radius: number;
|
|
4
5
|
endAngle: number;
|
|
5
6
|
constructor(radius: number, endAngle: number);
|
|
6
7
|
build(): void;
|
|
8
|
+
createCopy(remap: Map<SceneObject, SceneObject>): SceneObject;
|
|
7
9
|
compareTo(other: TangentArc): boolean;
|
|
8
10
|
getType(): string;
|
|
9
11
|
serialize(): {
|
|
@@ -48,6 +48,9 @@ export class TangentArc extends GeometrySceneObject {
|
|
|
48
48
|
this.addShape(edge);
|
|
49
49
|
this.setCurrentPosition(endPoint);
|
|
50
50
|
}
|
|
51
|
+
createCopy(remap) {
|
|
52
|
+
return new TangentArc(this.radius, this.endAngle);
|
|
53
|
+
}
|
|
51
54
|
compareTo(other) {
|
|
52
55
|
if (!(other instanceof TangentArc)) {
|
|
53
56
|
return false;
|
|
@@ -32,6 +32,15 @@ export declare abstract class ExtrudeBase extends SceneObject implements IExtrud
|
|
|
32
32
|
get faceSource(): SceneObject | null;
|
|
33
33
|
isFaceSourced(): boolean;
|
|
34
34
|
getSource(): SceneObject | null;
|
|
35
|
+
/**
|
|
36
|
+
* Dependency tail for cloning: if the source is a sketch-bound geometry
|
|
37
|
+
* primitive, return its containing `Sketch` so cloneWithTransform pulls
|
|
38
|
+
* the sketch in too. The sketch's clone-mode build path then carries
|
|
39
|
+
* correctly-transformed shapes onto cloned children, and the cloned
|
|
40
|
+
* primitive retains a `Sketch` parent for plane resolution. Otherwise
|
|
41
|
+
* return the source as-is.
|
|
42
|
+
*/
|
|
43
|
+
protected getSourceDependencies(): SceneObject[];
|
|
35
44
|
getSourcePlane(): Plane | null;
|
|
36
45
|
getSourceFaces(): Face[];
|
|
37
46
|
startFaces(...args: number[] | FaceFilterBuilder[]): SceneObject;
|
|
@@ -2,6 +2,7 @@ import { Face } from "../common/face.js";
|
|
|
2
2
|
import { Edge } from "../common/edge.js";
|
|
3
3
|
import { SceneObject } from "../common/scene-object.js";
|
|
4
4
|
import { LazySelectionSceneObject } from "./lazy-scene-object.js";
|
|
5
|
+
import { GeometrySceneObject } from "./2d/geometry.js";
|
|
5
6
|
import { normalizePoint2D } from "../helpers/normalize.js";
|
|
6
7
|
import { FaceOps } from "../oc/face-ops.js";
|
|
7
8
|
import { FaceMaker2 } from "../oc/face-maker2.js";
|
|
@@ -81,6 +82,27 @@ export class ExtrudeBase extends SceneObject {
|
|
|
81
82
|
getSource() {
|
|
82
83
|
return this._extrudable ?? this._faceSource;
|
|
83
84
|
}
|
|
85
|
+
/**
|
|
86
|
+
* Dependency tail for cloning: if the source is a sketch-bound geometry
|
|
87
|
+
* primitive, return its containing `Sketch` so cloneWithTransform pulls
|
|
88
|
+
* the sketch in too. The sketch's clone-mode build path then carries
|
|
89
|
+
* correctly-transformed shapes onto cloned children, and the cloned
|
|
90
|
+
* primitive retains a `Sketch` parent for plane resolution. Otherwise
|
|
91
|
+
* return the source as-is.
|
|
92
|
+
*/
|
|
93
|
+
getSourceDependencies() {
|
|
94
|
+
const source = this.getSource();
|
|
95
|
+
if (!source) {
|
|
96
|
+
return [];
|
|
97
|
+
}
|
|
98
|
+
if (source instanceof GeometrySceneObject) {
|
|
99
|
+
const sketch = source.sketch;
|
|
100
|
+
if (sketch) {
|
|
101
|
+
return [sketch];
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
return [source];
|
|
105
|
+
}
|
|
84
106
|
getSourcePlane() {
|
|
85
107
|
if (this._extrudable) {
|
|
86
108
|
return this._extrudable.getPlane();
|
|
@@ -282,11 +282,7 @@ export class ExtrudeToFace extends ExtrudeBase {
|
|
|
282
282
|
return objects;
|
|
283
283
|
}
|
|
284
284
|
getDependencies() {
|
|
285
|
-
const deps = [];
|
|
286
|
-
const source = this.getSource();
|
|
287
|
-
if (source) {
|
|
288
|
-
deps.push(source);
|
|
289
|
-
}
|
|
285
|
+
const deps = [...this.getSourceDependencies()];
|
|
290
286
|
if (this.face instanceof SceneObject) {
|
|
291
287
|
deps.push(this.face);
|
|
292
288
|
}
|
|
@@ -158,8 +158,7 @@ export class ExtrudeTwoDistances extends ExtrudeBase {
|
|
|
158
158
|
this.setFinalShapes(this.getShapes());
|
|
159
159
|
}
|
|
160
160
|
getDependencies() {
|
|
161
|
-
|
|
162
|
-
return source ? [source] : [];
|
|
161
|
+
return this.getSourceDependencies();
|
|
163
162
|
}
|
|
164
163
|
createCopy(remap) {
|
|
165
164
|
const source = this.getSource();
|
|
@@ -286,8 +286,7 @@ export class Extrude extends ExtrudeBase {
|
|
|
286
286
|
});
|
|
287
287
|
}
|
|
288
288
|
getDependencies() {
|
|
289
|
-
|
|
290
|
-
return source ? [source] : [];
|
|
289
|
+
return this.getSourceDependencies();
|
|
291
290
|
}
|
|
292
291
|
createCopy(remap) {
|
|
293
292
|
const source = this.getSource();
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
import { SceneObject } from "../common/scene-object.js";
|
|
2
2
|
export declare class LoadFile extends SceneObject {
|
|
3
3
|
fileName: string;
|
|
4
|
+
private _noColors;
|
|
5
|
+
private _include?;
|
|
6
|
+
private _exclude;
|
|
4
7
|
constructor(fileName: string);
|
|
8
|
+
noColors(): this;
|
|
9
|
+
include(...indices: number[]): this;
|
|
10
|
+
exclude(...indices: number[]): this;
|
|
5
11
|
build(): void;
|
|
6
12
|
compareTo(other: LoadFile): boolean;
|
|
7
13
|
getType(): string;
|
|
@@ -2,12 +2,38 @@ import { SceneObject } from "../common/scene-object.js";
|
|
|
2
2
|
import { FileImport } from "../io/file-import.js";
|
|
3
3
|
export class LoadFile extends SceneObject {
|
|
4
4
|
fileName;
|
|
5
|
+
_noColors = false;
|
|
6
|
+
_include;
|
|
7
|
+
_exclude = new Set();
|
|
5
8
|
constructor(fileName) {
|
|
6
9
|
super();
|
|
7
10
|
this.fileName = fileName;
|
|
8
11
|
}
|
|
12
|
+
noColors() {
|
|
13
|
+
this._noColors = true;
|
|
14
|
+
return this;
|
|
15
|
+
}
|
|
16
|
+
include(...indices) {
|
|
17
|
+
if (!this._include) {
|
|
18
|
+
this._include = new Set();
|
|
19
|
+
}
|
|
20
|
+
for (const i of indices) {
|
|
21
|
+
this._include.add(i);
|
|
22
|
+
}
|
|
23
|
+
return this;
|
|
24
|
+
}
|
|
25
|
+
exclude(...indices) {
|
|
26
|
+
for (const i of indices) {
|
|
27
|
+
this._exclude.add(i);
|
|
28
|
+
}
|
|
29
|
+
return this;
|
|
30
|
+
}
|
|
9
31
|
build() {
|
|
10
|
-
const shapes = FileImport.deserializeShapesWithMetadata(this.fileName
|
|
32
|
+
const shapes = FileImport.deserializeShapesWithMetadata(this.fileName, {
|
|
33
|
+
noColors: this._noColors,
|
|
34
|
+
include: this._include,
|
|
35
|
+
exclude: this._exclude.size > 0 ? this._exclude : undefined,
|
|
36
|
+
});
|
|
11
37
|
this.addShapes(shapes);
|
|
12
38
|
}
|
|
13
39
|
compareTo(other) {
|
|
@@ -20,6 +46,15 @@ export class LoadFile extends SceneObject {
|
|
|
20
46
|
if (this.fileName !== other.fileName) {
|
|
21
47
|
return false;
|
|
22
48
|
}
|
|
49
|
+
if (this._noColors !== other._noColors) {
|
|
50
|
+
return false;
|
|
51
|
+
}
|
|
52
|
+
if (!equalSets(this._include, other._include)) {
|
|
53
|
+
return false;
|
|
54
|
+
}
|
|
55
|
+
if (!equalSets(this._exclude, other._exclude)) {
|
|
56
|
+
return false;
|
|
57
|
+
}
|
|
23
58
|
return true;
|
|
24
59
|
}
|
|
25
60
|
getType() {
|
|
@@ -29,3 +64,20 @@ export class LoadFile extends SceneObject {
|
|
|
29
64
|
return {};
|
|
30
65
|
}
|
|
31
66
|
}
|
|
67
|
+
function equalSets(a, b) {
|
|
68
|
+
if (a === b) {
|
|
69
|
+
return true;
|
|
70
|
+
}
|
|
71
|
+
if (!a || !b) {
|
|
72
|
+
return false;
|
|
73
|
+
}
|
|
74
|
+
if (a.size !== b.size) {
|
|
75
|
+
return false;
|
|
76
|
+
}
|
|
77
|
+
for (const v of a) {
|
|
78
|
+
if (!b.has(v)) {
|
|
79
|
+
return false;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
return true;
|
|
83
|
+
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { BuildSceneObjectContext, SceneObject } from "../common/scene-object.js";
|
|
2
2
|
import { Matrix4 } from "../math/matrix4.js";
|
|
3
|
+
import { LazyMatrix } from "../math/lazy-matrix.js";
|
|
3
4
|
import { PlaneObjectBase } from "./plane-renderable-base.js";
|
|
4
5
|
export declare class MirrorFeature extends SceneObject {
|
|
5
6
|
private plane;
|
|
6
|
-
private _matrix
|
|
7
|
-
constructor(plane: PlaneObjectBase, _matrix
|
|
7
|
+
private _matrix;
|
|
8
|
+
constructor(plane: PlaneObjectBase, _matrix: LazyMatrix);
|
|
8
9
|
getTransformMatrix(): Matrix4 | null;
|
|
9
10
|
isContainer(): boolean;
|
|
10
11
|
build(context: BuildSceneObjectContext): void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BuildSceneObjectContext, SceneObject } from "../common/scene-object.js";
|
|
2
|
-
import {
|
|
2
|
+
import { RepeatAxisSource } from "./repeat-linear.js";
|
|
3
3
|
export type CircularRepeatOptions = {
|
|
4
4
|
count: number;
|
|
5
5
|
centered?: boolean;
|
|
@@ -12,10 +12,10 @@ export type CircularRepeatOptions = {
|
|
|
12
12
|
offset?: never;
|
|
13
13
|
});
|
|
14
14
|
export declare class RepeatCircular extends SceneObject {
|
|
15
|
-
axis:
|
|
15
|
+
axis: RepeatAxisSource;
|
|
16
16
|
options: CircularRepeatOptions;
|
|
17
17
|
targetObjects: SceneObject[] | null;
|
|
18
|
-
constructor(axis:
|
|
18
|
+
constructor(axis: RepeatAxisSource, options: CircularRepeatOptions, targetObjects?: SceneObject[] | null);
|
|
19
19
|
isContainer(): boolean;
|
|
20
20
|
build(context: BuildSceneObjectContext): void;
|
|
21
21
|
compareTo(other: RepeatCircular): boolean;
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import { SceneObject } from "../common/scene-object.js";
|
|
2
|
+
import { AxisObjectBase } from "./axis-renderable-base.js";
|
|
3
|
+
function axisOf(source) {
|
|
4
|
+
return source instanceof AxisObjectBase ? source.getAxis() : source;
|
|
5
|
+
}
|
|
2
6
|
export class RepeatCircular extends SceneObject {
|
|
3
7
|
axis;
|
|
4
8
|
options;
|
|
@@ -14,6 +18,9 @@ export class RepeatCircular extends SceneObject {
|
|
|
14
18
|
return true;
|
|
15
19
|
}
|
|
16
20
|
build(context) {
|
|
21
|
+
if (this.axis instanceof AxisObjectBase) {
|
|
22
|
+
this.axis.removeShapes(this);
|
|
23
|
+
}
|
|
17
24
|
this.saveShapesSnapshot(context);
|
|
18
25
|
}
|
|
19
26
|
compareTo(other) {
|
|
@@ -23,7 +30,7 @@ export class RepeatCircular extends SceneObject {
|
|
|
23
30
|
if (!super.compareTo(other)) {
|
|
24
31
|
return false;
|
|
25
32
|
}
|
|
26
|
-
if (!this.axis.equals(other.axis)) {
|
|
33
|
+
if (!axisOf(this.axis).equals(axisOf(other.axis))) {
|
|
27
34
|
return false;
|
|
28
35
|
}
|
|
29
36
|
const thisTargetObjects = this.targetObjects || [];
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { BuildSceneObjectContext, SceneObject } from "../common/scene-object.js";
|
|
2
2
|
import { Axis } from "../math/axis.js";
|
|
3
|
+
import { AxisObjectBase } from "./axis-renderable-base.js";
|
|
4
|
+
export type RepeatAxisSource = Axis | AxisObjectBase;
|
|
3
5
|
export type LinearRepeatOptions = {
|
|
4
6
|
count: number | number[];
|
|
5
7
|
centered?: boolean;
|
|
@@ -12,10 +14,10 @@ export type LinearRepeatOptions = {
|
|
|
12
14
|
offset?: never;
|
|
13
15
|
});
|
|
14
16
|
export declare class RepeatLinear extends SceneObject {
|
|
15
|
-
axes:
|
|
17
|
+
axes: RepeatAxisSource[];
|
|
16
18
|
options: LinearRepeatOptions;
|
|
17
19
|
targetObjects: SceneObject[] | null;
|
|
18
|
-
constructor(axes:
|
|
20
|
+
constructor(axes: RepeatAxisSource[], options: LinearRepeatOptions, targetObjects?: SceneObject[] | null);
|
|
19
21
|
isContainer(): boolean;
|
|
20
22
|
build(context: BuildSceneObjectContext): void;
|
|
21
23
|
compareTo(other: RepeatLinear): boolean;
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import { SceneObject } from "../common/scene-object.js";
|
|
2
|
+
import { AxisObjectBase } from "./axis-renderable-base.js";
|
|
3
|
+
function axisOf(source) {
|
|
4
|
+
return source instanceof AxisObjectBase ? source.getAxis() : source;
|
|
5
|
+
}
|
|
2
6
|
export class RepeatLinear extends SceneObject {
|
|
3
7
|
axes;
|
|
4
8
|
options;
|
|
@@ -14,6 +18,11 @@ export class RepeatLinear extends SceneObject {
|
|
|
14
18
|
return true;
|
|
15
19
|
}
|
|
16
20
|
build(context) {
|
|
21
|
+
for (const axis of this.axes) {
|
|
22
|
+
if (axis instanceof AxisObjectBase) {
|
|
23
|
+
axis.removeShapes(this);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
17
26
|
this.saveShapesSnapshot(context);
|
|
18
27
|
}
|
|
19
28
|
compareTo(other) {
|
|
@@ -27,7 +36,7 @@ export class RepeatLinear extends SceneObject {
|
|
|
27
36
|
return false;
|
|
28
37
|
}
|
|
29
38
|
for (let i = 0; i < this.axes.length; i++) {
|
|
30
|
-
if (!this.axes[i].equals(other.axes[i])) {
|
|
39
|
+
if (!axisOf(this.axes[i]).equals(axisOf(other.axes[i]))) {
|
|
31
40
|
return false;
|
|
32
41
|
}
|
|
33
42
|
}
|