fluidcad 0.0.2 → 0.0.4
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 +7 -7
- package/lib/dist/common/shape-factory.d.ts +1 -1
- package/lib/dist/oc/boolean-ops.d.ts +2 -2
- package/lib/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -2
- package/lib/dist/constraints/constraint.d.ts +0 -11
- package/lib/dist/constraints/constraint.js +0 -51
- package/lib/dist/constraints/outside.d.ts +0 -3
- package/lib/dist/constraints/outside.js +0 -4
- package/lib/dist/core/2d/aslot.d.ts +0 -12
- package/lib/dist/core/2d/aslot.js +0 -40
- package/lib/dist/core/2d/crect.d.ts +0 -12
- package/lib/dist/core/2d/crect.js +0 -74
- package/lib/dist/core/2d/face-maker.d.ts +0 -13
- package/lib/dist/core/2d/face-maker.js +0 -119
- package/lib/dist/core/2d/face-maker2.d.ts +0 -6
- package/lib/dist/core/2d/face-maker2.js +0 -54
- package/lib/dist/core/region.d.ts +0 -13
- package/lib/dist/core/region.js +0 -18
- package/lib/dist/features/2d/amove.d.ts +0 -14
- package/lib/dist/features/2d/amove.js +0 -33
- package/lib/dist/features/2d/constraints/constraint.d.ts +0 -11
- package/lib/dist/features/2d/constraints/constraint.js +0 -49
- package/lib/dist/features/2d/constraints/outside.d.ts +0 -3
- package/lib/dist/features/2d/constraints/outside.js +0 -4
- package/lib/dist/features/2d/tarc-two-circles.d.ts +0 -18
- package/lib/dist/features/2d/tarc-two-circles.js +0 -61
- package/lib/dist/features/2d/tcircle-three-tan.d.ts +0 -13
- package/lib/dist/features/2d/tcircle-three-tan.js +0 -33
- package/lib/dist/features/2d/tcircle-two-tan.d.ts +0 -13
- package/lib/dist/features/2d/tcircle-two-tan.js +0 -33
- package/lib/dist/features/Extrude.d.ts +0 -1
- package/lib/dist/features/Extrude.js +0 -1
- package/lib/dist/features/cut-base.d.ts +0 -49
- package/lib/dist/features/cut-base.js +0 -312
- package/lib/dist/features/cut-symmetric.d.ts +0 -23
- package/lib/dist/features/cut-symmetric.js +0 -119
- package/lib/dist/features/cut-two-distances.d.ts +0 -24
- package/lib/dist/features/cut-two-distances.js +0 -110
- package/lib/dist/features/cut.d.ts +0 -27
- package/lib/dist/features/cut.js +0 -101
- package/lib/dist/features/extrude-symmetric.d.ts +0 -28
- package/lib/dist/features/extrude-symmetric.js +0 -177
- package/lib/dist/features/region2d.d.ts +0 -25
- package/lib/dist/features/region2d.js +0 -185
- package/lib/dist/features/repeat-circular2d.d.ts +0 -17
- package/lib/dist/features/repeat-circular2d.js +0 -90
- package/lib/dist/features/repeat-linear2d.d.ts +0 -17
- package/lib/dist/features/repeat-linear2d.js +0 -114
- package/lib/dist/features/revolve-options.d.ts +0 -6
- package/lib/dist/features/revolve-options.js +0 -1
- package/lib/dist/features/split.d.ts +0 -14
- package/lib/dist/features/split.js +0 -74
- package/lib/dist/features/state-scene-object.d.ts +0 -15
- package/lib/dist/features/state-scene-object.js +0 -44
- package/lib/dist/features/state-select.d.ts +0 -21
- package/lib/dist/features/state-select.js +0 -73
- package/lib/dist/features/translate2d.d.ts +0 -16
- package/lib/dist/features/translate2d.js +0 -61
- package/lib/dist/filters/all-filter.d.ts +0 -8
- package/lib/dist/filters/all-filter.js +0 -12
- package/lib/dist/filters/near-point-filter.d.ts +0 -11
- package/lib/dist/filters/near-point-filter.js +0 -33
- package/lib/dist/helpers/resolve-filters.d.ts +0 -6
- package/lib/dist/helpers/resolve-filters.js +0 -25
- package/lib/dist/math/axis.test.d.ts +0 -1
- package/lib/dist/math/axis.test.js +0 -287
- package/lib/dist/math/coordinate-system.test.d.ts +0 -1
- package/lib/dist/math/coordinate-system.test.js +0 -308
- package/lib/dist/math/matrix4.test.d.ts +0 -1
- package/lib/dist/math/matrix4.test.js +0 -357
- package/lib/dist/math/plane.test.d.ts +0 -1
- package/lib/dist/math/plane.test.js +0 -398
- package/lib/dist/math/point.test.d.ts +0 -1
- package/lib/dist/math/point.test.js +0 -385
- package/lib/dist/math/quaternion.test.d.ts +0 -1
- package/lib/dist/math/quaternion.test.js +0 -278
- package/lib/dist/math/vector3d.test.d.ts +0 -1
- package/lib/dist/math/vector3d.test.js +0 -276
- package/lib/dist/oc/constraint-resolver.d.ts +0 -7
- package/lib/dist/oc/constraint-resolver.js +0 -31
- package/lib/dist/oc/constraints/curve-constraint-solver.d.ts +0 -1
- package/lib/dist/oc/constraints/curve-constraint-solver.js +0 -2
- package/lib/dist/oc/constraints/geometric-constraint-solver.d.ts +0 -1
- package/lib/dist/oc/constraints/geometric-constraint-solver.js +0 -5
- package/lib/dist/oc/face-maker.d.ts +0 -14
- package/lib/dist/oc/face-maker.js +0 -191
- package/lib/dist/oc/measure.d.ts +0 -21
- package/lib/dist/oc/measure.js +0 -256
- package/lib/dist/oc/tangent-circle-solver.d.ts +0 -17
- package/lib/dist/oc/tangent-circle-solver.js +0 -72
- package/lib/dist/oc/tangent-line-solver.d.ts +0 -17
- package/lib/dist/oc/tangent-line-solver.js +0 -83
- package/lib/dist/oc/tangent-solver.d.ts +0 -14
- package/lib/dist/oc/tangent-solver.js +0 -199
- package/lib/dist/rendering/builder-context.d.ts +0 -16
- package/lib/dist/rendering/builder-context.js +0 -63
- package/lib/dist/tests/extrude.test.d.ts +0 -1
- package/lib/dist/tests/extrude.test.js +0 -48
- package/lib/dist/tests/features/copy.test.d.ts +0 -1
- package/lib/dist/tests/features/copy.test.js +0 -158
- package/lib/dist/tests/features/dispose.test.d.ts +0 -1
- package/lib/dist/tests/features/dispose.test.js +0 -189
- package/lib/dist/tests/features/part-pick.test.d.ts +0 -1
- package/lib/dist/tests/features/part-pick.test.js +0 -73
- package/lib/dist/tests/features/part-repeat.test.d.ts +0 -1
- package/lib/dist/tests/features/part-repeat.test.js +0 -109
- package/server/dist/fluidcad-server.d.ts +0 -32
- package/server/dist/fluidcad-server.js +0 -150
- package/server/dist/index.d.ts +0 -1
- package/server/dist/index.js +0 -290
- package/server/dist/routes/actions.d.ts +0 -3
- package/server/dist/routes/actions.js +0 -100
- package/server/dist/routes/export.d.ts +0 -3
- package/server/dist/routes/export.js +0 -55
- package/server/dist/routes/properties.d.ts +0 -3
- package/server/dist/routes/properties.js +0 -46
- package/server/dist/routes/screenshot.d.ts +0 -2
- package/server/dist/routes/screenshot.js +0 -76
- package/server/dist/vite-manager.d.ts +0 -10
- package/server/dist/vite-manager.js +0 -64
- package/server/dist/ws-protocol.d.ts +0 -138
- package/server/dist/ws-protocol.js +0 -4
package/lib/dist/oc/measure.js
DELETED
|
@@ -1,256 +0,0 @@
|
|
|
1
|
-
import { getOC } from "./init.js";
|
|
2
|
-
import { Explorer } from "./explorer.js";
|
|
3
|
-
export class OccMeasure {
|
|
4
|
-
static compute(shapeA, typeA, indexA, shapeB, typeB, indexB) {
|
|
5
|
-
const oc = getOC();
|
|
6
|
-
// Extract sub-shapes by index
|
|
7
|
-
const subA = typeA === 'face'
|
|
8
|
-
? Explorer.findShapes(shapeA, oc.TopAbs_ShapeEnum.TopAbs_FACE)[indexA]
|
|
9
|
-
: Explorer.findShapes(shapeA, oc.TopAbs_ShapeEnum.TopAbs_EDGE)[indexA];
|
|
10
|
-
const subB = typeB === 'face'
|
|
11
|
-
? Explorer.findShapes(shapeB, oc.TopAbs_ShapeEnum.TopAbs_FACE)[indexB]
|
|
12
|
-
: Explorer.findShapes(shapeB, oc.TopAbs_ShapeEnum.TopAbs_EDGE)[indexB];
|
|
13
|
-
if (!subA || !subB) {
|
|
14
|
-
return null;
|
|
15
|
-
}
|
|
16
|
-
// Compute minimum distance and reference points via BRepExtrema
|
|
17
|
-
const progress = new oc.Message_ProgressRange();
|
|
18
|
-
const distCalc = new oc.BRepExtrema_DistShapeShape(subA, subB, oc.Extrema_ExtFlag.Extrema_ExtFlag_MIN, oc.Extrema_ExtAlgo.Extrema_ExtAlgo_Grad, progress);
|
|
19
|
-
let minDist = 0;
|
|
20
|
-
let refPointA = [0, 0, 0];
|
|
21
|
-
let refPointB = [0, 0, 0];
|
|
22
|
-
if (distCalc.IsDone() && distCalc.NbSolution() > 0) {
|
|
23
|
-
minDist = distCalc.Value();
|
|
24
|
-
const pA = distCalc.PointOnShape1(1);
|
|
25
|
-
const pB = distCalc.PointOnShape2(1);
|
|
26
|
-
refPointA = [pA.X(), pA.Y(), pA.Z()];
|
|
27
|
-
refPointB = [pB.X(), pB.Y(), pB.Z()];
|
|
28
|
-
}
|
|
29
|
-
distCalc.delete();
|
|
30
|
-
progress.delete();
|
|
31
|
-
const dx = refPointB[0] - refPointA[0];
|
|
32
|
-
const dy = refPointB[1] - refPointA[1];
|
|
33
|
-
const dz = refPointB[2] - refPointA[2];
|
|
34
|
-
const axisBreakdown = { dx, dy, dz };
|
|
35
|
-
const minDistEntry = {
|
|
36
|
-
label: 'Min Distance',
|
|
37
|
-
value: minDist,
|
|
38
|
-
unit: 'mm',
|
|
39
|
-
icon: 'distance',
|
|
40
|
-
axisBreakdown,
|
|
41
|
-
};
|
|
42
|
-
const others = [];
|
|
43
|
-
let headline = minDistEntry;
|
|
44
|
-
let headlineSet = false;
|
|
45
|
-
if (typeA === 'face' && typeB === 'face') {
|
|
46
|
-
const ocFaceA = oc.TopoDS.Face(subA);
|
|
47
|
-
const ocFaceB = oc.TopoDS.Face(subB);
|
|
48
|
-
const adaptorA = new oc.BRepAdaptor_Surface(ocFaceA, true);
|
|
49
|
-
const adaptorB = new oc.BRepAdaptor_Surface(ocFaceB, true);
|
|
50
|
-
const gTypeA = adaptorA.GetType();
|
|
51
|
-
const gTypeB = adaptorB.GetType();
|
|
52
|
-
if (gTypeA === oc.GeomAbs_SurfaceType.GeomAbs_Plane &&
|
|
53
|
-
gTypeB === oc.GeomAbs_SurfaceType.GeomAbs_Plane) {
|
|
54
|
-
// Plane + Plane
|
|
55
|
-
const planeA = adaptorA.Plane();
|
|
56
|
-
const planeB = adaptorB.Plane();
|
|
57
|
-
const axA = planeA.Axis();
|
|
58
|
-
const axB = planeB.Axis();
|
|
59
|
-
const dirA = axA.Direction();
|
|
60
|
-
const dirB = axB.Direction();
|
|
61
|
-
const nax = dirA.X(), nay = dirA.Y(), naz = dirA.Z();
|
|
62
|
-
const nbx = dirB.X(), nby = dirB.Y(), nbz = dirB.Z();
|
|
63
|
-
const dot = Math.abs(nax * nbx + nay * nby + naz * nbz);
|
|
64
|
-
if (dot > 0.9999) {
|
|
65
|
-
// Parallel planes → face distance
|
|
66
|
-
headline = {
|
|
67
|
-
label: 'Face Distance',
|
|
68
|
-
value: minDist,
|
|
69
|
-
unit: 'mm',
|
|
70
|
-
icon: 'distance',
|
|
71
|
-
axisBreakdown,
|
|
72
|
-
};
|
|
73
|
-
headlineSet = true;
|
|
74
|
-
}
|
|
75
|
-
else {
|
|
76
|
-
// Non-parallel → dihedral angle
|
|
77
|
-
const angleRad = Math.acos(Math.min(1, dot));
|
|
78
|
-
const angleDeg = angleRad * (180 / Math.PI);
|
|
79
|
-
headline = {
|
|
80
|
-
label: 'Dihedral Angle',
|
|
81
|
-
value: angleDeg,
|
|
82
|
-
unit: 'deg',
|
|
83
|
-
icon: 'angle',
|
|
84
|
-
};
|
|
85
|
-
headlineSet = true;
|
|
86
|
-
others.push(minDistEntry);
|
|
87
|
-
}
|
|
88
|
-
planeB.delete();
|
|
89
|
-
planeA.delete();
|
|
90
|
-
}
|
|
91
|
-
else if (gTypeA === oc.GeomAbs_SurfaceType.GeomAbs_Cylinder &&
|
|
92
|
-
gTypeB === oc.GeomAbs_SurfaceType.GeomAbs_Cylinder) {
|
|
93
|
-
// Cylinder + Cylinder
|
|
94
|
-
const cylA = adaptorA.Cylinder();
|
|
95
|
-
const cylB = adaptorB.Cylinder();
|
|
96
|
-
const axA = cylA.Axis();
|
|
97
|
-
const axB = cylB.Axis();
|
|
98
|
-
const dirA = axA.Direction();
|
|
99
|
-
const dirB = axB.Direction();
|
|
100
|
-
const adx = dirA.X(), ady = dirA.Y(), adz = dirA.Z();
|
|
101
|
-
const bdx = dirB.X(), bdy = dirB.Y(), bdz = dirB.Z();
|
|
102
|
-
const dot = Math.abs(adx * bdx + ady * bdy + adz * bdz);
|
|
103
|
-
const radA = cylA.Radius();
|
|
104
|
-
const radB = cylB.Radius();
|
|
105
|
-
if (dot > 0.9999) {
|
|
106
|
-
// Parallel axes → compute axis distance
|
|
107
|
-
const locA = cylA.Location();
|
|
108
|
-
const locB = cylB.Location();
|
|
109
|
-
const lax = locA.X(), lay = locA.Y(), laz = locA.Z();
|
|
110
|
-
const lbx = locB.X(), lby = locB.Y(), lbz = locB.Z();
|
|
111
|
-
const dv0 = lbx - lax, dv1 = lby - lay, dv2 = lbz - laz;
|
|
112
|
-
const proj = dv0 * adx + dv1 * ady + dv2 * adz;
|
|
113
|
-
const perpX = dv0 - proj * adx;
|
|
114
|
-
const perpY = dv1 - proj * ady;
|
|
115
|
-
const perpZ = dv2 - proj * adz;
|
|
116
|
-
const axisDist = Math.sqrt(perpX * perpX + perpY * perpY + perpZ * perpZ);
|
|
117
|
-
const radialGap = axisDist - radA - radB;
|
|
118
|
-
headline = {
|
|
119
|
-
label: 'Axis Distance',
|
|
120
|
-
value: axisDist,
|
|
121
|
-
unit: 'mm',
|
|
122
|
-
icon: 'distance',
|
|
123
|
-
};
|
|
124
|
-
headlineSet = true;
|
|
125
|
-
if (radialGap > -1e-6) {
|
|
126
|
-
others.push({
|
|
127
|
-
label: 'Radial Gap',
|
|
128
|
-
value: Math.max(0, radialGap),
|
|
129
|
-
unit: 'mm',
|
|
130
|
-
icon: 'distance',
|
|
131
|
-
});
|
|
132
|
-
}
|
|
133
|
-
others.push(minDistEntry);
|
|
134
|
-
}
|
|
135
|
-
else {
|
|
136
|
-
others.push(minDistEntry);
|
|
137
|
-
}
|
|
138
|
-
cylA.delete();
|
|
139
|
-
cylB.delete();
|
|
140
|
-
}
|
|
141
|
-
else if (gTypeA === oc.GeomAbs_SurfaceType.GeomAbs_Sphere &&
|
|
142
|
-
gTypeB === oc.GeomAbs_SurfaceType.GeomAbs_Sphere) {
|
|
143
|
-
// Sphere + Sphere → center distance
|
|
144
|
-
const sphA = adaptorA.Sphere();
|
|
145
|
-
const sphB = adaptorB.Sphere();
|
|
146
|
-
const locA = sphA.Location();
|
|
147
|
-
const locB = sphB.Location();
|
|
148
|
-
const cx = locB.X() - locA.X();
|
|
149
|
-
const cy = locB.Y() - locA.Y();
|
|
150
|
-
const cz = locB.Z() - locA.Z();
|
|
151
|
-
const centerDist = Math.sqrt(cx * cx + cy * cy + cz * cz);
|
|
152
|
-
headline = {
|
|
153
|
-
label: 'Center Distance',
|
|
154
|
-
value: centerDist,
|
|
155
|
-
unit: 'mm',
|
|
156
|
-
icon: 'distance',
|
|
157
|
-
axisBreakdown: { dx: cx, dy: cy, dz: cz },
|
|
158
|
-
};
|
|
159
|
-
headlineSet = true;
|
|
160
|
-
others.push(minDistEntry);
|
|
161
|
-
sphA.delete();
|
|
162
|
-
sphB.delete();
|
|
163
|
-
}
|
|
164
|
-
else {
|
|
165
|
-
// Mixed face types → min distance
|
|
166
|
-
others.push(minDistEntry);
|
|
167
|
-
}
|
|
168
|
-
adaptorA.delete();
|
|
169
|
-
adaptorB.delete();
|
|
170
|
-
}
|
|
171
|
-
else if (typeA === 'edge' && typeB === 'edge') {
|
|
172
|
-
const ocEdgeA = oc.TopoDS.Edge(subA);
|
|
173
|
-
const ocEdgeB = oc.TopoDS.Edge(subB);
|
|
174
|
-
const adaptorA = new oc.BRepAdaptor_Curve(ocEdgeA);
|
|
175
|
-
const adaptorB = new oc.BRepAdaptor_Curve(ocEdgeB);
|
|
176
|
-
const gTypeA = adaptorA.GetType();
|
|
177
|
-
const gTypeB = adaptorB.GetType();
|
|
178
|
-
if (gTypeA === oc.GeomAbs_CurveType.GeomAbs_Line &&
|
|
179
|
-
gTypeB === oc.GeomAbs_CurveType.GeomAbs_Line) {
|
|
180
|
-
// Line + Line
|
|
181
|
-
const linA = adaptorA.Line();
|
|
182
|
-
const linB = adaptorB.Line();
|
|
183
|
-
const dirA = linA.Direction();
|
|
184
|
-
const dirB = linB.Direction();
|
|
185
|
-
const adx = dirA.X(), ady = dirA.Y(), adz = dirA.Z();
|
|
186
|
-
const bdx = dirB.X(), bdy = dirB.Y(), bdz = dirB.Z();
|
|
187
|
-
const dot = Math.abs(adx * bdx + ady * bdy + adz * bdz);
|
|
188
|
-
linA.delete();
|
|
189
|
-
linB.delete();
|
|
190
|
-
if (dot > 0.9999) {
|
|
191
|
-
// Parallel lines → parallel distance
|
|
192
|
-
headline = {
|
|
193
|
-
label: 'Parallel Distance',
|
|
194
|
-
value: minDist,
|
|
195
|
-
unit: 'mm',
|
|
196
|
-
icon: 'distance',
|
|
197
|
-
axisBreakdown,
|
|
198
|
-
};
|
|
199
|
-
headlineSet = true;
|
|
200
|
-
}
|
|
201
|
-
else {
|
|
202
|
-
// Non-parallel → angle
|
|
203
|
-
const angleRad = Math.acos(Math.min(1, dot));
|
|
204
|
-
const angleDeg = angleRad * (180 / Math.PI);
|
|
205
|
-
headline = {
|
|
206
|
-
label: 'Angle',
|
|
207
|
-
value: angleDeg,
|
|
208
|
-
unit: 'deg',
|
|
209
|
-
icon: 'angle',
|
|
210
|
-
};
|
|
211
|
-
headlineSet = true;
|
|
212
|
-
others.push(minDistEntry);
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
else if (gTypeA === oc.GeomAbs_CurveType.GeomAbs_Circle &&
|
|
216
|
-
gTypeB === oc.GeomAbs_CurveType.GeomAbs_Circle) {
|
|
217
|
-
// Circle/Arc + Circle/Arc → center distance
|
|
218
|
-
const circA = adaptorA.Circle();
|
|
219
|
-
const circB = adaptorB.Circle();
|
|
220
|
-
const locA = circA.Location();
|
|
221
|
-
const locB = circB.Location();
|
|
222
|
-
const cx = locB.X() - locA.X();
|
|
223
|
-
const cy = locB.Y() - locA.Y();
|
|
224
|
-
const cz = locB.Z() - locA.Z();
|
|
225
|
-
const centerDist = Math.sqrt(cx * cx + cy * cy + cz * cz);
|
|
226
|
-
headline = {
|
|
227
|
-
label: 'Center Distance',
|
|
228
|
-
value: centerDist,
|
|
229
|
-
unit: 'mm',
|
|
230
|
-
icon: 'distance',
|
|
231
|
-
axisBreakdown: { dx: cx, dy: cy, dz: cz },
|
|
232
|
-
};
|
|
233
|
-
headlineSet = true;
|
|
234
|
-
others.push(minDistEntry);
|
|
235
|
-
circA.delete();
|
|
236
|
-
circB.delete();
|
|
237
|
-
}
|
|
238
|
-
adaptorA.delete();
|
|
239
|
-
adaptorB.delete();
|
|
240
|
-
}
|
|
241
|
-
if (!headlineSet) {
|
|
242
|
-
headline = minDistEntry;
|
|
243
|
-
}
|
|
244
|
-
// Ensure minDistEntry is in others if it's not the headline
|
|
245
|
-
const othersHasMinDist = others.some(e => e === minDistEntry);
|
|
246
|
-
if (headline !== minDistEntry && !othersHasMinDist) {
|
|
247
|
-
others.push(minDistEntry);
|
|
248
|
-
}
|
|
249
|
-
return {
|
|
250
|
-
headline,
|
|
251
|
-
others,
|
|
252
|
-
refPointA,
|
|
253
|
-
refPointB,
|
|
254
|
-
};
|
|
255
|
-
}
|
|
256
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { Edge } from "../common/edge.js";
|
|
2
|
-
import { ConstraintQualifier } from "../features/2d/constraints/qualified-geometry.js";
|
|
3
|
-
import { Plane } from "../math/plane.js";
|
|
4
|
-
import { Shape } from "../common/shape.js";
|
|
5
|
-
export declare class TangentCircleSolver {
|
|
6
|
-
static getTangentLines(plane: Plane, shape1: {
|
|
7
|
-
shape: Shape;
|
|
8
|
-
qualifier: ConstraintQualifier;
|
|
9
|
-
}, shape2: {
|
|
10
|
-
shape: Shape;
|
|
11
|
-
qualifier: ConstraintQualifier;
|
|
12
|
-
}): Edge[];
|
|
13
|
-
private static getPointCircleTangent;
|
|
14
|
-
private static getCircleCircleTangent;
|
|
15
|
-
private static collectSolverEdges;
|
|
16
|
-
private static getShapeGeometry;
|
|
17
|
-
}
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import { Convert } from "./convert.js";
|
|
2
|
-
import { Geometry } from "./geometry.js";
|
|
3
|
-
import { getOC } from "./init.js";
|
|
4
|
-
import { ConstraintResolver } from "./constraint-resolver.js";
|
|
5
|
-
export class TangentCircleSolver {
|
|
6
|
-
static getTangentLines(plane, shape1, shape2) {
|
|
7
|
-
return [];
|
|
8
|
-
}
|
|
9
|
-
static getPointCircleTangent(plane, vertex, circleShape) {
|
|
10
|
-
const oc = getOC();
|
|
11
|
-
// new oc.GccAna_Circ2d2TanRad()
|
|
12
|
-
const tolerance = oc.Precision.Angular();
|
|
13
|
-
const [pln, disposePln] = Convert.toGpPln(plane);
|
|
14
|
-
const [pnt, disposePnt] = Convert.toGpPnt2d(vertex.toPoint2D());
|
|
15
|
-
const geometry = this.getShapeGeometry(circleShape.shape);
|
|
16
|
-
const qualifiedGeometry = ConstraintResolver.getQualified(pln, geometry, circleShape.qualifier);
|
|
17
|
-
const solver = new oc.GccAna_Lin2d2Tan(qualifiedGeometry, pnt, tolerance);
|
|
18
|
-
disposePnt();
|
|
19
|
-
const edges = this.collectSolverEdges(solver, plane);
|
|
20
|
-
disposePln();
|
|
21
|
-
return edges;
|
|
22
|
-
}
|
|
23
|
-
static getCircleCircleTangent(plane, shape1, shape2) {
|
|
24
|
-
const oc = getOC();
|
|
25
|
-
const tolerance = oc.Precision.Angular();
|
|
26
|
-
const [pln, disposePln] = Convert.toGpPln(plane);
|
|
27
|
-
const geometry1 = this.getShapeGeometry(shape1.shape);
|
|
28
|
-
const geometry2 = this.getShapeGeometry(shape2.shape);
|
|
29
|
-
const qualifiedGeometry1 = ConstraintResolver.getQualified(pln, geometry1, shape1.qualifier);
|
|
30
|
-
const qualifiedGeometry2 = ConstraintResolver.getQualified(pln, geometry2, shape2.qualifier);
|
|
31
|
-
const solver = new oc.GccAna_Lin2d2Tan(qualifiedGeometry1, qualifiedGeometry2, tolerance);
|
|
32
|
-
const edges = this.collectSolverEdges(solver, plane);
|
|
33
|
-
disposePln();
|
|
34
|
-
return edges;
|
|
35
|
-
}
|
|
36
|
-
static collectSolverEdges(solver, plane) {
|
|
37
|
-
const oc = getOC();
|
|
38
|
-
const edges = [];
|
|
39
|
-
if (solver.IsDone()) {
|
|
40
|
-
const nSolutions = solver.NbSolutions();
|
|
41
|
-
for (let i = 1; i <= nSolutions; i++) {
|
|
42
|
-
const pnt1 = new oc.gp_Pnt2d();
|
|
43
|
-
const pnt2 = new oc.gp_Pnt2d();
|
|
44
|
-
solver.Tangency1(i, 0, 0, pnt1);
|
|
45
|
-
solver.Tangency2(i, 0, 0, pnt2);
|
|
46
|
-
const worldPnt1 = plane.localToWorld(Convert.toPoint2D(pnt1, true));
|
|
47
|
-
const worldPnt2 = plane.localToWorld(Convert.toPoint2D(pnt2, true));
|
|
48
|
-
const line = Geometry.makeSegment(worldPnt1, worldPnt2);
|
|
49
|
-
edges.push(Geometry.makeEdge(line));
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
return edges;
|
|
53
|
-
}
|
|
54
|
-
static getShapeGeometry(shape) {
|
|
55
|
-
const oc = getOC();
|
|
56
|
-
const adaptor = new oc.BRepAdaptor_Curve(shape.getShape());
|
|
57
|
-
const type = adaptor.GetType();
|
|
58
|
-
let geometry;
|
|
59
|
-
if (type === oc.GeomAbs_CurveType.GeomAbs_Line) {
|
|
60
|
-
geometry = adaptor.Line();
|
|
61
|
-
}
|
|
62
|
-
else if (type === oc.GeomAbs_CurveType.GeomAbs_Circle && adaptor.IsClosed()) {
|
|
63
|
-
geometry = adaptor.Circle();
|
|
64
|
-
}
|
|
65
|
-
else {
|
|
66
|
-
adaptor.delete();
|
|
67
|
-
throw new Error('Unsupported shape type for tangent line solver');
|
|
68
|
-
}
|
|
69
|
-
adaptor.delete();
|
|
70
|
-
return geometry;
|
|
71
|
-
}
|
|
72
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { Edge } from "../common/edge.js";
|
|
2
|
-
import { ConstraintQualifier } from "../features/2d/constraints/qualified-geometry.js";
|
|
3
|
-
import { Plane } from "../math/plane.js";
|
|
4
|
-
import { Shape } from "../common/shape.js";
|
|
5
|
-
export declare class TangentLineSolver {
|
|
6
|
-
static getTangentLines(plane: Plane, shape1: {
|
|
7
|
-
shape: Shape;
|
|
8
|
-
qualifier: ConstraintQualifier;
|
|
9
|
-
}, shape2: {
|
|
10
|
-
shape: Shape;
|
|
11
|
-
qualifier: ConstraintQualifier;
|
|
12
|
-
}): Edge[];
|
|
13
|
-
private static getPointCircleTangent;
|
|
14
|
-
private static getCircleCircleTangent;
|
|
15
|
-
private static collectSolverEdges;
|
|
16
|
-
private static getShapeGeometry;
|
|
17
|
-
}
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
import { getOC } from "./init.js";
|
|
2
|
-
import { Convert } from "./convert.js";
|
|
3
|
-
import { Geometry } from "./geometry.js";
|
|
4
|
-
import { ConstraintResolver } from "./constraint-resolver.js";
|
|
5
|
-
import { Vertex } from "../common/vertex.js";
|
|
6
|
-
export class TangentLineSolver {
|
|
7
|
-
static getTangentLines(plane, shape1, shape2) {
|
|
8
|
-
if (shape1.shape instanceof Vertex || shape2.shape instanceof Vertex) {
|
|
9
|
-
const [vertex] = [shape1, shape2].filter(s => s.shape instanceof Vertex);
|
|
10
|
-
const [otherShape] = [shape1, shape2].filter(s => s !== vertex);
|
|
11
|
-
if (otherShape instanceof Vertex) {
|
|
12
|
-
// todo: create a line between the two points and return it as the single tangent solution
|
|
13
|
-
return [];
|
|
14
|
-
}
|
|
15
|
-
return this.getPointCircleTangent(plane, vertex.shape, otherShape);
|
|
16
|
-
}
|
|
17
|
-
else {
|
|
18
|
-
return this.getCircleCircleTangent(plane, shape1, shape2);
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
static getPointCircleTangent(plane, vertex, circleShape) {
|
|
22
|
-
const oc = getOC();
|
|
23
|
-
const tolerance = oc.Precision.Angular();
|
|
24
|
-
const [pln, disposePln] = Convert.toGpPln(plane);
|
|
25
|
-
const [pnt, disposePnt] = Convert.toGpPnt2d(vertex.toPoint2D());
|
|
26
|
-
const geometry = this.getShapeGeometry(circleShape.shape);
|
|
27
|
-
const qualifiedGeometry = ConstraintResolver.getQualified(pln, geometry, circleShape.qualifier);
|
|
28
|
-
const solver = new oc.GccAna_Lin2d2Tan(qualifiedGeometry, pnt, tolerance);
|
|
29
|
-
disposePnt();
|
|
30
|
-
const edges = this.collectSolverEdges(solver, plane);
|
|
31
|
-
disposePln();
|
|
32
|
-
return edges;
|
|
33
|
-
}
|
|
34
|
-
static getCircleCircleTangent(plane, shape1, shape2) {
|
|
35
|
-
const oc = getOC();
|
|
36
|
-
const tolerance = oc.Precision.Angular();
|
|
37
|
-
const [pln, disposePln] = Convert.toGpPln(plane);
|
|
38
|
-
const geometry1 = this.getShapeGeometry(shape1.shape);
|
|
39
|
-
const geometry2 = this.getShapeGeometry(shape2.shape);
|
|
40
|
-
const qualifiedGeometry1 = ConstraintResolver.getQualified(pln, geometry1, shape1.qualifier);
|
|
41
|
-
const qualifiedGeometry2 = ConstraintResolver.getQualified(pln, geometry2, shape2.qualifier);
|
|
42
|
-
const solver = new oc.GccAna_Lin2d2Tan(qualifiedGeometry1, qualifiedGeometry2, tolerance);
|
|
43
|
-
const edges = this.collectSolverEdges(solver, plane);
|
|
44
|
-
disposePln();
|
|
45
|
-
return edges;
|
|
46
|
-
}
|
|
47
|
-
static collectSolverEdges(solver, plane) {
|
|
48
|
-
const oc = getOC();
|
|
49
|
-
const edges = [];
|
|
50
|
-
if (solver.IsDone()) {
|
|
51
|
-
const nSolutions = solver.NbSolutions();
|
|
52
|
-
for (let i = 1; i <= nSolutions; i++) {
|
|
53
|
-
const pnt1 = new oc.gp_Pnt2d();
|
|
54
|
-
const pnt2 = new oc.gp_Pnt2d();
|
|
55
|
-
solver.Tangency1(i, 0, 0, pnt1);
|
|
56
|
-
solver.Tangency2(i, 0, 0, pnt2);
|
|
57
|
-
const worldPnt1 = plane.localToWorld(Convert.toPoint2D(pnt1, true));
|
|
58
|
-
const worldPnt2 = plane.localToWorld(Convert.toPoint2D(pnt2, true));
|
|
59
|
-
const line = Geometry.makeSegment(worldPnt1, worldPnt2);
|
|
60
|
-
edges.push(Geometry.makeEdge(line));
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
return edges;
|
|
64
|
-
}
|
|
65
|
-
static getShapeGeometry(shape) {
|
|
66
|
-
const oc = getOC();
|
|
67
|
-
const adaptor = new oc.BRepAdaptor_Curve(shape.getShape());
|
|
68
|
-
const type = adaptor.GetType();
|
|
69
|
-
let geometry;
|
|
70
|
-
if (type === oc.GeomAbs_CurveType.GeomAbs_Line) {
|
|
71
|
-
geometry = adaptor.Line();
|
|
72
|
-
}
|
|
73
|
-
else if (type === oc.GeomAbs_CurveType.GeomAbs_Circle && adaptor.IsClosed()) {
|
|
74
|
-
geometry = adaptor.Circle();
|
|
75
|
-
}
|
|
76
|
-
else {
|
|
77
|
-
adaptor.delete();
|
|
78
|
-
throw new Error('Unsupported shape type for tangent line solver');
|
|
79
|
-
}
|
|
80
|
-
adaptor.delete();
|
|
81
|
-
return geometry;
|
|
82
|
-
}
|
|
83
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { Point2D } from "../math/point.js";
|
|
2
|
-
import { Edge } from "../common/edge.js";
|
|
3
|
-
import { QualifiedGeometry } from "../features/2d/constraints/qualified-geometry.js";
|
|
4
|
-
import { Plane } from "../math/plane.js";
|
|
5
|
-
export declare class TangentSolver {
|
|
6
|
-
static getTangentLines(plane: Plane, qualifiedC1: QualifiedGeometry, qualifiedC2: QualifiedGeometry): Edge[];
|
|
7
|
-
static getTangentCircles(plane: Plane, qualifiedC1: QualifiedGeometry, qualifiedC2: QualifiedGeometry, radius: number): Edge[];
|
|
8
|
-
static getTangentArcs(plane: Plane, qualifiedC1: QualifiedGeometry, qualifiedC2: QualifiedGeometry, radius: number): {
|
|
9
|
-
edge: Edge;
|
|
10
|
-
endTangent: Point2D;
|
|
11
|
-
}[];
|
|
12
|
-
static getTangentCircles3Tan(plane: Plane, qualifiedC1: QualifiedGeometry, qualifiedC2: QualifiedGeometry, qualifiedC3: QualifiedGeometry): Edge[];
|
|
13
|
-
private static buildCirc2TanSolver;
|
|
14
|
-
}
|
|
@@ -1,199 +0,0 @@
|
|
|
1
|
-
import { getOC } from "./init.js";
|
|
2
|
-
import { Convert } from "./convert.js";
|
|
3
|
-
import { Point2D } from "../math/point.js";
|
|
4
|
-
import { Geometry } from "./geometry.js";
|
|
5
|
-
import { ConstraintResolver } from "./constraint-resolver.js";
|
|
6
|
-
import { Wire } from "../common/wire.js";
|
|
7
|
-
import { Vertex } from "../common/vertex.js";
|
|
8
|
-
export class TangentSolver {
|
|
9
|
-
static getTangentLines(plane, qualifiedC1, qualifiedC2) {
|
|
10
|
-
const oc = getOC();
|
|
11
|
-
const tolerance = oc.Precision.Angular();
|
|
12
|
-
const [pln, disposePln] = Convert.toGpPln(plane);
|
|
13
|
-
let shape1 = qualifiedC1.object.getShapes({ excludeMeta: false })[0];
|
|
14
|
-
let shape2 = qualifiedC2.object.getShapes({ excludeMeta: false })[0];
|
|
15
|
-
if (shape1 instanceof Wire) {
|
|
16
|
-
shape1 = shape1.getEdges()[0];
|
|
17
|
-
}
|
|
18
|
-
if (shape2 instanceof Wire) {
|
|
19
|
-
shape2 = shape2.getEdges()[0];
|
|
20
|
-
}
|
|
21
|
-
let qc1;
|
|
22
|
-
let qc2;
|
|
23
|
-
if (shape1 instanceof Vertex || shape2 instanceof Vertex) {
|
|
24
|
-
// const oc = getOC();
|
|
25
|
-
// const vertex = shape.getShape() as TopoDS_Vertex;
|
|
26
|
-
// const pnt = oc.BRep_Tool.Pnt(vertex);
|
|
27
|
-
// const localPoint = plane.worldToLocal(Convert.toPoint(c2.qualified as gp_Pnt));
|
|
28
|
-
// const [gpPnt, disposeGpPnt] = Convert.toGpPnt2d(localPoint);
|
|
29
|
-
// solver = new oc.GccAna_Lin2d2Tan(c1.qualified as any, gpPnt, tolerance);
|
|
30
|
-
// disposeGpPnt();
|
|
31
|
-
throw new Error('TODO');
|
|
32
|
-
}
|
|
33
|
-
const adaptor1 = new oc.BRepAdaptor_Curve(shape1.getShape());
|
|
34
|
-
const adaptor2 = new oc.BRepAdaptor_Curve(shape2.getShape());
|
|
35
|
-
const type1 = adaptor1.GetType();
|
|
36
|
-
const type2 = adaptor2.GetType();
|
|
37
|
-
let solver;
|
|
38
|
-
if (type1 === oc.GeomAbs_CurveType.GeomAbs_Circle && type2 === oc.GeomAbs_CurveType.GeomAbs_Circle && adaptor1.IsClosed() && adaptor2.IsClosed()) {
|
|
39
|
-
const c1 = ConstraintResolver.getQualified(pln, qualifiedC1);
|
|
40
|
-
const c2 = ConstraintResolver.getQualified(pln, qualifiedC2);
|
|
41
|
-
solver = new oc.GccAna_Lin2d2Tan(c1.qualified, c2.qualified, tolerance);
|
|
42
|
-
}
|
|
43
|
-
else {
|
|
44
|
-
const c1 = ConstraintResolver.getQualifiedAsCurve(pln, adaptor1, ConstraintResolver.getQualifier(qualifiedC1.qualifier));
|
|
45
|
-
const c2 = ConstraintResolver.getQualifiedAsCurve(pln, adaptor2, ConstraintResolver.getQualifier(qualifiedC2.qualifier));
|
|
46
|
-
solver = new oc.Geom2dGcc_Lin2d2Tan(c1, c2, tolerance);
|
|
47
|
-
}
|
|
48
|
-
disposePln();
|
|
49
|
-
const edges = [];
|
|
50
|
-
if (solver.IsDone()) {
|
|
51
|
-
const nSolutions = solver.NbSolutions();
|
|
52
|
-
for (let i = 1; i <= nSolutions; i++) {
|
|
53
|
-
const pnt1 = new oc.gp_Pnt2d();
|
|
54
|
-
const pnt2 = new oc.gp_Pnt2d();
|
|
55
|
-
solver.Tangency1(i, 0, 0, pnt1);
|
|
56
|
-
solver.Tangency2(i, 0, 0, pnt2);
|
|
57
|
-
const worldPnt1 = plane.localToWorld(Convert.toPoint2D(pnt1, true));
|
|
58
|
-
const worldPnt2 = plane.localToWorld(Convert.toPoint2D(pnt2, true));
|
|
59
|
-
const line = Geometry.makeSegment(worldPnt1, worldPnt2);
|
|
60
|
-
edges.push(Geometry.makeEdge(line));
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
return edges;
|
|
64
|
-
}
|
|
65
|
-
static getTangentCircles(plane, qualifiedC1, qualifiedC2, radius) {
|
|
66
|
-
const solver = TangentSolver.buildCirc2TanSolver(plane, qualifiedC1, qualifiedC2, radius);
|
|
67
|
-
const edges = [];
|
|
68
|
-
if (solver.IsDone()) {
|
|
69
|
-
for (let i = 1; i <= solver.NbSolutions(); i++) {
|
|
70
|
-
const circ2d = solver.ThisSolution(i);
|
|
71
|
-
const center2d = Convert.toPoint2D(circ2d.Location());
|
|
72
|
-
const worldCenter = plane.localToWorld(center2d);
|
|
73
|
-
const r = circ2d.Radius();
|
|
74
|
-
const circle = Geometry.makeCircle(worldCenter, r, plane.normal);
|
|
75
|
-
edges.push(Geometry.makeEdgeFromCircle(circle));
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
return edges;
|
|
79
|
-
}
|
|
80
|
-
static getTangentArcs(plane, qualifiedC1, qualifiedC2, radius) {
|
|
81
|
-
const oc = getOC();
|
|
82
|
-
const solver = TangentSolver.buildCirc2TanSolver(plane, qualifiedC1, qualifiedC2, radius);
|
|
83
|
-
const results = [];
|
|
84
|
-
if (solver.IsDone()) {
|
|
85
|
-
for (let i = 1; i <= solver.NbSolutions(); i++) {
|
|
86
|
-
const circ2d = solver.ThisSolution(i);
|
|
87
|
-
const center2d = Convert.toPoint2D(circ2d.Location());
|
|
88
|
-
const worldCenter = plane.localToWorld(center2d);
|
|
89
|
-
const r = circ2d.Radius();
|
|
90
|
-
const pnt1 = new oc.gp_Pnt2d();
|
|
91
|
-
const pnt2 = new oc.gp_Pnt2d();
|
|
92
|
-
solver.Tangency1(i, 0, 0, pnt1);
|
|
93
|
-
solver.Tangency2(i, 0, 0, pnt2);
|
|
94
|
-
const worldPnt1 = plane.localToWorld(Convert.toPoint2D(pnt1, false));
|
|
95
|
-
const worldPnt2 = plane.localToWorld(Convert.toPoint2D(pnt2, false));
|
|
96
|
-
const angle1 = Math.atan2(pnt1.Y() - center2d.y, pnt1.X() - center2d.x);
|
|
97
|
-
const angle2 = Math.atan2(pnt2.Y() - center2d.y, pnt2.X() - center2d.x);
|
|
98
|
-
pnt1.delete();
|
|
99
|
-
pnt2.delete();
|
|
100
|
-
let diff = angle2 - angle1;
|
|
101
|
-
if (diff > Math.PI) {
|
|
102
|
-
diff -= 2 * Math.PI;
|
|
103
|
-
}
|
|
104
|
-
if (diff < -Math.PI) {
|
|
105
|
-
diff += 2 * Math.PI;
|
|
106
|
-
}
|
|
107
|
-
const midAngle = angle1 + diff / 2;
|
|
108
|
-
const worldMid = plane.localToWorld(new Point2D(center2d.x + r * Math.cos(midAngle), center2d.y + r * Math.sin(midAngle)));
|
|
109
|
-
const arc = Geometry.makeArcThreePoints(worldPnt1, worldMid, worldPnt2);
|
|
110
|
-
const edge = Geometry.makeEdgeFromCurve(arc);
|
|
111
|
-
const sign = diff > 0 ? 1 : -1;
|
|
112
|
-
const endTangent = new Point2D(sign * (-Math.sin(angle2)), sign * Math.cos(angle2));
|
|
113
|
-
results.push({ edge, endTangent });
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
return results;
|
|
117
|
-
}
|
|
118
|
-
static getTangentCircles3Tan(plane, qualifiedC1, qualifiedC2, qualifiedC3) {
|
|
119
|
-
const oc = getOC();
|
|
120
|
-
const tolerance = oc.Precision.Confusion();
|
|
121
|
-
const [pln, disposePln] = Convert.toGpPln(plane);
|
|
122
|
-
const inputs = [
|
|
123
|
-
{ q: qualifiedC1, r: ConstraintResolver.getQualified(pln, qualifiedC1) },
|
|
124
|
-
{ q: qualifiedC2, r: ConstraintResolver.getQualified(pln, qualifiedC2) },
|
|
125
|
-
{ q: qualifiedC3, r: ConstraintResolver.getQualified(pln, qualifiedC3) },
|
|
126
|
-
];
|
|
127
|
-
const circles = inputs.filter(i => i.r.type === 'circle');
|
|
128
|
-
const lines = inputs.filter(i => i.r.type === 'line');
|
|
129
|
-
const curves = inputs.filter(i => i.r.type === 'curve');
|
|
130
|
-
let solver;
|
|
131
|
-
if (curves.length > 0) {
|
|
132
|
-
const qc1 = ConstraintResolver.getQualifiedAsCurve(pln, qualifiedC1);
|
|
133
|
-
const qc2 = ConstraintResolver.getQualifiedAsCurve(pln, qualifiedC2);
|
|
134
|
-
const qc3 = ConstraintResolver.getQualifiedAsCurve(pln, qualifiedC3);
|
|
135
|
-
solver = new oc.Geom2dGcc_Circ2d3Tan(qc1, qc2, qc3, tolerance, 0, 0, 0);
|
|
136
|
-
}
|
|
137
|
-
else if (circles.length === 3) {
|
|
138
|
-
solver = new oc.GccAna_Circ2d3Tan(circles[0].r.qualified, circles[1].r.qualified, circles[2].r.qualified, tolerance);
|
|
139
|
-
}
|
|
140
|
-
else if (circles.length === 2 && lines.length === 1) {
|
|
141
|
-
solver = new oc.GccAna_Circ2d3Tan(circles[0].r.qualified, circles[1].r.qualified, lines[0].r.qualified, tolerance);
|
|
142
|
-
}
|
|
143
|
-
else if (circles.length === 1 && lines.length === 2) {
|
|
144
|
-
solver = new oc.GccAna_Circ2d3Tan(circles[0].r.qualified, lines[0].r.qualified, lines[1].r.qualified, tolerance);
|
|
145
|
-
}
|
|
146
|
-
else {
|
|
147
|
-
solver = new oc.GccAna_Circ2d3Tan(lines[0].r.qualified, lines[1].r.qualified, lines[2].r.qualified, tolerance);
|
|
148
|
-
}
|
|
149
|
-
disposePln();
|
|
150
|
-
const edges = [];
|
|
151
|
-
if (solver.IsDone()) {
|
|
152
|
-
for (let i = 1; i <= solver.NbSolutions(); i++) {
|
|
153
|
-
const circ2d = solver.ThisSolution(i);
|
|
154
|
-
const center2d = Convert.toPoint2D(circ2d.Location());
|
|
155
|
-
const worldCenter = plane.localToWorld(center2d);
|
|
156
|
-
const r = circ2d.Radius();
|
|
157
|
-
const circle = Geometry.makeCircle(worldCenter, r, plane.normal);
|
|
158
|
-
edges.push(Geometry.makeEdgeFromCircle(circle));
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
return edges;
|
|
162
|
-
}
|
|
163
|
-
static buildCirc2TanSolver(plane, qualifiedC1, qualifiedC2, radius) {
|
|
164
|
-
const oc = getOC();
|
|
165
|
-
const tolerance = oc.Precision.Confusion();
|
|
166
|
-
const [pln, disposePln] = Convert.toGpPln(plane);
|
|
167
|
-
const c1 = ConstraintResolver.getQualified(pln, qualifiedC1);
|
|
168
|
-
const c2 = ConstraintResolver.getQualified(pln, qualifiedC2);
|
|
169
|
-
let solver;
|
|
170
|
-
if (c1.type === 'circle' && c2.type === 'circle') {
|
|
171
|
-
solver = new oc.GccAna_Circ2d2TanRad(c1.qualified, c2.qualified, radius, tolerance);
|
|
172
|
-
}
|
|
173
|
-
else if (c1.type === 'circle' && c2.type === 'line') {
|
|
174
|
-
solver = new oc.GccAna_Circ2d2TanRad(c1.qualified, c2.qualified, radius, tolerance);
|
|
175
|
-
}
|
|
176
|
-
else if (c1.type === 'line' && c2.type === 'circle') {
|
|
177
|
-
solver = new oc.GccAna_Circ2d2TanRad(c2.qualified, c1.qualified, radius, tolerance);
|
|
178
|
-
}
|
|
179
|
-
else if (c1.type === 'line' && c2.type === 'line') {
|
|
180
|
-
solver = new oc.GccAna_Circ2d2TanRad(c1.qualified, c2.qualified, radius, tolerance);
|
|
181
|
-
}
|
|
182
|
-
else if (c1.type === 'point' && c2.type === 'point') {
|
|
183
|
-
const localPoint1 = plane.worldToLocal(Convert.toPoint(c1.qualified));
|
|
184
|
-
const localPoint2 = plane.worldToLocal(Convert.toPoint(c2.qualified));
|
|
185
|
-
const [gpPnt1, disposeGpPnt1] = Convert.toGpPnt2d(localPoint1);
|
|
186
|
-
const [gpPnt2, disposeGpPnt2] = Convert.toGpPnt2d(localPoint2);
|
|
187
|
-
solver = new oc.GccAna_Circ2d2TanRad(gpPnt1, gpPnt2, radius, tolerance);
|
|
188
|
-
disposeGpPnt1();
|
|
189
|
-
disposeGpPnt2();
|
|
190
|
-
}
|
|
191
|
-
else {
|
|
192
|
-
const qc1 = ConstraintResolver.getQualifiedAsCurve(pln, qualifiedC1);
|
|
193
|
-
const qc2 = ConstraintResolver.getQualifiedAsCurve(pln, qualifiedC2);
|
|
194
|
-
solver = new oc.Geom2dGcc_Circ2d2TanRad(qc1, qc2, radius, tolerance);
|
|
195
|
-
}
|
|
196
|
-
disposePln();
|
|
197
|
-
return solver;
|
|
198
|
-
}
|
|
199
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { SceneObject } from "../common/scene-object.js";
|
|
2
|
-
import { Shape, ShapeFilter } from "../common/shape.js";
|
|
3
|
-
import { SelectSceneObject } from "../features/select.js";
|
|
4
|
-
import { Extrudable } from "../helpers/types.js";
|
|
5
|
-
export declare class SceneBuilderContext {
|
|
6
|
-
private sceneObjects;
|
|
7
|
-
constructor(sceneObjects: SceneObject[]);
|
|
8
|
-
getSceneObjects(): SceneObject[];
|
|
9
|
-
getObjectShapesMap(filter?: ShapeFilter): Map<SceneObject, Shape<import("occjs-wrapper").TopoDS_Shape>[]>;
|
|
10
|
-
getActiveSceneObjects(): SceneObject[];
|
|
11
|
-
getSceneObjectsFromTo(from: SceneObject, to: SceneObject): SceneObject[];
|
|
12
|
-
getLastExtrudable(): Extrudable;
|
|
13
|
-
getLastSelections(): any[];
|
|
14
|
-
getLastSelection(): SelectSceneObject;
|
|
15
|
-
addObject(obj: SceneObject): void;
|
|
16
|
-
}
|