components/utils/scripts/sylvester.js
function(obj) {
    if (obj.normal) {
      // obj is a plane
      var A = this.anchor.elements, D = this.direction.elements;
      var A1 = A[0], A2 = A[1], A3 = A[2], D1 = D[0], D2 = D[1], D3 = D[2];
      var newA = this.anchor.reflectionIn(obj).elements;
      // Add the line's direction vector to its anchor, then mirror that in the plane
      var AD1 = A1 + D1, AD2 = A2 + D2, AD3 = A3 + D3;
      var Q = obj.pointClosestTo([AD1, AD2, AD3]).elements;
      var newD = [Q[0] + (Q[0] - AD1) - newA[0], Q[1] + (Q[1] - AD2) - newA[1], Q[2] + (Q[2] - AD3) - newA[2]];
      return Line.create(newA, newD);
    } else if (obj.direction) {
      // obj is a line - reflection obtained by rotating PI radians about obj
      return this.rotate(Math.PI, obj);
    } else {
      // obj is a point - just reflect the line's anchor in it
      var P = obj.elements || obj;
      return Line.create(this.anchor.reflectionIn([P[0], P[1], (P[2] || 0)]), this.direction);
    }
  }
function(obj) {
    if (obj.normal) {
      // obj is a plane
      var A = this.anchor.elements, D = this.direction.elements;
      var A1 = A[0], A2 = A[1], A3 = A[2], D1 = D[0], D2 = D[1], D3 = D[2];
      var newA = this.anchor.reflectionIn(obj).elements;
      // Add the line's direction vector to its anchor, then mirror that in the plane
      var AD1 = A1 + D1, AD2 = A2 + D2, AD3 = A3 + D3;
      var Q = obj.pointClosestTo([AD1, AD2, AD3]).elements;
      var newD = [Q[0] + (Q[0] - AD1) - newA[0], Q[1] + (Q[1] - AD2) - newA[1], Q[2] + (Q[2] - AD3) - newA[2]];
      return Line.create(newA, newD);
    } else if (obj.direction) {
      // obj is a line - reflection obtained by rotating PI radians about obj
      return this.rotate(Math.PI, obj);
    } else {
      // obj is a point - just reflect the line's anchor in it
      var P = obj.elements || obj;
      return Line.create(this.anchor.reflectionIn([P[0], P[1], (P[2] || 0)]), this.direction);
    }
  }
function ( obj ) { if ( obj . normal ) { // obj is a plane
 var A = this . anchor . elements , D = this . direction . elements ; var A1 = A [ 0 ] , A2 = A [ 1 ] , A3 = A [ 2 ] , D1 = D [ 0 ] , D2 = D [ 1 ] , D3 = D [ 2 ] ; var newA = this . anchor . reflectionIn ( obj ) . elements ; // Add the line's direction vector to its anchor, then mirror that in the plane
 var AD1 = A1 + D1 , AD2 = A2 + D2 , AD3 = A3 + D3 ; var Q = obj . pointClosestTo ( [ AD1 , AD2 , AD3 ] ) . elements ; var newD = [ Q [ 0 ] + ( Q [ 0 ] - AD1 ) - newA [ 0 ] , Q [ 1 ] + ( Q [ 1 ] - AD2 ) - newA [ 1 ] , Q [ 2 ] + ( Q [ 2 ] - AD3 ) - newA [ 2 ] ] ; return Line . create ( newA , newD ) ; } else if ( obj . direction ) { // obj is a line - reflection obtained by rotating PI radians about obj
 return this . rotate ( Math . PI , obj ) ; } else { // obj is a point - just reflect the line's anchor in it
 var P = obj . elements || obj ; return Line . create ( this . anchor . reflectionIn ( [ P [ 0 ] , P [ 1 ] , ( P [ 2 ] || 0 ) ] ) , this . direction ) ; } }
Returns the line's reflection in the given point or line
Returns the line s reflection in the given point or line