@genart-dev/plugin-construction 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +263 -0
- package/dist/index.cjs +2900 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +211 -0
- package/dist/index.d.ts +211 -0
- package/dist/index.js +2842 -0
- package/dist/index.js.map +1 -0
- package/package.json +64 -0
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
import { LayerTypeDefinition, McpToolDefinition, DesignPlugin } from '@genart-dev/core';
|
|
2
|
+
|
|
3
|
+
declare const formLayerType: LayerTypeDefinition;
|
|
4
|
+
|
|
5
|
+
declare const crossContourLayerType: LayerTypeDefinition;
|
|
6
|
+
|
|
7
|
+
declare const valueShapesLayerType: LayerTypeDefinition;
|
|
8
|
+
|
|
9
|
+
declare const envelopeLayerType: LayerTypeDefinition;
|
|
10
|
+
|
|
11
|
+
declare const intersectionLayerType: LayerTypeDefinition;
|
|
12
|
+
|
|
13
|
+
declare const constructionMcpTools: McpToolDefinition[];
|
|
14
|
+
|
|
15
|
+
/** 3D vector. */
|
|
16
|
+
interface Vec3 {
|
|
17
|
+
x: number;
|
|
18
|
+
y: number;
|
|
19
|
+
z: number;
|
|
20
|
+
}
|
|
21
|
+
/** 2D vector. */
|
|
22
|
+
interface Vec2 {
|
|
23
|
+
x: number;
|
|
24
|
+
y: number;
|
|
25
|
+
}
|
|
26
|
+
/** 3x3 matrix stored as row-major flat array. */
|
|
27
|
+
type Mat3 = [
|
|
28
|
+
number,
|
|
29
|
+
number,
|
|
30
|
+
number,
|
|
31
|
+
number,
|
|
32
|
+
number,
|
|
33
|
+
number,
|
|
34
|
+
number,
|
|
35
|
+
number,
|
|
36
|
+
number
|
|
37
|
+
];
|
|
38
|
+
/** Clamp a value to [min, max]. */
|
|
39
|
+
declare function clamp(v: number, min: number, max: number): number;
|
|
40
|
+
/**
|
|
41
|
+
* Build a ZYX Euler rotation matrix from angles in degrees.
|
|
42
|
+
* rotationX is clamped to [-90, 90] to avoid gimbal lock.
|
|
43
|
+
*
|
|
44
|
+
* R = Rz * Ry * Rx
|
|
45
|
+
*/
|
|
46
|
+
declare function rotationMatrix(rxDeg: number, ryDeg: number, rzDeg: number): Mat3;
|
|
47
|
+
/** Multiply a Mat3 by a Vec3, returning a new Vec3. */
|
|
48
|
+
declare function rotate3D(point: Vec3, m: Mat3): Vec3;
|
|
49
|
+
/**
|
|
50
|
+
* Project a 3D point to 2D.
|
|
51
|
+
*
|
|
52
|
+
* - "orthographic": drops Z (screen.x = point.x, screen.y = point.y)
|
|
53
|
+
* - "weak-perspective": mild foreshortening based on Z depth
|
|
54
|
+
* scale = focalLength / (focalLength + point.z)
|
|
55
|
+
*/
|
|
56
|
+
declare function project(point: Vec3, projection?: "orthographic" | "weak-perspective", focalLength?: number): Vec2;
|
|
57
|
+
/**
|
|
58
|
+
* Convenience: rotate a 3D point then project to 2D.
|
|
59
|
+
* rotationX is clamped to [-90, 90].
|
|
60
|
+
*/
|
|
61
|
+
declare function transformPoint(point: Vec3, rxDeg: number, ryDeg: number, rzDeg: number, projection?: "orthographic" | "weak-perspective", focalLength?: number): Vec2;
|
|
62
|
+
/** Transform a 3D normal vector and return the Z component (for face visibility). */
|
|
63
|
+
declare function transformedNormalZ(normal: Vec3, m: Mat3): number;
|
|
64
|
+
/** Compute the identity matrix. */
|
|
65
|
+
declare function identityMatrix(): Mat3;
|
|
66
|
+
/** Multiply two Mat3 matrices: result = a * b. */
|
|
67
|
+
declare function multiplyMat3(a: Mat3, b: Mat3): Mat3;
|
|
68
|
+
/** Normalize a Vec3 to unit length. Returns zero vector if length is ~0. */
|
|
69
|
+
declare function normalize3(v: Vec3): Vec3;
|
|
70
|
+
/** Dot product of two Vec3. */
|
|
71
|
+
declare function dot3(a: Vec3, b: Vec3): number;
|
|
72
|
+
/** Cross product of two Vec3. */
|
|
73
|
+
declare function cross3(a: Vec3, b: Vec3): Vec3;
|
|
74
|
+
|
|
75
|
+
interface EllipseParams {
|
|
76
|
+
cx: number;
|
|
77
|
+
cy: number;
|
|
78
|
+
rx: number;
|
|
79
|
+
ry: number;
|
|
80
|
+
rotation: number;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Compute ellipse parameters from a circle viewed at an angle.
|
|
84
|
+
*
|
|
85
|
+
* A circle of `radius` whose normal is tilted by `normalTilt` degrees from
|
|
86
|
+
* the viewer becomes an ellipse with:
|
|
87
|
+
* - major axis = radius (unchanged)
|
|
88
|
+
* - minor axis = radius * |cos(normalTilt)|
|
|
89
|
+
*
|
|
90
|
+
* `axisRotation` is the rotation of the ellipse's major axis on the 2D plane (degrees).
|
|
91
|
+
*/
|
|
92
|
+
declare function projectedEllipse(center: Vec2, radius: number, normalTilt: number, axisRotation: number): EllipseParams;
|
|
93
|
+
/**
|
|
94
|
+
* Draw an ellipse (or partial arc) on a Canvas2D context.
|
|
95
|
+
* Strokes the path — caller should set strokeStyle/lineWidth beforehand.
|
|
96
|
+
*
|
|
97
|
+
* @param startAngle - Arc start in radians (default 0)
|
|
98
|
+
* @param endAngle - Arc end in radians (default 2π)
|
|
99
|
+
* @param counterclockwise - Direction of arc (default false)
|
|
100
|
+
*/
|
|
101
|
+
declare function drawEllipse(ctx: CanvasRenderingContext2D, cx: number, cy: number, rx: number, ry: number, rotation: number, startAngle?: number, endAngle?: number, counterclockwise?: boolean): void;
|
|
102
|
+
/**
|
|
103
|
+
* Draw an ellipse with separate visible and hidden arcs.
|
|
104
|
+
* The "front" half (facing viewer) is drawn solid;
|
|
105
|
+
* the "back" half is drawn with the provided hidden style.
|
|
106
|
+
*
|
|
107
|
+
* @param frontHalf - Angle range in radians for the visible portion [start, end]
|
|
108
|
+
* @param hiddenAlpha - Alpha for hidden portion
|
|
109
|
+
* @param hiddenDash - Dash pattern for hidden portion
|
|
110
|
+
*/
|
|
111
|
+
declare function drawEllipseWithHidden(ctx: CanvasRenderingContext2D, params: EllipseParams, frontHalf: [number, number], hiddenAlpha: number, hiddenDash: number[]): void;
|
|
112
|
+
/**
|
|
113
|
+
* Compute points along an ellipse for use in path construction.
|
|
114
|
+
*/
|
|
115
|
+
declare function ellipsePoints(params: EllipseParams, segments: number, startAngle?: number, endAngle?: number): Vec2[];
|
|
116
|
+
|
|
117
|
+
interface LightSource {
|
|
118
|
+
azimuth: number;
|
|
119
|
+
elevation: number;
|
|
120
|
+
intensity: number;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Compute a 3D light direction vector from azimuth and elevation.
|
|
124
|
+
* Returns a unit vector pointing FROM the light TOWARD the scene.
|
|
125
|
+
*/
|
|
126
|
+
declare function lightDirection(light: LightSource): Vec3;
|
|
127
|
+
/**
|
|
128
|
+
* Compute the light direction as a 2D vector for rendering indicators.
|
|
129
|
+
* Points from center toward where light is coming from.
|
|
130
|
+
*/
|
|
131
|
+
declare function lightDirection2D(light: LightSource): Vec2;
|
|
132
|
+
/**
|
|
133
|
+
* Compute the terminator ellipse on a sphere.
|
|
134
|
+
* The terminator is a great circle perpendicular to the light direction.
|
|
135
|
+
*/
|
|
136
|
+
declare function sphereTerminator(center: Vec2, radius: number, light: LightSource, matrix: Mat3): {
|
|
137
|
+
terminatorEllipse: EllipseParams;
|
|
138
|
+
lightSide: Vec2;
|
|
139
|
+
};
|
|
140
|
+
/**
|
|
141
|
+
* Compute a simple cast shadow polygon on the ground plane.
|
|
142
|
+
* Projects the form's bottom silhouette along the light direction.
|
|
143
|
+
*/
|
|
144
|
+
declare function castShadow(center: Vec2, radius: number, light: LightSource, groundY: number): Vec2[];
|
|
145
|
+
type ValueGrouping = "two-value" | "three-value" | "five-value";
|
|
146
|
+
interface ValueZone {
|
|
147
|
+
type: "highlight" | "light" | "halftone" | "core-shadow" | "reflected-light" | "cast-shadow" | "occlusion-shadow";
|
|
148
|
+
path: Vec2[];
|
|
149
|
+
value: number;
|
|
150
|
+
label: string;
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Compute value zones for a sphere at a given position.
|
|
154
|
+
* Returns an array of zones with polygon paths and values.
|
|
155
|
+
*/
|
|
156
|
+
declare function sphereValueZones(center: Vec2, radius: number, light: LightSource, matrix: Mat3, grouping: ValueGrouping): ValueZone[];
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Compute envelope from points based on style.
|
|
160
|
+
* - "tight": convex hull
|
|
161
|
+
* - "loose": convex hull expanded outward
|
|
162
|
+
* - "fitted": the original polygon (straight lines connecting input points in order)
|
|
163
|
+
*/
|
|
164
|
+
declare function computeEnvelope(points: Vec2[], style: "tight" | "loose" | "fitted"): Vec2[];
|
|
165
|
+
/**
|
|
166
|
+
* Compute angles at each vertex of an envelope polygon.
|
|
167
|
+
* Returns the interior angle in degrees at each vertex.
|
|
168
|
+
*/
|
|
169
|
+
declare function envelopeAngles(vertices: Vec2[]): Array<{
|
|
170
|
+
vertex: Vec2;
|
|
171
|
+
angle: number;
|
|
172
|
+
}>;
|
|
173
|
+
/** Vertical plumb line through a reference point, clipped to bounds. */
|
|
174
|
+
declare function plumbLine(referencePoint: Vec2, bounds: {
|
|
175
|
+
x: number;
|
|
176
|
+
y: number;
|
|
177
|
+
width: number;
|
|
178
|
+
height: number;
|
|
179
|
+
}): [Vec2, Vec2];
|
|
180
|
+
/** Horizontal level line through a reference point, clipped to bounds. */
|
|
181
|
+
declare function levelLine(referencePoint: Vec2, bounds: {
|
|
182
|
+
x: number;
|
|
183
|
+
y: number;
|
|
184
|
+
width: number;
|
|
185
|
+
height: number;
|
|
186
|
+
}): [Vec2, Vec2];
|
|
187
|
+
/** Comparative measurement between two segments. Returns ratio and label. */
|
|
188
|
+
declare function comparativeMeasure(segment1: [Vec2, Vec2], segment2: [Vec2, Vec2]): {
|
|
189
|
+
ratio: number;
|
|
190
|
+
label: string;
|
|
191
|
+
};
|
|
192
|
+
|
|
193
|
+
type FormType = "box" | "cylinder" | "sphere" | "cone" | "wedge" | "egg";
|
|
194
|
+
interface FormDefinition {
|
|
195
|
+
type: FormType;
|
|
196
|
+
position: Vec3;
|
|
197
|
+
size: Vec3;
|
|
198
|
+
rotation: Vec3;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* Approximate form intersection by sampling both surfaces and finding
|
|
203
|
+
* points where they are equidistant from the camera (same Z depth).
|
|
204
|
+
*
|
|
205
|
+
* Returns a projected 2D polyline approximating the intersection curve.
|
|
206
|
+
*/
|
|
207
|
+
declare function approximateIntersection(form1: FormDefinition, form2: FormDefinition, samples?: number): Vec2[];
|
|
208
|
+
|
|
209
|
+
declare const constructionPlugin: DesignPlugin;
|
|
210
|
+
|
|
211
|
+
export { approximateIntersection, castShadow, clamp, comparativeMeasure, computeEnvelope, constructionMcpTools, cross3, crossContourLayerType, constructionPlugin as default, dot3, drawEllipse, drawEllipseWithHidden, ellipsePoints, envelopeAngles, envelopeLayerType, formLayerType, identityMatrix, intersectionLayerType, levelLine, lightDirection, lightDirection2D, multiplyMat3, normalize3, plumbLine, project, projectedEllipse, rotate3D, rotationMatrix, sphereTerminator, sphereValueZones, transformPoint, transformedNormalZ, valueShapesLayerType };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
import { LayerTypeDefinition, McpToolDefinition, DesignPlugin } from '@genart-dev/core';
|
|
2
|
+
|
|
3
|
+
declare const formLayerType: LayerTypeDefinition;
|
|
4
|
+
|
|
5
|
+
declare const crossContourLayerType: LayerTypeDefinition;
|
|
6
|
+
|
|
7
|
+
declare const valueShapesLayerType: LayerTypeDefinition;
|
|
8
|
+
|
|
9
|
+
declare const envelopeLayerType: LayerTypeDefinition;
|
|
10
|
+
|
|
11
|
+
declare const intersectionLayerType: LayerTypeDefinition;
|
|
12
|
+
|
|
13
|
+
declare const constructionMcpTools: McpToolDefinition[];
|
|
14
|
+
|
|
15
|
+
/** 3D vector. */
|
|
16
|
+
interface Vec3 {
|
|
17
|
+
x: number;
|
|
18
|
+
y: number;
|
|
19
|
+
z: number;
|
|
20
|
+
}
|
|
21
|
+
/** 2D vector. */
|
|
22
|
+
interface Vec2 {
|
|
23
|
+
x: number;
|
|
24
|
+
y: number;
|
|
25
|
+
}
|
|
26
|
+
/** 3x3 matrix stored as row-major flat array. */
|
|
27
|
+
type Mat3 = [
|
|
28
|
+
number,
|
|
29
|
+
number,
|
|
30
|
+
number,
|
|
31
|
+
number,
|
|
32
|
+
number,
|
|
33
|
+
number,
|
|
34
|
+
number,
|
|
35
|
+
number,
|
|
36
|
+
number
|
|
37
|
+
];
|
|
38
|
+
/** Clamp a value to [min, max]. */
|
|
39
|
+
declare function clamp(v: number, min: number, max: number): number;
|
|
40
|
+
/**
|
|
41
|
+
* Build a ZYX Euler rotation matrix from angles in degrees.
|
|
42
|
+
* rotationX is clamped to [-90, 90] to avoid gimbal lock.
|
|
43
|
+
*
|
|
44
|
+
* R = Rz * Ry * Rx
|
|
45
|
+
*/
|
|
46
|
+
declare function rotationMatrix(rxDeg: number, ryDeg: number, rzDeg: number): Mat3;
|
|
47
|
+
/** Multiply a Mat3 by a Vec3, returning a new Vec3. */
|
|
48
|
+
declare function rotate3D(point: Vec3, m: Mat3): Vec3;
|
|
49
|
+
/**
|
|
50
|
+
* Project a 3D point to 2D.
|
|
51
|
+
*
|
|
52
|
+
* - "orthographic": drops Z (screen.x = point.x, screen.y = point.y)
|
|
53
|
+
* - "weak-perspective": mild foreshortening based on Z depth
|
|
54
|
+
* scale = focalLength / (focalLength + point.z)
|
|
55
|
+
*/
|
|
56
|
+
declare function project(point: Vec3, projection?: "orthographic" | "weak-perspective", focalLength?: number): Vec2;
|
|
57
|
+
/**
|
|
58
|
+
* Convenience: rotate a 3D point then project to 2D.
|
|
59
|
+
* rotationX is clamped to [-90, 90].
|
|
60
|
+
*/
|
|
61
|
+
declare function transformPoint(point: Vec3, rxDeg: number, ryDeg: number, rzDeg: number, projection?: "orthographic" | "weak-perspective", focalLength?: number): Vec2;
|
|
62
|
+
/** Transform a 3D normal vector and return the Z component (for face visibility). */
|
|
63
|
+
declare function transformedNormalZ(normal: Vec3, m: Mat3): number;
|
|
64
|
+
/** Compute the identity matrix. */
|
|
65
|
+
declare function identityMatrix(): Mat3;
|
|
66
|
+
/** Multiply two Mat3 matrices: result = a * b. */
|
|
67
|
+
declare function multiplyMat3(a: Mat3, b: Mat3): Mat3;
|
|
68
|
+
/** Normalize a Vec3 to unit length. Returns zero vector if length is ~0. */
|
|
69
|
+
declare function normalize3(v: Vec3): Vec3;
|
|
70
|
+
/** Dot product of two Vec3. */
|
|
71
|
+
declare function dot3(a: Vec3, b: Vec3): number;
|
|
72
|
+
/** Cross product of two Vec3. */
|
|
73
|
+
declare function cross3(a: Vec3, b: Vec3): Vec3;
|
|
74
|
+
|
|
75
|
+
interface EllipseParams {
|
|
76
|
+
cx: number;
|
|
77
|
+
cy: number;
|
|
78
|
+
rx: number;
|
|
79
|
+
ry: number;
|
|
80
|
+
rotation: number;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Compute ellipse parameters from a circle viewed at an angle.
|
|
84
|
+
*
|
|
85
|
+
* A circle of `radius` whose normal is tilted by `normalTilt` degrees from
|
|
86
|
+
* the viewer becomes an ellipse with:
|
|
87
|
+
* - major axis = radius (unchanged)
|
|
88
|
+
* - minor axis = radius * |cos(normalTilt)|
|
|
89
|
+
*
|
|
90
|
+
* `axisRotation` is the rotation of the ellipse's major axis on the 2D plane (degrees).
|
|
91
|
+
*/
|
|
92
|
+
declare function projectedEllipse(center: Vec2, radius: number, normalTilt: number, axisRotation: number): EllipseParams;
|
|
93
|
+
/**
|
|
94
|
+
* Draw an ellipse (or partial arc) on a Canvas2D context.
|
|
95
|
+
* Strokes the path — caller should set strokeStyle/lineWidth beforehand.
|
|
96
|
+
*
|
|
97
|
+
* @param startAngle - Arc start in radians (default 0)
|
|
98
|
+
* @param endAngle - Arc end in radians (default 2π)
|
|
99
|
+
* @param counterclockwise - Direction of arc (default false)
|
|
100
|
+
*/
|
|
101
|
+
declare function drawEllipse(ctx: CanvasRenderingContext2D, cx: number, cy: number, rx: number, ry: number, rotation: number, startAngle?: number, endAngle?: number, counterclockwise?: boolean): void;
|
|
102
|
+
/**
|
|
103
|
+
* Draw an ellipse with separate visible and hidden arcs.
|
|
104
|
+
* The "front" half (facing viewer) is drawn solid;
|
|
105
|
+
* the "back" half is drawn with the provided hidden style.
|
|
106
|
+
*
|
|
107
|
+
* @param frontHalf - Angle range in radians for the visible portion [start, end]
|
|
108
|
+
* @param hiddenAlpha - Alpha for hidden portion
|
|
109
|
+
* @param hiddenDash - Dash pattern for hidden portion
|
|
110
|
+
*/
|
|
111
|
+
declare function drawEllipseWithHidden(ctx: CanvasRenderingContext2D, params: EllipseParams, frontHalf: [number, number], hiddenAlpha: number, hiddenDash: number[]): void;
|
|
112
|
+
/**
|
|
113
|
+
* Compute points along an ellipse for use in path construction.
|
|
114
|
+
*/
|
|
115
|
+
declare function ellipsePoints(params: EllipseParams, segments: number, startAngle?: number, endAngle?: number): Vec2[];
|
|
116
|
+
|
|
117
|
+
interface LightSource {
|
|
118
|
+
azimuth: number;
|
|
119
|
+
elevation: number;
|
|
120
|
+
intensity: number;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Compute a 3D light direction vector from azimuth and elevation.
|
|
124
|
+
* Returns a unit vector pointing FROM the light TOWARD the scene.
|
|
125
|
+
*/
|
|
126
|
+
declare function lightDirection(light: LightSource): Vec3;
|
|
127
|
+
/**
|
|
128
|
+
* Compute the light direction as a 2D vector for rendering indicators.
|
|
129
|
+
* Points from center toward where light is coming from.
|
|
130
|
+
*/
|
|
131
|
+
declare function lightDirection2D(light: LightSource): Vec2;
|
|
132
|
+
/**
|
|
133
|
+
* Compute the terminator ellipse on a sphere.
|
|
134
|
+
* The terminator is a great circle perpendicular to the light direction.
|
|
135
|
+
*/
|
|
136
|
+
declare function sphereTerminator(center: Vec2, radius: number, light: LightSource, matrix: Mat3): {
|
|
137
|
+
terminatorEllipse: EllipseParams;
|
|
138
|
+
lightSide: Vec2;
|
|
139
|
+
};
|
|
140
|
+
/**
|
|
141
|
+
* Compute a simple cast shadow polygon on the ground plane.
|
|
142
|
+
* Projects the form's bottom silhouette along the light direction.
|
|
143
|
+
*/
|
|
144
|
+
declare function castShadow(center: Vec2, radius: number, light: LightSource, groundY: number): Vec2[];
|
|
145
|
+
type ValueGrouping = "two-value" | "three-value" | "five-value";
|
|
146
|
+
interface ValueZone {
|
|
147
|
+
type: "highlight" | "light" | "halftone" | "core-shadow" | "reflected-light" | "cast-shadow" | "occlusion-shadow";
|
|
148
|
+
path: Vec2[];
|
|
149
|
+
value: number;
|
|
150
|
+
label: string;
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Compute value zones for a sphere at a given position.
|
|
154
|
+
* Returns an array of zones with polygon paths and values.
|
|
155
|
+
*/
|
|
156
|
+
declare function sphereValueZones(center: Vec2, radius: number, light: LightSource, matrix: Mat3, grouping: ValueGrouping): ValueZone[];
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Compute envelope from points based on style.
|
|
160
|
+
* - "tight": convex hull
|
|
161
|
+
* - "loose": convex hull expanded outward
|
|
162
|
+
* - "fitted": the original polygon (straight lines connecting input points in order)
|
|
163
|
+
*/
|
|
164
|
+
declare function computeEnvelope(points: Vec2[], style: "tight" | "loose" | "fitted"): Vec2[];
|
|
165
|
+
/**
|
|
166
|
+
* Compute angles at each vertex of an envelope polygon.
|
|
167
|
+
* Returns the interior angle in degrees at each vertex.
|
|
168
|
+
*/
|
|
169
|
+
declare function envelopeAngles(vertices: Vec2[]): Array<{
|
|
170
|
+
vertex: Vec2;
|
|
171
|
+
angle: number;
|
|
172
|
+
}>;
|
|
173
|
+
/** Vertical plumb line through a reference point, clipped to bounds. */
|
|
174
|
+
declare function plumbLine(referencePoint: Vec2, bounds: {
|
|
175
|
+
x: number;
|
|
176
|
+
y: number;
|
|
177
|
+
width: number;
|
|
178
|
+
height: number;
|
|
179
|
+
}): [Vec2, Vec2];
|
|
180
|
+
/** Horizontal level line through a reference point, clipped to bounds. */
|
|
181
|
+
declare function levelLine(referencePoint: Vec2, bounds: {
|
|
182
|
+
x: number;
|
|
183
|
+
y: number;
|
|
184
|
+
width: number;
|
|
185
|
+
height: number;
|
|
186
|
+
}): [Vec2, Vec2];
|
|
187
|
+
/** Comparative measurement between two segments. Returns ratio and label. */
|
|
188
|
+
declare function comparativeMeasure(segment1: [Vec2, Vec2], segment2: [Vec2, Vec2]): {
|
|
189
|
+
ratio: number;
|
|
190
|
+
label: string;
|
|
191
|
+
};
|
|
192
|
+
|
|
193
|
+
type FormType = "box" | "cylinder" | "sphere" | "cone" | "wedge" | "egg";
|
|
194
|
+
interface FormDefinition {
|
|
195
|
+
type: FormType;
|
|
196
|
+
position: Vec3;
|
|
197
|
+
size: Vec3;
|
|
198
|
+
rotation: Vec3;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* Approximate form intersection by sampling both surfaces and finding
|
|
203
|
+
* points where they are equidistant from the camera (same Z depth).
|
|
204
|
+
*
|
|
205
|
+
* Returns a projected 2D polyline approximating the intersection curve.
|
|
206
|
+
*/
|
|
207
|
+
declare function approximateIntersection(form1: FormDefinition, form2: FormDefinition, samples?: number): Vec2[];
|
|
208
|
+
|
|
209
|
+
declare const constructionPlugin: DesignPlugin;
|
|
210
|
+
|
|
211
|
+
export { approximateIntersection, castShadow, clamp, comparativeMeasure, computeEnvelope, constructionMcpTools, cross3, crossContourLayerType, constructionPlugin as default, dot3, drawEllipse, drawEllipseWithHidden, ellipsePoints, envelopeAngles, envelopeLayerType, formLayerType, identityMatrix, intersectionLayerType, levelLine, lightDirection, lightDirection2D, multiplyMat3, normalize3, plumbLine, project, projectedEllipse, rotate3D, rotationMatrix, sphereTerminator, sphereValueZones, transformPoint, transformedNormalZ, valueShapesLayerType };
|