mirror of
https://github.com/xibyte/jsketcher
synced 2025-12-07 08:53:25 +01:00
fix nurbs mirroring(left handed coordinate system if working in parametric space)
This commit is contained in:
parent
6dc0c7e2be
commit
cbf54794e6
1 changed files with 15 additions and 5 deletions
|
|
@ -294,6 +294,14 @@ export class NurbsSurface extends Surface {
|
||||||
this.simpleSurface = simpleSurface || figureOutSimpleSurface(this);
|
this.simpleSurface = simpleSurface || figureOutSimpleSurface(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
domainU() {
|
||||||
|
return this.verb.domainU();
|
||||||
|
}
|
||||||
|
|
||||||
|
domainV() {
|
||||||
|
return this.verb.domainV();
|
||||||
|
}
|
||||||
|
|
||||||
middle() {
|
middle() {
|
||||||
let {min: uMin, max: uMax} = this.verb.domainU();
|
let {min: uMin, max: uMax} = this.verb.domainU();
|
||||||
let {min: vMin, max: vMax} = this.verb.domainV();
|
let {min: vMin, max: vMax} = this.verb.domainV();
|
||||||
|
|
@ -370,11 +378,13 @@ export class NurbsSurface extends Surface {
|
||||||
}
|
}
|
||||||
|
|
||||||
static isMirrored(surface) {
|
static isMirrored(surface) {
|
||||||
//TODO: use domain!
|
let {min: uMin} = surface.domainU();
|
||||||
let a = surface.point(0, 0);
|
let {min: vMin} = surface.domainV();
|
||||||
let b = surface.point(1, 0);
|
|
||||||
let c = surface.point(1, 1);
|
let x = surface.isoCurveAlignU(uMin).tangentAtParam(uMin);
|
||||||
return b.minus(a).cross(c.minus(a))._normalize().dot(surface.normalUV(0, 0)) < 0;
|
let y = surface.isoCurveAlignV(vMin).tangentAtParam(vMin);
|
||||||
|
|
||||||
|
return x.cross(y).dot(surface.normalUV(uMin, vMin)) < 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
intersectSurfaceForSameClass(other) {
|
intersectSurfaceForSameClass(other) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue