build/modelscript.umd.js
function(anchor, v1, v2) {
                anchor = vector.create(anchor);
                anchor = anchor.to3D(); if (anchor === null) { return null; }
                v1 = vector.create(v1);
                v1 = v1.to3D(); if (v1 === null) { return null; }
                if (typeof(v2) == 'undefined') {
                  v2 = null;
                } else {
                  v2 = vector.create(v2);
                  v2 = v2.to3D(); if (v2 === null) { return null; }
                }
                var A1 = anchor.elements[0], A2 = anchor.elements[1], A3 = anchor.elements[2];
                var v11 = v1.elements[0], v12 = v1.elements[1], v13 = v1.elements[2];
                var normal, mod;
                if (v2 !== null) {
                  var v21 = v2.elements[0], v22 = v2.elements[1], v23 = v2.elements[2];
                  normal = vector.create([
                    (v12 - A2) * (v23 - A3) - (v13 - A3) * (v22 - A2),
                    (v13 - A3) * (v21 - A1) - (v11 - A1) * (v23 - A3),
                    (v11 - A1) * (v22 - A2) - (v12 - A2) * (v21 - A1)
                  ]);
                  mod = normal.modulus();
                  if (mod === 0) { return null; }
                  normal = vector.create([normal.elements[0] / mod, normal.elements[1] / mod, normal.elements[2] / mod]);
                } else {
                  mod = Math.sqrt(v11*v11 + v12*v12 + v13*v13);
                  if (mod === 0) { return null; }
                  normal = vector.create([v1.elements[0] / mod, v1.elements[1] / mod, v1.elements[2] / mod]);
                }
                this.anchor = anchor;
                this.normal = normal;
                return this;
              }
function(anchor, v1, v2) {
                anchor = vector.create(anchor);
                anchor = anchor.to3D(); if (anchor === null) { return null; }
                v1 = vector.create(v1);
                v1 = v1.to3D(); if (v1 === null) { return null; }
                if (typeof(v2) == 'undefined') {
                  v2 = null;
                } else {
                  v2 = vector.create(v2);
                  v2 = v2.to3D(); if (v2 === null) { return null; }
                }
                var A1 = anchor.elements[0], A2 = anchor.elements[1], A3 = anchor.elements[2];
                var v11 = v1.elements[0], v12 = v1.elements[1], v13 = v1.elements[2];
                var normal, mod;
                if (v2 !== null) {
                  var v21 = v2.elements[0], v22 = v2.elements[1], v23 = v2.elements[2];
                  normal = vector.create([
                    (v12 - A2) * (v23 - A3) - (v13 - A3) * (v22 - A2),
                    (v13 - A3) * (v21 - A1) - (v11 - A1) * (v23 - A3),
                    (v11 - A1) * (v22 - A2) - (v12 - A2) * (v21 - A1)
                  ]);
                  mod = normal.modulus();
                  if (mod === 0) { return null; }
                  normal = vector.create([normal.elements[0] / mod, normal.elements[1] / mod, normal.elements[2] / mod]);
                } else {
                  mod = Math.sqrt(v11*v11 + v12*v12 + v13*v13);
                  if (mod === 0) { return null; }
                  normal = vector.create([v1.elements[0] / mod, v1.elements[1] / mod, v1.elements[2] / mod]);
                }
                this.anchor = anchor;
                this.normal = normal;
                return this;
              }
function ( anchor , v1 , v2 ) { anchor = vector . create ( anchor ) ; anchor = anchor . to3D ( ) ; if ( anchor === null ) { return null ; } v1 = vector . create ( v1 ) ; v1 = v1 . to3D ( ) ; if ( v1 === null ) { return null ; } if ( typeof ( v2 ) == 'undefined' ) { v2 = null ; } else { v2 = vector . create ( v2 ) ; v2 = v2 . to3D ( ) ; if ( v2 === null ) { return null ; } } var A1 = anchor . elements [ 0 ] , A2 = anchor . elements [ 1 ] , A3 = anchor . elements [ 2 ] ; var v11 = v1 . elements [ 0 ] , v12 = v1 . elements [ 1 ] , v13 = v1 . elements [ 2 ] ; var normal , mod ; if ( v2 !== null ) { var v21 = v2 . elements [ 0 ] , v22 = v2 . elements [ 1 ] , v23 = v2 . elements [ 2 ] ; normal = vector . create ( [ ( v12 - A2 ) * ( v23 - A3 ) - ( v13 - A3 ) * ( v22 - A2 ) , ( v13 - A3 ) * ( v21 - A1 ) - ( v11 - A1 ) * ( v23 - A3 ) , ( v11 - A1 ) * ( v22 - A2 ) - ( v12 - A2 ) * ( v21 - A1 ) ] ) ; mod = normal . modulus ( ) ; if ( mod === 0 ) { return null ; } normal = vector . create ( [ normal . elements [ 0 ] / mod , normal . elements [ 1 ] / mod , normal . elements [ 2 ] / mod ] ) ; } else { mod = Math . sqrt ( v11 * v11 + v12 * v12 + v13 * v13 ) ; if ( mod === 0 ) { return null ; } normal = vector . create ( [ v1 . elements [ 0 ] / mod , v1 . elements [ 1 ] / mod , v1 . elements [ 2 ] / mod ] ) ; } this . anchor = anchor ; this . normal = normal ; return this ; }
Sets the anchor point and normal to the plane. If three arguments are specified, the normal is calculated by assuming the three points should lie in the same plane. If only two are sepcified, the second is taken to be the normal. Normal vector is normalised before storage.
Sets the anchor point and normal to the plane . If three arguments are specified the normal is calculated by assuming the three points should lie in the same plane . If only two are sepcified the second is taken to be the normal . Normal vector is normalised before storage .