public bool contains(Vertex v) { //Console.WriteLine("\n"); foreach (Plane p in planes) { //Console.WriteLine(v.position + " " + p.getNormal() + " " + p.getD()); //Console.WriteLine(Vector3.Dot(v.position, p.getNormal()) + p.getD()); if(Vector3.Dot(v.position, p.getNormal()) + p.getD() > 0.04) return false; } return true; }
public Vertex(Vertex other) { position = new Vector3(other.position.X, other.position.Y, other.position.Z); }
//might need to convert these floats to doubles for accuracy sake public Vertex getIntersection(Vector3 n1, Vector3 n2, Vector3 n3, float d1, float d2, float d3) { float denom = Vector3.Dot(n1, Vector3.Cross(n2, n3)); if (denom == 0) return null; //p = -d1 * ( n2.Cross ( n3 ) ) – d2 * ( n3.Cross ( n1 ) ) – d3 * ( n1.Cross ( n2 ) ) / denom; Vertex v = new Vertex(Vector3.Multiply(Vector3.Multiply(Vector3.Cross(n2, n3), -d1) + Vector3.Multiply(Vector3.Cross(n3,n1), -d2) + Vector3.Multiply(Vector3.Cross(n1, n2), -d3), 1/denom)); return v; }