/// <summary> /// V is an enhanced vector 3, heavily used by the algorithm. /// </summary> /// <param name="position">Vertex position eular space.</param> /// <param name="parent">Polychop parent - to prevent having static variables.</param> public V(Vec3 position, Polychop parent) { this.parent = parent; this.position = position; centerCost = position.SquaredMagnitude(); objDist = float.NaN; }
/// <summary> /// Creates a triangle, which is basicly a V[3] with a extra few functionalities. /// Counter-clockwise vertex order expected. /// </summary> /// <param name="firstVertex">First vertex</param> /// <param name="secondVertex">Second</param> /// <param name="thirdVertex">Third</param> /// <param name="p"></param> public T(V firstVertex, V secondVertex, V thirdVertex, Polychop p) { parent = p; vert = new V[] { firstVertex, secondVertex, thirdVertex }; vert[0].face.Add(this); vert[1].face.Add(this); vert[2].face.Add(this); vert[0].neighbor.Add(vert[1]); vert[0].neighbor.Add(vert[2]); vert[1].neighbor.Add(vert[0]); vert[1].neighbor.Add(vert[2]); vert[2].neighbor.Add(vert[0]); vert[2].neighbor.Add(vert[1]); ComputeNormal(); }