fluidcad 0.0.29 → 0.0.30

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.
Files changed (62) hide show
  1. package/lib/dist/common/scene-object.d.ts +1 -0
  2. package/lib/dist/common/scene-object.js +3 -0
  3. package/lib/dist/core/2d/aline.d.ts +12 -12
  4. package/lib/dist/core/2d/aline.js +13 -8
  5. package/lib/dist/core/2d/back.d.ts +12 -0
  6. package/lib/dist/core/2d/back.js +11 -0
  7. package/lib/dist/core/2d/hline.d.ts +19 -12
  8. package/lib/dist/core/2d/hline.js +24 -10
  9. package/lib/dist/core/2d/index.d.ts +1 -0
  10. package/lib/dist/core/2d/index.js +1 -0
  11. package/lib/dist/core/2d/vline.d.ts +19 -12
  12. package/lib/dist/core/2d/vline.js +20 -10
  13. package/lib/dist/core/interfaces.d.ts +54 -0
  14. package/lib/dist/core/mirror.d.ts +7 -7
  15. package/lib/dist/core/rotate.d.ts +5 -5
  16. package/lib/dist/core/translate.d.ts +9 -9
  17. package/lib/dist/features/2d/aline.d.ts +8 -5
  18. package/lib/dist/features/2d/aline.js +70 -18
  19. package/lib/dist/features/2d/back.d.ts +14 -0
  20. package/lib/dist/features/2d/back.js +35 -0
  21. package/lib/dist/features/2d/hline.d.ts +9 -4
  22. package/lib/dist/features/2d/hline.js +65 -14
  23. package/lib/dist/features/2d/sketch.d.ts +1 -0
  24. package/lib/dist/features/2d/sketch.js +15 -0
  25. package/lib/dist/features/2d/vline.d.ts +9 -4
  26. package/lib/dist/features/2d/vline.js +67 -15
  27. package/lib/dist/features/lazy-scene-object.d.ts +1 -0
  28. package/lib/dist/features/lazy-scene-object.js +3 -0
  29. package/lib/dist/features/lazy-vertex.d.ts +1 -0
  30. package/lib/dist/features/lazy-vertex.js +3 -0
  31. package/lib/dist/features/mirror-shape.d.ts +2 -0
  32. package/lib/dist/features/mirror-shape.js +16 -0
  33. package/lib/dist/features/mirror-shape2d.d.ts +2 -0
  34. package/lib/dist/features/mirror-shape2d.js +22 -1
  35. package/lib/dist/features/rotate.d.ts +2 -0
  36. package/lib/dist/features/rotate.js +16 -0
  37. package/lib/dist/features/rotate2d.d.ts +2 -0
  38. package/lib/dist/features/rotate2d.js +16 -0
  39. package/lib/dist/features/translate.d.ts +2 -0
  40. package/lib/dist/features/translate.js +23 -2
  41. package/lib/dist/oc/ray-intersect.d.ts +16 -0
  42. package/lib/dist/oc/ray-intersect.js +91 -0
  43. package/lib/dist/rendering/render.js +4 -1
  44. package/lib/dist/tests/features/2d/back.test.d.ts +1 -0
  45. package/lib/dist/tests/features/2d/back.test.js +60 -0
  46. package/lib/dist/tests/features/2d/constrained.test.js +4 -4
  47. package/lib/dist/tests/features/2d/line.test.js +88 -2
  48. package/lib/dist/tests/features/2d/slot-from-edge.test.js +1 -1
  49. package/lib/dist/tests/features/mirror.test.js +58 -0
  50. package/lib/dist/tests/features/mirror2d.test.js +63 -0
  51. package/lib/dist/tests/features/rotate.test.js +62 -0
  52. package/lib/dist/tests/features/rotate2d.test.js +47 -0
  53. package/lib/dist/tests/features/thin-revolve.test.js +2 -2
  54. package/lib/dist/tests/features/translate.test.js +63 -0
  55. package/lib/dist/tsconfig.tsbuildinfo +1 -1
  56. package/package.json +1 -1
  57. package/server/dist/index.js +77 -45
  58. package/server/dist/ws-protocol.d.ts +11 -0
  59. package/ui/dist/assets/{index-VY48_dgc.js → index-6Ep4GPxf.js} +92 -55
  60. package/ui/dist/assets/index-DRKfe6N9.css +2 -0
  61. package/ui/dist/index.html +2 -2
  62. package/ui/dist/assets/index-VKkXzLfR.css +0 -2
@@ -69,6 +69,7 @@ export declare abstract class SceneObject implements Comparable<SceneObject>, Se
69
69
  getPreviousSibling(obj: SceneObject): SceneObject | null;
70
70
  getPreviousSiblings(obj: SceneObject): SceneObject[];
71
71
  isContainer(): boolean;
72
+ isLazy(): boolean;
72
73
  saveShapesSnapshot(context: BuildSceneObjectContext): void;
73
74
  getSnapshot(): Map<SceneObject, Shape[]>;
74
75
  abstract serialize(scope?: Set<SceneObject>): any;
@@ -85,6 +85,9 @@ export class SceneObject {
85
85
  isContainer() {
86
86
  return false;
87
87
  }
88
+ isLazy() {
89
+ return false;
90
+ }
88
91
  // called by containers to save the shapes state up to this object
89
92
  saveShapesSnapshot(context) {
90
93
  const upToHere = context.getSceneObjects();
@@ -1,28 +1,28 @@
1
1
  import { PlaneLike } from "../../math/plane.js";
2
- import { IGeometry, ISceneObject } from "../interfaces.js";
2
+ import { IALine, ISceneObject } from "../interfaces.js";
3
3
  interface ALineFunction {
4
4
  /**
5
5
  * Draws a line at the given angle with the given length.
6
- * @param length - The line length
6
+ * Chain `.centered()` to center the line on the current position.
7
7
  * @param angle - The angle in degrees
8
- * @param centered - Whether to center the line on the current position
8
+ * @param length - The line length
9
9
  */
10
- (length: number, angle: number, centered?: boolean): IGeometry;
10
+ (angle: number, length: number): IALine;
11
11
  /**
12
- * Draws a line at the given angle on a specific plane.
13
- * @param targetPlane - The plane to draw on
14
- * @param length - The line length
12
+ * Draws a line at the given angle that ends where it intersects the target
13
+ * geometry. The nearest intersection along the line's direction (in either
14
+ * sign) is used.
15
15
  * @param angle - The angle in degrees
16
+ * @param target - The geometry to intersect with
16
17
  */
17
- (targetPlane: PlaneLike | ISceneObject, length: number, angle: number): IGeometry;
18
+ (angle: number, target: ISceneObject): IALine;
18
19
  /**
19
- * Draws a centered line at the given angle on a specific plane.
20
+ * Draws a line at the given angle on a specific plane.
20
21
  * @param targetPlane - The plane to draw on
21
- * @param length - The line length
22
22
  * @param angle - The angle in degrees
23
- * @param centered - Whether to center the line on the current position
23
+ * @param length - The line length
24
24
  */
25
- (targetPlane: PlaneLike | ISceneObject, length: number, angle: number, centered: boolean): IGeometry;
25
+ (targetPlane: PlaneLike | ISceneObject, angle: number, length: number): IALine;
26
26
  }
27
27
  declare const _default: ALineFunction;
28
28
  export default _default;
@@ -7,22 +7,27 @@ function build(context) {
7
7
  return function line() {
8
8
  let planeObj = null;
9
9
  let argOffset = 0;
10
- // Detect plane as first argument (only valid outside a sketch)
10
+ const inSketch = context.getActiveSketch() !== null;
11
11
  if (arguments.length > 0) {
12
12
  const firstArg = arguments[0];
13
- if (isPlaneLike(firstArg) || firstArg instanceof SceneObject) {
14
- if (context.getActiveSketch() !== null) {
13
+ if (isPlaneLike(firstArg)) {
14
+ if (inSketch) {
15
15
  throw new Error("aLine(plane, ...) cannot be used inside a sketch. Use aLine(...) instead.");
16
16
  }
17
17
  planeObj = resolvePlane(firstArg, context);
18
18
  argOffset = 1;
19
19
  }
20
+ else if (!inSketch && firstArg instanceof SceneObject) {
21
+ planeObj = resolvePlane(firstArg, context);
22
+ argOffset = 1;
23
+ }
20
24
  }
21
- const argCount = arguments.length - argOffset;
22
- const length = arguments[argOffset];
23
- const angle = arguments[argOffset + 1];
24
- const centered = argCount >= 3 ? arguments[argOffset + 2] : false;
25
- const aline = new AngledLine(length, angle, centered, planeObj);
25
+ const angle = arguments[argOffset];
26
+ const second = arguments[argOffset + 1];
27
+ const lengthOrTarget = second instanceof SceneObject
28
+ ? second
29
+ : second;
30
+ const aline = new AngledLine(angle, lengthOrTarget, planeObj);
26
31
  context.addSceneObject(aline);
27
32
  return aline;
28
33
  };
@@ -0,0 +1,12 @@
1
+ import { IGeometry } from "../interfaces.js";
2
+ interface BackFunction {
3
+ /** Reverts the cursor to the previous position. */
4
+ (): IGeometry;
5
+ /**
6
+ * Reverts the cursor `count` position-changes back.
7
+ * @param count - How many prior cursor changes to undo (default 1).
8
+ */
9
+ (count: number): IGeometry;
10
+ }
11
+ declare const _default: BackFunction;
12
+ export default _default;
@@ -0,0 +1,11 @@
1
+ import { Back } from "../../features/2d/back.js";
2
+ import { registerBuilder } from "../../index.js";
3
+ function build(context) {
4
+ return function back() {
5
+ const count = arguments[0] ?? 1;
6
+ const obj = new Back(count);
7
+ context.addSceneObject(obj);
8
+ return obj;
9
+ };
10
+ }
11
+ export default registerBuilder(build);
@@ -1,33 +1,40 @@
1
1
  import { Point2DLike } from "../../math/point.js";
2
2
  import { PlaneLike } from "../../math/plane.js";
3
- import { IGeometry, ISceneObject } from "../interfaces.js";
3
+ import { IHLine, ISceneObject } from "../interfaces.js";
4
4
  interface HLineFunction {
5
5
  /**
6
6
  * Draws a horizontal line of the given distance.
7
+ * Chain `.centered()` to center the line on the current position.
7
8
  * @param distance - The line length
8
- * @param centered - Whether to center the line on the current position
9
9
  */
10
- (distance: number, centered?: boolean): IGeometry;
10
+ (distance: number): IHLine;
11
+ /**
12
+ * Draws a horizontal line that ends where it intersects the target geometry.
13
+ * The nearest intersection (in either direction along the X axis) is used.
14
+ * @param target - The geometry to intersect with
15
+ */
16
+ (target: ISceneObject): IHLine;
11
17
  /**
12
18
  * Draws a horizontal line from a start point.
19
+ * Chain `.centered()` to center the line on the start point.
13
20
  * @param start - The start point
14
21
  * @param distance - The line length
15
- * @param centered - Whether to center the line on the start point
16
22
  */
17
- (start: Point2DLike, distance: number, centered?: boolean): IGeometry;
23
+ (start: Point2DLike, distance: number): IHLine;
18
24
  /**
19
- * Draws a horizontal line on a specific plane.
20
- * @param targetPlane - The plane to draw on
21
- * @param distance - The line length
25
+ * Draws a horizontal line from a start point that ends where it intersects
26
+ * the target geometry. The nearest intersection (in either direction along
27
+ * the X axis) is used.
28
+ * @param start - The start point
29
+ * @param target - The geometry to intersect with
22
30
  */
23
- (targetPlane: PlaneLike | ISceneObject, distance: number): IGeometry;
31
+ (start: Point2DLike, target: ISceneObject): IHLine;
24
32
  /**
25
- * Draws a horizontal line with centering on a specific plane.
33
+ * Draws a horizontal line on a specific plane.
26
34
  * @param targetPlane - The plane to draw on
27
35
  * @param distance - The line length
28
- * @param centered - Whether to center the line on the current position
29
36
  */
30
- (targetPlane: PlaneLike | ISceneObject, distance: number, centered: boolean): IGeometry;
37
+ (targetPlane: PlaneLike | ISceneObject, distance: number): IHLine;
31
38
  }
32
39
  declare const _default: HLineFunction;
33
40
  export default _default;
@@ -10,30 +10,44 @@ function build(context) {
10
10
  return function line() {
11
11
  let planeObj = null;
12
12
  let argOffset = 0;
13
- // Detect plane as first argument (only valid outside a sketch)
13
+ const inSketch = context.getActiveSketch() !== null;
14
+ // Detect plane as first argument (only valid outside a sketch).
15
+ // Inside a sketch, a SceneObject in the first position is a target geometry,
16
+ // and a true PlaneLike is an error since drawing on another plane mid-sketch
17
+ // is not supported.
14
18
  if (arguments.length > 0) {
15
19
  const firstArg = arguments[0];
16
- if (isPlaneLike(firstArg) || (firstArg instanceof SceneObject && !isPoint2DLike(firstArg))) {
17
- if (context.getActiveSketch() !== null) {
20
+ if (isPlaneLike(firstArg)) {
21
+ if (inSketch) {
18
22
  throw new Error("hLine(plane, ...) cannot be used inside a sketch. Use hLine(...) instead.");
19
23
  }
20
24
  planeObj = resolvePlane(firstArg, context);
21
25
  argOffset = 1;
22
26
  }
27
+ else if (!inSketch && firstArg instanceof SceneObject && !isPoint2DLike(firstArg)) {
28
+ planeObj = resolvePlane(firstArg, context);
29
+ argOffset = 1;
30
+ }
31
+ }
32
+ if (argOffset === 0 && inSketch && arguments[0] instanceof SceneObject && !isPoint2DLike(arguments[0])) {
33
+ // hLine(target)
34
+ const hline = new HorizontalLine(arguments[0], null);
35
+ context.addSceneObject(hline);
36
+ return hline;
23
37
  }
24
- const argCount = arguments.length - argOffset;
25
38
  if (argOffset === 0 && typeof arguments[0] !== 'number') {
26
- // hline(start, distance) or hline(start, distance, centered)
39
+ // hLine(start, distance) or hLine(start, target)
27
40
  const start = normalizePoint2D(arguments[0]);
28
- const distance = arguments[1];
29
- const centered = argCount >= 3 ? arguments[2] : false;
30
- const hline = new HorizontalLine(distance, centered, planeObj);
41
+ const second = arguments[1];
42
+ const distanceOrTarget = second instanceof SceneObject
43
+ ? second
44
+ : second;
45
+ const hline = new HorizontalLine(distanceOrTarget, planeObj);
31
46
  context.addSceneObjects([new Move(start), hline]);
32
47
  return hline;
33
48
  }
34
49
  const distance = arguments[argOffset];
35
- const centered = argCount >= 2 ? arguments[argOffset + 1] : false;
36
- const hline = new HorizontalLine(distance, centered, planeObj);
50
+ const hline = new HorizontalLine(distance, planeObj);
37
51
  context.addSceneObject(hline);
38
52
  return hline;
39
53
  };
@@ -22,3 +22,4 @@ export { default as project } from './project.js';
22
22
  export { default as intersect } from './intersect.js';
23
23
  export { default as bezier } from './bezier.js';
24
24
  export { default as center } from './center.js';
25
+ export { default as back } from './back.js';
@@ -22,3 +22,4 @@ export { default as project } from './project.js';
22
22
  export { default as intersect } from './intersect.js';
23
23
  export { default as bezier } from './bezier.js';
24
24
  export { default as center } from './center.js';
25
+ export { default as back } from './back.js';
@@ -1,33 +1,40 @@
1
1
  import { Point2DLike } from "../../math/point.js";
2
2
  import { PlaneLike } from "../../math/plane.js";
3
- import { IGeometry, ISceneObject } from "../interfaces.js";
3
+ import { IVLine, ISceneObject } from "../interfaces.js";
4
4
  interface VLineFunction {
5
5
  /**
6
6
  * Draws a vertical line of the given distance.
7
+ * Chain `.centered()` to center the line on the current position.
7
8
  * @param distance - The line length
8
- * @param centered - Whether to center the line on the current position
9
9
  */
10
- (distance: number, centered?: boolean): IGeometry;
10
+ (distance: number): IVLine;
11
+ /**
12
+ * Draws a vertical line that ends where it intersects the target geometry.
13
+ * The nearest intersection (in either direction along the Y axis) is used.
14
+ * @param target - The geometry to intersect with
15
+ */
16
+ (target: ISceneObject): IVLine;
11
17
  /**
12
18
  * Draws a vertical line from a start point.
19
+ * Chain `.centered()` to center the line on the start point.
13
20
  * @param start - The start point
14
21
  * @param distance - The line length
15
- * @param centered - Whether to center the line on the start point
16
22
  */
17
- (start: Point2DLike, distance: number, centered?: boolean): IGeometry;
23
+ (start: Point2DLike, distance: number): IVLine;
18
24
  /**
19
- * Draws a vertical line on a specific plane.
20
- * @param targetPlane - The plane to draw on
21
- * @param distance - The line length
25
+ * Draws a vertical line from a start point that ends where it intersects
26
+ * the target geometry. The nearest intersection (in either direction along
27
+ * the Y axis) is used.
28
+ * @param start - The start point
29
+ * @param target - The geometry to intersect with
22
30
  */
23
- (targetPlane: PlaneLike | ISceneObject, distance: number): IGeometry;
31
+ (start: Point2DLike, target: ISceneObject): IVLine;
24
32
  /**
25
- * Draws a vertical line with centering on a specific plane.
33
+ * Draws a vertical line on a specific plane.
26
34
  * @param targetPlane - The plane to draw on
27
35
  * @param distance - The line length
28
- * @param centered - Whether to center the line on the current position
29
36
  */
30
- (targetPlane: PlaneLike | ISceneObject, distance: number, centered: boolean): IGeometry;
37
+ (targetPlane: PlaneLike | ISceneObject, distance: number): IVLine;
31
38
  }
32
39
  declare const _default: VLineFunction;
33
40
  export default _default;
@@ -10,30 +10,40 @@ function build(context) {
10
10
  return function line() {
11
11
  let planeObj = null;
12
12
  let argOffset = 0;
13
- // Detect plane as first argument (only valid outside a sketch)
13
+ const inSketch = context.getActiveSketch() !== null;
14
14
  if (arguments.length > 0) {
15
15
  const firstArg = arguments[0];
16
- if (isPlaneLike(firstArg) || (firstArg instanceof SceneObject && !isPoint2DLike(firstArg))) {
17
- if (context.getActiveSketch() !== null) {
16
+ if (isPlaneLike(firstArg)) {
17
+ if (inSketch) {
18
18
  throw new Error("vLine(plane, ...) cannot be used inside a sketch. Use vLine(...) instead.");
19
19
  }
20
20
  planeObj = resolvePlane(firstArg, context);
21
21
  argOffset = 1;
22
22
  }
23
+ else if (!inSketch && firstArg instanceof SceneObject && !isPoint2DLike(firstArg)) {
24
+ planeObj = resolvePlane(firstArg, context);
25
+ argOffset = 1;
26
+ }
27
+ }
28
+ if (argOffset === 0 && inSketch && arguments[0] instanceof SceneObject && !isPoint2DLike(arguments[0])) {
29
+ // vLine(target)
30
+ const vline = new VerticalLine(arguments[0], null);
31
+ context.addSceneObject(vline);
32
+ return vline;
23
33
  }
24
- const argCount = arguments.length - argOffset;
25
34
  if (argOffset === 0 && typeof arguments[0] !== 'number') {
26
- // vline(start, distance) or vline(start, distance, centered)
35
+ // vLine(start, distance) or vLine(start, target)
27
36
  const start = normalizePoint2D(arguments[0]);
28
- const distance = arguments[1];
29
- const centered = argCount >= 3 ? arguments[2] : false;
30
- const vline = new VerticalLine(distance, centered, planeObj);
37
+ const second = arguments[1];
38
+ const distanceOrTarget = second instanceof SceneObject
39
+ ? second
40
+ : second;
41
+ const vline = new VerticalLine(distanceOrTarget, planeObj);
31
42
  context.addSceneObjects([new Move(start), vline]);
32
43
  return vline;
33
44
  }
34
45
  const distance = arguments[argOffset];
35
- const centered = argCount >= 2 ? arguments[argOffset + 1] : false;
36
- const vline = new VerticalLine(distance, centered, planeObj);
46
+ const vline = new VerticalLine(distance, planeObj);
37
47
  context.addSceneObject(vline);
38
48
  return vline;
39
49
  };
@@ -227,6 +227,33 @@ export interface ISlot extends IExtrudableGeometry {
227
227
  */
228
228
  rotate(angle: number): this;
229
229
  }
230
+ export interface IALine extends IGeometry {
231
+ /**
232
+ * Controls whether the line is centered on the current position.
233
+ * When `true`, the line is offset backward by half its length so that the
234
+ * current position falls at its midpoint.
235
+ * @param value - `true` to center, `false` (default) to start from the current position.
236
+ */
237
+ centered(value?: boolean): this;
238
+ }
239
+ export interface IHLine extends IGeometry {
240
+ /**
241
+ * Controls whether the line is centered on the current position.
242
+ * When `true`, the line is offset backward by half its length so that the
243
+ * current position falls at its midpoint.
244
+ * @param value - `true` to center, `false` (default) to start from the current position.
245
+ */
246
+ centered(value?: boolean): this;
247
+ }
248
+ export interface IVLine extends IGeometry {
249
+ /**
250
+ * Controls whether the line is centered on the current position.
251
+ * When `true`, the line is offset backward by half its length so that the
252
+ * current position falls at its midpoint.
253
+ * @param value - `true` to center, `false` (default) to start from the current position.
254
+ */
255
+ centered(value?: boolean): this;
256
+ }
230
257
  export interface IPolygon extends IExtrudableGeometry {
231
258
  /**
232
259
  * Returns a specific edge of the polygon by index.
@@ -629,6 +656,33 @@ export interface ISweep extends IBooleanOperation {
629
656
  */
630
657
  capEdges(...args: (number | EdgeFilterBuilder)[]): ISceneObject;
631
658
  }
659
+ export interface IMirror extends ISceneObject {
660
+ /**
661
+ * Excludes the given objects from the mirror operation. Useful when
662
+ * mirroring "everything" but a few specific objects should be skipped,
663
+ * or when narrowing an explicit target list.
664
+ * @param objects - The objects to exclude from mirroring.
665
+ */
666
+ exclude(...objects: ISceneObject[]): this;
667
+ }
668
+ export interface ITranslate extends ISceneObject {
669
+ /**
670
+ * Excludes the given objects from the translate operation. Useful when
671
+ * translating "everything" but a few specific objects should be skipped,
672
+ * or when narrowing an explicit target list.
673
+ * @param objects - The objects to exclude from translating.
674
+ */
675
+ exclude(...objects: ISceneObject[]): this;
676
+ }
677
+ export interface IRotate extends ISceneObject {
678
+ /**
679
+ * Excludes the given objects from the rotate operation. Useful when
680
+ * rotating "everything" but a few specific objects should be skipped,
681
+ * or when narrowing an explicit target list.
682
+ * @param objects - The objects to exclude from rotating.
683
+ */
684
+ exclude(...objects: ISceneObject[]): this;
685
+ }
632
686
  export interface IDraft extends ISceneObject {
633
687
  }
634
688
  export interface IShell extends ISceneObject {
@@ -1,40 +1,40 @@
1
1
  import { PlaneLike } from "../math/plane.js";
2
2
  import { AxisLike } from "../math/axis.js";
3
- import { ISceneObject } from "./interfaces.js";
3
+ import { IMirror, ISceneObject } from "./interfaces.js";
4
4
  interface MirrorFunction {
5
5
  /**
6
6
  * [2D] Mirror all sketch geometries across a given line.
7
7
  * @param line The line to mirror across
8
8
  */
9
- (line: ISceneObject): ISceneObject;
9
+ (line: ISceneObject): IMirror;
10
10
  /**
11
11
  * [2D] Mirror all sketch geometries across a given axis.
12
12
  * @param axis The local axis to mirror across
13
13
  */
14
- (axis: AxisLike): ISceneObject;
14
+ (axis: AxisLike): IMirror;
15
15
  /**
16
16
  * [2D] Mirror given sketch geometries across a given line.
17
17
  * @param line The line to mirror across
18
18
  * @param geometries The geometries to mirror
19
19
  */
20
- (line: ISceneObject, ...geometries: ISceneObject[]): ISceneObject;
20
+ (line: ISceneObject, ...geometries: ISceneObject[]): IMirror;
21
21
  /**
22
22
  * [2D] Mirror given sketch geometries across a given axis.
23
23
  * @param axis The local axis to mirror across
24
24
  * @param geometries The geometries to mirror
25
25
  */
26
- (axis: AxisLike, ...geometries: ISceneObject[]): ISceneObject;
26
+ (axis: AxisLike, ...geometries: ISceneObject[]): IMirror;
27
27
  /**
28
28
  * [3D] Mirror all scene shapes across a given plane.
29
29
  * @param plane The plane to mirror across
30
30
  */
31
- (plane: PlaneLike): ISceneObject;
31
+ (plane: PlaneLike): IMirror;
32
32
  /**
33
33
  * [3D] Mirror given shapes across a given plane.
34
34
  * @param plane The plane to mirror across
35
35
  * @param objects The shapes to mirror
36
36
  */
37
- (plane: PlaneLike, ...objects: ISceneObject[]): ISceneObject;
37
+ (plane: PlaneLike, ...objects: ISceneObject[]): IMirror;
38
38
  }
39
39
  declare const _default: MirrorFunction;
40
40
  export default _default;
@@ -1,26 +1,26 @@
1
1
  import { AxisLike } from "../math/axis.js";
2
- import { ISceneObject } from "./interfaces.js";
2
+ import { IRotate, ISceneObject } from "./interfaces.js";
3
3
  interface RotateFunction {
4
4
  /**
5
5
  * [2D] Rotates geometry by an angle inside a sketch.
6
6
  * @param angle - The rotation angle in degrees
7
7
  * @param targets - The geometries to rotate (defaults to last object)
8
8
  */
9
- (angle: number, ...targets: ISceneObject[]): ISceneObject;
9
+ (angle: number, ...targets: ISceneObject[]): IRotate;
10
10
  /**
11
11
  * [2D] Rotates geometry by an angle inside a sketch, optionally making a copy.
12
12
  * @param angle - The rotation angle in degrees
13
13
  * @param copy - Whether to copy instead of move
14
14
  * @param targets - The geometries to rotate (defaults to last object)
15
15
  */
16
- (angle: number, copy: boolean, ...targets: ISceneObject[]): ISceneObject;
16
+ (angle: number, copy: boolean, ...targets: ISceneObject[]): IRotate;
17
17
  /**
18
18
  * [3D] Rotates objects around an axis by an angle.
19
19
  * @param axis - The axis to rotate around
20
20
  * @param angle - The rotation angle in degrees
21
21
  * @param targets - The objects to rotate (defaults to last object)
22
22
  */
23
- (axis: AxisLike, angle: number, ...targets: ISceneObject[]): ISceneObject;
23
+ (axis: AxisLike, angle: number, ...targets: ISceneObject[]): IRotate;
24
24
  /**
25
25
  * [3D] Rotates objects around an axis by an angle, optionally making a copy.
26
26
  * @param axis - The axis to rotate around
@@ -28,7 +28,7 @@ interface RotateFunction {
28
28
  * @param copy - Whether to copy instead of move
29
29
  * @param targets - The objects to rotate (defaults to last object)
30
30
  */
31
- (axis: AxisLike, angle: number, copy: boolean, ...targets: ISceneObject[]): ISceneObject;
31
+ (axis: AxisLike, angle: number, copy: boolean, ...targets: ISceneObject[]): IRotate;
32
32
  }
33
33
  declare const _default: RotateFunction;
34
34
  export default _default;
@@ -1,26 +1,26 @@
1
1
  import { PointLike } from "../math/point.js";
2
- import { ISceneObject } from "./interfaces.js";
2
+ import { ISceneObject, ITranslate } from "./interfaces.js";
3
3
  interface TranslateFunction {
4
4
  /**
5
5
  * Translates objects along the X axis.
6
6
  * @param x - The X distance
7
7
  * @param targets - The objects to translate (defaults to last object)
8
8
  */
9
- (x: number, ...targets: ISceneObject[]): ISceneObject;
9
+ (x: number, ...targets: ISceneObject[]): ITranslate;
10
10
  /**
11
11
  * Translates objects along the X axis, optionally making a copy.
12
12
  * @param x - The X distance
13
13
  * @param copy - Whether to copy instead of move
14
14
  * @param targets - The objects to translate (defaults to last object)
15
15
  */
16
- (x: number, copy: boolean, ...targets: ISceneObject[]): ISceneObject;
16
+ (x: number, copy: boolean, ...targets: ISceneObject[]): ITranslate;
17
17
  /**
18
18
  * Translates objects along the X and Y axes.
19
19
  * @param x - The X distance
20
20
  * @param y - The Y distance
21
21
  * @param targets - The objects to translate (defaults to last object)
22
22
  */
23
- (x: number, y: number, ...targets: ISceneObject[]): ISceneObject;
23
+ (x: number, y: number, ...targets: ISceneObject[]): ITranslate;
24
24
  /**
25
25
  * Translates objects along the X and Y axes, optionally making a copy.
26
26
  * @param x - The X distance
@@ -28,7 +28,7 @@ interface TranslateFunction {
28
28
  * @param copy - Whether to copy instead of move
29
29
  * @param targets - The objects to translate (defaults to last object)
30
30
  */
31
- (x: number, y: number, copy: boolean, ...targets: ISceneObject[]): ISceneObject;
31
+ (x: number, y: number, copy: boolean, ...targets: ISceneObject[]): ITranslate;
32
32
  /**
33
33
  * Translates objects along all three axes.
34
34
  * @param x - The X distance
@@ -36,7 +36,7 @@ interface TranslateFunction {
36
36
  * @param z - The Z distance
37
37
  * @param targets - The objects to translate (defaults to last object)
38
38
  */
39
- (x: number, y: number, z: number, ...targets: ISceneObject[]): ISceneObject;
39
+ (x: number, y: number, z: number, ...targets: ISceneObject[]): ITranslate;
40
40
  /**
41
41
  * Translates objects along all three axes, optionally making a copy.
42
42
  * @param x - The X distance
@@ -45,20 +45,20 @@ interface TranslateFunction {
45
45
  * @param copy - Whether to copy instead of move
46
46
  * @param targets - The objects to translate (defaults to last object)
47
47
  */
48
- (x: number, y: number, z: number, copy: boolean, ...targets: ISceneObject[]): ISceneObject;
48
+ (x: number, y: number, z: number, copy: boolean, ...targets: ISceneObject[]): ITranslate;
49
49
  /**
50
50
  * Translates objects by a point-like offset.
51
51
  * @param distance - The offset as a point
52
52
  * @param targets - The objects to translate (defaults to last object)
53
53
  */
54
- (distance: PointLike, ...targets: ISceneObject[]): ISceneObject;
54
+ (distance: PointLike, ...targets: ISceneObject[]): ITranslate;
55
55
  /**
56
56
  * Translates objects by a point-like offset, optionally making a copy.
57
57
  * @param distance - The offset as a point
58
58
  * @param copy - Whether to copy instead of move
59
59
  * @param targets - The objects to translate (defaults to last object)
60
60
  */
61
- (distance: PointLike, copy: boolean, ...targets: ISceneObject[]): ISceneObject;
61
+ (distance: PointLike, copy: boolean, ...targets: ISceneObject[]): ITranslate;
62
62
  }
63
63
  declare const _default: TranslateFunction;
64
64
  export default _default;
@@ -1,20 +1,23 @@
1
1
  import { SceneObject } from "../../common/scene-object.js";
2
2
  import { PlaneObjectBase } from "../plane-renderable-base.js";
3
3
  import { GeometrySceneObject } from "./geometry.js";
4
- export declare class AngledLine extends GeometrySceneObject {
5
- length: number;
4
+ import { IALine } from "../../core/interfaces.js";
5
+ export declare class AngledLine extends GeometrySceneObject implements IALine {
6
6
  angle: number;
7
- centered: boolean;
7
+ lengthOrTarget: number | SceneObject;
8
8
  private targetPlane;
9
- constructor(length: number, angle: number, centered?: boolean, targetPlane?: PlaneObjectBase);
9
+ private _centered;
10
+ constructor(angle: number, lengthOrTarget: number | SceneObject, targetPlane?: PlaneObjectBase);
11
+ centered(value?: boolean): this;
10
12
  build(): void;
13
+ getDependencies(): SceneObject[];
11
14
  createCopy(remap: Map<SceneObject, SceneObject>): SceneObject;
12
15
  compareTo(other: AngledLine): boolean;
13
16
  getType(): string;
14
17
  getUniqueType(): string;
15
18
  serialize(): {
16
- length: number;
17
19
  angle: number;
20
+ length: number;
18
21
  centered: boolean;
19
22
  };
20
23
  }