public void ReplaceVertex(Vert vo, Vert vnew, Vector2 newUV, Vector3 newVN, History his) { Vector3 vec = vo.position; Vert changedVertex = v2; int changedVertexId = 2; Vector3 changedNormal = vn2; Vector2 changedUV = uv2; if (vec == v0.position) { changedVertex = v0; changedVertexId = 0; changedNormal = vn0; changedUV = uv0; v0 = vnew; vn0 = newVN; uv0 = newUV; } else if (vec == v1.position) { changedVertex = v1; changedVertexId = 1; changedNormal = vn1; changedUV = uv1; v1 = vnew; vn1 = newVN; uv1 = newUV; } else { v2 = vnew; vn2 = newVN; uv2 = newUV; } vo.RemoveFace(this); vnew.AddFace(this); vo.RemoveIfNonNeighbor(v0); v0.RemoveIfNonNeighbor(vo); vo.RemoveIfNonNeighbor(v1); v1.RemoveIfNonNeighbor(vo); vo.RemoveIfNonNeighbor(v2); v2.RemoveIfNonNeighbor(vo); v0.AddNeighbor(v1); v0.AddNeighbor(v2); v1.AddNeighbor(v0); v1.AddNeighbor(v2); v2.AddNeighbor(v0); v2.AddNeighbor(v1); RecalculateNormal(); his.ReplaceVertex(id, changedVertexId, changedVertex.id, changedNormal, changedUV, vnew.id, newVN, newUV); }
public void RemoveTriangle(History his) { v0.RemoveFace(this); v1.RemoveFace(this); v2.RemoveFace(this); v0.RemoveIfNonNeighbor(v1); v0.RemoveIfNonNeighbor(v2); v1.RemoveIfNonNeighbor(v0); v1.RemoveIfNonNeighbor(v2); v2.RemoveIfNonNeighbor(v1); v2.RemoveIfNonNeighbor(v0); deleted = true; his.RemovedTriangle(id); }