public Splice ( LibTessDotNet.MeshUtils.Edge eOrg, LibTessDotNet.MeshUtils.Edge eDst ) : void | ||
eOrg | LibTessDotNet.MeshUtils.Edge | |
eDst | LibTessDotNet.MeshUtils.Edge | |
리턴 | void |
public void Splice(MeshUtils.Edge eOrg, MeshUtils.Edge eDst)
{
if (eOrg == eDst)
{
return;
}
bool joiningVertices = false;
if (eDst._Org != eOrg._Org)
{
// We are merging two disjoint vertices -- destroy eDst->Org
joiningVertices = true;
MeshUtils.KillVertex(eDst._Org, eOrg._Org);
}
bool joiningLoops = false;
if (eDst._Lface != eOrg._Lface)
{
// We are connecting two disjoint loops -- destroy eDst->Lface
joiningLoops = true;
MeshUtils.KillFace(eDst._Lface, eOrg._Lface);
}
// Change the edge structure
MeshUtils.Splice(eDst, eOrg);
if (!joiningVertices)
{
// We split one vertex into two -- the new vertex is eDst->Org.
// Make sure the old vertex points to a valid half-edge.
MeshUtils.MakeVertex(eDst, eOrg._Org);
eOrg._Org._anEdge = eOrg;
}
if (!joiningLoops)
{
// We split one loop into two -- the new loop is eDst->Lface.
// Make sure the old face points to a valid half-edge.
MeshUtils.MakeFace(eDst, eOrg._Lface);
eOrg._Lface._anEdge = eOrg;
}
}
public void AddContour(ContourVertex[] vertices, ContourOrientation forceOrientation) { if (_mesh == null) { _mesh = new Mesh(); } bool flag = false; if (forceOrientation != 0) { float num = SignedArea(vertices); flag = ((forceOrientation == ContourOrientation.Clockwise && num < 0f) || (forceOrientation == ContourOrientation.CounterClockwise && num > 0f)); } MeshUtils.Edge edge = null; for (int i = 0; i < vertices.Length; i++) { if (edge == null) { edge = _mesh.MakeEdge(); Mesh mesh = _mesh; MeshUtils.Edge edge2 = edge; mesh.Splice(edge2, edge2._Sym); } else { _mesh.SplitEdge(edge); edge = edge._Lnext; } int num2 = flag ? (vertices.Length - 1 - i) : i; edge._Org._coords = vertices[num2].Position; edge._Org._data = vertices[num2].Data; edge._winding = 1; edge._Sym._winding = -1; } }