mirror of
https://github.com/xibyte/jsketcher
synced 2025-12-15 21:05:22 +01:00
nurbs curve support for unmanaged objects
This commit is contained in:
parent
1fb0c6f451
commit
bfbde56b00
2 changed files with 18 additions and 9 deletions
|
|
@ -47,10 +47,12 @@ export class UnmanagedSceneSolid extends SceneSolid {
|
|||
tr = tr[0];
|
||||
}
|
||||
tr.forEach(p => geom.vertices.push(vec(p)));
|
||||
if (!normales && faceData.surface.TYPE === 'PLANE') {
|
||||
normales = vec(faceData.surface.normal);
|
||||
if (faceData.inverted) {
|
||||
normales.negate();
|
||||
if (!normales) {
|
||||
if (faceData.surface.normal) {
|
||||
normales = vec(faceData.surface.normal);
|
||||
if (faceData.inverted) {
|
||||
normales.negate();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (faceData.inverted) {
|
||||
|
|
@ -61,12 +63,19 @@ export class UnmanagedSceneSolid extends SceneSolid {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
let testNormal = Array.isArray(normales) ? normalizedSumOfTHREE(normales) : normales;
|
||||
let indices = [off, off + 1, off + 2];
|
||||
let trNormal = normalOfCCWSeqTHREE(indices.map(i => geom.vertices[i]));
|
||||
if (testNormal.dot(trNormal) < 0) {
|
||||
indices.reverse();
|
||||
if (normales) {
|
||||
let testNormal = Array.isArray(normales) ? normalizedSumOfTHREE(normales) : normales;
|
||||
if (testNormal.dot(trNormal) < 0) {
|
||||
indices.reverse();
|
||||
}
|
||||
} else {
|
||||
normales = trNormal;
|
||||
if (faceData.inverted) {
|
||||
normales.negate();
|
||||
indices.reverse();
|
||||
}
|
||||
}
|
||||
let [a, b, c] = indices;
|
||||
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ class SketchPrimitive {
|
|||
}
|
||||
|
||||
isCurve() {
|
||||
return this.constructor.name != 'Segment';
|
||||
return this.constructor.name !== 'Segment';
|
||||
}
|
||||
|
||||
toNurbs(plane) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue