Overview

The RoseMeshTopology class computes and validates the topology of a RoseMesh.

A mesh contains only vertices, facets and normals; the RoseMeshTopology class builds additional information about edges that exist between the facets so that an application can determine which facets are adjacent to each other for geometric analysis. This class also contain functions to validate that a mesh is watertight and facets are correctly oriented.

To use this class, call the init() function, passing in a RoseMesh. The mesh must be complete, this topology class should not be used on a mesh that is still under construction. After that, the application can use the query and validation functions.

An edge is a line segment connecting two points. In a well-formed mesh, each edge borders exactly two facets. The vertices associated with an edge can be obtained using the getEdgeVertex() function. The facets adjoining an edge can be retrieved with the getEdgeFacet() function. The edges on a facet can be obtained using the getFacetEdge() function. As with vertices and facets in RoseMesh, the edges are identified by index. Empty values, as in a poorly formed mesh, are identified by the ROSE_NOTFOUND constant.

The rose_mesh_topology_dump() function will write out the topology information for a mesh.

findVertexEdges()

void findVertexEdges(
        rose_uint_vector * edges, 
        unsigned v
	);

The findVertexEdges() function computes the edges that contain a given vertex, and places them in the given vector. The vector is emptied before any new items are added to it.

See Also

findVertexFacets(), findVertexFacetsEdges(), RoseMeshTopologyVertexCursor

findVertexFacets()

void findVertexFacets(
        rose_uint_vector * facets, 
        unsigned v
	);

The findVertexFacets() function finds the facets that contain a given vertex, and places them in the given vector. The vector is emptied before any new items are added to it.

See Also

findVertexEdges(), findVertexFacetsEdges(), RoseMeshTopologyVertexCursor

findVertexFacetsEdges()

void findVertexFacetsEdges(
        rose_uint_vector * facets, 
        rose_uint_vector * edges, 
        unsigned v
	);

The findVertexFacetsEdges() function finds the edges and facets that contain a given vertex, and places them in the given vectors. The vector is emptied before any new items are added to it.

See Also

findVertexEdges(), findVertexFacets(), RoseMeshTopologyVertexCursor

getEdge()

unsigned getEdge(
        unsigned v1, 
        unsigned v2
	);

The getEdge() function returns the index of edge connecting the two given vertices. It returns ROSE_NOTFOUND if no edge exists between them.

getEdgeCount()

unsigned getEdgeCount();

The getEdgeCount() function returns the number of edges in the facet set.

getEdgeFacet()

unsigned getEdgeFacet(
        unsigned e, 
        unsigned i
	);

The getEdgeFacet() function returns a facet that shares the edge. The e parameter is the index of the edge, and the i parameter is 0 or 1 indicating the two facets which share the edge.

getEdgeVertex()

unsigned getEdgeVertex(
        unsigned e, 
        unsigned i
	);

The getEdgeVertex() function returns a vertex on an edge. The e parameter is the index of the edge, and the i parameter is 0 or 1 indicating the point on that edge.

getFacetCount()

unsigned getFacetCount();

The getFacetCount() function returns the number of facets in the mesh.

getFacetEdge()

unsigned getFacetEdge(
        unsigned f, 
        unsigned i
	);

The getFacetEdge() function returns an edge of a facet. The f parameter is the index of the facet (same as in the underlying mesh), and the i parameter is which edge to get: either 0, 1, or 2. Edge 0 is the edge between vertex 0 and 1, edge 1 is between vertex 1 and 2, and edge 3 is between vertex 2 and 0.

getFacetSet()

const RoseMesh * getFacetSet();

The getFacetSet() function returns the mesh associated with this this topology structure.

getFacetVertex()

unsigned getFacetVertex(
        unsigned f, 
        unsigned i
	);

The getFacetVertex() function one vertex of a facet. The f parameter is the index of the facet (same as in the underlying mesh), and the i parameter is which vertex to get: either 0, 1, or 2. This is simply a wrapper that calls getFacet() on the underlying mesh and returns the vertex of the coorect index.

getFirstVertexFacet()

unsigned getFirstVertexFacet(
        unsigned v_idx
	);

The getFirstVertexFacet() function returns one of the facets that have a given vertex.

getNeighborFacetByEdge()

void getNeighborFacetByEdge (
        unsigned facet,
        unsinged edge,
	);

The getNeighborFacetByEdge() function returns the facet that is the neighbor of the facet parameter, and contains the edge given by the edge parameter.

getNeighborFacetByIndex()

void getNeighborFacetByIndex (
        unsigned facet,
        unsinged idx,
	);

The getNeighborFacetByIndex() function returns the neighboring facets. The idx parameter identifies the neighbor by the common edge. Edge 0 is the edge between vertex 0 and 1, edge 1 is between vertex 1 and 2, and edge 3 is between vertex 2 and 0.

init()

virtual void init(
        const RoseMesh * facets
	);

The init() function builds the topology information for a given mesh. The mesh must be complete and should not be deleted until the application is finished with the topology object.

validate()

int validate();

The validate() function calls all of the other validate functions and returns true they all indicate that the mesh is well-formed, false otherwise.

validateEdgeUsage()

int validateEdgeUsage();

The validateEdgeUsage() function return true if all the edges are part of exactly two facets, false otherwise.

validateEdgesUnique()

int validateEdgesUnique();

The validateEdgesUnique() function validates that every edge in the mesh is unique. An edge is unique is no other edge contains the same two end vertices.

validateFaceSenses()

int validateFaceSenses();

The validateFaceSenses() function checks that all of the factes of the mesh have the same orientation or sense. (e.g. all facets are facing outward).

validateFaceSensesOnEdge()

int validateFaceSensesOnEdge(
        unsigned e
	);

The validateFaceSensesOnEdge() function checks that the two facets on an edge have the same orientation.