bool ConnectVertices( VertexHandle hVertexA, VertexHandle hVertexB, HalfEdgeMesh.HalfEdgeHandle& hNewEdge )

book_4_sparkGenerated
code_blocksInput

Description

The ConnectVertices method in the PolygonMesh class is used to connect two vertices within a mesh by creating a new edge between them. This method is part of the Sandbox namespace and is utilized in mesh editing operations where establishing a direct connection between two vertices is necessary.

Usage

To use the ConnectVertices method, you need to provide two vertex handles, hVertexA and hVertexB, which represent the vertices you want to connect. The method will output a new half-edge handle, hNewEdge, which represents the newly created edge connecting the two vertices.

The method returns a Boolean value indicating whether the operation was successful. A return value of true means the vertices were successfully connected, while false indicates a failure, possibly due to invalid vertex handles or other constraints within the mesh.

Example

// Example usage of ConnectVertices method
PolygonMesh mesh = new PolygonMesh();
HalfEdgeMesh.VertexHandle vertexA = mesh.AddVertex(new Vector3(0, 0, 0));
HalfEdgeMesh.VertexHandle vertexB = mesh.AddVertex(new Vector3(1, 0, 0));
HalfEdgeMesh.HalfEdgeHandle newEdge;

bool success = mesh.ConnectVertices(vertexA, vertexB, out newEdge);

if (success)
{
    // The vertices were successfully connected
    // newEdge now contains the handle to the new edge
}
else
{
    // The connection failed
}