jsketcher/web/app/brep/utils/ray.js
Val Erastov (xibyte) e11c1f7f4a geom module
2020-07-19 22:37:24 -07:00

22 lines
No EOL
544 B
JavaScript

import pertrub from './vector-petrub';
import BrepCurve from '../../../../modules/geom/curves/brepCurve';
export class Ray {
constructor(pt, dir, normal, reachableDistance) {
this.pt = pt;
this.dir = dir;
this.normal = normal;
this.reachableDistance = reachableDistance;
this.updateCurve();
}
updateCurve() {
this.curve = BrepCurve.createLinearCurve(this.pt, this.pt.plus(this.dir.multiply(this.reachableDistance)));
}
pertrub() {
this.dir.set3(pertrub(this.dir.data()));
this.updateCurve();
}
}