using System; namespace Science.Mathematics.VectorCalculus { public class Plane { public Plane() { } private Vector a; private Vector v; private Vector w; private Vector n; private double t, s; public Vector Direction1 { get { return v; } set { v = value; } } public Vector Direction2 { get { return w; } set { w = value; } } public Vector Normal { get { return n; } set { n = value; } } public Vector ThroughTip { get { return a; } set { a = value; } } public double Parameter1 { get { return t; } set { t = value; } } public double Parameter2 { get { return s; } set { s = value; } } public Plane(Vector throughTip, Vector direction1, Vector direction2) { a = throughTip; v = direction1; w = direction2; n = v % w; } public Plane(Point p, Vector normal) { n = normal; a = new Vector(p); if (normal[0] == 0.0) { v = normal % UnitVector.i; w = normal % v; } else if (normal[0] == 0.0) { v = normal % UnitVector.j; w = normal % v; } else { v = normal % UnitVector.k; w = normal % v; } } public Plane(Point p, Point q, Point r) { a = new Vector(p); v = new Vector(p, q); w = new Vector(p, r); n = v % w; } public Vector GetVectorOnPlane() { Vector l = a + t * v + s * w; return l; } } }