Mesh::Face Class Reference

The class Face implements the face topological entity of Tops. More...

#include <mesh.h>

Collaboration diagram for Mesh::Face:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 Face (Surf *s, Hedge *e0, Hedge *e1, Hedge *e2)
 The constructor creates a triangular face.
 ~Face ()
 The Obj class destructor.
Surfsurf ()
 Returns the surface pointer.
Hedgehedge (int k)
 Returns the half-edge of index k.
Vertexvertex (int k)
 Returns the vertex of index k.
void set_hedge (int k, Hedge *h)
 Updates the half-edge of index k.
void set_surf (Surf *s)
 Updates the vertex of index k.
void link_edges ()
Facereuse (Hedge *e0, Hedge *e1, Hedge *e2)
 Redefines a face by specifing replacement half-edges.
int reuse (Hedge *he, Hedge *ne)

Private Attributes

Hedgee_
 Points to the first half-egde of face's loop.
Surfs_
 Points to surface it belongs.

Detailed Description

The class Face implements the face topological entity of Tops.

Definition at line 309 of file mesh.h.


Constructor & Destructor Documentation

Face::Face Surf s,
Hedge e0,
Hedge e1,
Hedge e2
 

The constructor creates a triangular face.

Parameters:
s Surface pointer
e0 First half-edge.
e1 Second half-edge.
e2 Third half-edge.

Definition at line 22 of file face.cpp.

References reuse(), and s_.

00023 {
00024   s_ = s;
00025   reuse(e0, e1, e2);
00026 }

Mesh::Face::~Face  )  [inline]
 

The Obj class destructor.

Definition at line 324 of file mesh.h.

00324 {};


Member Function Documentation

Hedge * Face::hedge int  k  ) 
 

Returns the half-edge of index k.

Returns:
half-edge pointer.

Definition at line 78 of file face.cpp.

References e_, and Mesh::Hedge::next().

Referenced by Mesh::Surf::destroy(), link_edges(), set_hedge(), Mesh::Surf::split(), and vertex().

00079 {
00080   switch (k) {
00081   case 0: return e_;
00082   case 1: return e_->next();
00083   case 2: return e_->next()->next();
00084   }
00085   throw Error("hedge index");
00086 }

void Face::link_edges  ) 
 

Updates the half-edges refereces to the face

Definition at line 112 of file face.cpp.

References hedge().

00113 {
00114   for (int k = 0; k < 3; k++)
00115     hedge(k)->set_face(this);
00116 }

int Face::reuse Hedge he,
Hedge ne
 

substitutes two half-edges.

Definition at line 50 of file face.cpp.

References e_, Mesh::Hedge::next(), and reuse().

00051 {
00052   Hedge *e0, *e1, *e2;
00053   e0 = e_;
00054   e1 = e_->next();
00055   e2 = e_->next()->next();
00056   
00057   if (e0 == e){
00058     reuse(ne, e1, e2);
00059     return 0;
00060   }
00061   if (e1 == e){
00062     reuse(e0, ne, e2); 
00063     return 1;
00064   }
00065   if (e2 == e){
00066     reuse(e0, e1, ne);
00067     return 2;
00068   }
00069 
00070   return -1;
00071 }

Face * Face::reuse Hedge e0,
Hedge e1,
Hedge e2
 

Redefines a face by specifing replacement half-edges.

Updates the half-edges of the face. Make half-edge links to build a face loop. Links half-edges to face.

Parameters:
e0 First half-edge.
e1 Second half-edge.
e2 Third half-edge.
Returns:
face pointer.

Definition at line 36 of file face.cpp.

References e_, Mesh::Hedge::set_face(), and Mesh::Hedge::set_next().

Referenced by Mesh::Surf::bisect(), Mesh::Surf::detach_handle_1(), Mesh::Surf::detach_handle_2(), Mesh::Surf::detach_handle_4(), Face(), Mesh::Surf::flip(), reuse(), and Mesh::Surf::split().

00037 {
00038   e_ = e0;
00039   e0->set_next(e1); e1->set_next(e2); e2->set_next(e0);
00040   e0->set_face(this); e1->set_face(this); e2->set_face(this);
00041   return this;
00042 }

void Face::set_hedge int  k,
Hedge h
 

Updates the half-edge of index k.

Updates the half-edge of index k.

Parameters:
k half-edge index, Valid values of k=[0,1,2].
h Specify a new half-edge.

Definition at line 101 of file face.cpp.

References e_, hedge(), NEXT3, PREV3, and Mesh::Hedge::set_next().

Referenced by Mesh::Surf::attach_handle_0(), Mesh::Surf::attach_handle_1(), Mesh::Surf::attach_handle_2(), and Mesh::Surf::attach_handle_4().

00102 {
00103   Hedge *n = hedge(NEXT3(k));
00104   Hedge *p = hedge(PREV3(k));
00105   h->set_next(n);
00106   p->set_next(h);
00107   if (k == 0) e_ = h;
00108 }

void Mesh::Face::set_surf Surf s  )  [inline]
 

Updates the vertex of index k.

Definition at line 342 of file mesh.h.

References s_.

00342 {s_ = s; };

Surf* Mesh::Face::surf  )  [inline]
 

Returns the surface pointer.

Returns:
surface pointer.

Definition at line 328 of file mesh.h.

References s_.

Referenced by Mesh::Surf::attach_handle_0(), and Mesh::Surf::glue().

00328 { return s_;};

Vertex * Face::vertex int  k  ) 
 

Returns the vertex of index k.

Returns:
vertex pointer.

Definition at line 92 of file face.cpp.

References hedge(), Mesh::Hedge::org(), and PREV3.

Referenced by Mesh::Surf::split().

00093 {
00094   return hedge(PREV3(k))->org();
00095 }


Member Data Documentation

Hedge* Mesh::Face::e_ [private]
 

Points to the first half-egde of face's loop.

Definition at line 311 of file mesh.h.

Referenced by hedge(), reuse(), and set_hedge().

Surf* Mesh::Face::s_ [private]
 

Points to surface it belongs.

Definition at line 312 of file mesh.h.

Referenced by Face(), set_surf(), and surf().


The documentation for this class was generated from the following files:
Generated on Fri Feb 24 12:23:24 2006 for TOPs by  doxygen 1.4.6-NO