Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

NhalfEdge Class Reference

#include <NhalfEdge.h>

Inheritance diagram for NhalfEdge:

Inheritance graph
[legend]
Collaboration diagram for NhalfEdge:

Collaboration graph
[legend]
List of all members.

Detailed Description

half edge for use with half-edge mesh data structure

Definition at line 30 of file NhalfEdge.h.

Public Member Functions

constructors
 NhalfEdge ()
 basic constructor

 NhalfEdge (NhalfEdgeVertex *v1, NhalfEdgeVertex *v2)
 another constructor

 NhalfEdge (NhalfEdgeVertex *v1, NhalfEdgeVertex *v2, const R32 weight)
 another constructor

destruction and deallocation
 ~NhalfEdge ()
 basic destructor

void clear ()
 clear the edge

check for properties of the edge
BOOL isVisited () const
 test whether edge has been visited

BOOL isDeleted () const
 test whether edge has been deleted

BOOL isActive () const
 test whether edge is active

BOOL isContractable ()
 test whether edge may be contracted

BOOL onPartition () const
 test wheter edge straddles a partition

BOOL operator< (const NhalfEdge &edge)
 less than operator

BOOL operator> (const NhalfEdge &edge)
 greator than operator

BOOL operator<= (const NhalfEdge &edge)
 less than equals operator

get information about the edge
NhalfEdgeVertexgetVertexA () const
 get the "from" vertex of the edge

NhalfEdgeVertexgetVertexB () const
 get the "to" vertex of the edge

R32 getWeight () const
 get the edge weight

NhalfEdgegetOpposite () const
 get the opposite for the edge

NhalfEdgegetNext () const
 get the next for the edge

NhalfEdgegetPrevious () const
 get the previous for the edge

set information about the edge
void setVisited (const BOOL visited)
 set the edge visited or not

void setActive (const BOOL active)
 set the edge active or not

void setDeleted (const BOOL deleted)
 set the edge deleted or not

void setWeight (const R32 weight)
 set the edge weight

void addToWeight (const R32 weight)
 add to the edge weight

void setNext (NhalfEdge *pEdge)
 set the next for the edge

void setOpposite (NhalfEdge *pEdge)
 set the opposite for the edge


Protected Member Functions

special operations on the edge
void reconnectPrevious () const
 special op for deletion

void disconnectFromOpposite () const
 special op for deletion

U32 getIndex () const
 get the index for the edge

void setIndex (const U32 index)
 set the index for the edge


Protected Attributes

NhalfEdgeVertexm_pVertexA
 pointer to start vertex

NhalfEdgeVertexm_pVertexB
 pointer to edge vertex

NhalfEdgem_pOpposite
 pointer to opposite vertex

NhalfEdgem_pNext
 pointer to next vertex

R32 m_weight
 edge weight

U32 m_attributeMask
 attribute mash

U32 m_index
 index ..only should be accessed by halfEdgeMesh


Friends

class NhalfEdgeMesh
class NhalfEdgeVertex


Constructor & Destructor Documentation

NhalfEdge::NhalfEdge  ) 
 

basic constructor

Definition at line 7 of file NhalfEdge.cpp.

References clear(), FALSE, setActive(), setDeleted(), setVisited(), and TRUE.

Referenced by NhalfEdge().

NhalfEdge::NhalfEdge NhalfEdgeVertex pVertex1,
NhalfEdgeVertex pVertex2
 

another constructor

Parameters:
pVertex1 pointer to vertex at start of half edge
pVertex2 pointer to vertex at end of half edge

Definition at line 34 of file NhalfEdge.cpp.

References clear(), FALSE, getOpposite(), m_pVertexA, m_pVertexB, setActive(), setDeleted(), setOpposite(), setVisited(), and TRUE.

NhalfEdge::NhalfEdge NhalfEdgeVertex pVertex1,
NhalfEdgeVertex pVertex2,
const R32  weight
 

another constructor

Parameters:
pVertex1 pointer to vertex at start of half edge
pVertex2 pointer to vertex at end of half edge
weight the weight for the edge

Definition at line 22 of file NhalfEdge.cpp.

References NhalfEdge(), R32, and setWeight().

NhalfEdge::~NhalfEdge  ) 
 

basic destructor

Definition at line 54 of file NhalfEdge.cpp.

References clear().


Member Function Documentation

void NhalfEdge::addToWeight const R32  weight  ) 
 

add to the edge weight

Parameters:
weight add any floating point number to existing edge weight
See also:
getWeight()

setWeight()

Definition at line 441 of file NhalfEdge.cpp.

References isDeleted(), m_weight, and R32.

Referenced by NhalfEdgeMesh::collapseEdge().

void NhalfEdge::clear  ) 
 

clear the edge

Definition at line 62 of file NhalfEdge.cpp.

References m_attributeMask, m_pNext, m_pOpposite, m_pVertexA, m_pVertexB, and m_weight.

Referenced by NhalfEdge(), and ~NhalfEdge().

void NhalfEdge::disconnectFromOpposite  )  const [protected]
 

special op for deletion

halfEdge.gif
Note:
this is merely a convenience operation
  • example: if "this" is edge C then D.setOpposite(NULL) gets called. This means that C.getOpposite() == D but D.getOpposite() == NULL it's convenient to use this operation when you want to deactivate C temporarily, or it C is being deleted.
See also:
setActive()

setDeleted()

Definition at line 380 of file NhalfEdge.cpp.

References isDeleted(), and setOpposite().

Referenced by NhalfEdgeMesh::activatePartition(), NhalfEdgeMesh::deleteEdge(), NhalfEdgeMesh::deleteFace(), and NhalfEdgeMesh::deleteVertex().

U32 NhalfEdge::getIndex  )  const [protected]
 

get the index for the edge

allows for fast deletion and finding

Returns:
the index assigned to vertex by NhalfEdgeMesh

Definition at line 119 of file NhalfEdge.cpp.

References U32.

NhalfEdge * NhalfEdge::getNext  )  const
 

get the next for the edge

the edge that is next in the "ring" in clockwise order

halfEdge.gif
Note:
edge edge MUST half a next.. otherwise the mesh is invaid/non manifold
  • example: if "this" is edge A then getNext() returns a pointer to edge B
  • example: if "this" is edge D then getNext() returns a pointer to edge E
See also:
setNext()

getOpposite()

setOpposite()

Returns:
returns a pointer to the next edge

Reimplemented in gmEdge, and ParticleEdge.

Definition at line 311 of file NhalfEdge.cpp.

Referenced by NhalfEdgeMesh::activatePartition(), NhalfEdgeMesh::collapseEdge(), NhalfEdgeMesh::deleteFace(), NhalfEdgeMesh::deleteVertex(), NhalfEdgeVertex::getNeighbors(), ParticleEdge::getNext(), gmEdge::getNext(), getPrevious(), isContractable(), NhalfEdgeVertex::isMovable(), reconnectPrevious(), and NhalfEdgeMesh::uncollapseVertex().

NhalfEdge * NhalfEdge::getOpposite  )  const
 

get the opposite for the edge

halfEdge.gif
Note:
every edge has at most one opposite. hence this structure does not support non-manifold meshes.
  • example: if "this" is edge C then getOpposite() returns a pointer to edge D
  • example: if "this" is edge A then getOpposite() returns NULL
See also:
getNext()

setNext()

setOpposite()

Returns:
returns a pointer to the Opposite edge

Reimplemented in gmEdge, and ParticleEdge.

Definition at line 293 of file NhalfEdge.cpp.

Referenced by NhalfEdgeVertex::addEdge(), NhalfEdgeMesh::collapseEdge(), NhalfEdgeVertex::getNeighbors(), ParticleEdge::getOpposite(), gmEdge::getOpposite(), NhalfEdge(), and NhalfEdgeVertex::removeEdge().

NhalfEdge * NhalfEdge::getPrevious  )  const
 

get the previous for the edge

the edge that is previous in the "ring" in clockwise order slow.. method traverses ring to get edge...

halfEdge.gif
Note:
edge edge MUST half a previous.. otherwise the mesh is invaid/non manifold. each edge does not explicity store a pointer to its previous.. it only knows what its next is. Hence get previous is implemented by performing a series of getNext() operations, traversing around the ring of half edges
  • example: if "this" is edge A then getNext() returns a pointer to edge C
  • example: if "this" is edge D then getNext() returns a pointer to edge F
See also:
setNext()

getNext()

Returns:
returns a pointer to the previoius edge if complete ring of clockwise edges exist

Reimplemented in gmEdge, and ParticleEdge.

Definition at line 332 of file NhalfEdge.cpp.

References getNext().

Referenced by NhalfEdgeMesh::deleteFace(), ParticleEdge::getPrevious(), and gmEdge::getPrevious().

NhalfEdgeVertex * NhalfEdge::getVertexA  )  const
 

get the "from" vertex of the edge

halfEdge.gif
Note:
every edge must be connected to two vertices.. a "from" vertex (e.g. vertexA) and a "to" vertex (e.g. vertexB )
  • example: if "this" is edge A then getVertexA() returns a pointer to vertex 3
See also:
getVertexB();
Returns:
returns vertex that the edge is leaving from

Reimplemented in gmEdge, and ParticleEdge.

Definition at line 257 of file NhalfEdge.cpp.

Referenced by NhalfEdgeMesh::activatePartition(), NhalfEdgeVertex::addEdge(), NhalfEdgeMesh::addHalfEdge(), NhalfEdgeMesh::collapseEdge(), NhalfEdgeMesh::deleteEdge(), NhalfEdgeMesh::deleteFace(), NhalfEdgeMesh::deleteVertex(), NhalfEdgeVertex::findEdge(), NhalfEdgeVertex::getNeighbors(), ParticleEdge::getVertexA(), gmEdge::getVertexA(), isContractable(), NhalfEdgeVertex::removeEdge(), and NhalfEdgeMesh::uncollapseVertex().

NhalfEdgeVertex * NhalfEdge::getVertexB  )  const
 

get the "to" vertex of the edge

halfEdge.gif
Note:
every edge must be connected to two vertices.. a "from" vertex (e.g. vertexA) and a "to" vertex (e.g. vertexB )
  • example: if "this" is edge A then getVertexB() returns a pointer to vertex 1
See also:
getVertexA();
Returns:
returns vertex that the edge is going to

Reimplemented in gmEdge, and ParticleEdge.

Definition at line 273 of file NhalfEdge.cpp.

Referenced by NhalfEdgeMesh::activatePartition(), NhalfEdgeVertex::addEdge(), NhalfEdgeMesh::addHalfEdge(), NhalfEdgeMesh::collapseEdge(), NhalfEdgeMesh::deleteEdge(), NhalfEdgeMesh::deleteFace(), NhalfEdgeMesh::deleteVertex(), NhalfEdgeVertex::findEdge(), NhalfEdgeVertex::getNeighbors(), ParticleEdge::getVertexB(), gmEdge::getVertexB(), isContractable(), NhalfEdgeVertex::isMovable(), NhalfEdgeMesh::partitionFromConnectedness(), NhalfEdgeVertex::removeEdge(), and NhalfEdgeMesh::uncollapseVertex().

R32 NhalfEdge::getWeight  )  const
 

get the edge weight

See also:
setWeight();

addToWeight();

Returns:
returns weight of the edge

Definition at line 415 of file NhalfEdge.cpp.

References R32.

Referenced by NhalfEdgeMesh::collapseEdge(), and NhalfEdgePtrSort::operator()().

BOOL NhalfEdge::isActive  )  const
 

test whether edge is active

See also:
setDeleted()
Returns:
returns true if edge is active

Definition at line 167 of file NhalfEdge.cpp.

References BOOL, FALSE, and N_EDGE_ACTIVE.

Referenced by NhalfEdgeMesh::activateEdge(), NhalfEdgeMesh::activatePartition(), NhalfEdgeVertex::findEdge(), NhalfEdgeVertex::getNeighbors(), and NhalfEdgeMesh::isInHalfEdgeMesh().

BOOL NhalfEdge::isContractable  ) 
 

test whether edge may be contracted

Note:
not all edges may be contracted. The simple reason is that topological degeneracies may get created.
Returns:
returns true if edge is contractable

Definition at line 455 of file NhalfEdge.cpp.

References BOOL, FALSE, NhalfEdgeVertex::findEdge(), NhalfEdgeVertex::getNeighbors(), getNext(), getVertexA(), getVertexB(), isDeleted(), and TRUE.

Referenced by NhalfEdgeMesh::collapseEdge().

BOOL NhalfEdge::isDeleted  )  const
 

test whether edge has been deleted

See also:
setDeleted()
Returns:
returns true if edge has been deleted

Definition at line 191 of file NhalfEdge.cpp.

References BOOL, and N_EDGE_DELETED.

Referenced by NhalfEdgeMesh::activatePartition(), addToWeight(), disconnectFromOpposite(), isContractable(), NhalfEdgeMesh::isInHalfEdgeMesh(), operator<(), operator<=(), operator>(), reconnectPrevious(), setActive(), setIndex(), setNext(), setOpposite(), setVisited(), and setWeight().

BOOL NhalfEdge::isVisited  )  const
 

test whether edge has been visited

See also:
setVisited()
Returns:
returns true if edge has been visited

Definition at line 141 of file NhalfEdge.cpp.

References BOOL, and N_EDGE_VISITED.

Referenced by ModButterflySubdivision::subdivide().

BOOL NhalfEdge::onPartition  )  const
 

test wheter edge straddles a partition

See also:
setDeleted()
Returns:
returns true if edge connects vertices in different partitions

Definition at line 400 of file NhalfEdge.cpp.

References BOOL, FALSE, and TRUE.

BOOL NhalfEdge::operator< const NhalfEdge edge  ) 
 

less than operator

Note:
uses the edges weights to compare one edge to another
Parameters:
edge an edge
See also:
getWeight

setWeight less than comparison based on edge weight

Definition at line 77 of file NhalfEdge.cpp.

References BOOL, edge, isDeleted(), and m_weight.

BOOL NhalfEdge::operator<= const NhalfEdge edge  ) 
 

less than equals operator

Note:
uses the edges weights to compare one edge to another
Parameters:
edge an edge
See also:
getWeight

setWeight less than equals comparison based on edge weight

Definition at line 107 of file NhalfEdge.cpp.

References BOOL, edge, isDeleted(), and m_weight.

BOOL NhalfEdge::operator> const NhalfEdge edge  ) 
 

greator than operator

Note:
uses the edges weights to compare one edge to another
Parameters:
edge an edge
See also:
getWeight

setWeight greator than comparison based on edge weight

Definition at line 92 of file NhalfEdge.cpp.

References BOOL, edge, isDeleted(), and m_weight.

void NhalfEdge::reconnectPrevious  )  const [protected]
 

special op for deletion

halfEdge.gif
Note:
complex convenience operation for maintain a mesh undergoing deletions
  • example if "this" is edge D, then edge F's next pointer is set to edge A. This is convenient for deleting edges. Tae for example if we called this operation on both edges C and D, then deleted edges C and D, then a perfect ring A->B->E->F->A... remains helpful utility when deleting this edge.

Definition at line 352 of file NhalfEdge.cpp.

References getNext(), isDeleted(), and setNext().

Referenced by NhalfEdgeMesh::deleteEdge().

void NhalfEdge::setActive const BOOL  active  ) 
 

set the edge active or not

Parameters:
active "TRUE" for active or "FALSE" for deactivated
See also:
isActive();

Definition at line 177 of file NhalfEdge.cpp.

References BOOL, isDeleted(), m_attributeMask, and N_EDGE_ACTIVE.

Referenced by NhalfEdgeMesh::activateEdge(), NhalfEdgeMesh::deActivateEdge(), and NhalfEdge().

void NhalfEdge::setDeleted const BOOL  visited  ) 
 

set the edge deleted or not

Parameters:
visited "TRUE" for delete or "FALSE" for not deleted
See also:
isDeleted();

Definition at line 200 of file NhalfEdge.cpp.

References BOOL, m_attributeMask, and N_EDGE_DELETED.

Referenced by NhalfEdgeMesh::deleteEdge(), NhalfEdgeMesh::deleteFace(), NhalfEdgeMesh::deleteVertex(), NhalfEdge(), and NhalfEdgeMesh::uncollapseVertex().

void NhalfEdge::setIndex const U32  index  )  [protected]
 

set the index for the edge

allows for fast deletion and finding

Parameters:
index the index assigned to half edge by NhalfEdgeMesh

Definition at line 128 of file NhalfEdge.cpp.

References isDeleted(), m_index, and U32.

Referenced by NhalfEdgeMesh::addHalfEdge().

void NhalfEdge::setNext NhalfEdge pEdge  ) 
 

set the next for the edge

the edge that is next in the "ring" in clockwise order

halfEdge.gif
Note:
every edge must have a next. it is the user of this classes responsibility when setting up a mesh to ensure that every edge have a next forming a ring connection for every face in the mesh
  • example: the above diagram shows two faces being defined in ring order A->B->C->A.. and D->E->F->D->.. by default clockwise order is assumed. This is not imposed by the data structure, but consistence CCW or CW must be maintained throughout the mesh.
Parameters:
pEdge pointer to edge next in clockwise order
See also:
getNext()

getOpposite()

setOpposite()

Definition at line 241 of file NhalfEdge.cpp.

References isDeleted(), and m_pNext.

Referenced by NhalfEdgeMesh::activatePartition(), NhalfEdgeMesh::collapseEdge(), NhalfEdgeMesh::deleteFace(), reconnectPrevious(), ModButterflySubdivision::subdivide(), and NhalfEdgeMesh::uncollapseVertex().

void NhalfEdge::setOpposite NhalfEdge pEdge  ) 
 

set the opposite for the edge

halfEdge.gif
Note:
every edge may or may not half an opposite. If the edge does not have an opposite, then it is a boundary edge. In general setOpposite() does not need to be called on the edge. During construction the edge checks to see whether an edge exists going in the opposite direction and assigns its opposite if one exists.
Parameters:
pEdge pointer to edge going the other way
See also:
getOpposite()

getNext()

setNext()

Definition at line 219 of file NhalfEdge.cpp.

References isDeleted(), and m_pOpposite.

Referenced by NhalfEdgeMesh::activatePartition(), NhalfEdgeMesh::collapseEdge(), disconnectFromOpposite(), and NhalfEdge().

void NhalfEdge::setVisited const BOOL  visited  ) 
 

set the edge visited or not

Parameters:
visited "TRUE" for visited or "FALSE" for unvisited
See also:
isVisited();

Definition at line 153 of file NhalfEdge.cpp.

References BOOL, isDeleted(), m_attributeMask, and N_EDGE_VISITED.

Referenced by NhalfEdgeMesh::computeCutSize(), NhalfEdge(), and ModButterflySubdivision::subdivide().

void NhalfEdge::setWeight const R32  weight  ) 
 

set the edge weight

Parameters:
weight any positive floating point number
See also:
getWeight()

addToWeight()

Definition at line 428 of file NhalfEdge.cpp.

References isDeleted(), m_weight, and R32.

Referenced by NhalfEdgeMesh::activatePartition(), NhalfEdgeMesh::collapseEdge(), and NhalfEdge().


Friends And Related Function Documentation

friend class NhalfEdgeMesh [friend]
 

Definition at line 31 of file NhalfEdge.h.

friend class NhalfEdgeVertex [friend]
 

Definition at line 32 of file NhalfEdge.h.


Member Data Documentation

U32 NhalfEdge::m_attributeMask [protected]
 

attribute mash

Definition at line 128 of file NhalfEdge.h.

Referenced by clear(), setActive(), setDeleted(), and setVisited().

U32 NhalfEdge::m_index [protected]
 

index ..only should be accessed by halfEdgeMesh

Definition at line 130 of file NhalfEdge.h.

Referenced by setIndex().

NhalfEdge* NhalfEdge::m_pNext [protected]
 

pointer to next vertex

Definition at line 124 of file NhalfEdge.h.

Referenced by clear(), and setNext().

NhalfEdge* NhalfEdge::m_pOpposite [protected]
 

pointer to opposite vertex

Definition at line 122 of file NhalfEdge.h.

Referenced by clear(), and setOpposite().

NhalfEdgeVertex* NhalfEdge::m_pVertexA [protected]
 

pointer to start vertex

Definition at line 118 of file NhalfEdge.h.

Referenced by clear(), and NhalfEdge().

NhalfEdgeVertex* NhalfEdge::m_pVertexB [protected]
 

pointer to edge vertex

Definition at line 120 of file NhalfEdge.h.

Referenced by clear(), and NhalfEdge().

R32 NhalfEdge::m_weight [protected]
 

edge weight

Definition at line 126 of file NhalfEdge.h.

Referenced by addToWeight(), clear(), operator<(), operator<=(), operator>(), and setWeight().


The documentation for this class was generated from the following files:
Generated on Mon Jun 28 15:02:31 2004 for Advanced Surface Library by doxygen 1.3.4