function defineline(p1,p2) {
var l={};l.m={};l.b={};l.t=""
var dx=(p1.x-p2.x);var dy=(p1.y-p2.y);var dz=(p1.z-p2.z)
if (dx=0){if (dy=0){l.t="vh";l.b.x=p1.x;l.b.y=p1.y}
else {l.t="v";l.b.x=p1.x;l.m.zy=dz/dy;l.b.y=p1.y*-1*l.m.zy}}
else {l.t="n";l.m.yx=dy/dx;l.m.zx=dz/dx;l.b.y=b1.y*-1*l.m.yx;l.b.z=b1.z*-1*l.m.zx}
return l}
given three points that define a plane, p1, p2, and p3
cases
1) all three points have the same y value
2) two of the points have the same y value
3) none of the points have the same y value
var p = {} creates the plane object
var pn = {} creates a point object
to define a point object we will assign values to pn.x, pn.y, and pn.z
having defined three point objects, p1, p2, and p3
we can assign them to a plane object
p.p1 = p1; p.p2 = p2; p.p3 = p3
var aplane = definetheplane(p) {}
function definetheplane(p) {
if (p.p1.y === p.p2.y && p.p1.y === p.p3.y) {
p.t = "p" // the plane's type is "p", the plane is parallel to the xz plane
p.v = p.p1.y // the forumla for a type p plane is y = p.v where v means "value"
return p}
else if (p.p1.y != p.p2.y && p.p1.y != p.p3.y && p.p2.y != p.p3.y) {
return definetype3plane(p)}
else {return definetype2plane(p)}}
function definetype3plane(p) {
// find two xz intercepts
//