#include <mesh.h>
Public Member Functions | |
Surf () | |
The construtor specifies a Surf class. | |
~Surf () | |
The mesh class destructor. Destroys the surface cells. | |
VertexIter | verts_begin () |
Returns iterator that points to the first vertex of the surface. | |
VertexIter | verts_end () |
Returns iterador that points to the last vertex of the surface. | |
int | num_verts () |
Returns the number of vertices. | |
EdgeIter | edges_begin () |
Returns iterator that points to the first edge of the surface. | |
EdgeIter | edges_end () |
Returns iterador that points to the last edge of the surface. | |
int | num_edges () |
Returns the number of egdes. | |
FaceIter | faces_begin () |
Returns iterator that points to the first face of the surface. | |
FaceIter | faces_end () |
Returns iterador that points to the last vertex of the surface. | |
int | num_faces () |
Returns the number of faces. | |
EdgeIter | bdries_begin () |
Returns iterator that points to the first boundary of the surface. | |
EdgeIter | bdries_end () |
Returns iterador that points to the last boundary of the surface. | |
int | num_bdries () |
Returns the number of boundaries. | |
Hedge * | lookup_hedge (Point *p0, Point *p1) |
Look for a hedge in surface. | |
Vertex * | split (Face *f) |
Divides a face. | |
Vertex * | split (Hedge *e) |
Splits an edge. | |
Hedge * | weld (Vertex *w) |
Removes a vertex. Supported for boudary and internal edges. | |
Hedge * | flip (Hedge *h) |
Flips internal edge. | |
Face * | create (Point *p0, Point *p1, Point *p2) |
Creates a new face. | |
void | destroy (Face *f) |
Destroys a face. | |
Edge * | glue (Hedge *e1, Hedge *e2) |
Glue two half edges. | |
Edge * | unglue (Hedge *e1, Hedge *e2) |
Unglue two half-edges. | |
Private Member Functions | |
Vertex * | add_new_vertex (Point *p) |
Creates a new vertex. | |
bool | add_vertex (Vertex *v) |
Adds an existing vertex. | |
void | del_vertex (Vertex *v) |
Removes a vertex from surface. | |
Hedge * | add_new_edge (Vertex *v0, Vertex *v1) |
Adds a new edge. | |
bool | add_edge (Edge *e) |
Add an existing edge. | |
void | del_edge (Edge *e) |
Removes an edge from surface. | |
bool | add_face (Face *f) |
Adds an existing face. | |
void | del_face (Face *f) |
Removes a face from surface. | |
bool | add_bdry (Edge *e) |
Add an existing boundary. | |
void | del_bdry (Edge *e) |
Removes an boundary from surface. | |
void | transfer_cells (Surf *s2) |
Adds cells from other surface. It doesn't perform any topological change. | |
Vertex * | bisect (Hedge *e, Hedge **el, Hedge **er) |
Splits an edge in two sub-edges. | |
Hedge * | bisect (Face *f, Hedge *e1, Hedge *e2, Hedge *el, Hedge *er) |
Splits a face in two sub-faces. | |
Edge * | attach_handle_0 (Hedge *e1, Hedge *e2) |
Glue two edges from different surfaces. | |
Edge * | attach_handle_1 (Hedge *e1, Hedge *e2) |
Glue two edges from different boundary curves. | |
Edge * | attach_handle_2 (Hedge *e1, Hedge *e2) |
Glue two edges from the same boundary curve but no commom vertices. | |
Edge * | attach_handle_3 (Hedge *e1, Hedge *e2) |
Glue two edges from the same boundary curve but one commom vertex. | |
Edge * | attach_handle_4 (Hedge *e1, Hedge *e2) |
Glue two edges from the same boundary curve but two commom verteces. | |
Edge * | detach_handle_1 (Hedge *e1, Hedge *e2) |
Unglue two edges and split one boundary curve into two. | |
Edge * | detach_handle_2 (Hedge *e1, Hedge *e2) |
Unglue two edges and join two boundary curves. | |
Edge * | detach_handle_3 (Hedge *e1, Hedge *e2) |
Unglue two edges in the same boundary curve. | |
Edge * | detach_handle_4 (Hedge *e1, Hedge *e2) |
Unglue two edges and creates a new boundary curve. | |
Private Attributes | |
VertexContainer | vc_ |
Set of vertices. | |
EdgeContainer | ec_ |
Set of edges. | |
FaceContainer | fc_ |
Set of faces. | |
EdgeContainer | bc_ |
Set of Boundary Curve Representatives. |
Definition at line 126 of file mesh.h.
|
The construtor specifies a Surf class.
Definition at line 137 of file mesh.h.
|
|
The mesh class destructor. Destroys the surface cells. Dealocates all data (vertices, faces, edges) of surface. Definition at line 13 of file surf.cpp. References bc_, ec_, fc_, and vc_. 00014 { 00015 for (VertexIter p = vc_.begin(); p != vc_.end(); p++) 00016 delete *p; 00017 vc_.clear(); 00018 for (EdgeIter e = ec_.begin(); e != ec_.end(); e++) 00019 delete *e; 00020 ec_.clear(); 00021 for (FaceIter f = fc_.begin(); f != fc_.end(); f++) 00022 delete *f; 00023 fc_.clear(); 00024 bc_.clear(); 00025 }
|
|
Add an existing boundary.
Definition at line 257 of file mesh.h. References bc_. Referenced by attach_handle_0(), attach_handle_1(), attach_handle_2(), attach_handle_3(), create(), detach_handle_1(), detach_handle_4(), and transfer_cells(). 00257 { std::pair<EdgeIter, bool> r = bc_.insert(e); return r.second;};
|
|
Add an existing edge.
Definition at line 239 of file mesh.h. References ec_. Referenced by add_new_edge(), create(), detach_handle_1(), detach_handle_2(), detach_handle_4(), and transfer_cells(). 00240 { std::pair<EdgeIter, bool> r = ec_.insert(e); return r.second;};
|
|
Adds an existing face.
Definition at line 249 of file mesh.h. References fc_. Referenced by bisect(), create(), split(), and transfer_cells(). 00249 { std::pair<FaceIter, bool> r = fc_.insert(f); return r.second;};
|
|
Adds a new edge. Adds a new edge in the surface.
Definition at line 33 of file surf.cpp. References add_edge(), and Mesh::Edge::hedge(). Referenced by bisect(), and split().
|
|
Creates a new vertex. Adds a new vertex in the surface.
Definition at line 44 of file surf.cpp. References add_vertex(). Referenced by bisect(), and split(). 00045 { 00046 Vertex *v = new Vertex(p); 00047 add_vertex(v); 00048 return v; 00049 }
|
|
Adds an existing vertex.
Definition at line 226 of file mesh.h. References vc_. Referenced by add_new_vertex(), create(), detach_handle_1(), detach_handle_2(), and transfer_cells(). 00227 { std::pair<VertexIter, bool> r = vc_.insert(v);return r.second;};
|
|
Glue two edges from different surfaces. Glue two edges from different surfaces. Two boundaries are joined into one.
Definition at line 175 of file handle.cpp. References add_bdry(), del_bdry(), del_edge(), del_vertex(), Mesh::Hedge::dst(), Mesh::Hedge::edge(), Mesh::Hedge::face(), Mesh::Hedge::get_bdry(), Mesh::Edge::is_bdry(), Mesh::Hedge::mate(), Mesh::Hedge::next(), Mesh::Hedge::org(), Mesh::Hedge::prev(), Mesh::Hedge::prev_on_bdry(), Mesh::Edge::set_bdry(), Mesh::Hedge::set_edge(), Mesh::Hedge::set_face(), Mesh::Face::set_hedge(), Mesh::Hedge::set_org(), Mesh::Face::surf(), and transfer_cells(). Referenced by glue(). 00176 { 00177 Face *f2 = he2->face(); 00178 Edge *e1 = he1->edge(); 00179 Edge *e2 = he2->edge(); 00180 Hedge *mhe1 = he1->mate(); 00181 Hedge *nhe2 = he2->next(); 00182 Hedge *phe2 = he2->prev(); 00183 Vertex *v1 = he1->org(); 00184 Vertex *v2 = he1->dst(); 00185 Vertex *v3 = he2->org(); 00186 Vertex *v4 = he2->dst(); 00187 Edge *eb1 = he1->get_bdry(); 00188 Edge *eb2 = he2->get_bdry(); 00189 Hedge *he; 00190 00191 transfer_cells(he2->face()->surf()); 00192 00193 if (eb1 == e1) 00194 { 00195 del_bdry(eb1); 00196 he = he1->prev_on_bdry(); 00197 eb1 = he->edge(); 00198 do 00199 { 00200 he->edge()->set_bdry(eb1); 00201 he = he->prev_on_bdry(); 00202 } 00203 while(he != he1); 00204 add_bdry(eb1); 00205 } 00206 00207 he = he2->prev_on_bdry(); 00208 do 00209 { 00210 he->edge()->set_bdry(eb1); 00211 he = he->prev_on_bdry(); 00212 } 00213 while(he != he2); 00214 del_bdry(eb2); 00215 00216 he = he2; 00217 do 00218 { 00219 he->next()->set_org(v1); 00220 he = he->next()->mate(); 00221 } 00222 while(!(he->next()->edge()->is_bdry())); 00223 del_vertex(v4); 00224 delete v4; 00225 00226 he = he2->prev_on_bdry(); 00227 do 00228 { 00229 he->next()->set_org(v2); 00230 he = he->next()->mate(); 00231 } 00232 while(!(he->next()->edge()->is_bdry())); 00233 del_vertex(v3); 00234 delete v3; 00235 00236 mhe1->set_edge(e1); 00237 mhe1->set_face(f2); 00238 f2->set_hedge(0,mhe1); 00239 f2->set_hedge(1,nhe2); 00240 f2->set_hedge(2,phe2); 00241 00242 del_edge(e2); 00243 delete e2; 00244 00245 return e1; 00246 }
|
|
Glue two edges from different boundary curves. Glue two edges from different boundarie curves. Two boundary curves are joined into one.
Definition at line 255 of file handle.cpp. References add_bdry(), del_bdry(), del_edge(), Mesh::Point::del_vert(), del_vertex(), Mesh::Hedge::dst(), Mesh::Hedge::edge(), Mesh::Hedge::face(), Mesh::Hedge::get_bdry(), Mesh::Edge::is_bdry(), Mesh::Hedge::mate(), Mesh::Hedge::next(), Mesh::Hedge::org(), Mesh::Vertex::p(), Mesh::Hedge::prev(), Mesh::Hedge::prev_on_bdry(), Mesh::Edge::set_bdry(), Mesh::Hedge::set_edge(), Mesh::Hedge::set_face(), Mesh::Face::set_hedge(), Mesh::Hedge::set_org(), Mesh::Hedge::set_prev_on_bdry(), Mesh::Vertex::set_star(), and Mesh::Vertex::star_first(). Referenced by glue(). 00256 { 00257 Face *f2 = he2->face(); 00258 Edge *e1 = he1->edge(); 00259 Edge *e2 = he2->edge(); 00260 Hedge *mhe1 = he1->mate(); 00261 Hedge *nhe2 = he2->next(); 00262 Hedge *phe2 = he2->prev(); 00263 Vertex *v1 = he1->org(); 00264 Vertex *v2 = he1->dst(); 00265 Vertex *v3 = he2->org(); 00266 Vertex *v4 = he2->dst(); 00267 Edge *eb1 = he1->get_bdry(); 00268 Edge *eb2 = he2->get_bdry(); 00269 Hedge *he; 00270 00271 if (eb1 == e1) 00272 { 00273 del_bdry(eb1); 00274 he = he1->prev_on_bdry(); 00275 eb1 = he->edge(); 00276 do 00277 { 00278 he->edge()->set_bdry(eb1); 00279 he = he->prev_on_bdry(); 00280 } 00281 while(he != he1); 00282 add_bdry(eb1); 00283 } 00284 00285 he = he2->prev_on_bdry(); 00286 do 00287 { 00288 he->edge()->set_bdry(eb1); 00289 he = he->prev_on_bdry(); 00290 } 00291 while(he != he2); 00292 del_bdry(eb2); 00293 00294 he = he2->next(); 00295 he->set_org(v1); 00296 while(!(he->edge()->is_bdry())) 00297 { 00298 he = he->mate()->next(); 00299 he->set_org(v1); 00300 } 00301 he->set_prev_on_bdry(v1->star_first()); 00302 del_vertex(v4); 00303 v4->p()->del_vert(v4); 00304 delete v4; 00305 00306 00307 he = he2->prev_on_bdry(); 00308 he->mate()->set_org(v2); 00309 while(!(he->next()->edge()->is_bdry())){ 00310 he->next()->set_org(v2); 00311 he = he->next()->mate(); 00312 } 00313 v2->set_star(v3->star_first()); 00314 del_vertex(v3); 00315 v3->p()->del_vert(v3); 00316 delete v3; 00317 00318 he = he1->next(); 00319 while(!(he->edge()->is_bdry())) 00320 he = he->mate()->next(); 00321 he->set_prev_on_bdry(v2->star_first()); 00322 00323 00324 mhe1->set_edge(e1); 00325 mhe1->set_face(f2); 00326 f2->set_hedge(0,mhe1); 00327 f2->set_hedge(1,nhe2); 00328 f2->set_hedge(2,phe2); 00329 00330 del_edge(e2); 00331 delete e2; 00332 00333 return e1; 00334 }
|
|
Glue two edges from the same boundary curve but no commom vertices. Glue two edges from the same boundary curve but with no common vertices. One boundary curve is splitted into two.
Definition at line 343 of file handle.cpp. References add_bdry(), del_bdry(), del_edge(), Mesh::Point::del_vert(), del_vertex(), Mesh::Hedge::dst(), Mesh::Hedge::edge(), Mesh::Hedge::face(), Mesh::Hedge::get_bdry(), Mesh::Edge::is_bdry(), Mesh::Hedge::mate(), Mesh::Hedge::next(), Mesh::Hedge::org(), Mesh::Vertex::p(), Mesh::Hedge::prev(), Mesh::Hedge::prev_on_bdry(), Mesh::Edge::set_bdry(), Mesh::Hedge::set_edge(), Mesh::Hedge::set_face(), Mesh::Face::set_hedge(), Mesh::Hedge::set_org(), Mesh::Hedge::set_prev_on_bdry(), Mesh::Vertex::set_star(), and Mesh::Vertex::star_first(). Referenced by glue(). 00344 { 00345 Face *f2 = he2->face(); 00346 Edge *e1 = he1->edge(); 00347 Edge *e2 = he2->edge(); 00348 Hedge *mhe1 = he1->mate(); 00349 Hedge *nhe2 = he2->next(); 00350 Hedge *phe2 = he2->prev(); 00351 Vertex *v1 = he1->org(); 00352 Vertex *v2 = he1->dst(); 00353 Vertex *v3 = he2->org(); 00354 Vertex *v4 = he2->dst(); 00355 Edge *eb = he1->get_bdry(); 00356 Hedge *he; 00357 00358 del_bdry(eb); 00359 00360 he = he2->prev_on_bdry(); 00361 eb = he->edge(); 00362 do 00363 { 00364 he->edge()->set_bdry(eb); 00365 he = he->prev_on_bdry(); 00366 } 00367 while(he != he1); 00368 add_bdry(eb); 00369 00370 he = he1->prev_on_bdry(); 00371 eb = he->edge(); 00372 do 00373 { 00374 he->edge()->set_bdry(eb); 00375 he = he->prev_on_bdry(); 00376 } 00377 while(he != he2); 00378 add_bdry(eb); 00379 00380 he = he2->next(); 00381 he->set_org(v1); 00382 while(!(he->edge()->is_bdry())) 00383 { 00384 he = he->mate()->next(); 00385 he->set_org(v1); 00386 } 00387 he->set_prev_on_bdry(v1->star_first()); 00388 del_vertex(v4); 00389 v4->p()->del_vert(v4); 00390 delete v4; 00391 00392 00393 he = he2->prev_on_bdry(); 00394 he->mate()->set_org(v2); 00395 while(!(he->next()->edge()->is_bdry())){ 00396 he->next()->set_org(v2); 00397 he = he->next()->mate(); 00398 } 00399 v2->set_star(v3->star_first()); 00400 del_vertex(v3); 00401 v3->p()->del_vert(v3); 00402 delete v3; 00403 00404 he = he1->next(); 00405 while(!(he->edge()->is_bdry())) 00406 he = he->mate()->next(); 00407 he->set_prev_on_bdry(v2->star_first()); 00408 00409 mhe1->set_edge(e1); 00410 mhe1->set_face(f2); 00411 f2->set_hedge(0,mhe1); 00412 f2->set_hedge(1,nhe2); 00413 f2->set_hedge(2,phe2); 00414 00415 del_edge(e2); 00416 delete e2; 00417 00418 return e1; 00419 }
|
|
Glue two edges from the same boundary curve but one commom vertex. Glue two edges from the same boundary curve but with one common vertix.
Definition at line 427 of file handle.cpp. References add_bdry(), del_bdry(), Mesh::Point::del_vert(), del_vertex(), Mesh::Hedge::dst(), Mesh::Hedge::edge(), Mesh::Hedge::face(), Mesh::Hedge::get_bdry(), Mesh::Edge::is_bdry(), Mesh::Hedge::mate(), Mesh::Hedge::next(), Mesh::Hedge::org(), Mesh::Vertex::p(), Mesh::Hedge::prev(), Mesh::Hedge::prev_on_bdry(), Mesh::Edge::set_bdry(), Mesh::Hedge::set_org(), Mesh::Hedge::set_prev_on_bdry(), and Mesh::Vertex::star_first(). Referenced by glue(). 00428 { 00429 00430 Face *f2 = he2->face(); 00431 Edge *e1 = he1->edge(); 00432 Edge *e2 = he2->edge(); 00433 Hedge *mhe1 = he1->mate(); 00434 Hedge *nhe2 = he2->next(); 00435 Hedge *phe2 = he2->prev(); 00436 Vertex *v1 = he1->org(); 00437 Vertex *v2 = he1->dst(); 00438 Vertex *v3 = he2->org(); 00439 Vertex *v4 = he2->dst(); 00440 Edge *eb = he1->get_bdry(); 00441 Hedge *he; 00442 00443 if (he1 == he2->prev_on_bdry()){ 00444 00445 if ((eb == e1) || (eb == e2)) 00446 { 00447 del_bdry(eb); 00448 he = he1->prev_on_bdry(); 00449 eb = he->edge(); 00450 do 00451 { 00452 he->edge()->set_bdry(eb); 00453 he = he->prev_on_bdry(); 00454 } 00455 while(he != he2); 00456 add_bdry(eb); 00457 } 00458 00459 he = he2->next(); 00460 he->set_org(v1); 00461 while(!(he->edge()->is_bdry())) 00462 { 00463 he = he->mate()->next(); 00464 he->set_org(v1); 00465 } 00466 he->set_prev_on_bdry(v1->star_first()); 00467 del_vertex(v4); 00468 v4->p()->del_vert(v4); 00469 delete v4; 00470 00471 } 00472 else { 00473 if ((eb == e1) || (eb == e2)) 00474 { 00475 del_bdry(eb); 00476 he = he1->prev_on_bdry()->prev_on_bdry(); 00477 eb = he->edge(); 00478 do 00479 { 00480 he->edge()->set_bdry(eb); 00481 he = he->prev_on_bdry(); 00482 } 00483 while(he != he1); 00484 add_bdry(eb); 00485 } 00486 00487 v2->set_star(v3->star_first()); 00488 v1->set_star(mhe1); 00489 he = he2->prev(); 00490 he->mate()->set_org(v2); 00491 while(!(he->edge()->is_bdry())) 00492 { 00493 he = he->mate()->prev(); 00494 he->mate()->set_org(v2); 00495 } 00496 00497 del_vertex(v3); 00498 v3->p()->del_vert(v3); 00499 delete v3; 00500 00501 he = he1->next(); 00502 while(!(he->edge()->is_bdry())) 00503 he = he->mate()->next(); 00504 he->set_prev_on_bdry(v2->star_first()); 00505 } 00506 00507 mhe1->set_edge(e1); 00508 mhe1->set_face(f2); 00509 f2->set_hedge(0,mhe1); 00510 f2->set_hedge(1,nhe2); 00511 f2->set_hedge(2,phe2); 00512 00513 del_edge(e2); 00514 delete e2; 00515 00516 return e1; 00517 }
|
|
Glue two edges from the same boundary curve but two commom verteces. Glue two edges from the same boundary curve but with two common vertices. One boundary curve destroyed.
Definition at line 526 of file handle.cpp. References del_bdry(), del_edge(), Mesh::Hedge::edge(), Mesh::Hedge::face(), Mesh::Hedge::get_bdry(), Mesh::Hedge::mate(), Mesh::Hedge::next(), Mesh::Hedge::org(), Mesh::Hedge::prev(), Mesh::Hedge::set_edge(), Mesh::Hedge::set_face(), Mesh::Face::set_hedge(), and Mesh::Vertex::set_star(). Referenced by glue(). 00527 { 00528 Face *f2 = he2->face(); 00529 Edge *e1 = he1->edge(); 00530 Edge *e2 = he2->edge(); 00531 Hedge *mhe1 = he1->mate(); 00532 Hedge *nhe2 = he2->next(); 00533 Hedge *phe2 = he2->prev(); 00534 Vertex *v1 = he1->org(); 00535 00536 del_bdry(he1->get_bdry()); 00537 00538 mhe1->set_edge(e1); 00539 mhe1->set_face(f2); 00540 f2->set_hedge(0,mhe1); 00541 f2->set_hedge(1,nhe2); 00542 f2->set_hedge(2,phe2); 00543 00544 v1->set_star(mhe1); 00545 del_edge(e2); 00546 delete e2; 00547 00548 return e1; 00549 }
|
|
Returns iterator that points to the first boundary of the surface.
Definition at line 180 of file mesh.h. References bc_. Referenced by transfer_cells(). 00180 { return bc_.begin(); };
|
|
Returns iterador that points to the last boundary of the surface.
Definition at line 184 of file mesh.h. References bc_. Referenced by transfer_cells(). 00184 { return bc_.end(); };
|
|
Splits a face in two sub-faces. Splits a face into two new faces. The face is splitted through vertex m.
Definition at line 73 of file stellar.cpp. References add_face(), add_new_edge(), Mesh::Hedge::mate(), Mesh::Hedge::org(), and Mesh::Face::reuse(). 00074 { 00075 if (f == NULL) return 0; 00076 Hedge *em = add_new_edge(e2->org(), er->org()); 00077 f->reuse(e1, em, er); 00078 add_face(new Face(this, e2, el, em->mate())); 00079 return em; 00080 }
|
|
Splits an edge in two sub-edges. Bisects a half-edge into two new sub half-edges. The old half-edge is divided by inserting a new vertex.
Definition at line 40 of file stellar.cpp. References add_new_vertex(), Mesh::Hedge::dst(), Mesh::Hedge::edge(), Mesh::Hedge::get_bdry(), Mesh::Edge::is_bdry(), Mesh::Hedge::org(), and Mesh::Hedge::prev_on_bdry(). Referenced by split(). 00041 { 00042 Edge *bd = NULL; Hedge *epb= NULL; 00043 Vertex *v0 = e->org(); 00044 Vertex *v1 = e->dst(); 00045 Vertex *m = add_new_vertex(new Point()); 00046 if (e->edge()->is_bdry()) { 00047 bd = e->get_bdry(); 00048 epb = e->prev_on_bdry(); 00049 } 00050 *el = e->reuse(v0, m); 00051 *er = add_new_edge(m, v1); 00052 if (v1->star_first() == e) 00053 v1->set_star((*er)); 00054 if (bd != NULL) { 00055 (*el)->edge()->set_bdry(bd); 00056 (*er)->edge()->set_bdry(bd); 00057 (*el)->set_prev_on_bdry(*er); 00058 (*er)->set_prev_on_bdry(epb); 00059 } 00060 return m; 00061 }
|
|
Creates a new face. Creates a new face. Adds face to surface. Creates one boundary. Updates toplogical references.
Definition at line 21 of file handle.cpp. References add_bdry(), add_edge(), add_face(), Mesh::Point::add_vert(), add_vertex(), Mesh::Edge::hedge(), Mesh::Edge::set_bdry(), Mesh::Hedge::set_prev_on_bdry(), and Mesh::Vertex::set_star(). 00022 { 00023 Vertex *v0 = new Vertex (p0); p0->add_vert(v0); 00024 Vertex *v1 = new Vertex (p1); p1->add_vert(v1); 00025 Vertex *v2 = new Vertex (p2); p2->add_vert(v2); 00026 add_vertex(v0); 00027 add_vertex(v1); 00028 add_vertex(v2); 00029 00030 Edge *e0 = new Edge (v0,v1); 00031 Edge *e1 = new Edge (v1,v2); 00032 Edge *e2 = new Edge (v2,v0); 00033 add_edge(e0); 00034 add_edge(e1); 00035 add_edge(e2); 00036 00037 Hedge *he0 = e0->hedge(0); 00038 Hedge *he1 = e1->hedge(0); 00039 Hedge *he2 = e2->hedge(0); 00040 00041 Face *f = new Face (this,he0,he1,he2); 00042 add_face(f); 00043 00044 // update boundary 00045 add_bdry(e0); 00046 e0->set_bdry(e0); 00047 e1->set_bdry(e0); 00048 e2->set_bdry(e0); 00049 he0->set_prev_on_bdry(he2); 00050 he1->set_prev_on_bdry(he0); 00051 he2->set_prev_on_bdry(he1); 00052 00053 // update stars 00054 v0->set_star(he2); 00055 v1->set_star(he0); 00056 v2->set_star(he1); 00057 00058 return f; 00059 }
|
|
Removes an boundary from surface.
Definition at line 261 of file mesh.h. References bc_. Referenced by attach_handle_0(), attach_handle_1(), attach_handle_2(), attach_handle_3(), attach_handle_4(), destroy(), and detach_handle_2(). 00261 { bc_.erase(e);};
|
|
Removes an edge from surface.
Definition at line 244 of file mesh.h. References ec_. Referenced by attach_handle_0(), attach_handle_1(), attach_handle_2(), attach_handle_4(), and destroy(). 00244 { ec_.erase(e);};
|
|
Removes a face from surface.
Definition at line 252 of file mesh.h. References fc_. Referenced by destroy(). 00252 { fc_.erase(f);};
|
|
Removes a vertex from surface.
Definition at line 231 of file mesh.h. References vc_. Referenced by attach_handle_0(), attach_handle_1(), attach_handle_2(), attach_handle_3(), and destroy(). 00231 { vc_.erase(v);};
|
|
Destroys a face. Destroys a face. Delete a face to surface. Destroys one boundary. Removes subcells .
Definition at line 68 of file handle.cpp. References del_bdry(), del_edge(), del_face(), Mesh::Point::del_vert(), del_vertex(), Mesh::Hedge::edge(), Mesh::Face::hedge(), Mesh::Hedge::mate(), Mesh::Hedge::org(), and Mesh::Vertex::p(). 00069 { 00070 Hedge *he0 = f->hedge(0); 00071 Hedge *he1 = f->hedge(1); 00072 Hedge *he2 = f->hedge(2); 00073 00074 Vertex *v0 = he0->org(); 00075 Vertex *v1 = he1->org(); 00076 Vertex *v2 = he2->org(); 00077 00078 Edge *e0 = he0->edge(); 00079 Edge *e1 = he1->edge(); 00080 Edge *e2 = he2->edge(); 00081 Edge *eb = he0->mate()->edge(); 00082 00083 del_vertex(v0); 00084 del_vertex(v1); 00085 del_vertex(v2); 00086 00087 v0->p()->del_vert(v0); 00088 v1->p()->del_vert(v1); 00089 v2->p()->del_vert(v2); 00090 00091 delete v0; 00092 delete v1; 00093 delete v2; 00094 00095 del_bdry(eb); 00096 del_edge(e0); 00097 del_edge(e1); 00098 del_edge(e2); 00099 00100 delete e0; 00101 delete e1; 00102 delete e2; 00103 00104 del_face(f); 00105 delete f; 00106 }
|
|
Unglue two edges and split one boundary curve into two. Unglue two internal edges. One boundary curve is splitted into two.
Definition at line 560 of file handle.cpp. References add_bdry(), add_edge(), Mesh::Point::add_vert(), add_vertex(), Mesh::Hedge::dst(), Mesh::Hedge::edge(), Mesh::Hedge::face(), Mesh::Hedge::get_bdry(), Mesh::Edge::hedge(), Mesh::Edge::is_bdry(), Mesh::Hedge::mate(), Mesh::Hedge::next(), Mesh::Hedge::org(), Mesh::Vertex::p(), Mesh::Hedge::prev(), Mesh::Hedge::prev_on_bdry(), Mesh::Face::reuse(), Mesh::Edge::set_bdry(), Mesh::Hedge::set_face(), Mesh::Hedge::set_org(), Mesh::Hedge::set_prev_on_bdry(), Mesh::Vertex::set_star(), and Mesh::Vertex::star_first(). Referenced by unglue(). 00561 { 00562 Hedge *he, *he2_old; 00563 Face *f2 = he2->face(); 00564 Vertex *v1 = he1->org(); 00565 Vertex *v2 = he1->dst(); 00566 Edge *eb1 = v1->star_first()->get_bdry(); 00567 Edge *eb2; 00568 Vertex *v3 = new Vertex(v2->p()); 00569 Vertex *v4 = new Vertex(v1->p()); 00570 v3->p()->add_vert(v3); 00571 v4->p()->add_vert(v4); 00572 add_vertex(v3); 00573 add_vertex(v4); 00574 00575 Edge *ne = new Edge(v3, v4); 00576 he2_old = he2; 00577 he2 = ne->hedge(0); 00578 eb2 = ne; 00579 add_edge(ne); 00580 00581 /*update hedge of a face*/ 00582 if (f2->reuse(he2_old, he2)<0) return NULL; 00583 he2_old->set_face(NULL); 00584 00585 /*update bdries*/ 00586 ne->set_bdry(eb2); 00587 he1->edge()->set_bdry(eb1); 00588 00589 add_bdry(eb2); 00590 00591 he = v2->star_first(); 00592 do 00593 { 00594 he->edge()->set_bdry(eb2); 00595 he = he->prev_on_bdry(); 00596 } 00597 while(he != v1->star_first()); 00598 00599 00600 /*update prev on bdry, orgs*/ 00601 he1->set_prev_on_bdry(v1->star_first()); 00602 00603 he = he1->next(); 00604 while(!(he->edge()->is_bdry())) 00605 he = he->mate()->next(); 00606 he->set_prev_on_bdry(he1); 00607 00608 he = he2->prev(); 00609 while(!(he->edge()->is_bdry())){ 00610 he->mate()->set_org(v3); 00611 he = he->mate()->prev(); 00612 } 00613 he->mate()->set_org(v3); 00614 he2->set_prev_on_bdry(he); 00615 v3->set_star(he); 00616 00617 he = he2->next(); 00618 he->set_org(v4); 00619 while(!(he->edge()->is_bdry())){ 00620 he = he->mate()->next(); 00621 he->set_org(v4); 00622 } 00623 he->set_prev_on_bdry(he2); 00624 00625 /*update star*/ 00626 v2->set_star(he1); 00627 v4->set_star(he2); 00628 00629 return ne; 00630 }
|
|
Unglue two edges and join two boundary curves. Unglue two internal edges. Two boundary curves are joined into one.
Definition at line 639 of file handle.cpp. References add_edge(), Mesh::Point::add_vert(), add_vertex(), del_bdry(), Mesh::Hedge::dst(), Mesh::Hedge::edge(), Mesh::Hedge::face(), Mesh::Hedge::get_bdry(), Mesh::Edge::hedge(), Mesh::Edge::is_bdry(), Mesh::Hedge::mate(), Mesh::Hedge::next(), Mesh::Hedge::org(), Mesh::Vertex::p(), Mesh::Hedge::prev(), Mesh::Hedge::prev_on_bdry(), Mesh::Face::reuse(), Mesh::Edge::set_bdry(), Mesh::Hedge::set_face(), Mesh::Hedge::set_org(), Mesh::Hedge::set_prev_on_bdry(), Mesh::Vertex::set_star(), and Mesh::Vertex::star_first(). Referenced by unglue(). 00640 { 00641 Hedge *he, *he2_old; 00642 Face *f2 = he2->face(); 00643 Vertex *v1 = he1->org(); 00644 Vertex *v2 = he1->dst(); 00645 Edge *eb1 = v1->star_first()->get_bdry(); 00646 Edge *eb2 = v2->star_first()->get_bdry(); 00647 Vertex *v3 = new Vertex(v2->p()); 00648 Vertex *v4 = new Vertex(v1->p()); 00649 v3->p()->add_vert(v3); 00650 v4->p()->add_vert(v4); 00651 add_vertex(v3); 00652 add_vertex(v4); 00653 00654 Edge *ne = new Edge(v3, v4); 00655 he2_old = he2; 00656 he2 = ne->hedge(0); 00657 add_edge(ne); 00658 00659 /*update hedge of a face*/ 00660 if (f2->reuse(he2_old, he2)<0) return NULL; 00661 he2_old->set_face(NULL); 00662 00663 /*update bdries*/ 00664 ne->set_bdry(eb1); 00665 he1->edge()->set_bdry(eb1); 00666 00667 del_bdry(eb2); 00668 he = v2->star_first(); 00669 do 00670 { 00671 he->edge()->set_bdry(eb1); 00672 he = he->prev_on_bdry(); 00673 } 00674 while(he != v2->star_first()); 00675 00676 00677 /*update prev on bdry, orgs*/ 00678 he1->set_prev_on_bdry(v1->star_first()); 00679 00680 he = he1->next(); 00681 while(!(he->edge()->is_bdry())) 00682 he = he->mate()->next(); 00683 he->set_prev_on_bdry(he1); 00684 00685 he = he2->prev(); 00686 while(!(he->edge()->is_bdry())){ 00687 he->mate()->set_org(v3); 00688 he = he->mate()->prev(); 00689 } 00690 he->mate()->set_org(v3); 00691 he2->set_prev_on_bdry(he); 00692 v3->set_star(he); 00693 00694 he = he2->next(); 00695 he->set_org(v4); 00696 while(!(he->edge()->is_bdry())){ 00697 he = he->mate()->next(); 00698 he->set_org(v4); 00699 } 00700 he->set_prev_on_bdry(he2); 00701 00702 /*update star*/ 00703 v2->set_star(he1); 00704 v4->set_star(he2); 00705 00706 return ne; 00707 }
|
|
Unglue two edges in the same boundary curve. Unglue two internal edges.
Definition at line 715 of file handle.cpp. References Mesh::Vertex::is_bdry(), and Mesh::Hedge::org(). Referenced by unglue(). 00716 { 00717 if(he1->org()->is_bdry()){ 00718 Hedge *temp = he1; 00719 he1 = he2; 00720 he2 = temp; 00721 } 00722 Hedge *he2_old, *he; 00723 Face *f2 = he2->face(); 00724 Vertex *v1 = he1->org(); 00725 Vertex *v2 = he1->dst(); 00726 Edge *eb = v2->star_first()->get_bdry(); 00727 Vertex *v3 = new Vertex(v2->p()); 00728 v3->p()->add_vert(v3); 00729 add_vertex(v3); 00730 00731 Edge *ne = new Edge(v3, v1); 00732 he2_old = he2; 00733 he2 = ne->hedge(0); 00734 add_edge(ne); 00735 00736 /*update hedge of a face*/ 00737 if (f2->reuse(he2_old, he2)<0) return NULL; 00738 he2_old->set_face(NULL); 00739 00740 /*update bdries, orgs*/ 00741 ne->set_bdry(eb); 00742 he1->edge()->set_bdry(eb); 00743 00744 he = he2->prev(); 00745 while(!(he->edge()->is_bdry())){ 00746 he->mate()->set_org(v3); 00747 he = he->mate()->prev(); 00748 } 00749 he->mate()->set_org(v3); 00750 he2->set_prev_on_bdry(he); 00751 v3->set_star(he); 00752 00753 /*update prev on bdry*/ 00754 he1->set_prev_on_bdry(he2); 00755 he = he1->next(); 00756 while(!(he->edge()->is_bdry())) 00757 he = he->mate()->next(); 00758 he->set_prev_on_bdry(he1); 00759 00760 /*update stars*/ 00761 v1->set_star(he2); 00762 v2->set_star(he1); 00763 return ne; 00764 }
|
|
Unglue two edges and creates a new boundary curve. Unglue two internal edges. A new boundary curve created.
Definition at line 773 of file handle.cpp. References add_bdry(), add_edge(), Mesh::Hedge::dst(), Mesh::Hedge::edge(), Mesh::Hedge::face(), Mesh::Edge::hedge(), Mesh::Hedge::org(), Mesh::Face::reuse(), Mesh::Edge::set_bdry(), Mesh::Hedge::set_face(), Mesh::Hedge::set_prev_on_bdry(), and Mesh::Vertex::set_star(). Referenced by unglue(). 00774 { 00775 Hedge *he2_old; 00776 Face *f2 = he2->face(); 00777 Vertex *v1 = he1->org(); 00778 Vertex *v2 = he1->dst(); 00779 00780 Edge *ne = new Edge(v2, v1); 00781 he2_old = he2; 00782 he2 = ne->hedge(0); 00783 add_edge(ne); 00784 add_bdry(ne); 00785 00786 /*update hedge of a face*/ 00787 if (f2->reuse(he2_old, he2)<0) return NULL; 00788 he2_old->set_face(NULL); 00789 00790 /*update bdries*/ 00791 ne->set_bdry(ne); 00792 he1->edge()->set_bdry(ne); 00793 00794 /*update prev on bdry*/ 00795 he1->set_prev_on_bdry(he2); 00796 he2->set_prev_on_bdry(he1); 00797 00798 /*update star*/ 00799 v1->set_star(he2); 00800 v2->set_star(he1); 00801 00802 return ne; 00803 }
|
|
Returns iterator that points to the first edge of the surface.
Definition at line 156 of file mesh.h. References ec_. Referenced by transfer_cells(). 00156 { return ec_.begin(); };
|
|
Returns iterador that points to the last edge of the surface.
Definition at line 160 of file mesh.h. References ec_. Referenced by transfer_cells(). 00160 { return ec_.end(); };
|
|
Returns iterator that points to the first face of the surface.
Definition at line 168 of file mesh.h. References fc_. Referenced by transfer_cells(). 00168 { return fc_.begin(); };
|
|
Returns iterador that points to the last vertex of the surface.
Definition at line 172 of file mesh.h. References fc_. Referenced by transfer_cells(). 00172 { return fc_.end(); };
|
|
Flips internal edge. Changes the connectivity of an edge shared by two faces.
Definition at line 161 of file stellar.cpp. References Mesh::Hedge::dst(), Mesh::Hedge::face(), Mesh::Hedge::mate(), Mesh::Hedge::next(), Mesh::Hedge::org(), Mesh::Hedge::prev(), Mesh::Face::reuse(), Mesh::Hedge::reuse(), Mesh::Vertex::set_star(), and Mesh::Vertex::star_first(). 00162 { 00163 Hedge *m = h->mate(); 00164 Face *fl = h->face(); 00165 Face *fr = m->face(); 00166 if (fl == NULL || fr == NULL) 00167 return h; 00168 Hedge *hp = h->prev(); 00169 Hedge *hn = h->next(); 00170 Hedge *mp = m->prev(); 00171 Hedge *mn = m->next(); 00172 Vertex *v0 = h->org(); 00173 Vertex *v1 = h->dst(); 00174 Vertex *vl = hp->org(); 00175 Vertex *vr = mp->org(); 00176 if (v0->star_first() == m) 00177 v0->set_star(hp); 00178 if (v1->star_first() == h) 00179 v1->set_star(mp); 00180 Hedge *o = h->reuse(vl, vr); 00181 fr->reuse(o, mp, hn); 00182 fl->reuse(o->mate(), hp, mn); 00183 return o; 00184 }
|
|
Glue two half edges. Glue two boundary edges. This function deals and encapsulates 4 handle operators.
Definition at line 115 of file handle.cpp. References attach_handle_0(), attach_handle_1(), attach_handle_2(), attach_handle_3(), attach_handle_4(), Mesh::Hedge::dst(), Mesh::Hedge::face(), Mesh::Hedge::get_bdry(), Mesh::Hedge::org(), and Mesh::Face::surf(). 00116 { 00117 Surf* s1 = e1->face()->surf(); 00118 Surf* s2 = e2->face()->surf(); 00119 Vertex* v1 = e1->org(); 00120 Vertex* v2 = e1->dst(); 00121 Vertex* v3 = e2->org(); 00122 Vertex* v4 = e2->dst(); 00123 Edge* b1 = e1->get_bdry(); 00124 Edge* b2 = e2->get_bdry(); 00125 00126 if (s1 != s2) 00127 return attach_handle_0(e1, e2); 00128 if (b1 != b2) 00129 return attach_handle_1(e1, e2); 00130 if (v1 == v4) { 00131 if (v2 != v3) 00132 return attach_handle_3(e1, e2); 00133 else 00134 return attach_handle_4(e1, e2); 00135 } 00136 if (v2 == v3) 00137 return attach_handle_3(e1, e2); 00138 return attach_handle_2(e1, e2); 00139 }
|
|
Look for a hedge in surface. Look for a hedge in surface.
Definition at line 57 of file surf.cpp. References ec_, Mesh::Hedge::mate(), and Mesh::Point::p(). 00058 { 00059 for (EdgeIter e = ec_.begin(); e != ec_.end(); e++) { 00060 Hedge* h = (*e)->hedge(0); 00061 if (h->org()->p() == p0 && h->dst()->p() == p1) return h; 00062 if (h->org()->p() == p1 && h->dst()->p() == p0) return h->mate(); 00063 } 00064 return NULL; 00065 }
|
|
Returns the number of boundaries.
Definition at line 188 of file mesh.h. References bc_. 00188 { return bc_.size(); };
|
|
Returns the number of egdes.
Definition at line 164 of file mesh.h. References ec_. 00164 { return ec_.size(); };
|
|
Returns the number of faces.
Definition at line 176 of file mesh.h. References fc_. 00176 { return fc_.size(); };
|
|
Returns the number of vertices.
Definition at line 152 of file mesh.h. References vc_. 00152 { return vc_.size(); };
|
|
Splits an edge. Splits a half-edge into two sub-half-edges.
Definition at line 16 of file stellar.cpp. References bisect(), Mesh::Hedge::face(), Mesh::Hedge::mate(), Mesh::Hedge::next(), Mesh::Hedge::prev(), and Mesh::Vertex::set_star(). 00017 { 00018 Hedge *el, *er; 00019 Face *f = e->face(); 00020 if (f == NULL) throw Error("subdiv edge"); 00021 Face *fm = e->mate()->face(); 00022 Hedge *ef1 = e->next(); 00023 Hedge *ef2 = e->prev(); 00024 Hedge *efm1 = (fm)? e->mate()->next() : NULL; 00025 Hedge *efm2 = (fm)? e->mate()->prev() : NULL; 00026 Vertex *v = bisect(e, &el, &er); 00027 bisect(f, ef1, ef2, e, er); 00028 bisect(fm, efm1, efm2, er->mate(), e->mate()); 00029 v->set_star(e); 00030 return v; 00031 }
|
|
Divides a face. Divides a face into three new faces. The new vertex is inserted inside the face and new faces are built.
Definition at line 137 of file stellar.cpp. References add_face(), add_new_edge(), add_new_vertex(), Mesh::Face::hedge(), Mesh::Hedge::mate(), Mesh::Face::reuse(), Mesh::Vertex::set_star(), and Mesh::Face::vertex(). 00138 { 00139 Hedge *e0 = f->hedge(0); 00140 Hedge *e1 = f->hedge(1); 00141 Hedge *e2 = f->hedge(2); 00142 Vertex *v0 = f->vertex(0); 00143 Vertex *v1 = f->vertex(1); 00144 Vertex *v2 = f->vertex(2); 00145 Vertex *vc = add_new_vertex(new Point()); 00146 Hedge *e0c = add_new_edge(v0, vc); 00147 Hedge *e1c = add_new_edge(v1, vc); 00148 Hedge *e2c = add_new_edge(v2, vc); 00149 f->reuse(e0, e2c, e1c->mate()); 00150 add_face(new Face(this, e1, e0c, e2c->mate())); 00151 add_face(new Face(this, e2, e1c, e0c->mate())); 00152 vc->set_star(e0c); 00153 return vc; 00154 }
|
|
Adds cells from other surface. It doesn't perform any topological change.
Definition at line 71 of file surf.cpp. References add_bdry(), add_edge(), add_face(), add_vertex(), bdries_begin(), bdries_end(), edges_begin(), edges_end(), faces_begin(), faces_end(), verts_begin(), and verts_end(). Referenced by attach_handle_0(). 00072 { 00073 for (VertexIter p = s2->verts_begin(); p != s2->verts_end(); p++) 00074 add_vertex(*p); 00075 for (EdgeIter e = s2->edges_begin(); e != s2->edges_end(); e++) 00076 add_edge(*e); 00077 for (FaceIter f = s2->faces_begin(); f != s2->faces_end(); f++) 00078 add_face(*f); 00079 for (EdgeIter e = s2->bdries_begin(); e != s2->bdries_end(); e++) 00080 add_bdry(*e); 00081 }
|
|
Unglue two half-edges. Unglue two boundary edges. This function deals and encapsulates 4 handle inverse operators.
Definition at line 148 of file handle.cpp. References detach_handle_1(), detach_handle_2(), detach_handle_3(), detach_handle_4(), Mesh::Hedge::dst(), Mesh::Hedge::edge(), Mesh::Vertex::is_bdry(), Mesh::Hedge::mate(), Mesh::Hedge::org(), and Mesh::Vertex::star_first(). 00149 { 00150 Vertex* v1 = e1->org(); 00151 Vertex* v2 = e1->dst(); 00152 00153 if (!v1->is_bdry() && !v2->is_bdry()) 00154 return detach_handle_4(e1, e2); 00155 if (v1->is_bdry() && !v2->is_bdry()) 00156 return detach_handle_3(e1, e2); 00157 if (!v1->is_bdry() && v2->is_bdry()) 00158 return detach_handle_3(e1, e2); 00159 if (v1->is_bdry() && v2->is_bdry()) { 00160 if (v2->star_first()->mate()->edge() != v1->star_first()->mate()->edge()) 00161 return detach_handle_2(e1, e2); 00162 else 00163 return detach_handle_1(e1, e2); 00164 } 00165 return NULL; 00166 }
|
|
Returns iterator that points to the first vertex of the surface.
Definition at line 144 of file mesh.h. References vc_. Referenced by transfer_cells(). 00144 { return vc_.begin(); };
|
|
Returns iterador that points to the last vertex of the surface.
Definition at line 148 of file mesh.h. References vc_. Referenced by transfer_cells(). 00148 { return vc_.end(); };
|
|
Removes a vertex. Supported for boudary and internal edges. Removes a vertex from mesh. This operation welds two half-edges into one half-edge.
Definition at line 88 of file stellar.cpp. References Mesh::Vertex::star_first(), and Mesh::Vertex::star_next(). 00089 { 00090 int k, n; 00091 Hedge *ee, *e[6]; Face *f[6]; Vertex *v[6]; 00092 for (n=0, ee=w->star_first(); ee != NULL; n++, ee=w->star_next(ee)) { 00093 if (n > 4) throw Error("weld"); 00094 e[n] = ee; 00095 v[n] = ee->org(); 00096 f[n] = ee->face(); 00097 } 00098 if (n != 4 && n != 3) 00099 { std::cerr << "can't weld " << n << "\n"; return NULL; } 00100 Hedge *p0 = e[0]->prev(); 00101 Hedge *n2 = e[2]->mate()->next(); 00102 Hedge *n0, *p2; 00103 if (f[2] != NULL) { 00104 n0 = e[0]->mate()->next(); 00105 p2 = e[2]->prev(); 00106 } 00107 Hedge *en = e[0]; e[0]->reuse(v[0], v[2]); 00108 00109 if (v[2]->star_first() == e[2]->mate()) 00110 v[2]->set_star(en); 00111 if (v[1]->star_first() == e[1]->mate()) 00112 v[1]->set_star(n2); 00113 if (n == 4 && (v[3]->star_first() == e[3]->mate())) 00114 v[3]->set_star(n0); 00115 00116 f[0]->reuse(en, n2, p0); 00117 if (f[2] != NULL) 00118 f[1]->reuse(en->mate(), n0, p2); 00119 else 00120 del_face(f[1]); 00121 00122 for (k = 2; k < n; k++) 00123 if (f[k] != NULL) 00124 del_face(f[k]); 00125 for (k = 1; k < n; k++) 00126 del_edge(e[k]->edge()); 00127 del_vertex(w); 00128 return en; 00129 }
|
|
Set of Boundary Curve Representatives.
Definition at line 131 of file mesh.h. Referenced by add_bdry(), bdries_begin(), bdries_end(), del_bdry(), num_bdries(), and ~Surf(). |
|
Set of edges.
Definition at line 129 of file mesh.h. Referenced by add_edge(), del_edge(), edges_begin(), edges_end(), lookup_hedge(), num_edges(), and ~Surf(). |
|
Set of faces.
Definition at line 130 of file mesh.h. Referenced by add_face(), del_face(), faces_begin(), faces_end(), num_faces(), and ~Surf(). |
|
Set of vertices.
Definition at line 128 of file mesh.h. Referenced by add_vertex(), del_vertex(), num_verts(), verts_begin(), verts_end(), and ~Surf(). |