build/modelscript.umd.js
function(obj) {
                if (obj.normal) {
                  // obj is a plane
                  var V = this.line.intersectionWith(obj);
                  if (V === null) { return null; }
                  return this.pointClosestTo(V);
                } else {
                  // obj is a line (segment) or point
                  var P = this.line.pointClosestTo(obj);
                  if (P === null) { return null; }
                  if (this.contains(P)) { return P; }
                  return (this.line.positionOf(P) < 0 ? this.start : this.end).dup();
                }
              }
function(obj) {
                if (obj.normal) {
                  // obj is a plane
                  var V = this.line.intersectionWith(obj);
                  if (V === null) { return null; }
                  return this.pointClosestTo(V);
                } else {
                  // obj is a line (segment) or point
                  var P = this.line.pointClosestTo(obj);
                  if (P === null) { return null; }
                  if (this.contains(P)) { return P; }
                  return (this.line.positionOf(P) < 0 ? this.start : this.end).dup();
                }
              }
function ( obj ) { if ( obj . normal ) { // obj is a plane var V = this . line . intersectionWith ( obj ) ; if ( V === null ) { return null ; } return this . pointClosestTo ( V ) ; } else { // obj is a line (segment) or point var P = this . line . pointClosestTo ( obj ) ; if ( P === null ) { return null ; } if ( this . contains ( P ) ) { return P ; } return ( this . line . positionOf ( P ) < 0 ? this . start : this . end ) . dup ( ) ; } }
Returns the point on the line segment closest to the given object
Returns the point on the line segment closest to the given object