public void SetVertices(HairyPlotterVertex v0, HairyPlotterVertex v1, HairyPlotterVertex v2) { vertices = new HairyPlotterVertex[3] { v0, v1, v2 }; v0.AddTriangle(this); v1.AddTriangle(this); v2.AddTriangle(this); plotter.Dirty = true; }
public void SwitchVertices(HairyPlotterVertex a, HairyPlotterVertex b) { int aIndex = Array.IndexOf(vertices, a); int bIndex = Array.IndexOf(vertices, b); if (aIndex == -1 && bIndex == -1) { return; } // Switch both if (aIndex > -1 && bIndex > -1) { vertices[bIndex] = a; vertices[aIndex] = b; } // Switch a for b if (aIndex > -1) { vertices[aIndex] = b; a.RemoveTriangle(this); b.AddTriangle(this); } // Switch b for a if (bIndex > -1) { vertices[bIndex] = a; b.RemoveTriangle(this); a.AddTriangle(this); } plotter.Dirty = true; }