Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Overlay Class Reference

#include <Overlay.h>

Collaboration diagram for Overlay:

Public Types

typedef Overlay Self
 
typedef HDS_overlay HDS
 
typedef RFC_Window_overlay::Vertex Vertex
 
typedef
RFC_Window_overlay::Halfedge 
Halfedge
 
typedef RFC_Window_overlay::Facet Facet
 
typedef std::pair< const
Halfedge *, const Halfedge * > 
Parent_pair
 
typedef std::list< const INode * > INode_const_list
 
typedef std::vector< const
INode * > 
Subface
 
typedef std::list< SubfaceSubface_list
 
typedef
RFC_Window_overlay::Feature_0 
Feature_0
 
typedef
RFC_Window_overlay::Feature_1 
Feature_1
 
typedef
RFC_Window_overlay::Feature_list_0 
Feature_list_0
 
typedef
RFC_Window_overlay::Feature_list_1 
Feature_list_1
 

Public Member Functions

 Overlay (const COM::Window *w1, const COM::Window *w2, const char *pre)
 
 ~Overlay ()
 
int overlay ()
 
void set_tolerance (double tol)
 
RFC_Window_overlayget_rfc_window (const COM::Window *w)
 
const RFC_Window_overlayget_rfc_window (const COM::Window *w) const
 
RFC_Window_overlayget_blue_window ()
 
RFC_Window_overlayget_green_window ()
 
const RFC_Window_overlayget_blue_window () const
 
const RFC_Window_overlayget_green_window () const
 
void get_inodes_of_face (const Facet *f, INode_const_list &nodes)
 
Halfedgeget_parent_face (const Subface &sf, int color)
 
bool subdivide (const INode_const_list &face, INode_const_list::const_iterator last_checked, Subface_list &sub_faces, int color, int depth=0) const
 
Point_2 get_nat_coor (const INode &i, const Generic_element &e, const Halfedge *h, int color) const
 
void export_windows (RFC_Window_base *, RFC_Window_base *)
 Export the subdivisions to the two given windows. More...
 
void write_inodes_tec (std::ostream &os, const char *color)
 
void write_inodes_vec (std::ostream &os)
 
void write_overlay_tec (std::ostream &, const COM::Window *)
 
void write_overlay_off (std::ostream &, const COM::Window *)
 

Protected Member Functions

INodeoverlay_init ()
 
void get_green_parent (const Vertex *v, const Halfedge *b, Halfedge **o, Parent_type *t, Point_2 *nc)
 
void insert_node_in_blue_edge (INode &x, Halfedge *b)
 
void intersect_blue_with_green ()
 
void sort_on_green_edges ()
 
void associate_green_vertices ()
 
void insert_node_in_green_edge (INode *v, int tag)
 
void project_adjacent_green_vertices (const INode *, Halfedge *)
 Helper for associate_green_vertices(). More...
 
bool verify_inode (const INode *i)
 
Host_face get_edge_parent (const INode &i0, const INode &i1, const int color) const
 
Parent_pair get_edge_pair_parents (const INode &i0, const INode &i1, const int color) const
 
bool intersect_link (const INode *x, const Halfedge *b, const Halfedge *g0, const Parent_type t0, Halfedge *g1, const Parent_type t1, Real start, Real *cb, Real *cg, Halfedge **g, Parent_type *t, int tryindex=0)
 
bool intersect_link_helper (const Halfedge *b, Halfedge *g2, Real start, Real *cb, Real *cg, Halfedge **g, Parent_type *t, bool *found, int snapcode, const Vertex *anchor, bool panic)
 
bool intersect_link_helper2 (Real *cb, Real *cg, Halfedge **g, Parent_type *t)
 
bool contains (const Halfedge *e1, const Parent_type t1, const Halfedge *e2, const Parent_type t2) const
 
void match_features_0 ()
 
INodeproject_next_vertex (Halfedge *, Halfedge *)
 
int count_edges (const Halfedge *e) const
 

Protected Attributes

RFC_Window_overlayB
 
RFC_Window_overlayG
 
std::list< INode * > inodes
 
Overlay_primitives op
 
HDS_accessor< Tag_trueacc
 
bool is_opposite
 
bool verbose
 
bool verbose2
 
std::string out_pre
 
Real eps_e
 
Real eps_p
 

Private Member Functions

void set_subnode_id (INode *i, int color, int pane_id, int l_id)
 
int get_subnode_id (const INode *i, int color, int pane_id) const
 
int get_subnode_copies (const INode *i, int color) const
 
void convert_nat_coordinates (const INode *i, Halfedge *h, int color, int pane_id, int &lid, RFC_Pane_overlay::Edge_ID &eid, Point_2 &nc) const
 
void number_a_subnode (INode *i, int color, std::map< int, std::pair< int, int > > &cnts)
 
void count_subnodes (INode *i, int color, std::map< int, std::pair< int, int > > &cnts)
 
void number_subnodes ()
 
void number_subfaces ()
 
void insert_edge_into_queue (Halfedge *h, INode *v, std::queue< Halfedge * > &q, std::queue< Halfedge * > &q_rdg, std::queue< Halfedge * > &q_crn)
 
bool is_queue_empty (std::queue< Halfedge * > &q, std::queue< Halfedge * > &q_rdg, std::queue< Halfedge * > &q_crn)
 
Real sq_length (const Halfedge &h) const
 
const INodeget_next_inode (const INode *v1, const INode *v2, int) const
 
std::pair< const INode
*, const Halfedge * > 
get_next_inode_ccw (const INode *v0, const INode *v1, int color) const
 
std::pair< const INode
*, const Halfedge * > 
get_next_inode_cw (const INode *v0, const INode *v1, int color) const
 
bool logical_xor (bool a, bool b) const
 

Private Attributes

std::vector< Node_ID_subnode_ids_b
 
std::vector< Node_ID_subnode_ids_g
 
std::vector< char > _subnode_copies_b
 
std::vector< char > _subnode_copies_g
 
std::map< int, std::map< int,
int > > 
_subnode_imap_b
 
std::map< int, std::map< int,
int > > 
_subnode_imap_g
 

Detailed Description

Definition at line 55 of file Overlay.h.

Member Typedef Documentation

Definition at line 61 of file Overlay.h.

Definition at line 66 of file Overlay.h.

Definition at line 67 of file Overlay.h.

Definition at line 68 of file Overlay.h.

Definition at line 69 of file Overlay.h.

Definition at line 60 of file Overlay.h.

typedef HDS_overlay HDS

Definition at line 58 of file Overlay.h.

typedef std::list< const INode *> INode_const_list

Definition at line 63 of file Overlay.h.

typedef std::pair< const Halfedge*, const Halfedge*> Parent_pair

Definition at line 62 of file Overlay.h.

typedef Overlay Self

Definition at line 57 of file Overlay.h.

typedef std::vector< const INode*> Subface

Definition at line 64 of file Overlay.h.

typedef std::list< Subface > Subface_list

Definition at line 65 of file Overlay.h.

Definition at line 59 of file Overlay.h.

Constructor & Destructor Documentation

RFC_BEGIN_NAME_SPACE Overlay ( const COM::Window *  w1,
const COM::Window *  w2,
const char *  pre 
)

Definition at line 46 of file Overlay.C.

References B, BLUE, G, GREEN, out_pre, and verbose2.

48  : op(1.e-9, 1.e-6, 1.e-2), is_opposite(true),
49  verbose(true), verbose2(false), out_pre(pre?pre:""),
50  eps_e( 1.e-2), eps_p(1.e-6) {
51  B = new RFC_Window_overlay( const_cast<COM::Window*>(w1), BLUE,
52  out_pre.c_str());
53  G = new RFC_Window_overlay( const_cast<COM::Window*>(w2), GREEN,
54  out_pre.c_str());
55 
56 #if DEBUG
57  verbose2 = true;
58 #endif
59 }
Real eps_e
Definition: Overlay.h:291
bool is_opposite
Definition: Overlay.h:286
const Color GREEN
Definition: Color.C:59
Real eps_p
Definition: Overlay.h:292
A window is a collection of panes.
RFC_Window_overlay * G
Definition: Overlay.h:281
const Color BLUE
Definition: Color.C:62
Overlay_primitives op
Definition: Overlay.h:283
bool verbose
Definition: Overlay.h:287
RFC_Window_overlay * B
Definition: Overlay.h:280
bool verbose2
Definition: Overlay.h:288
std::string out_pre
Definition: Overlay.h:289
~Overlay ( )

Definition at line 61 of file Overlay.C.

References B, and G.

61  {
62  delete G;
63  delete B;
64 }
RFC_Window_overlay * G
Definition: Overlay.h:281
RFC_Window_overlay * B
Definition: Overlay.h:280

Member Function Documentation

void associate_green_vertices ( )
protected

Definition at line 898 of file Overlay.C.

References acc, B, In_place_list_n< T, managed >::begin(), COM_assertion, In_place_list_n< T, managed >::empty(), In_place_list_n< T, managed >::end(), HDS_accessor< _MP >::get_halfedge(), HDS_accessor< _MP >::get_inode(), HDS_accessor< _MP >::get_inode_list(), HDS_accessor< _MP >::get_next(), HDS_accessor< _MP >::get_opposite(), HDS_accessor< _MP >::get_origin(), GREEN, i, HDS_accessor< _MP >::is_border(), RFC_Window_derived< _Pane >::panes(), PARENT_FACE, INode::parent_type(), project_adjacent_green_vertices(), In_place_list_n< T, managed >::rbegin(), In_place_list_n< T, managed >::rend(), and v.

Referenced by overlay().

898  {
899  std::vector<RFC_Pane_overlay*> ps;
900  B->panes( ps); // Process all the panes including extension panes.
901 
902  // Loop through all panes of B
903  for (std::vector<RFC_Pane_overlay*>::iterator
904  pit=ps.begin(); pit!=ps.end(); ++pit) {
905  // Loop through the core faces of each pane.
906  for ( HDS::Facet_iterator fit=(*pit)->hds().facets_begin();
907  fit!=(*pit)->hds().facets_end(); ++fit) {
908 
909  Halfedge *b = acc.get_halfedge( &*fit);
911  Halfedge *h=b;
912 
913  do {
915  if ( i && i->parent_type( GREEN)!=PARENT_FACE)
917 
918  INode_list &il = acc.get_inode_list( h);
919 
920  if ( ! il.empty()) {
921  // Loop through the intersections on the edges
922  INode_list::iterator v = il.begin(), vend = il.end();
923  for ( ; v != vend; ++v) project_adjacent_green_vertices( &*v, b);
924  }
925  else {
927  if ( !ilr.empty()) {
928  INode_list::reverse_iterator vr=ilr.rbegin(),vrend=ilr.rend();
929  for ( ; vr!=vrend; ++vr) project_adjacent_green_vertices(&*vr,b);
930  }
931  }
932  // Increment the iterator
933  } while ( (h = acc.get_next(h)) != b);
934  }
935  }
936 }
Vertex * get_origin(Halfedge *h) const
Definition: HDS_accessor.h:87
Halfedge * get_next(Halfedge *h) const
Definition: HDS_accessor.h:108
Parent_type parent_type(const int color) const
Definition: HDS_overlay.h:350
#define COM_assertion(EX)
Error checking utility similar to the assert macro of the C language.
Halfedge * get_opposite(Halfedge *h) const
Definition: HDS_accessor.h:99
std::reverse_iterator< iterator > reverse_iterator
void project_adjacent_green_vertices(const INode *, Halfedge *)
Helper for associate_green_vertices().
Definition: Overlay.C:940
This class encapsulate a halfedge over a window manifold.
Definition: Manifold_2.h:446
INode * get_inode(Vertex *v) const
Definition: HDS_accessor.h:370
const Color GREEN
Definition: Color.C:59
void panes(std::vector< Pane * > &ps)
Get a vector of local panes contained in the window.
Halfedge * get_halfedge(Vertex *v) const
Definition: HDS_accessor.h:75
*********************************************************************Illinois Open Source License ****University of Illinois NCSA **Open Source License University of Illinois All rights reserved ****Developed free of to any person **obtaining a copy of this software and associated documentation to deal with the Software without including without limitation the rights to and or **sell copies of the and to permit persons to whom the **Software is furnished to do subject to the following this list of conditions and the following disclaimers ****Redistributions in binary form must reproduce the above **copyright this list of conditions and the following **disclaimers in the documentation and or other materials **provided with the distribution ****Neither the names of the Center for Simulation of Advanced the University of nor the names of its **contributors may be used to endorse or promote products derived **from this Software without specific prior written permission ****THE SOFTWARE IS PROVIDED AS WITHOUT WARRANTY OF ANY **EXPRESS OR INCLUDING BUT NOT LIMITED TO THE WARRANTIES **OF FITNESS FOR A PARTICULAR PURPOSE AND **NONINFRINGEMENT IN NO EVENT SHALL THE CONTRIBUTORS OR **COPYRIGHT HOLDERS BE LIABLE FOR ANY DAMAGES OR OTHER WHETHER IN AN ACTION OF TORT OR **ARISING OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE **USE OR OTHER DEALINGS WITH THE SOFTWARE v
Definition: roccomf90.h:20
bool empty() const
blockLoc i
Definition: read.cpp:79
INode_list & get_inode_list(Halfedge *h) const
Definition: HDS_accessor.h:377
reverse_iterator rbegin()
HDS_accessor< Tag_true > acc
Definition: Overlay.h:284
bool is_border(const Halfedge *h) const
Definition: HDS_accessor.h:153
RFC_Window_overlay * B
Definition: Overlay.h:280
reverse_iterator rend()

Here is the call graph for this function:

Here is the caller graph for this function:

bool contains ( const Halfedge e1,
const Parent_type  t1,
const Halfedge e2,
const Parent_type  t2 
) const
protected

Definition at line 1488 of file Overlay.C.

References acc, HDS_accessor< _MP >::get_destination(), HDS_accessor< _MP >::get_facet(), HDS_accessor< _MP >::get_next(), HDS_accessor< _MP >::get_opposite(), HDS_accessor< _MP >::get_origin(), PARENT_EDGE, PARENT_FACE, PARENT_VERTEX, RFC_assertion, and RFC_precondition.

Referenced by get_edge_parent(), get_next_inode(), get_parent_face(), insert_node_in_blue_edge(), intersect_link(), intersect_link_helper(), project_adjacent_green_vertices(), and verify_inode().

1489  {
1490  RFC_precondition( e1!=NULL);
1491  if ( e2 == NULL) return false;
1492 
1493  switch ( t1) {
1494  case PARENT_FACE: {
1495  const Facet *f1=acc.get_facet(e1);
1496  RFC_assertion( f1!=NULL);
1497  switch( t2) {
1498  case PARENT_FACE: {
1499  RFC_assertion( acc.get_facet(e2));
1500  return f1 == acc.get_facet(e2);
1501  }
1502  case PARENT_EDGE: {
1503  return f1 == acc.get_facet(e2) ||
1504  f1 == acc.get_facet( acc.get_opposite(e2));
1505  }
1506  case PARENT_VERTEX: {
1507  // Is true if any edge have acc.get_origin(e2) as an endpoint.
1508  const Vertex *v2=acc.get_origin(e2);
1509  const Halfedge *h = e1;
1510  do {
1511  if ( acc.get_destination(h) == v2) return true;
1512  } while ( ( h = acc.get_next(h)) != e1);
1513  break;
1514  }
1515  default:
1516  RFC_assertion( false);
1517  break;
1518  }
1519  break;
1520  }
1521  case PARENT_EDGE:
1522  if ( t2 == PARENT_EDGE)
1523  return ( e1 == e2 || e1 == acc.get_opposite(e2));
1524  else if ( t2 == PARENT_VERTEX) {
1525  const Vertex *v2=acc.get_origin(e2);
1526  return acc.get_origin(e1) == v2 || acc.get_destination(e1) == v2;
1527  }
1528  break;
1529  case PARENT_VERTEX:
1530  return t2 == PARENT_VERTEX && acc.get_origin(e1) == acc.get_origin(e2);
1531  default:
1532  RFC_assertion( false);
1533  break;
1534  }
1535  return false;
1536 }
Vertex * get_origin(Halfedge *h) const
Definition: HDS_accessor.h:87
Halfedge * get_next(Halfedge *h) const
Definition: HDS_accessor.h:108
Halfedge * get_opposite(Halfedge *h) const
Definition: HDS_accessor.h:99
This class encapsulate a halfedge over a window manifold.
Definition: Manifold_2.h:446
RFC_Window_overlay::Vertex Vertex
Definition: Overlay.h:59
Facet * get_facet(Halfedge *h) const
Definition: HDS_accessor.h:111
RFC_Window_overlay::Facet Facet
Definition: Overlay.h:61
HDS_accessor< Tag_true > acc
Definition: Overlay.h:284
#define RFC_precondition
Definition: rfc_basic.h:63
Vertex * get_destination(Halfedge *h) const
Definition: HDS_accessor.h:93
#define RFC_assertion
Definition: rfc_basic.h:65

Here is the call graph for this function:

Here is the caller graph for this function:

void convert_nat_coordinates ( const INode i,
Halfedge h,
int  color,
int  pane_id,
int &  lid,
RFC_Pane_overlay::Edge_ID eid,
Point_2 nc 
) const
private

Retrieve the local id within a given pane for a given subnode.

See Also
set_subnode_id

Definition at line 123 of file Overlay_IO.C.

References acc, B, RFC_Pane_base::base(), BLUE, Halfedge_overlay::destination(), RFC_Pane_base::Edge_ID::edge_id, RFC_Pane_base::Edge_ID::face_id, Halfedge_overlay::facet(), G, RFC_Pane_overlay::get_lid(), RFC_Pane_base::get_lvid(), HDS_accessor< _MP >::get_pane(), get_subnode_id(), INode::halfedge(), INode::nat_coor(), Halfedge_overlay::next(), RFC_Pane_base::normalize_nat_coor(), Halfedge_overlay::origin(), PARENT_FACE, INode::parent_type(), PARENT_VERTEX, RFC_assertion, and RFC_assertion_code.

Referenced by number_subfaces().

126  {
127  lid = get_subnode_id( i, color, pane_id);
128  i->nat_coor( color, nc);
129 
130  // ==== Determine eid
131  RFC_Pane_overlay &pane = *acc.get_pane(h);
132  eid.face_id = pane.get_lid( h->facet());
133 
134  // Determine eid.edge_id
135  Element_node_enumerator ene( pane.base(), eid.face_id);
136  Halfedge *b = i->halfedge( color);
137 
138  if ( b->facet() != h->facet()) {
139  RFC_assertion( i->parent_type(color) != PARENT_FACE);
140  RFC_Window_overlay &win = color==BLUE? *B : *G;
141  RFC_assertion_code( int count=0);
142  // Find the local node id of b->origin() in the host pane of h
143  while ( !win.is_same_node( b->origin(), h->destination())) {
144  h = h->next(); RFC_assertion( ++count <= 4);
145  }
146  if ( i->parent_type(color) == PARENT_VERTEX)
147  eid.edge_id = pane.get_lvid( ene, pane.get_lid( h->destination()));
148  else {
149  eid.edge_id = pane.get_lvid( ene, pane.get_lid( h->origin()));
150  nc = Point_2( 1-nc[0], 0);
151  }
152  }
153  else {
154  eid.edge_id = pane.get_lvid( ene, pane.get_lid( b->origin()));
155 
156  if ( i->parent_type(color) == PARENT_FACE) {
157  pane.normalize_nat_coor( eid.edge_id, ene.size_of_edges(), nc);
158  eid.edge_id = 0;
159  }
160  }
161 }
int face_id
local face id.
Parent_type parent_type(const int color) const
Definition: HDS_overlay.h:350
An adaptor for enumerating node IDs of an element.
RFC_Pane_overlay * get_pane(Vertex *v) const
Definition: HDS_accessor.h:128
void normalize_nat_coor(int idx, int e, Point &nc) const
Base * base()
The id of its base COM::Pane object.
This class encapsulate a halfedge over a window manifold.
Definition: Manifold_2.h:446
Halfedge next() const
Get the next halfedge of its owner element.
Definition: Manifold_2.h:465
int get_lid(const Vertex *v) const
int get_lvid(const Element_node_enumerator &ene, const int v) const
A window is a collection of panes.
const Point_2S & nat_coor(const int color) const
Definition: HDS_overlay.h:327
RFC_Window_overlay * G
Definition: Overlay.h:281
int edge_id
edge id within the face.
Node destination() const
Obtain the (primary copy of the) destination of the edge.
Definition: Manifold_2.h:472
int get_subnode_id(const INode *i, int color, int pane_id) const
Definition: Overlay_IO.C:83
const Color BLUE
Definition: Color.C:62
Halfedge * halfedge(const int color) const
Definition: HDS_overlay.h:357
HDS_accessor< Tag_true > acc
Definition: Overlay.h:284
#define RFC_assertion_code
Definition: rfc_basic.h:68
RFC_Window_overlay * B
Definition: Overlay.h:280
Node origin() const
Obtain the (primary copy of the) origin of the edge.
Definition: Manifold_2.h:468
#define RFC_assertion
Definition: rfc_basic.h:65
SURF::Vector_2< Real > Point_2
Definition: rfc_basic.h:43

Here is the call graph for this function:

Here is the caller graph for this function:

int count_edges ( const Halfedge e) const
inlineprotected

Definition at line 224 of file Overlay.h.

References i, and Halfedge_overlay::next().

Referenced by insert_node_in_blue_edge(), and number_subfaces().

224  {
225  int i=0;
226  const Halfedge *h=e;
227  do { ++i; } while ( (h=h->next())!= e);
228  return i;
229  }
This class encapsulate a halfedge over a window manifold.
Definition: Manifold_2.h:446
Halfedge next() const
Get the next halfedge of its owner element.
Definition: Manifold_2.h:465
blockLoc i
Definition: read.cpp:79

Here is the call graph for this function:

Here is the caller graph for this function:

void count_subnodes ( INode i,
int  color,
std::map< int, std::pair< int, int > > &  cnts 
)
private

Definition at line 212 of file Overlay_IO.C.

References acc, HDS_accessor< _MP >::get_next_around_origin(), HDS_accessor< _MP >::get_pane(), Vertex_overlay::halfedge(), INode::halfedge(), RFC_Pane_base::id(), Halfedge_overlay::is_border(), Halfedge_overlay::origin(), INode::parent_type(), and PARENT_VERTEX.

Referenced by number_subnodes().

213  {
214  if ( i->parent_type( color) == PARENT_VERTEX) {
215  Halfedge *h = i->halfedge( color);
216  Halfedge *h0 = h;
217  int last_id = -1;
218  std::set<int> panes;
219  bool first_iter = true;
220  do {
221  int pane_id = acc.get_pane(h)->id();
222  if ( !first_iter && (pane_id==last_id||panes.find(pane_id)!=panes.end()))
223  continue;
224  ++(cnts[ pane_id].second);
225  panes.insert(last_id=pane_id);
226 
227  // Optimization assuming the halfedge structure is normalized
228  if ( first_iter && !h->origin()->halfedge()->is_border()) break;
229  first_iter = false;
230  } while ( (h=acc.get_next_around_origin(h)) != h0);
231  }
232 }
Parent_type parent_type(const int color) const
Definition: HDS_overlay.h:350
RFC_Pane_overlay * get_pane(Vertex *v) const
Definition: HDS_accessor.h:128
This class encapsulate a halfedge over a window manifold.
Definition: Manifold_2.h:446
bool is_border() const
Definition: HDS_overlay.h:131
Halfedge * halfedge(const int color) const
Definition: HDS_overlay.h:357
HDS_accessor< Tag_true > acc
Definition: Overlay.h:284
Halfedge * get_next_around_origin(Halfedge *h) const
Definition: HDS_accessor.h:136
int id() const
Node origin() const
Obtain the (primary copy of the) origin of the edge.
Definition: Manifold_2.h:468
Halfedge halfedge() const
Get an incident halfedge originated from the node.
Definition: Manifold_2.h:670

Here is the call graph for this function:

Here is the caller graph for this function:

void export_windows ( RFC_Window_base bw,
RFC_Window_base gw 
)

Export the subdivisions to the two given windows.

Definition at line 455 of file Overlay_IO.C.

References B, RFC_Window_base::export_window(), and G.

455  {
456  // Copy data from RFC_Window_overlay into RFC_Window_base.
457  B->export_window( bw);
458  G->export_window( gw);
459 }
RFC_Window_overlay * G
Definition: Overlay.h:281
void export_window(RFC_Window_base *) const
RFC_Window_overlay * B
Definition: Overlay.h:280

Here is the call graph for this function:

RFC_Window_overlay* get_blue_window ( )
inline

Definition at line 88 of file Overlay.h.

References B.

88 { return B; }
RFC_Window_overlay * B
Definition: Overlay.h:280
const RFC_Window_overlay* get_blue_window ( ) const
inline

Definition at line 90 of file Overlay.h.

References B.

90 { return B; }
RFC_Window_overlay * B
Definition: Overlay.h:280
Overlay::Parent_pair get_edge_pair_parents ( const INode i0,
const INode i1,
const int  color 
) const
protected

Definition at line 1464 of file Overlay.C.

References acc, get_edge_parent(), HDS_accessor< _MP >::get_opposite(), Host_face::halfedge(), HDS_accessor< _MP >::is_border(), PARENT_EDGE, PARENT_FACE, Host_face::parent_type(), and RFC_assertion.

1466  {
1467  Host_face f = get_edge_parent( i0, i1, color);
1468  Halfedge *g = f.halfedge();
1469  RFC_assertion( !acc.is_border(g));
1470 
1471  // There are two cases for f:
1472  // 1. g is not a border edge and the parent type is PARENT_FACE
1473  // 2. g is not a border edge and the parent type is PARENT_EDGE
1474 
1475  switch ( f.parent_type()) {
1476  case PARENT_FACE:
1477  return std::make_pair( g, g);
1478  case PARENT_EDGE:
1479  return std::make_pair( g, acc.get_opposite(g));
1480  default:
1481  RFC_assertion( false);
1482  return std::make_pair( (Halfedge*)NULL, (Halfedge*)NULL);
1483  }
1484 }
Halfedge_overlay * halfedge() const
Definition: HDS_overlay.h:295
Halfedge * get_opposite(Halfedge *h) const
Definition: HDS_accessor.h:99
This class encapsulate a halfedge over a window manifold.
Definition: Manifold_2.h:446
Host_face get_edge_parent(const INode &i0, const INode &i1, const int color) const
Definition: Overlay.C:1393
Parent_type parent_type() const
Definition: HDS_overlay.h:297
HDS_accessor< Tag_true > acc
Definition: Overlay.h:284
bool is_border(const Halfedge *h) const
Definition: HDS_accessor.h:153
#define RFC_assertion
Definition: rfc_basic.h:65

Here is the call graph for this function:

Host_face get_edge_parent ( const INode i0,
const INode i1,
const int  color 
) const
protected

Definition at line 1393 of file Overlay.C.

References acc, contains(), HDS_accessor< _MP >::get_destination(), HDS_accessor< _MP >::get_next_around_origin(), HDS_accessor< _MP >::get_opposite(), HDS_accessor< _MP >::get_origin(), INode::halfedge(), HDS_accessor< _MP >::is_border(), INode::nat_coor(), PARENT_EDGE, PARENT_FACE, PARENT_NONE, INode::parent_type(), PARENT_VERTEX, and RFC_assertion.

Referenced by get_edge_pair_parents(), get_next_inode(), get_next_inode_ccw(), get_next_inode_cw(), get_parent_face(), and intersect_blue_with_green().

1395  {
1396  Halfedge *h0 = i0.halfedge( color);
1397  Halfedge *h1 = i1.halfedge( color);
1398 
1399  Parent_type t0 = i0.parent_type( color);
1400  Parent_type t1 = i1.parent_type( color);
1401 
1402  if ( t1 == PARENT_FACE) {
1403  if ( !acc.is_border( h1) && contains( h1, PARENT_FACE, h0, t0))
1404  return Host_face( h1, PARENT_FACE);
1405  else
1406  return Host_face( NULL, PARENT_NONE);
1407  }
1408 
1409  switch ( t0) {
1410  case PARENT_VERTEX: {
1411  Halfedge *h = h0;
1412  // First check whether they lie on the same edge
1413  do {
1414  if ( t1 == PARENT_EDGE && (h == h1 || acc.get_opposite(h) == h1) ||
1415  t1 == PARENT_VERTEX && acc.get_destination(h)==acc.get_origin(h1)) {
1416  return Host_face( h, PARENT_EDGE);
1417  }
1418  RFC_assertion( t1 != PARENT_VERTEX ||
1419  acc.get_origin(h0) != acc.get_origin(h1));
1420  } while ( (h=acc.get_next_around_origin(h)) != h0);
1421  // If not, check whether they lie on the same face
1422  do {
1423  if ( !acc.is_border( h) && contains(h, PARENT_FACE, h1, t1))
1424  return Host_face( h, PARENT_FACE);
1425  } while ( (h=acc.get_next_around_origin(h)) != h0);
1426  break;
1427  }
1428  case PARENT_EDGE: {
1429  Halfedge *hopp=acc.get_opposite(h0);
1430  if ( t1 == PARENT_EDGE && ( h0 == h1 || hopp == h1)) {
1431  Real nc0=i0.nat_coor( color)[0], nc1=i1.nat_coor( color)[0];
1432  if ( h0 == h1 && nc0<nc1 || hopp == h1 && 1.-nc0<nc1)
1433  return Host_face( h0, PARENT_EDGE);
1434  else
1435  return Host_face( hopp, PARENT_EDGE);
1436  }
1437  if ( t1 == PARENT_VERTEX) {
1438  if (acc.get_destination(h0) == acc.get_origin(h1))
1439  return Host_face( h0, PARENT_EDGE);
1440  else if (acc.get_origin(h0) == acc.get_origin(h1))
1441  return Host_face( hopp, PARENT_EDGE);
1442  }
1443  if ( ! acc.is_border(h0) && contains( h0, PARENT_FACE, h1, t1))
1444  return Host_face( h0, PARENT_FACE);
1445  if ( ! acc.is_border(hopp) && contains( hopp, PARENT_FACE, h1, t1))
1446  return Host_face( hopp, PARENT_FACE);
1447  break;
1448  }
1449  case PARENT_FACE: {
1450  RFC_assertion( ! acc.is_border(h0));
1451  if ( contains(h0, PARENT_FACE, h1, t1))
1452  return Host_face(h0, PARENT_FACE);
1453  break;
1454  }
1455  default:
1456  RFC_assertion( false);
1457  break;
1458  }
1459  return Host_face( NULL, PARENT_NONE);
1460 }
Vertex * get_origin(Halfedge *h) const
Definition: HDS_accessor.h:87
Parent_type parent_type(const int color) const
Definition: HDS_overlay.h:350
Halfedge * get_opposite(Halfedge *h) const
Definition: HDS_accessor.h:99
This class encapsulate a halfedge over a window manifold.
Definition: Manifold_2.h:446
double Real
Definition: mapbasic.h:322
Parent_type
Definition: rfc_basic.h:49
const Point_2S & nat_coor(const int color) const
Definition: HDS_overlay.h:327
Halfedge * halfedge(const int color) const
Definition: HDS_overlay.h:357
HDS_accessor< Tag_true > acc
Definition: Overlay.h:284
Halfedge * get_next_around_origin(Halfedge *h) const
Definition: HDS_accessor.h:136
Vertex * get_destination(Halfedge *h) const
Definition: HDS_accessor.h:93
bool is_border(const Halfedge *h) const
Definition: HDS_accessor.h:153
#define RFC_assertion
Definition: rfc_basic.h:65
bool contains(const Halfedge *e1, const Parent_type t1, const Halfedge *e2, const Parent_type t2) const
Definition: Overlay.C:1488

Here is the call graph for this function:

Here is the caller graph for this function:

void get_green_parent ( const Vertex v,
const Halfedge b,
Halfedge **  o,
Parent_type t,
Point_2 nc 
)
protected

Definition at line 101 of file Overlay_init.C.

References NTS::abs(), acc, eps_e, G, Overlay_primitives::get_face_normal(), HDS_accessor< _MP >::get_halfedge(), HDS_accessor< _MP >::get_next(), RFC_Pane_overlay::get_normal(), HDS_accessor< _MP >::get_normal(), HDS_accessor< _MP >::get_opposite(), HDS_accessor< _MP >::get_pane(), RFC_Pane_overlay::get_point(), Overlay_primitives::get_point(), RFC_Pane_overlay::hds(), HDS_accessor< _MP >::is_border(), is_opposite, HDS_accessor< _MP >::is_primary(), HDS_accessor< _MP >::mark(), HDS_accessor< _MP >::marked(), op, RFC_Window_derived< _Pane >::panes(), PARENT_NONE, Overlay_primitives::project_onto_element(), q, RFC_assertion, sq_length(), and HDS_accessor< _MP >::unmark().

Referenced by overlay_init().

106 {
107  const Point_3 &p = acc.get_pane(v)->get_point(v);
108  Real sq_dist = 1.e30;
109  Vertex *w = NULL;
110 
111  //=================================================================
112  // Locate the closest green vertex
113  //=================================================================
114  std::vector<RFC_Pane_overlay*> ps;
115  G->panes( ps);
116  // Loop through all the panes of G
117  for ( std::vector<RFC_Pane_overlay*>::iterator
118  pit=ps.begin(); pit != ps.end(); ++pit) {
119  RFC_Pane_overlay &pane = **pit;
120  // loop through all the green vertices that are complete
121  for ( HDS::Vertex_iterator vit=pane.hds().vertices_begin();
122  vit!=pane.hds().vertices_end(); ++vit)
123  if ( vit->halfedge() && vit->halfedge()->destination() == &*vit) {
124  // if the distance is closer than previous ones, save it
125  Real sq_d = ( p- acc.get_pane(&*vit)->get_point(&*vit)).squared_norm();
126  if ( sq_d < sq_dist) { sq_dist = sq_d; w = &*vit; }
127  }
128  }
129 
130  if ( w == NULL) return;
131 
132  RFC_assertion( acc.is_primary( w)); // Because we start from smaller ids.
133  // Let h be a nonborder incident halfedge of w
134  Halfedge *h = acc.get_halfedge( w);
135  h = !acc.is_border( h) ? acc.get_next( h) : acc.get_opposite( h);
136 
137  // We perform breadth-first search starting from h
138  std::queue< Halfedge*> q;
139  std::list< Halfedge*> hlist;
140 
141  q.push( h);
142  // Mark the halfedges in the same face as h
143  Halfedge *h0 = h;
144  do { RFC_assertion( !acc.marked(h)); acc.mark( h); hlist.push_back( h); }
145  while ( (h=acc.get_next(h)) != h0);
146 
147  Vector_3 vec(0.,0.,0.);
148  while ( !q.empty()) {
149  h = q.front(); q.pop();
150 
151  *t_out = PARENT_NONE; *h_out=h;
152  if ( op.project_onto_element( p, h_out, t_out, vec, nc, eps_e) &&
153  std::abs(acc.get_normal(b)* acc.get_normal(h)) >= 0.6)
154  break;
155 
156  // Insert the incident faces of h into the queue
157  h0 = h;
158  do {
159  Halfedge *hopp=acc.get_opposite(h);
160  if ( !acc.is_border(hopp) && ! acc.marked( hopp)) {
161  Halfedge *h1 = hopp;
162  q.push( h1);
163  do {
164  acc.mark(h1); hlist.push_back( h1);
165  } while ((h1=acc.get_next(h1))!=hopp);
166  }
167  } while ( (h=acc.get_next(h)) != h0);
168  }
169  // Unmark the halfedges
170  while ( !hlist.empty())
171  { acc.unmark( hlist.front()); hlist.pop_front(); }
172 
173  // If v is too far from p_out, return NULL.
174  vec = op.get_point( *h_out, *nc) - p;
175  if ( vec * vec > sq_length( **h_out) + sq_length( *acc.get_halfedge(v))) {
176  *h_out = NULL; *t_out = PARENT_NONE;
177  }
178  else {
179  // Determine whether the two surfaces are facing each other
180  is_opposite = ( acc.get_pane(b)->get_normal( b, v) *
181  op.get_face_normal( *h_out, *nc)) < 0;
182  }
183 }
Halfedge * get_next(Halfedge *h) const
Definition: HDS_accessor.h:108
bool is_primary(const Vertex *v) const
Definition: HDS_accessor.h:187
Halfedge * get_opposite(Halfedge *h) const
Definition: HDS_accessor.h:99
Real eps_e
Definition: Overlay.h:291
RFC_Pane_overlay * get_pane(Vertex *v) const
Definition: HDS_accessor.h:128
bool is_opposite
Definition: Overlay.h:286
const Vector_3 & get_normal(const Halfedge *h) const
Definition: HDS_accessor.h:289
This class encapsulate a halfedge over a window manifold.
Definition: Manifold_2.h:446
bool marked(const Halfedge *h) const
Definition: HDS_accessor.h:299
double Real
Definition: mapbasic.h:322
Vector_3 get_face_normal(const Halfedge *b, const Point_2 &nc, int scheme=0) const
void unmark(Halfedge *h) const
Definition: HDS_accessor.h:297
void panes(std::vector< Pane * > &ps)
Get a vector of local panes contained in the window.
Halfedge * get_halfedge(Vertex *v) const
Definition: HDS_accessor.h:75
*********************************************************************Illinois Open Source License ****University of Illinois NCSA **Open Source License University of Illinois All rights reserved ****Developed free of to any person **obtaining a copy of this software and associated documentation to deal with the Software without including without limitation the rights to and or **sell copies of the and to permit persons to whom the **Software is furnished to do subject to the following this list of conditions and the following disclaimers ****Redistributions in binary form must reproduce the above **copyright this list of conditions and the following **disclaimers in the documentation and or other materials **provided with the distribution ****Neither the names of the Center for Simulation of Advanced the University of nor the names of its **contributors may be used to endorse or promote products derived **from this Software without specific prior written permission ****THE SOFTWARE IS PROVIDED AS WITHOUT WARRANTY OF ANY **EXPRESS OR INCLUDING BUT NOT LIMITED TO THE WARRANTIES **OF FITNESS FOR A PARTICULAR PURPOSE AND **NONINFRINGEMENT IN NO EVENT SHALL THE CONTRIBUTORS OR **COPYRIGHT HOLDERS BE LIABLE FOR ANY DAMAGES OR OTHER WHETHER IN AN ACTION OF TORT OR **ARISING OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE **USE OR OTHER DEALINGS WITH THE SOFTWARE v
Definition: roccomf90.h:20
RFC_Window_overlay::Vertex Vertex
Definition: Overlay.h:59
const Point_3 & get_point(int id) const
RFC_Window_overlay * G
Definition: Overlay.h:281
Real sq_length(const Halfedge &h) const
Definition: Overlay.C:178
bool project_onto_element(const Point_3 &p, Halfedge **g, Parent_type *pt, Vector_3 dir, Point_2 *nc_out, const Real eps_p, Real eps_np=-1.) const
HDS_accessor< Tag_true > acc
Definition: Overlay.h:284
Overlay_primitives op
Definition: Overlay.h:283
NT q
void mark(Halfedge *h) const
Definition: HDS_accessor.h:295
Point_3 get_point(const Halfedge *b, const Point_2S &nc) const
NT abs(const NT &x)
Definition: number_utils.h:130
Some basic geometric data types.
Definition: mapbasic.h:54
bool is_border(const Halfedge *h) const
Definition: HDS_accessor.h:153
Vector_3 & get_normal(int v)
#define RFC_assertion
Definition: rfc_basic.h:65

Here is the call graph for this function:

Here is the caller graph for this function:

RFC_Window_overlay* get_green_window ( )
inline

Definition at line 89 of file Overlay.h.

References G.

89 { return G; }
RFC_Window_overlay * G
Definition: Overlay.h:281
const RFC_Window_overlay* get_green_window ( ) const
inline

Definition at line 91 of file Overlay.h.

References G.

91 { return G; }
RFC_Window_overlay * G
Definition: Overlay.h:281
void get_inodes_of_face ( const Facet f,
INode_const_list nodes 
)

Definition at line 1922 of file Overlay.C.

References acc, In_place_list_n< T, managed >::begin(), In_place_list_n< T, managed >::empty(), In_place_list_n< T, managed >::end(), HDS_accessor< _MP >::get_halfedge(), HDS_accessor< _MP >::get_inode(), HDS_accessor< _MP >::get_inode_list(), HDS_accessor< _MP >::get_next(), HDS_accessor< _MP >::get_opposite(), HDS_accessor< _MP >::get_origin(), i, Halfedge_overlay::is_border(), HDS_accessor< _MP >::is_border(), In_place_list_n< T, managed >::rbegin(), In_place_list_n< T, managed >::rend(), and v.

Referenced by number_subfaces(), write_overlay_off(), and write_overlay_tec().

1923  {
1924  const Halfedge *b = acc.get_halfedge(f);
1925  if ( acc.is_border(b)) {
1926  // Make sure the opposite of b is a border edge
1927  while ( !acc.get_opposite(b)->is_border()) b=acc.get_next(b);
1928  }
1929  const Halfedge *h=b;
1930  do {
1931  const INode *i=acc.get_inode( acc.get_origin(h));
1932  if ( i) nodes.push_back( i);
1933 
1934  const INode_list &il = acc.get_inode_list( h);
1935 
1936  if ( ! il.empty()) {
1937  // Loop through the intersections on the edges
1938  INode_list::const_iterator v = il.begin(), vend = il.end();
1939  for ( ; v != vend; ++v) nodes.push_back( &*v);
1940  }
1941  else {
1942  const INode_list &ilr = acc.get_inode_list( acc.get_opposite(h));
1943  if ( !ilr.empty()) {
1944  INode_list::const_reverse_iterator vr=ilr.rbegin(),vrend=ilr.rend();
1945  for ( ; vr!=vrend; ++vr) nodes.push_back(&*vr);
1946  }
1947  }
1948 
1949  // Increment the iterator
1950  } while ( (h = acc.get_next(h)) != b);
1951 
1952  return;
1953 }
Vertex * get_origin(Halfedge *h) const
Definition: HDS_accessor.h:87
Halfedge * get_next(Halfedge *h) const
Definition: HDS_accessor.h:108
std::reverse_iterator< const_iterator > const_reverse_iterator
Halfedge * get_opposite(Halfedge *h) const
Definition: HDS_accessor.h:99
This class encapsulate a halfedge over a window manifold.
Definition: Manifold_2.h:446
bool is_border() const
Definition: HDS_overlay.h:131
INode * get_inode(Vertex *v) const
Definition: HDS_accessor.h:370
Halfedge * get_halfedge(Vertex *v) const
Definition: HDS_accessor.h:75
*********************************************************************Illinois Open Source License ****University of Illinois NCSA **Open Source License University of Illinois All rights reserved ****Developed free of to any person **obtaining a copy of this software and associated documentation to deal with the Software without including without limitation the rights to and or **sell copies of the and to permit persons to whom the **Software is furnished to do subject to the following this list of conditions and the following disclaimers ****Redistributions in binary form must reproduce the above **copyright this list of conditions and the following **disclaimers in the documentation and or other materials **provided with the distribution ****Neither the names of the Center for Simulation of Advanced the University of nor the names of its **contributors may be used to endorse or promote products derived **from this Software without specific prior written permission ****THE SOFTWARE IS PROVIDED AS WITHOUT WARRANTY OF ANY **EXPRESS OR INCLUDING BUT NOT LIMITED TO THE WARRANTIES **OF FITNESS FOR A PARTICULAR PURPOSE AND **NONINFRINGEMENT IN NO EVENT SHALL THE CONTRIBUTORS OR **COPYRIGHT HOLDERS BE LIABLE FOR ANY DAMAGES OR OTHER WHETHER IN AN ACTION OF TORT OR **ARISING OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE **USE OR OTHER DEALINGS WITH THE SOFTWARE v
Definition: roccomf90.h:20
bool empty() const
blockLoc i
Definition: read.cpp:79
INode_list & get_inode_list(Halfedge *h) const
Definition: HDS_accessor.h:377
reverse_iterator rbegin()
HDS_accessor< Tag_true > acc
Definition: Overlay.h:284
bool is_border(const Halfedge *h) const
Definition: HDS_accessor.h:153
reverse_iterator rend()

Here is the call graph for this function:

Here is the caller graph for this function:

Point_2 get_nat_coor ( const INode i,
const Generic_element e,
const Halfedge h,
int  color 
) const

Definition at line 1854 of file Overlay.C.

References acc, Halfedge_overlay::facet(), HDS_accessor< _MP >::get_next(), HDS_accessor< _MP >::get_opposite(), HDS_accessor< _MP >::get_origin(), INode::halfedge(), HDS_accessor< _MP >::is_border(), INode::nat_coor(), Halfedge_overlay::next(), PARENT_EDGE, INode::parent_type(), PARENT_VERTEX, Halfedge_overlay::prev(), RFC_assertion, and v.

Referenced by insert_node_in_blue_edge(), and number_subfaces().

1855  {
1856  const Halfedge *hi = i.halfedge( color);
1857  Point_2 nc; i.nat_coor( color, nc);
1858 
1859  if ( hi->facet() != h->facet()) {
1860  switch ( i.parent_type( color)) {
1861  case PARENT_VERTEX: {
1862  const Vertex *v = acc.get_origin( hi);
1863  hi = h;
1864  while ( acc.get_origin( hi) != v)
1865  { hi = acc.get_next( hi); RFC_assertion( hi != h); }
1866  break;
1867  }
1868  case PARENT_EDGE: {
1869  const Halfedge *hj = acc.get_opposite( hi);
1870  if ( hj->facet() == h->facet()) {
1871  hi = hj; nc = Point_2( 1.-nc[0], 0.); break;
1872  }
1873  // Otherwise, it is in an extension edge and we treat it as a face.
1874  }
1875  default: {
1876  RFC_assertion( acc.is_border( hi));
1877 
1878  // In the extension region
1879  while ( acc.get_opposite( hi) != h)
1880  { hi = acc.get_next(hi); RFC_assertion( hi != i.halfedge(color)); }
1881 
1882  return Point_2(1.-get_nat_coor(i, Generic_element(4), hi, color)[0],0.);
1883  }
1884  }
1885  }
1886 
1887  switch( e.size_of_edges()) {
1888  case 3: {
1889  if ( hi == h)
1890  return nc;
1891  else if ( hi == h->prev()) {
1892  return Point_2( nc[1], 1.-nc[0]-nc[1]);
1893  }
1894  else {
1895  RFC_assertion( hi == h->next());
1896  return Point_2( 1.-nc[0]-nc[1], nc[0]);
1897  }
1898  }
1899  case 4: {
1900  if ( hi == h)
1901  return nc;
1902  else if ( hi == h->prev()) {
1903  return Point_2( nc[1], 1-nc[0]);
1904  }
1905  else if ( hi == h->next()) {
1906  return Point_2( 1-nc[1], nc[0]);
1907  }
1908  else {
1909  RFC_assertion( hi == h->next()->next());
1910  return Point_2( 1-nc[0], 1-nc[1]);
1911  }
1912  }
1913  default: {
1914  RFC_assertion( false);
1915  }
1916  }
1917  return Point_2(0,0);
1918 }
Vertex * get_origin(Halfedge *h) const
Definition: HDS_accessor.h:87
Halfedge * get_next(Halfedge *h) const
Definition: HDS_accessor.h:108
Parent_type parent_type(const int color) const
Definition: HDS_overlay.h:350
Halfedge * get_opposite(Halfedge *h) const
Definition: HDS_accessor.h:99
Halfedge prev() const
Get the previous halfedge of its owner element.
Definition: Manifold_2.h:460
This class encapsulate a halfedge over a window manifold.
Definition: Manifold_2.h:446
Halfedge next() const
Get the next halfedge of its owner element.
Definition: Manifold_2.h:465
SURF::Generic_element_2 Generic_element
Definition: rfc_basic.h:46
*********************************************************************Illinois Open Source License ****University of Illinois NCSA **Open Source License University of Illinois All rights reserved ****Developed free of to any person **obtaining a copy of this software and associated documentation to deal with the Software without including without limitation the rights to and or **sell copies of the and to permit persons to whom the **Software is furnished to do subject to the following this list of conditions and the following disclaimers ****Redistributions in binary form must reproduce the above **copyright this list of conditions and the following **disclaimers in the documentation and or other materials **provided with the distribution ****Neither the names of the Center for Simulation of Advanced the University of nor the names of its **contributors may be used to endorse or promote products derived **from this Software without specific prior written permission ****THE SOFTWARE IS PROVIDED AS WITHOUT WARRANTY OF ANY **EXPRESS OR INCLUDING BUT NOT LIMITED TO THE WARRANTIES **OF FITNESS FOR A PARTICULAR PURPOSE AND **NONINFRINGEMENT IN NO EVENT SHALL THE CONTRIBUTORS OR **COPYRIGHT HOLDERS BE LIABLE FOR ANY DAMAGES OR OTHER WHETHER IN AN ACTION OF TORT OR **ARISING OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE **USE OR OTHER DEALINGS WITH THE SOFTWARE v
Definition: roccomf90.h:20
RFC_Window_overlay::Vertex Vertex
Definition: Overlay.h:59
const Point_2S & nat_coor(const int color) const
Definition: HDS_overlay.h:327
Halfedge * halfedge(const int color) const
Definition: HDS_overlay.h:357
HDS_accessor< Tag_true > acc
Definition: Overlay.h:284
Halfedge_overlay * next()
Definition: HDS_overlay.h:120
Point_2 get_nat_coor(const INode &i, const Generic_element &e, const Halfedge *h, int color) const
Definition: Overlay.C:1854
bool is_border(const Halfedge *h) const
Definition: HDS_accessor.h:153
#define RFC_assertion
Definition: rfc_basic.h:65
SURF::Vector_2< Real > Point_2
Definition: rfc_basic.h:43

Here is the call graph for this function:

Here is the caller graph for this function:

const INode * get_next_inode ( const INode v1,
const INode v2,
int  color 
) const
private

Definition at line 1728 of file Overlay.C.

References acc, contains(), get_edge_parent(), get_next_inode_ccw(), get_next_inode_cw(), Host_face::halfedge(), HDS_accessor< _MP >::is_border(), is_opposite, PARENT_FACE, and Host_face::parent_type().

Referenced by subdivide().

1728  {
1729  // First, find the blue face that contain both inodes.
1730  std::pair<const INode*,const Halfedge*> b, g;
1731 
1732  b = get_next_inode_ccw( v0, v1, color);
1733  if ( !is_opposite)
1734  g = get_next_inode_ccw( v0, v1, !color);
1735  else
1736  g = get_next_inode_cw( v0, v1, !color);
1737 
1738  if ( g.first==NULL) return b.first;
1739  if ( b.first!=NULL) {
1740  const Host_face bf = get_edge_parent( *v1, *b.first, !color);
1741 
1742  if ( !acc.is_border( g.second) &&
1743  contains( g.second, PARENT_FACE, bf.halfedge(), bf.parent_type()))
1744  // If the blue one is contained in the green face, return the blue one
1745  return b.first;
1746  }
1747 
1748  return g.first;
1749 }
Halfedge_overlay * halfedge() const
Definition: HDS_overlay.h:295
bool is_opposite
Definition: Overlay.h:286
Host_face get_edge_parent(const INode &i0, const INode &i1, const int color) const
Definition: Overlay.C:1393
Parent_type parent_type() const
Definition: HDS_overlay.h:297
HDS_accessor< Tag_true > acc
Definition: Overlay.h:284
bool is_border(const Halfedge *h) const
Definition: HDS_accessor.h:153
std::pair< const INode *, const Halfedge * > get_next_inode_ccw(const INode *v0, const INode *v1, int color) const
Definition: Overlay.C:1585
std::pair< const INode *, const Halfedge * > get_next_inode_cw(const INode *v0, const INode *v1, int color) const
Definition: Overlay.C:1655
bool contains(const Halfedge *e1, const Parent_type t1, const Halfedge *e2, const Parent_type t2) const
Definition: Overlay.C:1488

Here is the call graph for this function:

Here is the caller graph for this function:

std::pair< const INode *, const Overlay::Halfedge * > get_next_inode_ccw ( const INode v0,
const INode v1,
int  color 
) const
private

Definition at line 1585 of file Overlay.C.

References acc, In_place_list_n< T, managed >::back(), In_place_list_n< T, managed >::empty(), Halfedge_overlay::facet(), In_place_list_n< T, managed >::front(), HDS_accessor< _MP >::get_destination(), get_edge_parent(), HDS_accessor< _MP >::get_inode(), HDS_accessor< _MP >::get_inode_list(), HDS_accessor< _MP >::get_next_around_origin(), HDS_accessor< _MP >::get_opposite(), Host_face::halfedge(), INode::halfedge(), In_place_list_n_base< T, n >::next_link, PARENT_EDGE, PARENT_FACE, Host_face::parent_type(), INode::parent_type(), PARENT_VERTEX, In_place_list_n_base< T, n >::prev_link, and RFC_assertion.

Referenced by get_next_inode().

1586 {
1587  INode *v2=NULL;
1588  switch( v1->parent_type( color)) {
1589  case PARENT_FACE:
1590  // Rule 1: When making turns, it must be at an edge/vertex.
1591  return std::pair<const INode *, const Halfedge*>(NULL,NULL);
1592  case PARENT_EDGE: {
1593  Host_face hf = get_edge_parent( *v0, *v1, color);
1594  if ( hf.parent_type() == PARENT_EDGE) {
1595  // Rule 2: No three vertices on the same edge can be in the same subface.
1596  return std::pair<const INode *, const Halfedge*>(NULL,NULL);
1597  }
1598  else {
1600  // next inode is the next one along the edge
1601  Halfedge *h = v1->halfedge( color);
1602  if ( h->facet() != hf.halfedge()->facet()) {
1603  h = acc.get_opposite( h);
1604  RFC_assertion( h->facet() == hf.halfedge()->facet());
1605  }
1606 
1607  INode_list &il = acc.get_inode_list( h);
1608  if ( !il.empty()) {
1609  if ( v1 == &il.back())
1610  v2 = acc.get_inode(acc.get_destination( h));
1611  else
1612  v2 = v1->next_link[color];
1613  }
1614  else {
1616  RFC_assertion( !ilr.empty());
1617  if ( v1 == &ilr.front())
1618  v2 = acc.get_inode(acc.get_destination( h));
1619  else
1620  v2 = v1->prev_link[color];
1621  }
1622  RFC_assertion( v2);
1623  return std::pair<const INode*, const Halfedge*>(v2, h);
1624  }
1625  }
1626  case PARENT_VERTEX: {
1627  Host_face hf = get_edge_parent( *v0, *v1, color);
1628 
1629  Halfedge *h = v1->halfedge(color);
1630  while ( h->facet() != hf.halfedge()->facet()) {
1631  h = acc.get_next_around_origin( h);
1632  RFC_assertion( h != v1->halfedge(color));
1633  }
1634 
1635  INode_list &il = acc.get_inode_list( h);
1636  if ( !il.empty())
1637  v2 = &il.front();
1638  else {
1640  if ( !ilr.empty())
1641  v2 = &ilr.back();
1642  else
1643  v2 = acc.get_inode( acc.get_destination( h));
1644  }
1645  RFC_assertion( v2);
1646  return std::pair<const INode*, const Halfedge*>(v2, h);
1647  }
1648  default:
1649  RFC_assertion( false);
1650  return std::pair<const INode *, const Halfedge*>(NULL,NULL);
1651  }
1652 }
Parent_type parent_type(const int color) const
Definition: HDS_overlay.h:350
Halfedge_overlay * halfedge() const
Definition: HDS_overlay.h:295
Halfedge * get_opposite(Halfedge *h) const
Definition: HDS_accessor.h:99
This class encapsulate a halfedge over a window manifold.
Definition: Manifold_2.h:446
INode * get_inode(Vertex *v) const
Definition: HDS_accessor.h:370
Host_face get_edge_parent(const INode &i0, const INode &i1, const int color) const
Definition: Overlay.C:1393
Parent_type parent_type() const
Definition: HDS_overlay.h:297
bool empty() const
INode_list & get_inode_list(Halfedge *h) const
Definition: HDS_accessor.h:377
Halfedge * halfedge(const int color) const
Definition: HDS_overlay.h:357
HDS_accessor< Tag_true > acc
Definition: Overlay.h:284
Halfedge * get_next_around_origin(Halfedge *h) const
Definition: HDS_accessor.h:136
Vertex * get_destination(Halfedge *h) const
Definition: HDS_accessor.h:93
#define RFC_assertion
Definition: rfc_basic.h:65
reference front()
Facet_overlay * facet()
Definition: HDS_overlay.h:129
reference back()

Here is the call graph for this function:

Here is the caller graph for this function:

std::pair< const INode *, const Overlay::Halfedge * > get_next_inode_cw ( const INode v0,
const INode v1,
int  color 
) const
private

Definition at line 1655 of file Overlay.C.

References acc, In_place_list_n< T, managed >::back(), In_place_list_n< T, managed >::empty(), Halfedge_overlay::facet(), In_place_list_n< T, managed >::front(), get_edge_parent(), HDS_accessor< _MP >::get_inode(), HDS_accessor< _MP >::get_inode_list(), HDS_accessor< _MP >::get_next_around_origin(), HDS_accessor< _MP >::get_opposite(), HDS_accessor< _MP >::get_origin(), Host_face::halfedge(), INode::halfedge(), j, In_place_list_n_base< T, n >::next_link, PARENT_EDGE, PARENT_FACE, Host_face::parent_type(), INode::parent_type(), PARENT_VERTEX, Halfedge_overlay::prev(), In_place_list_n_base< T, n >::prev_link, and RFC_assertion.

Referenced by get_next_inode().

1656 {
1657  INode *v2=NULL;
1658  switch( v1->parent_type( color)) {
1659  case PARENT_FACE:
1660  // Rule 1: When making turns, it must be at an edge/vertex.
1661  return std::pair<const INode *, const Halfedge*>(NULL,NULL);
1662  case PARENT_EDGE: {
1663  Host_face hf = get_edge_parent( *v0, *v1, color);
1664  if ( hf.parent_type() == PARENT_EDGE) {
1665  // Rule 2: No three vertices on the same edge can be in the same subface.
1666  return std::pair<const INode *, const Halfedge*>(NULL,NULL);
1667  }
1668  else {
1670  // next inode is the next one along the edge
1671  Halfedge *h = v1->halfedge( color);
1672  if ( h->facet() != hf.halfedge()->facet()) {
1673  h = acc.get_opposite( h);
1674  RFC_assertion( h->facet() == hf.halfedge()->facet());
1675  }
1676 
1677  INode_list &il = acc.get_inode_list( h);
1678  if ( !il.empty()) {
1679  if ( v1 == &il.front())
1680  v2 = acc.get_inode(acc.get_origin( h));
1681  else
1682  v2 = v1->prev_link[color],h->prev();
1683  }
1684  else {
1686  RFC_assertion( !ilr.empty());
1687  if ( v1 == &ilr.back())
1688  v2 = acc.get_inode(acc.get_origin( h));
1689  else
1690  v2 = v1->next_link[color],h->prev();
1691  }
1692  return std::pair<const INode*, const Halfedge*>(v2, h);
1693  }
1694  }
1695  case PARENT_VERTEX: {
1696  Host_face hf = get_edge_parent( *v0, *v1, color);
1697 
1698  Halfedge *h = v1->halfedge(color);
1699  Halfedge *j = ( (hf.parent_type() == PARENT_EDGE) ?
1700  acc.get_opposite(hf.halfedge()) : hf.halfedge());
1701 
1702  while ( h->facet() != j->facet()) {
1703  h = acc.get_next_around_origin( h);
1704  RFC_assertion( h != v1->halfedge(color));
1705  }
1706  h = h->prev();
1707 
1708  INode *v2;
1709  INode_list &il = acc.get_inode_list( h);
1710  if ( !il.empty())
1711  v2 = &il.back();
1712  else {
1714  if ( !ilr.empty())
1715  v2 = &ilr.front();
1716  else
1717  v2 = acc.get_inode( acc.get_origin( h));
1718  }
1719  return std::pair<const INode*, const Halfedge*>(v2, h);
1720  }
1721  default:
1722  RFC_assertion( false);
1723  return std::pair<const INode *, const Halfedge*>(NULL,NULL);
1724  }
1725 }
Vertex * get_origin(Halfedge *h) const
Definition: HDS_accessor.h:87
Parent_type parent_type(const int color) const
Definition: HDS_overlay.h:350
Halfedge_overlay * halfedge() const
Definition: HDS_overlay.h:295
Halfedge * get_opposite(Halfedge *h) const
Definition: HDS_accessor.h:99
Halfedge prev() const
Get the previous halfedge of its owner element.
Definition: Manifold_2.h:460
This class encapsulate a halfedge over a window manifold.
Definition: Manifold_2.h:446
INode * get_inode(Vertex *v) const
Definition: HDS_accessor.h:370
Host_face get_edge_parent(const INode &i0, const INode &i1, const int color) const
Definition: Overlay.C:1393
Parent_type parent_type() const
Definition: HDS_overlay.h:297
bool empty() const
INode_list & get_inode_list(Halfedge *h) const
Definition: HDS_accessor.h:377
Halfedge * halfedge(const int color) const
Definition: HDS_overlay.h:357
HDS_accessor< Tag_true > acc
Definition: Overlay.h:284
j indices j
Definition: Indexing.h:6
Halfedge * get_next_around_origin(Halfedge *h) const
Definition: HDS_accessor.h:136
#define RFC_assertion
Definition: rfc_basic.h:65
reference front()
Facet_overlay * facet()
Definition: HDS_overlay.h:129
reference back()

Here is the call graph for this function:

Here is the caller graph for this function:

Overlay::Halfedge * get_parent_face ( const Subface sf,
int  color 
)

Definition at line 1841 of file Overlay.C.

References acc, contains(), get_edge_parent(), HDS_accessor< _MP >::get_opposite(), PARENT_FACE, and RFC_assertion.

Referenced by number_subfaces().

1841  {
1842  RFC_assertion( sf.size()>0);
1843 
1844  Host_face f = get_edge_parent( *sf[0], *sf[1], color);
1845  if ( !f.halfedge()->is_border() &&
1846  contains( f.halfedge(), PARENT_FACE,
1847  sf[2]->halfedge(color), sf[2]->parent_type(color)))
1848  return f.halfedge();
1849  else
1850  return acc.get_opposite(f.halfedge());
1851 }
Halfedge * get_opposite(Halfedge *h) const
Definition: HDS_accessor.h:99
Host_face get_edge_parent(const INode &i0, const INode &i1, const int color) const
Definition: Overlay.C:1393
HDS_accessor< Tag_true > acc
Definition: Overlay.h:284
#define RFC_assertion
Definition: rfc_basic.h:65
bool contains(const Halfedge *e1, const Parent_type t1, const Halfedge *e2, const Parent_type t2) const
Definition: Overlay.C:1488

Here is the call graph for this function:

Here is the caller graph for this function:

RFC_Window_overlay* get_rfc_window ( const COM::Window *  w)
inline

Definition at line 84 of file Overlay.h.

References B, RFC_Window_base::base(), and G.

85  { return ( B->base() == w) ? B : G; }
RFC_Window_overlay * G
Definition: Overlay.h:281
const COM::Window * base() const
Get a reference to the base COM::Window object.
RFC_Window_overlay * B
Definition: Overlay.h:280

Here is the call graph for this function:

const RFC_Window_overlay* get_rfc_window ( const COM::Window *  w) const
inline

Definition at line 86 of file Overlay.h.

References B, RFC_Window_base::base(), and G.

87  { return ( B->base() == w) ? B : G; }
RFC_Window_overlay * G
Definition: Overlay.h:281
const COM::Window * base() const
Get a reference to the base COM::Window object.
RFC_Window_overlay * B
Definition: Overlay.h:280

Here is the call graph for this function:

int get_subnode_copies ( const INode i,
int  color 
) const
private

Retrieve the number of copies for a given subnode.

Definition at line 107 of file Overlay_IO.C.

References _subnode_copies_b, _subnode_copies_g, BLUE, GREEN, INode::id(), and RFC_assertion.

107  {
108  if ( color==BLUE) {
109  int global_id = i->id();
110  return _subnode_copies_b[ global_id];
111  }
112  else {
113  RFC_assertion( color == GREEN);
114  int global_id = i->id();
115  return _subnode_copies_g[ global_id];
116  }
117 }
int id() const
Definition: HDS_overlay.h:347
const Color GREEN
Definition: Color.C:59
std::vector< char > _subnode_copies_g
Definition: Overlay.h:250
const Color BLUE
Definition: Color.C:62
std::vector< char > _subnode_copies_b
Definition: Overlay.h:249
#define RFC_assertion
Definition: rfc_basic.h:65

Here is the call graph for this function:

int get_subnode_id ( const INode i,
int  color,
int  pane_id 
) const
private

Retrieve the local id within a given pane for a given subnode.

See Also
set_subnode_id

Definition at line 83 of file Overlay_IO.C.

References _subnode_ids_b, _subnode_ids_g, _subnode_imap_b, _subnode_imap_g, BLUE, GREEN, INode::id(), Node_ID::node_id, Node_ID::pane_id, and RFC_assertion.

Referenced by convert_nat_coordinates().

83  {
84  if ( color==BLUE) {
85  int global_id = i->id();
86  const Node_ID &vid = _subnode_ids_b[ global_id];
87 
88  if ( vid.pane_id == pane_id)
89  return vid.node_id;
90  else
91  return _subnode_imap_b.find( global_id)->second.find( pane_id)->second;
92  }
93  else { RFC_assertion( color == GREEN);
94  int global_id = i->id();
95  const Node_ID &vid = _subnode_ids_g[ global_id];
96 
97  if ( vid.pane_id == pane_id)
98  return vid.node_id;
99  else
100  return _subnode_imap_g.find( global_id)->second.find( pane_id)->second;
101  }
102 }
std::vector< Node_ID > _subnode_ids_b
Definition: Overlay.h:247
int node_id
the local id within the pane starting from 1.
int id() const
Definition: HDS_overlay.h:347
std::map< int, std::map< int, int > > _subnode_imap_g
Definition: Overlay.h:253
const Color GREEN
Definition: Color.C:59
int pane_id
the id of the owner pane.
std::vector< Node_ID > _subnode_ids_g
Definition: Overlay.h:248
std::map< int, std::map< int, int > > _subnode_imap_b
Definition: Overlay.h:252
const Color BLUE
Definition: Color.C:62
A global ID of a node.
#define RFC_assertion
Definition: rfc_basic.h:65

Here is the call graph for this function:

Here is the caller graph for this function:

void insert_edge_into_queue ( Halfedge h,
INode v,
std::queue< Halfedge * > &  q,
std::queue< Halfedge * > &  q_rdg,
std::queue< Halfedge * > &  q_crn 
)
private

Definition at line 486 of file Overlay.C.

References acc, Halfedge_overlay::destination(), HDS_accessor< _MP >::get_opposite(), GREEN, INode::halfedge(), HDS_accessor< _MP >::is_border(), HDS_accessor< _MP >::is_feature_0(), HDS_accessor< _MP >::is_feature_1(), HDS_accessor< _MP >::is_on_feature(), HDS_accessor< _MP >::mark(), HDS_accessor< _MP >::marked(), Halfedge_overlay::origin(), PARENT_EDGE, INode::parent_type(), and PARENT_VERTEX.

Referenced by intersect_blue_with_green().

489  {
490  // If the edge or its opposite has been marked, then skip.
491  if ( acc.marked( h)) return;
492 
493  // First, determine feature rank of origin and destination vertices.
494  int frank_org = acc.is_on_feature( h->origin());
495  if ( frank_org) frank_org += acc.is_feature_0( ( h->origin()));
496 
497  if ( frank_org != 2) { // Consider feature type of green parent.
498  Parent_type pt = v->parent_type(GREEN);
499  Halfedge *g = v->halfedge(GREEN);
500  if ( pt == PARENT_VERTEX) {
501  Vertex *gv;
502  if ( acc.is_feature_0( gv=g->origin()))
503  frank_org = 2; // If mapped onto a corner, consider vertex as corner
504  else if ( frank_org == 0 && acc.is_on_feature( gv))
505  frank_org = 1;
506  }
507  else if ( frank_org==0 && pt==PARENT_EDGE && acc.is_feature_1( g)) {
508  frank_org = 1; // Ridge vertex
509  }
510  }
511 
512  int frank_dst = 0;
513  if ( frank_org) { // Determine type of destination vertex
514  frank_dst = acc.is_on_feature( ( h->destination()));
515  if ( frank_dst) frank_dst += acc.is_feature_0( h->destination());
516  }
517 
518  Halfedge *hopp = acc.get_opposite(h);
519  acc.mark( h);
520  if ( frank_org == 0 || frank_org < frank_dst || acc.is_border(hopp) ||
521  frank_dst != 2 && !acc.is_border(hopp) && acc.marked( hopp)) {
522  // If push edge into main queue, then mark both the edge and its opposite
523  q.push( h); acc.mark( hopp);
524  }
525  else if ( frank_org == 2 && !acc.is_border(hopp) && acc.marked( hopp)) {
526  // If I am a corner and the other edge is candidate, move into main queue
527  q.push( hopp);
528  }
529  else if ( frank_org == 1) {
530  // Otherwise, if frank_org is ridge, then push into ridge queue
531  q_rdg.push( h);
532  }
533  else {
534  // Otherwise frank_org is corner, don't push it.
535  q_crn.push(h);
536  }
537 }
Parent_type parent_type(const int color) const
Definition: HDS_overlay.h:350
Halfedge * get_opposite(Halfedge *h) const
Definition: HDS_accessor.h:99
bool is_feature_1(const Halfedge *h) const
Definition: HDS_accessor.h:184
This class encapsulate a halfedge over a window manifold.
Definition: Manifold_2.h:446
bool marked(const Halfedge *h) const
Definition: HDS_accessor.h:299
const Color GREEN
Definition: Color.C:59
bool is_feature_0(const Vertex *v) const
Definition: HDS_accessor.h:179
bool is_on_feature(const Vertex *v) const
Definition: HDS_accessor.h:174
RFC_Window_overlay::Vertex Vertex
Definition: Overlay.h:59
Parent_type
Definition: rfc_basic.h:49
Node destination() const
Obtain the (primary copy of the) destination of the edge.
Definition: Manifold_2.h:472
Halfedge * halfedge(const int color) const
Definition: HDS_overlay.h:357
HDS_accessor< Tag_true > acc
Definition: Overlay.h:284
void mark(Halfedge *h) const
Definition: HDS_accessor.h:295
bool is_border(const Halfedge *h) const
Definition: HDS_accessor.h:153
Node origin() const
Obtain the (primary copy of the) origin of the edge.
Definition: Manifold_2.h:468

Here is the call graph for this function:

Here is the caller graph for this function:

void insert_node_in_blue_edge ( INode x,
Halfedge b 
)
protected

Definition at line 187 of file Overlay.C.

References NTS::abs(), acc, In_place_list_n< T, managed >::back(), BLUE, contains(), count_edges(), Halfedge_overlay::destination(), dist(), In_place_list_n< T, managed >::empty(), eps_e, In_place_list_n< T, managed >::front(), RFC_Pane_overlay::get_index(), HDS_accessor< _MP >::get_inode(), HDS_accessor< _MP >::get_inode_list(), get_nat_coor(), HDS_accessor< _MP >::get_next(), HDS_accessor< _MP >::get_next_around_origin(), HDS_accessor< _MP >::get_opposite(), HDS_accessor< _MP >::get_origin(), HDS_accessor< _MP >::get_pane(), Overlay_primitives::get_point(), GREEN, INode::halfedge(), i, RFC_Pane_base::id(), HDS_accessor< _MP >::is_border(), INode::nat_coor(), Halfedge_overlay::next(), op, Halfedge_overlay::origin(), PARENT_EDGE, PARENT_FACE, INode::parent_type(), PARENT_VERTEX, Vertex_overlay::point(), In_place_list_n< T, managed >::pop_back(), In_place_list_n< T, managed >::pop_front(), RFC_assertion, HDS_accessor< _MP >::set_inode(), INode::set_parent(), sqrt(), verbose, and x.

Referenced by intersect_blue_with_green(), match_features_0(), and project_next_vertex().

187  {
188  Halfedge *b = x.halfedge( BLUE);
190 
191  // Step 1, verify that x is not at a green vertex that already has
192  // an inode associated with. If so, merge the two inodes by making
193  // its blue parent the intersection of the two blue edges/vertices,
194  // and delete the old one.
195  if ( x.parent_type( GREEN) == PARENT_VERTEX) {
196  INode *i = acc.get_inode( acc.get_origin( g));
197  if (i) {
198  if ( i->parent_type( BLUE) == PARENT_VERTEX) {
199  std::cerr << "ERROR: One-to-many mapping at green vertex "
200  << acc.get_pane(g)->get_index(g->origin())+1
201  << " of pane " << acc.get_pane(g)->id()
202  << " at " << g->origin()->point()
203  << ".\n It is projected onto from blue vertices \n\t"
204  << acc.get_pane(b)->get_index(b->origin())+1 << " of pane "
205  << acc.get_pane(b)->id() << " at " << b->origin()->point() << " and\n\t";
206  b = i->halfedge(BLUE);
207  std::cerr << acc.get_pane(b)->get_index(b->origin())+1
208  << " of pane " << acc.get_pane(b)->id()
209  << " at " << b->origin()->point() << std::endl;
210  RFC_assertion(i->parent_type( BLUE) != PARENT_VERTEX); abort();
211  }
212  if ( !contains( i->halfedge( BLUE), i->parent_type( BLUE),
213  b, PARENT_VERTEX)) {
214  b = acc.get_next( b);
216  b, PARENT_VERTEX));
217  }
218  x.set_parent( b, Point_2(0,0), BLUE);
219  }
220  }
221 
222  if ( x.parent_type( BLUE) == PARENT_VERTEX) {
223  // Step 2a, assign blue parent
224  INode *i = acc.get_inode( acc.get_origin( b));
225  if ( i != NULL) {
226  if ( !contains( i->halfedge( GREEN), i->parent_type( GREEN),
227  g, x.parent_type( GREEN))) {
228  // Otherwise, we must correct the green parent of i by computing
229  // the intersection of the two computed parents
230  if ( x.parent_type( GREEN) == PARENT_FACE) {
231  Parent_type pg = i->parent_type(GREEN);
232 
233  bool found=false;
234  if ( pg ==PARENT_FACE) {
235  // Find the intersection of the two faces
236  Halfedge *h = g; RFC_assertion( !acc.is_border(h));
237  do {
238  if ( contains( i->halfedge( GREEN), pg, h, PARENT_EDGE)) {
239  // the edge is the intersection of the two
241  h, GREEN);
242  RFC_assertion( nc[0]>0 && nc[0]<1 && nc[1]>0 && nc[1]<0.5);
243  x.set_parent( g, Point_2(nc[0],0), GREEN);
244 
245  found = true;
246  break;
247  }
248  } while ( (h=acc.get_next( h)) != g);
249  }
250 
251  if ( !found) {
252  // Search for the common vertex
253  Halfedge *h = g;
254  do {
255  if ( contains( i->halfedge( GREEN), pg, h, PARENT_VERTEX)) {
256  g = h; x.set_parent( g, Point_2(0,0), GREEN);
257 
258  found = true;
259  break;
260  }
261  } while ( (h=acc.get_next( h)) != g);
262  RFC_assertion( found);
263  }
264  }
265  else { // green parent of x is not a face.
266  if ( x.parent_type(GREEN)==PARENT_EDGE &&
267  x.parent_type( GREEN) == i->parent_type( GREEN) &&
268  !contains( i->halfedge( GREEN), i->parent_type( GREEN),
269  g, PARENT_VERTEX)) {
270  g = acc.get_next( g);
272  g, PARENT_VERTEX));
273  }
275  acc.get_inode(acc.get_origin(g))->parent_type(BLUE)
276  == PARENT_EDGE);
277 
278  x.set_parent( g, Point_2(0,0), GREEN);
279 
280  if ( !contains( i->halfedge( GREEN), i->parent_type( GREEN),
281  g, x.parent_type( GREEN))) {
282  std::cerr << "ERROR: One-to-many mapping at blue vertex "
283  << acc.get_pane(b)->get_index(b->origin())+1
284  << " of pane " << acc.get_pane(b)->id()
285  << " at " << b->origin()->point()
286  << ". It projects onto \n\tgreen vertex "
287  << acc.get_pane(g)->get_index(g->origin())+1 << " of pane "
288  << acc.get_pane(g)->id() << " at " << g->origin()->point()
289  << " and\n\tgreen ";
290  switch (i->parent_type(GREEN)) {
291  case PARENT_VERTEX: std::cerr << "vertex"; break;
292  case PARENT_EDGE: std::cerr << "edge"; break;
293  case PARENT_FACE: std::cerr << "face incident on"; break;
294  default: ;
295  }
296  g = i->halfedge(GREEN);
297  std::cerr << " ("
298  << acc.get_pane(g)->get_index(g->origin())+1 << ","
299  << acc.get_pane(g)->get_index(g->destination())+1
300  << ") of pane " << acc.get_pane(g)->id() << " at ("
301  << g->origin()->point() << ","
302  << g->destination()->point() << ")." << std::endl;
303 
305  g, x.parent_type( GREEN))); abort();
306  }
307  }
308  }
309  delete i; i=NULL;
310  }
311  acc.set_inode( acc.get_origin( b), &x);
312 
313  // Step 3a
314  // Delete the inconsistent inodes on adjacent edges of b
315  Halfedge *h = b;
316  do {
317  INode_list &il = acc.get_inode_list( h);
318  if ( !il.empty()) {
319  // Throw away the false intersection points.
320  while ( ! il.empty()) {
321  INode *i=&il.front();
322 
323  if ( contains( i->halfedge( GREEN), i->parent_type( GREEN),
324  g, x.parent_type( GREEN))) {
325  il.pop_front();
326  delete i; i=NULL;
327  }
328  else
329  break;
330  }
331  }
332  else {
334  // Throw away the false intersection points.
335  while ( ! ilr.empty()) {
336  INode *i=&ilr.back();
337 
338  if ( contains( i->halfedge( GREEN), i->parent_type( GREEN),
339  g, x.parent_type( GREEN))) {
340  ilr.pop_back();
341  delete i; i=NULL;
342  }
343  else
344  break;
345  }
346  }
347  } while ( ( h = acc.get_next_around_origin( h)) != b);
348  }
349  else {
350  // If x is on a blue edge, remove the inconsistent ones
351  RFC_assertion( x.parent_type( BLUE) == PARENT_EDGE && b1==b);
352 
353  // Step 3b
354  INode_list &il = acc.get_inode_list( b);
355  // Throw away the false intersection points.
356  while ( !il.empty()) {
357  INode *i=&il.back();
358  if ( i->nat_coor(BLUE)[0] >= x.nat_coor(BLUE)[0]) {
359  std::cerr << "WARNING: Intersections are out-of-order on blue edge ("
360  << acc.get_pane(b)->get_index(b->origin())+1 << ","
361  << acc.get_pane(b)->get_index(b->destination())+1
362  << ") on pane " << acc.get_pane(b)->id() << " at ("
363  << b->origin()->point() << "," << b->destination()->point()
364  << ").\n\tPrevious intersection was "
365  << i->nat_coor(BLUE)[0]
366  << " but current one is at " << x.nat_coor(BLUE)[0]
367  << " and green parameterization is "
368  << x.nat_coor(GREEN)[0] << "." << std::endl;
369 
370  RFC_assertion( std::abs(i->nat_coor(0)[0] - x.nat_coor(0)[0]) < 0.1);
372 
373  if ( !contains( i->halfedge( GREEN), i->parent_type( GREEN),
374  g, PARENT_VERTEX) &&
375  !contains( i->halfedge( GREEN), i->parent_type( GREEN),
376  g->next(), PARENT_VERTEX)) {
377  std::cerr << "Cannot be continued. Stopping..." << std::endl;
378  abort();
379  }
380 
381  // Otherwise, we must correct the green parent of i by computing
382  // the intersection of the two computed parents
383  if ( !contains( i->halfedge( GREEN), i->parent_type( GREEN),
384  g, PARENT_VERTEX))
385  g = acc.get_next( g);
386 
387  x.set_parent( g, Point_2(0,0), GREEN);
388 
389  { // Determine the blue parameterization of x based on closest point
390  // of the green vertex on the blue edge.
391  Vector_3 t = b->destination()->point()-b->origin()->point();
392  Real c = (g->origin()->point()-b->origin()->point())*t / (t*t);
393 
394  // If snapped onto a blue vertex, then call recursively.
395  if ( c>=1-eps_e) {
396  x.set_parent( b->next(), Point_2(0,0), BLUE);
397  insert_node_in_blue_edge( x, x.halfedge(BLUE)); return;
398  }
399  else if ( c<=eps_e) {
400  x.set_parent( b, Point_2(0,0), BLUE);
401  insert_node_in_blue_edge( x, x.halfedge(BLUE)); return;
402  }
403 
404  // Otherwise, pop the neighbor vertex.
405  x.set_parent( b, Point_2(c,0), BLUE);
406  }
407  }
408 
409  if ( contains( i->halfedge( GREEN), i->parent_type( GREEN),
410  g, x.parent_type( GREEN))) {
411  il.pop_back();
412  delete i; i=NULL;
413  }
414  else
415  break;
416  }
417  il.push_back( x);
418  }
419 
420  // If x is a vertex and b is border, change to a nonborder edge.
421  if ( x.parent_type(BLUE) == PARENT_VERTEX && acc.is_border( b)) {
423  x.set_parent( b, Point_2(0,0), BLUE);
424  }
425 
426  // If the green parent of x is a vertex, associate x with the green vertex.
427  if ( x.parent_type(GREEN) == PARENT_VERTEX) {
428  RFC_assertion(g==x.halfedge(GREEN));
429  acc.set_inode( acc.get_origin(g), &x);
430  }
431 
432  // Output some debugging information.
433  static int count=0, countmax=10;
434  if ( verbose && count<countmax) {
435  if ( x.parent_type(BLUE) == PARENT_VERTEX) {
436  b = x.halfedge(BLUE);
437  double dist = ( b->origin()->point() -
438  op.get_point( x.halfedge(GREEN), x.nat_coor(GREEN))).squared_norm();
439 
440  if ( dist > 0.1*(b->destination()->point()-
441  b->origin()->point()).squared_norm()) {
442  if ( count == 0) std::cout << std::endl;
443  std::cout << "WARNING: Distance from blue vertex "
444  << acc.get_pane(b)->get_index(b->origin())+1
445  << " of pane " << acc.get_pane(b)->id()
446  << " at " << b->origin()->point()
447  << " to green mesh is relatively large: " << std::sqrt(dist) << std::endl;
448 
449  if ( count++==0) {
450  std::cout << "Note: Only " << countmax << " such warnings "
451  << " will be printed." << std::endl;
452  }
453  }
454  }
455  else if ( x.parent_type(GREEN) == PARENT_VERTEX) {
456  g = x.halfedge( GREEN);
457  double dist = ( g->origin()->point() -
458  op.get_point( x.halfedge(BLUE), x.nat_coor(BLUE))).squared_norm();
459 
460  if ( dist > 0.1*( g->destination()->point()-
461  g->origin()->point()).squared_norm()) {
462 
463  if ( count == 0) std::cout << std::endl;
464  std::cout << "WARNING: Distance from green vertex "
465  << acc.get_pane(g)->get_index(g->origin())+1
466  << " of pane " << acc.get_pane(g)->id()
467  << " at " << g->origin()->point()
468  << " to blue mesh is relatively large: " << std::sqrt(dist) << std::endl;
469 
470  if ( count++==0) {
471  std::cout << "NOTE: Only " << countmax << " such warnings"
472  << " will be printed." << std::endl;
473  }
474  }
475  }
476  }
477 }
Vertex * get_origin(Halfedge *h) const
Definition: HDS_accessor.h:87
Halfedge * get_next(Halfedge *h) const
Definition: HDS_accessor.h:108
Parent_type parent_type(const int color) const
Definition: HDS_overlay.h:350
Halfedge * get_opposite(Halfedge *h) const
Definition: HDS_accessor.h:99
Real eps_e
Definition: Overlay.h:291
RFC_Pane_overlay * get_pane(Vertex *v) const
Definition: HDS_accessor.h:128
This class encapsulate a halfedge over a window manifold.
Definition: Manifold_2.h:446
double Real
Definition: mapbasic.h:322
Halfedge next() const
Get the next halfedge of its owner element.
Definition: Manifold_2.h:465
double sqrt(double d)
Definition: double.h:73
SURF::Generic_element_2 Generic_element
Definition: rfc_basic.h:46
INode * get_inode(Vertex *v) const
Definition: HDS_accessor.h:370
const Color GREEN
Definition: Color.C:59
bool empty() const
Parent_type
Definition: rfc_basic.h:49
const Point_2S & nat_coor(const int color) const
Definition: HDS_overlay.h:327
blockLoc i
Definition: read.cpp:79
void int int REAL * x
Definition: read.cpp:74
Node destination() const
Obtain the (primary copy of the) destination of the edge.
Definition: Manifold_2.h:472
INode_list & get_inode_list(Halfedge *h) const
Definition: HDS_accessor.h:377
int count_edges(const Halfedge *e) const
Definition: Overlay.h:224
const Color BLUE
Definition: Color.C:62
Halfedge * halfedge(const int color) const
Definition: HDS_overlay.h:357
HDS_accessor< Tag_true > acc
Definition: Overlay.h:284
Overlay_primitives op
Definition: Overlay.h:283
int get_index(const Vertex *v) const
Halfedge * get_next_around_origin(Halfedge *h) const
Definition: HDS_accessor.h:136
Point_2 get_nat_coor(const INode &i, const Generic_element &e, const Halfedge *h, int color) const
Definition: Overlay.C:1854
const Point_3< Real > & point() const
Obtain the coordinates of a node.
Definition: Manifold_2.h:394
Point_3 get_point(const Halfedge *b, const Point_2S &nc) const
NT abs(const NT &x)
Definition: number_utils.h:130
void insert_node_in_blue_edge(INode &x, Halfedge *b)
Definition: Overlay.C:187
Some basic geometric data types.
Definition: mapbasic.h:54
long double dist(long double *coord1, long double *coord2, int size)
bool verbose
Definition: Overlay.h:287
bool is_border(const Halfedge *h) const
Definition: HDS_accessor.h:153
void set_inode(Vertex *v, INode *i) const
Definition: HDS_accessor.h:374
int id() const
Node origin() const
Obtain the (primary copy of the) origin of the edge.
Definition: Manifold_2.h:468
void set_parent(Halfedge *h, const Point_2 &p, int color)
Definition: HDS_overlay.h:337
#define RFC_assertion
Definition: rfc_basic.h:65
reference front()
SURF::Vector_2< Real > Point_2
Definition: rfc_basic.h:43
reference back()
bool contains(const Halfedge *e1, const Parent_type t1, const Halfedge *e2, const Parent_type t2) const
Definition: Overlay.C:1488

Here is the call graph for this function:

Here is the caller graph for this function:

void insert_node_in_green_edge ( INode v,
int  tag 
)
protected

Definition at line 856 of file Overlay.C.

References acc, HDS_accessor< _MP >::get_buffered_inode(), HDS_accessor< _MP >::get_inode(), HDS_accessor< _MP >::get_opposite(), HDS_accessor< _MP >::get_origin(), GREEN, INode::halfedge(), HDS_accessor< _MP >::is_border(), INode::nat_coor(), In_place_list_n_base< T, n >::next_link, PARENT_EDGE, PARENT_FACE, INode::parent_type(), PARENT_VERTEX, In_place_list_n_base< T, n >::prev_link, RFC_assertion, HDS_accessor< _MP >::set_buffered_inode(), INode::set_parent(), v, x, and y.

Referenced by sort_on_green_edges().

856  {
857  switch ( v->parent_type( GREEN)) {
858  case PARENT_VERTEX: {
860  return;
861  }
862  case PARENT_EDGE: {
863  Halfedge *g = v->halfedge( GREEN), *gopp=acc.get_opposite(g);
864  if ( !acc.is_border(gopp) && g>gopp) {
865  g = gopp;
866  v->set_parent( gopp, Point_2( 1.-v->nat_coor(GREEN)[0],0.), GREEN);
867  }
868  INode *y = acc.get_buffered_inode( g, tag);
869 
870  if ( y ) {
871  INode *x = v;
872 
873  if ( y->nat_coor(GREEN)[0] > x->nat_coor(GREEN)[0]) {
874  RFC_assertion(x->next_link[GREEN] == NULL || x->next_link[GREEN] == y);
875  RFC_assertion(y->prev_link[GREEN] == NULL || y->prev_link[GREEN] == x);
876  x->next_link[GREEN] = y; y->prev_link[GREEN] = x;
877  }
878  else {
879  RFC_assertion(x->prev_link[GREEN] == NULL || x->prev_link[GREEN] == y);
880  RFC_assertion(y->next_link[GREEN] == NULL || y->next_link[GREEN] == x);
881  x->prev_link[GREEN] = y; y->next_link[GREEN] = x;
882  }
883  }
884  // Otherwise, store the node
885  else
886  acc.set_buffered_inode( g, tag, v);
887  }
888  case PARENT_FACE:
889  return;
890  default:
891  RFC_assertion(false);
892  }
893 }
Vertex * get_origin(Halfedge *h) const
Definition: HDS_accessor.h:87
Parent_type parent_type(const int color) const
Definition: HDS_overlay.h:350
INode * get_buffered_inode(Halfedge *h, int tag) const
Definition: HDS_accessor.h:383
Halfedge * get_opposite(Halfedge *h) const
Definition: HDS_accessor.h:99
void int int REAL REAL * y
Definition: read.cpp:74
This class encapsulate a halfedge over a window manifold.
Definition: Manifold_2.h:446
INode * get_inode(Vertex *v) const
Definition: HDS_accessor.h:370
const Color GREEN
Definition: Color.C:59
*********************************************************************Illinois Open Source License ****University of Illinois NCSA **Open Source License University of Illinois All rights reserved ****Developed free of to any person **obtaining a copy of this software and associated documentation to deal with the Software without including without limitation the rights to and or **sell copies of the and to permit persons to whom the **Software is furnished to do subject to the following this list of conditions and the following disclaimers ****Redistributions in binary form must reproduce the above **copyright this list of conditions and the following **disclaimers in the documentation and or other materials **provided with the distribution ****Neither the names of the Center for Simulation of Advanced the University of nor the names of its **contributors may be used to endorse or promote products derived **from this Software without specific prior written permission ****THE SOFTWARE IS PROVIDED AS WITHOUT WARRANTY OF ANY **EXPRESS OR INCLUDING BUT NOT LIMITED TO THE WARRANTIES **OF FITNESS FOR A PARTICULAR PURPOSE AND **NONINFRINGEMENT IN NO EVENT SHALL THE CONTRIBUTORS OR **COPYRIGHT HOLDERS BE LIABLE FOR ANY DAMAGES OR OTHER WHETHER IN AN ACTION OF TORT OR **ARISING OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE **USE OR OTHER DEALINGS WITH THE SOFTWARE v
Definition: roccomf90.h:20
void set_buffered_inode(Halfedge *h, int tag, INode *i) const
Definition: HDS_accessor.h:386
const Point_2S & nat_coor(const int color) const
Definition: HDS_overlay.h:327
void int int REAL * x
Definition: read.cpp:74
Halfedge * halfedge(const int color) const
Definition: HDS_overlay.h:357
HDS_accessor< Tag_true > acc
Definition: Overlay.h:284
bool is_border(const Halfedge *h) const
Definition: HDS_accessor.h:153
void set_parent(Halfedge *h, const Point_2 &p, int color)
Definition: HDS_overlay.h:337
#define RFC_assertion
Definition: rfc_basic.h:65
SURF::Vector_2< Real > Point_2
Definition: rfc_basic.h:43

Here is the call graph for this function:

Here is the caller graph for this function:

void intersect_blue_with_green ( )
protected

Definition at line 572 of file Overlay.C.

References acc, B, In_place_list_n< T, managed >::begin(), BLUE, Halfedge_overlay::destination(), In_place_list_n< T, managed >::empty(), In_place_list_n< T, managed >::end(), eps_e, In_place_list_n< T, managed >::front(), HDS_accessor< _MP >::get_destination(), get_edge_parent(), RFC_Pane_overlay::get_index(), HDS_accessor< _MP >::get_inode(), HDS_accessor< _MP >::get_inode_list(), HDS_accessor< _MP >::get_next(), HDS_accessor< _MP >::get_next_around_origin(), HDS_accessor< _MP >::get_opposite(), HDS_accessor< _MP >::get_origin(), HDS_accessor< _MP >::get_pane(), GREEN, INode::halfedge(), i, RFC_Pane_base::id(), insert_edge_into_queue(), insert_node_in_blue_edge(), intersect_link(), HDS_accessor< _MP >::is_border(), HDS_accessor< _MP >::is_feature_1(), RFC_Pane_overlay::is_feature_1(), HDS_accessor< _MP >::is_on_feature(), is_opposite, is_queue_empty(), INode::nat_coor(), Halfedge_overlay::next(), op, Halfedge_overlay::origin(), overlay_init(), PARENT_EDGE, PARENT_NONE, INode::parent_type(), PARENT_VERTEX, Vertex_overlay::point(), In_place_list_n< T, managed >::pop_front(), Overlay_primitives::project_onto_element(), In_place_list_n< T, managed >::push_front(), q, RFC_assertion, INode::set_parent(), Overlay_primitives::snap_blue_ridge_edge(), Overlay_primitives::snap_blue_ridge_vertex(), RFC_Window_overlay::unmark_alledges(), verbose, and x.

Referenced by overlay().

572  {
573  // Precondition: None of the blue halfedges is marked.
574  std::queue<Halfedge*> q, q_rdg, q_crn;
575 
576 for ( int ncomp=1; ;++ncomp) { // Top loop over connected components.
577  INode *seed = overlay_init();
578  if ( seed==NULL) return; // If all halfedges are marked, then stop.
580  Halfedge *b = seed->halfedge( BLUE), *h=b;
581 
582  if ( verbose) {
583  if ( ncomp>1)
584  std::cout << "There appear to be multiple connected components "
585  << "in the input mesh.\n\tWorking on component "
586  << ncomp << std::endl;
587  else
588  std::cout << "\nThe input meshes have "
589  << ( is_opposite ? "opposite orientations" :
590  "the same orientation") << std::endl;
591 
592  std::cout << "Starting with seed vertex "
593  << acc.get_pane(b)->get_index(b->origin())+1
594  << " in pane " << acc.get_pane(b)->id() << " of blue mesh at "
595  << b->origin()->point() << std::endl;
596  }
597 
598  // Embed the seed into the blue vertex, (and the green vertex if its
599  // green parent is a vertex.)
600  insert_node_in_blue_edge( *seed, seed->halfedge(BLUE));
601  do {
602  insert_edge_into_queue( h, seed, q, q_rdg, q_crn);
603  } while ( (h = acc.get_next_around_origin(h)) != b);
604 
605  while ( !is_queue_empty( q, q_rdg, q_crn)) {
606  Halfedge *b = q.front(); q.pop();
607  Halfedge *bopp=acc.get_opposite(b);
608 
609  INode_list &il = acc.get_inode_list( b);
610  INode *x = acc.get_inode( acc.get_origin(b));
611  Vertex *dst = acc.get_destination(b);
612  INode *idst= acc.get_inode( dst);
613 
614  bool is_feature = acc.get_pane(b)->is_feature_1( b);
615  bool is_border = acc.is_border(b) || acc.is_border( acc.get_opposite(b));
616  bool is_dst_feature = is_feature || acc.is_on_feature( dst);
617  bool is_dst_border = is_border || acc.is_border( dst);
618 
619  // This is to snap open-ends of features.
620  const Real tol_snap_fea = 0.2, tol_snap_border = 2./3.;
621  Real cb=0, cg;
622 
623  for (;;) {
624  if (x->parent_type( BLUE)==PARENT_VERTEX &&
625  acc.get_origin(x->halfedge( BLUE))==dst ||
626  idst && get_edge_parent(*x,*idst,GREEN)!=Host_face(NULL,PARENT_NONE))
627  break; // The last two inodes on the edge are adjacent
628 
629  Halfedge *g1, *g0, *g2;
630  Parent_type t1, t0, t2;
631 
632  if ( il.empty()) {
633  INode *iorg = acc.get_inode( acc.get_origin(b));
634  g1 = iorg->halfedge( GREEN); t1 = iorg->parent_type( GREEN);
635  g0 = NULL; t0 = PARENT_NONE;
636  }
637  else {
638  INode_list::iterator it=--il.end();
639  g1 = it->halfedge( GREEN); t1 = it->parent_type( GREEN);
640  if ( it==il.begin()) {
641  INode *iorg = acc.get_inode( acc.get_origin(b));
642  g0 = iorg->halfedge( GREEN); t0 = iorg->parent_type( GREEN);
643  }
644  else {
645  --it; g0 = it->halfedge( GREEN); t0 = it->parent_type( GREEN);
646  }
647  }
648 
649  // Compute the intersection of b with the edges in the link
650  // of <g1,t1> but not in the star of <g0, t0>.
651  Real start = cb;
652  intersect_link( x, b, g0, t0, g1, t1, start, &cb, &cg, &g2, &t2);
653 
654  // If current edge is a ridge edge, then attempt to snap it onto ridge.
655  if ( is_feature && cb < 1 && cb > 0) {
656  op.snap_blue_ridge_edge( b, g2, &cb, &cg, &t2,
657  is_border ? tol_snap_border : tol_snap_fea);
658  }
659  else if ( !is_feature && cb < 1 &&
660  ( is_dst_feature && cb>1-tol_snap_fea &&
661  (t2 == PARENT_VERTEX && acc.is_on_feature(g2->origin()) ||
662  t2 == PARENT_EDGE && acc.is_feature_1(g2)) ||
663  is_dst_feature && cb>1-tol_snap_border &&
664  (t2 == PARENT_VERTEX && acc.is_border(g2->origin()) ||
665  t2 == PARENT_EDGE && acc.is_border(g2)))) {
666  // Enforce snapping vertex onto feature/border
667  cb = 1 + tol_snap_fea;
668  t2 = PARENT_EDGE;
669  }
670 
671  Point_2 nc(cg,0.);
672  RFC_assertion( t2 != PARENT_NONE);
673  if ( cb > 1) { // If intersects beyond the end point, do projection.
675  bool onto=op.project_onto_element( dst->point(),&g2,&t2,
676  Vector_3(0,0,0), &nc, eps_e, 0.2);
677  RFC_assertion( onto);
678  }
679 
680  if ( is_dst_feature && t2 != PARENT_VERTEX && cb>=1) {
681  op.snap_blue_ridge_vertex( dst, &g2, &t2, &nc, is_dst_border ?
682  tol_snap_border : tol_snap_fea);
683  }
684 
685  // Create an inode for the intersection point.
686  x = new INode();
687  if ( cb < 1)
688  x->set_parent( b, Point_2( cb, 0), BLUE);
689  else
690  x->set_parent( bopp, Point_2(0,0), BLUE);
691 
692  if ( nc[0] == 1.) {
693  nc[0] = 0;
694  g2 = !acc.is_border( g2) ? g2->next() : acc.get_opposite(g2);
695  }
696 
697  static int count=0, countmax = 10;
698  if ( verbose && count < countmax) {
699  if ( acc.is_border( dst) && cb>=1 && acc.get_inode( dst)==NULL &&
700  !( t2 == PARENT_EDGE && acc.is_border(acc.get_opposite(g2)) ||
701  t2 == PARENT_VERTEX && acc.is_border(g2->origin()))) {
702  if ( count == 0) std::cerr << std::endl;
703  std::cerr << "WARNING: Blue border vertex " << b->destination()->point()
704  << " is not matched with green boundary" << std::endl;
705  ++count;
706  }
707  else if ( is_border && cb>0 && cb<1 &&
708  !( t2 == PARENT_EDGE && acc.is_border(acc.get_opposite(g2)) ||
709  t2 == PARENT_VERTEX && acc.is_border(g2->origin()))) {
710 
711  if ( count == 0) std::cerr << std::endl;
712  std::cerr << "WARNING: Blue border edge " << b->origin()->point()
713  << b->destination()->point()
714  << " is not matched with green boundary " << std::endl;
715  ++count;
716  }
717 
718  if ( is_dst_feature && cb>=1 && acc.get_inode( dst)==NULL &&
719  !( t2 == PARENT_EDGE && acc.get_pane(g2)->is_feature_1(g2) ||
720  t2 == PARENT_VERTEX && acc.is_on_feature(g2->origin()))) {
721  std::cerr << "WARNING: Blue ridge vertex " << b->destination()->point()
722  << " is not matched with green ridge. cb is " << cb
723  << " and nc is " << nc << std::endl;
724  ++count;
725  }
726  else if ( is_feature && cb<1 &&
727  !( t2 == PARENT_EDGE && acc.get_pane(g2)->is_feature_1(g2) ||
728  t2 == PARENT_VERTEX && acc.is_on_feature(g2->origin()))) {
729  std::cerr << "WARNING: Blue ridge edge " << b->origin()->point()
730  << b->destination()->point()
731  << " is not matched with green ridge. cb is " << cb
732  << " and nc is " << nc << std::endl;
733  ++count;
734  }
735  }
736 
737  x->set_parent( g2, nc, GREEN);
738 
739  insert_node_in_blue_edge( *x, b);
740  }
741 
742  // Copy inode from border edge into neighbor edge
743  if ( acc.is_border( b) && !il.empty()) {
744  INode_list &ilr = acc.get_inode_list( bopp);
745 
746  while ( !il.empty()) {
747  INode &i = il.front(); il.pop_front();
748  ilr.push_front( i);
749  i.set_parent( bopp, Point_2(1-i.nat_coor(BLUE)[0],0), BLUE);
750  }
751  }
752 
753  // Push unvisited incident halfedges of b->destination() into q.
754  Halfedge *h; h = acc.get_next(b);
755 
756  do {
757  // Push the edge into queue and mark it as nonzero.
758  insert_edge_into_queue( h, x, q, q_rdg, q_crn);
759  } while ( ( h = acc.get_next_around_origin( h)) != bopp);
760  }
761  } // end for
762 
763  // Unmark all the halfedges of B
764  B->unmark_alledges();
765 }
Vertex * get_origin(Halfedge *h) const
Definition: HDS_accessor.h:87
Halfedge * get_next(Halfedge *h) const
Definition: HDS_accessor.h:108
Parent_type parent_type(const int color) const
Definition: HDS_overlay.h:350
Halfedge * get_opposite(Halfedge *h) const
Definition: HDS_accessor.h:99
Real eps_e
Definition: Overlay.h:291
RFC_Pane_overlay * get_pane(Vertex *v) const
Definition: HDS_accessor.h:128
bool is_opposite
Definition: Overlay.h:286
INode * overlay_init()
Definition: Overlay_init.C:48
bool is_feature_1(const Halfedge *h) const
Definition: HDS_accessor.h:184
This class encapsulate a halfedge over a window manifold.
Definition: Manifold_2.h:446
double Real
Definition: mapbasic.h:322
SURF::Vector_3< Real > Vector_3
Definition: rfc_basic.h:42
Halfedge next() const
Get the next halfedge of its owner element.
Definition: Manifold_2.h:465
INode * get_inode(Vertex *v) const
Definition: HDS_accessor.h:370
const Color GREEN
Definition: Color.C:59
void push_front(T &x)
Host_face get_edge_parent(const INode &i0, const INode &i1, const int color) const
Definition: Overlay.C:1393
bool is_on_feature(const Vertex *v) const
Definition: HDS_accessor.h:174
RFC_Window_overlay::Vertex Vertex
Definition: Overlay.h:59
bool intersect_link(const INode *x, const Halfedge *b, const Halfedge *g0, const Parent_type t0, Halfedge *g1, const Parent_type t1, Real start, Real *cb, Real *cg, Halfedge **g, Parent_type *t, int tryindex=0)
Definition: Overlay.C:1251
void snap_blue_ridge_edge(const Halfedge *b, const Halfedge *g, Real *cb, Real *cg, Parent_type *t, Real tol=0.1) const
void insert_edge_into_queue(Halfedge *h, INode *v, std::queue< Halfedge * > &q, std::queue< Halfedge * > &q_rdg, std::queue< Halfedge * > &q_crn)
Definition: Overlay.C:486
bool empty() const
Parent_type
Definition: rfc_basic.h:49
const Point_2S & nat_coor(const int color) const
Definition: HDS_overlay.h:327
blockLoc i
Definition: read.cpp:79
void int int REAL * x
Definition: read.cpp:74
Node destination() const
Obtain the (primary copy of the) destination of the edge.
Definition: Manifold_2.h:472
INode_list & get_inode_list(Halfedge *h) const
Definition: HDS_accessor.h:377
const Color BLUE
Definition: Color.C:62
void snap_blue_ridge_vertex(const Vertex *v, Halfedge **g, Parent_type *t, Point_2 *nc, Real tol=0.1) const
bool project_onto_element(const Point_3 &p, Halfedge **g, Parent_type *pt, Vector_3 dir, Point_2 *nc_out, const Real eps_p, Real eps_np=-1.) const
Halfedge * halfedge(const int color) const
Definition: HDS_overlay.h:357
HDS_accessor< Tag_true > acc
Definition: Overlay.h:284
Overlay_primitives op
Definition: Overlay.h:283
int get_index(const Vertex *v) const
Halfedge * get_next_around_origin(Halfedge *h) const
Definition: HDS_accessor.h:136
NT q
const Point_3< Real > & point() const
Obtain the coordinates of a node.
Definition: Manifold_2.h:394
void insert_node_in_blue_edge(INode &x, Halfedge *b)
Definition: Overlay.C:187
Vertex * get_destination(Halfedge *h) const
Definition: HDS_accessor.h:93
bool verbose
Definition: Overlay.h:287
bool is_border(const Halfedge *h) const
Definition: HDS_accessor.h:153
RFC_Window_overlay * B
Definition: Overlay.h:280
int id() const
bool is_feature_1(const Halfedge *h) const
Node origin() const
Obtain the (primary copy of the) origin of the edge.
Definition: Manifold_2.h:468
void set_parent(Halfedge *h, const Point_2 &p, int color)
Definition: HDS_overlay.h:337
#define RFC_assertion
Definition: rfc_basic.h:65
reference front()
SURF::Vector_2< Real > Point_2
Definition: rfc_basic.h:43
bool is_queue_empty(std::queue< Halfedge * > &q, std::queue< Halfedge * > &q_rdg, std::queue< Halfedge * > &q_crn)
Definition: Overlay.C:546

Here is the call graph for this function:

Here is the caller graph for this function:

bool intersect_link ( const INode x,
const Halfedge b,
const Halfedge g0,
const Parent_type  t0,
Halfedge g1,
const Parent_type  t1,
Real  start,
Real cb,
Real cg,
Halfedge **  g,
Parent_type t,
int  tryindex = 0 
)
protected

Definition at line 1251 of file Overlay.C.

References acc, contains(), Halfedge_overlay::destination(), RFC_Pane_overlay::get_index(), HDS_accessor< _MP >::get_opposite(), HDS_accessor< _MP >::get_origin(), HDS_accessor< _MP >::get_pane(), HDS_accessor< _MP >::get_prev(), RFC_Pane_base::id(), intersect_link_helper(), intersect_link_helper2(), Halfedge_overlay::is_border(), HDS_accessor< _MP >::is_border(), HDS_accessor< _MP >::is_feature_1(), Halfedge_overlay::next(), Halfedge_overlay::origin(), PARENT_EDGE, PARENT_FACE, PARENT_VERTEX, Vertex_overlay::point(), Halfedge_overlay::prev(), RFC_assertion, and v.

Referenced by intersect_blue_with_green().

1261  {
1262 
1263  bool found = false, is_feature = acc.is_feature_1(b);
1264  bool is_border= acc.is_border(b) || acc.is_border(acc.get_opposite(b));
1265  *cb = *cg = HUGE_VAL;
1266  *g = NULL;
1267 
1268  switch ( t1) {
1269  case PARENT_FACE: {
1270  RFC_assertion( !g1->is_border());
1271  // Loop through the edges of the face
1272  Halfedge *g2 = g1;
1273  do {
1274  int snapcode = is_feature ? 4 : 0;
1275 
1276  if ( intersect_link_helper( b, g2, start, cb, cg, g, t, &found,
1277  snapcode, NULL, trytime)) {
1278  if ( found) return true;
1279  else return intersect_link_helper2( cb, cg, g, t);
1280  }
1281  } while ( ( g2 = g2->next()) != g1);
1282 
1283  break;
1284  }
1285  case PARENT_EDGE: {
1286  Halfedge *g1_0=g1;
1287 
1288  // if g1 intersects b from left to right
1289  do {
1290  if ( g1->is_border() || contains( g1, PARENT_FACE, g0, t0)) continue;
1291  Halfedge *g2 = g1->next();
1292 
1293  do {
1294  int snapcode = 0;
1295  if (is_feature) {
1296  snapcode = 4;
1297  if ( is_border && acc.is_border( acc.get_opposite(g1)) ||
1298  !is_border && acc.is_feature_1( g1)) {
1299  if ( g2->prev()==g1) snapcode += 1;
1300  else if (g2->next()==g1) snapcode += 2;
1301  }
1302  }
1303 
1304  if ( intersect_link_helper( b, g2, start, cb, cg, g, t, &found,
1305  snapcode, NULL, trytime)) {
1306  if ( found) return true;
1307  else return intersect_link_helper2( cb, cg, g, t);
1308  }
1309  } while ( ( g2 = g2->next()) != g1);
1310  } while ( ( g1 = acc.get_opposite(g1)) != g1_0);
1311 
1312  break;
1313  }
1314  case PARENT_VERTEX: {
1315  Halfedge *g1_0=g1, *g1_1;
1316  Vertex *v = acc.get_origin(g1);
1317 
1318  do {
1319  g1_1 = acc.get_prev(g1);
1320  if ( g1->is_border() || contains( g1, PARENT_FACE, g0, t0)) continue;
1321  Halfedge *g2 = g1->next();
1322  do {
1323  int snapcode = 0;
1324  if (is_feature) {
1325  snapcode = 4;
1326 
1327  if ( is_border && acc.is_border( acc.get_opposite(g2->prev())) ||
1328  !is_border && acc.is_feature_1( g2->prev()) &&
1329  contains(g2->prev(), PARENT_EDGE, g1, PARENT_VERTEX))
1330  snapcode += 1;
1331  if ( is_border && acc.is_border( acc.get_opposite(g2->next())) ||
1332  !is_border && acc.is_feature_1( g2->next()) &&
1333  contains(g2->next(), PARENT_EDGE, g1, PARENT_VERTEX))
1334  snapcode += 2;
1335  }
1336 
1337  if ( intersect_link_helper( b, g2, start, cb, cg, g, t, &found,
1338  snapcode, v, trytime)) {
1339  if ( found) return true;
1340  else return intersect_link_helper2( cb, cg, g, t);
1341  }
1342  } while ( ( g2 = g2->next()) != g1_1);
1343  } while ( ( g1 = acc.get_opposite(g1_1)) != g1_0);
1344 
1345  break;
1346  }
1347  default:
1348  RFC_assertion( false);
1349  break;
1350  }
1351 
1352  if (found) return true;
1353  if ( *cb < HUGE_VAL) return intersect_link_helper2( cb, cg, g, t);
1354 
1355  if ( trytime==0) {
1356  // Print out error messages
1357  std::cerr << "WARNING: Encountered inconsistency when intersecting blue edge ("
1358  << acc.get_pane(b)->get_index(b->origin())+1 << ","
1359  << acc.get_pane(b)->get_index(b->destination())+1 << ") in pane "
1360  << acc.get_pane(b)->id() << " at \n\t("
1361  << b->origin()->point() << "), (" << b->destination()->point()
1362  << ") \nwith the link of the ";
1363  if ( t1 == PARENT_FACE) std::cerr << "green face incident on";
1364  if ( t1 == PARENT_EDGE) std::cerr << "green";
1365  if ( t1 == PARENT_VERTEX) std::cerr << "source vertex of green";
1366  std::cerr << " halfedge (" << acc.get_pane(g1)->get_index(g1->origin())+1
1367  << "," << acc.get_pane(g1)->get_index(g1->destination())+1
1368  << ") in pane " << acc.get_pane(g1)->id() << " at \n\t("
1369  << g1->origin()->point() << "), ("
1370  << g1->destination()->point() << ")." << std::endl;
1371 
1372  // One more try with print info
1373  intersect_link( x, b, g0, t0, g1, t1, start, cb, cg, g, t, 1);
1374 
1375  if ( *cb < HUGE_VAL) {
1376  std::cerr << "WARNING: Input meshes appear to have severe normal mismatch." << std::endl;
1377  std::cerr << "WARNING: Trying to continue with relaxed normal matching.\n\n" << std::endl;
1378  }
1379  else {
1380  // Continue with projecting onto face
1381  *cb = HUGE_VAL; *cg = HUGE_VAL; *t = PARENT_FACE;
1382  if ( *g == NULL || t1==PARENT_VERTEX) *g = g1;
1383  std::cerr << "WARNING: Could not find edge intersection." << std::endl;
1384  std::cerr << "WARNING: Trying to recover with point projection.\n\n" << std::endl;
1385  }
1386  }
1387 
1388  return false;
1389 }
Vertex * get_origin(Halfedge *h) const
Definition: HDS_accessor.h:87
Halfedge * get_prev(Halfedge *h) const
Definition: HDS_accessor.h:105
Halfedge * get_opposite(Halfedge *h) const
Definition: HDS_accessor.h:99
RFC_Pane_overlay * get_pane(Vertex *v) const
Definition: HDS_accessor.h:128
bool is_feature_1(const Halfedge *h) const
Definition: HDS_accessor.h:184
Halfedge prev() const
Get the previous halfedge of its owner element.
Definition: Manifold_2.h:460
This class encapsulate a halfedge over a window manifold.
Definition: Manifold_2.h:446
Halfedge next() const
Get the next halfedge of its owner element.
Definition: Manifold_2.h:465
*********************************************************************Illinois Open Source License ****University of Illinois NCSA **Open Source License University of Illinois All rights reserved ****Developed free of to any person **obtaining a copy of this software and associated documentation to deal with the Software without including without limitation the rights to and or **sell copies of the and to permit persons to whom the **Software is furnished to do subject to the following this list of conditions and the following disclaimers ****Redistributions in binary form must reproduce the above **copyright this list of conditions and the following **disclaimers in the documentation and or other materials **provided with the distribution ****Neither the names of the Center for Simulation of Advanced the University of nor the names of its **contributors may be used to endorse or promote products derived **from this Software without specific prior written permission ****THE SOFTWARE IS PROVIDED AS WITHOUT WARRANTY OF ANY **EXPRESS OR INCLUDING BUT NOT LIMITED TO THE WARRANTIES **OF FITNESS FOR A PARTICULAR PURPOSE AND **NONINFRINGEMENT IN NO EVENT SHALL THE CONTRIBUTORS OR **COPYRIGHT HOLDERS BE LIABLE FOR ANY DAMAGES OR OTHER WHETHER IN AN ACTION OF TORT OR **ARISING OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE **USE OR OTHER DEALINGS WITH THE SOFTWARE v
Definition: roccomf90.h:20
RFC_Window_overlay::Vertex Vertex
Definition: Overlay.h:59
bool intersect_link(const INode *x, const Halfedge *b, const Halfedge *g0, const Parent_type t0, Halfedge *g1, const Parent_type t1, Real start, Real *cb, Real *cg, Halfedge **g, Parent_type *t, int tryindex=0)
Definition: Overlay.C:1251
Node destination() const
Obtain the (primary copy of the) destination of the edge.
Definition: Manifold_2.h:472
bool intersect_link_helper2(Real *cb, Real *cg, Halfedge **g, Parent_type *t)
Definition: Overlay.C:1223
HDS_accessor< Tag_true > acc
Definition: Overlay.h:284
bool is_border() const
Is the edge a border edge?
Definition: Manifold_2.h:476
int get_index(const Vertex *v) const
bool intersect_link_helper(const Halfedge *b, Halfedge *g2, Real start, Real *cb, Real *cg, Halfedge **g, Parent_type *t, bool *found, int snapcode, const Vertex *anchor, bool panic)
Definition: Overlay.C:1058
const Point_3< Real > & point() const
Obtain the coordinates of a node.
Definition: Manifold_2.h:394
bool is_border(const Halfedge *h) const
Definition: HDS_accessor.h:153
int id() const
Node origin() const
Obtain the (primary copy of the) origin of the edge.
Definition: Manifold_2.h:468
#define RFC_assertion
Definition: rfc_basic.h:65
bool contains(const Halfedge *e1, const Parent_type t1, const Halfedge *e2, const Parent_type t2) const
Definition: Overlay.C:1488

Here is the call graph for this function:

Here is the caller graph for this function:

bool intersect_link_helper ( const Halfedge b,
Halfedge g2,
Real  start,
Real cb,
Real cg,
Halfedge **  g,
Parent_type t,
bool *  found,
int  snapcode,
const Vertex anchor,
bool  panic 
)
protected

Definition at line 1058 of file Overlay.C.

References NTS::abs(), acc, contains(), Halfedge_overlay::destination(), do_intersect(), eps_e, eps_p, Halfedge_overlay::facet(), HDS_accessor< _MP >::get_destination(), HDS_accessor< _MP >::get_next(), HDS_accessor< _MP >::get_origin(), Overlay_primitives::intersect(), Halfedge_overlay::is_border(), is_opposite, Halfedge_overlay::next(), Overlay_primitives::normalmatch(), op, Halfedge_overlay::origin(), PARENT_EDGE, PARENT_FACE, PARENT_VERTEX, Vertex_overlay::point(), Halfedge_overlay::prev(), RFC_assertion, and verbose.

Referenced by intersect_link().

1067  {
1068  RFC_assertion( !g2->is_border());
1069 
1070  Real tcb, tcg; // Parameterization of intersection on b and g2
1071  Real orient_match; // To what degree [0..1] b and g2 are counterclockwise
1072  Real normal_match; // To what degree [0..1] the intersection have same normal
1073 
1074  // Tolerance for normal matching
1075  const Real tol_nm_large = 0.6, tol_nm_small=0.3; // about 50 and 80 degrees
1076  const Real tol_nm = panic ? tol_nm_small : tol_nm_large;
1077  const Real tol_proj=0.5, tol_snap=0.2;
1078 
1079  bool do_intersect = op.intersect( b, g2, start, &tcb, &tcg, &orient_match,
1080  &normal_match, is_opposite, eps_e);
1081  do_intersect &= (normal_match >= tol_nm);
1082 
1083  if ( verbose && panic) {
1084  std::cerr << "INFO: Intersection with green edge ("
1085  << g2->origin()->point() << "," << g2->destination()->point()
1086  << ") is at bparam=" << tcb << ", gparam=" << tcg << std::endl;
1087 
1088  if ( tcb<HUGE_VAL) {
1089  std::cerr << "\t inner product of normals equal to "
1090  << normal_match << std::endl;
1091 
1092  if ( normal_match<tol_nm_large) {
1093  std::cerr << "WARNING: Intersection was rejected due to normal mismatch under tolerance "
1094  << tol_nm_large << std::endl;
1095 
1096  if ( normal_match > tol_nm_small) {
1097  std::cerr << "WARNING: Trying with reduced normal-matching tolerance of "
1098  << tol_nm_small << std::endl;
1099  }
1100  }
1101  }
1102  }
1103 
1104  if ( do_intersect && tcb == 0) {
1105  // Inconsistency detected. It has backfired!
1106  // Or we need to snap to feature edge if nothing else works.
1107  *cb = 0.; *g = g2; *cg = tcg; *found=false;
1108  *t = ( tcg==0 || tcg==1) ? PARENT_VERTEX : PARENT_EDGE;
1109 
1110  return true;
1111  }
1112 
1113  if ( (tcb*eps_e > 1.) || orient_match < -eps_p ||
1114  normal_match < tol_nm || tcb<0.) {
1115  if ( *cb == HUGE_VAL) *g = g2; // Keep a record of the last intersection.
1116 
1117  // Do not treat it as fatal inconsistency because this might
1118  // happen at locations with large curvature and trying to repair it
1119  // can fail the algorithm. Instead, we simply ignore this intersection.
1120  return false;
1121  }
1122 
1123  if ( verbose && snapcode == 7 && tcg > tol_snap && tcg < 1-tol_snap ) {
1124  std::cerr << "WARNING: Blue edge (" << b->origin()->point()
1125  << ", " << b->destination()->point()
1126  << " appears to walk over a green corner "
1127  << g2->prev()->origin()->point()
1128  << " in an ambiguous way. This may cause overlay to failure. "
1129  << std::endl;
1130  }
1131 
1132  if ( do_intersect) {
1133  bool case1;
1134  if ( ( case1 = tcg == 1. || snapcode==6 || snapcode==7 &&
1135  op.normalmatch(b, g2->next()) > op.normalmatch( b, g2->prev())) ||
1136  tcg == 0. || snapcode==5 || snapcode==7 &&
1137  op.normalmatch(b, g2->next()) < op.normalmatch( b, g2->prev()) ||
1138  ( case1 = *found && tcg>0.5 &&
1139  contains( *g, *t, acc.get_next(g2), PARENT_VERTEX)) ||
1140  *found && tcg<0.5 && contains( *g, *t, g2, PARENT_VERTEX)) {
1141  *g = case1 ? acc.get_next(g2) : g2; *t = PARENT_VERTEX; *cg = 0.;
1142  if ( *found && *cb >1 && *cb < 1+tol_proj || tcb == 1) *cb = 1;
1143  else if ( !*found || tcb < *cb) *cb = tcb;
1144 
1145  *found = true;
1146  }
1147  else if ( !*found || !snapcode && tcb < *cb ||
1148  snapcode && std::abs(0.5-tcg)>std::abs(0.5-*cg))
1149  { *g = g2; *t = PARENT_EDGE; *cg = tcg; *cb = tcb; *found = true; }
1150  }
1151  else if ( tcg >=0. && tcg <= 1.) {
1152  RFC_assertion( tcb > 1.); // Otherwise, they would have intersected.
1153 
1154  bool case1;
1155  if ( ( case1 = tcg == 1. || snapcode==6 || snapcode==7 &&
1156  op.normalmatch(b, g2->next()) > op.normalmatch( b, g2->prev())) ||
1157  tcg == 0. || snapcode==5 || snapcode==7 &&
1158  op.normalmatch(b, g2->next()) < op.normalmatch( b, g2->prev()) ||
1159  *found && *t != PARENT_VERTEX && g2->facet()!=(*g)->facet() &&
1160  ( ( case1 = tcg>0.5 && contains( *g, *t, acc.get_next(g2), PARENT_VERTEX)) ||
1161  tcg<0.5 && contains( *g, *t, g2, PARENT_VERTEX))) {
1162 
1163  if ( *found && *cb <= 1)
1164  { *g = case1 ? g2->next() : g2; *t = PARENT_VERTEX; *cg = 0.; *cb = 1; }
1165  else if ( case1) {
1166  *g = g2->next(); *cg = 0;
1167  *t = (acc.get_destination( *g) == anchor) ? PARENT_EDGE : PARENT_FACE;
1168 
1169  if ( !*found || tcb < *cb) *cb = tcb;
1170  }
1171  else {
1172  *g = g2->prev(); *cg = 1.;
1173  *t = (acc.get_origin( *g) == anchor) ? PARENT_EDGE : PARENT_FACE;
1174 
1175  if ( !*found || tcb < *cb) *cb = tcb;
1176  }
1177 
1178  *found = true;
1179  }
1180  else if ( !*found || !snapcode && tcb < *cb ||
1181  snapcode && std::abs(0.5-tcg)>std::abs(0.5-*cg))
1182  { *cg = tcg; *g = g2; *t = PARENT_FACE; *cb = tcb; *found = true; }
1183  }
1184  else if ( !*found && tcb>=0) {
1185  bool case1;
1186  if ( *cb > 0 && *cb < HUGE_VAL &&
1187  *t != PARENT_VERTEX && g2->facet() != (*g)->facet() &&
1188  ( ( case1 = tcg>0.5 && contains( *g, *t, acc.get_next(g2), PARENT_VERTEX)) ||
1189  tcg<0.5 && contains( *g, *t, g2, PARENT_VERTEX))) {
1190 
1191  if ( tcb > 1 && *cb >1) {
1192  *g = case1 ? g2->next() : g2->prev(); *t = PARENT_EDGE; *cg = case1 ? 0. : 1.;
1193  if ( tcb < *cb) *cb = tcb;
1194  }
1195  else {
1196  *g = case1 ? acc.get_next(g2) : g2; *t = PARENT_VERTEX; *cg = 0.;
1197  if ( tcb ==1 || tcb >1 && tcb < 1+tol_proj && *cb < 1 ||
1198  tcb<=1 && *cb > 1 && *cb < 1+tol_proj)
1199  *cb = 1;
1200  else if ( tcb < *cb) *cb = tcb;
1201  }
1202  }
1203  else if ( *cb == HUGE_VAL ||
1204  *cg < tcg && tcg < 0 || *cg > tcg && tcg > 1) {
1205  // NOTE: cg is not used outside intersect_link if *cb>1, but we
1206  // need to keep the value of tcg for later comparisons
1207  if ( tcg <0 && tcb>1 && acc.get_origin( g2->prev()) == anchor)
1208  { *g = g2->prev(); *t = PARENT_EDGE; }
1209  else if ( tcg>1 && tcb>1 && acc.get_destination( g2->next()) == anchor)
1210  { *g = g2->next(); *t = PARENT_EDGE; }
1211  else
1212  { *g = g2; *t = PARENT_FACE; }
1213 
1214  *cb = tcb; *cg = tcg;
1215  }
1216  }
1217 
1218  return false;
1219 }
Vertex * get_origin(Halfedge *h) const
Definition: HDS_accessor.h:87
Halfedge * get_next(Halfedge *h) const
Definition: HDS_accessor.h:108
bool intersect(const Halfedge *b, const Halfedge *g, Real start, Real *c1, Real *c2, Real *dir, Real *dir_match, bool is_opposite, Real eps_e) const
Real eps_e
Definition: Overlay.h:291
bool is_opposite
Definition: Overlay.h:286
Halfedge prev() const
Get the previous halfedge of its owner element.
Definition: Manifold_2.h:460
bool do_intersect(const Line_2< R > &p1, const Line_2< R > &p2)
double Real
Definition: mapbasic.h:322
Halfedge next() const
Get the next halfedge of its owner element.
Definition: Manifold_2.h:465
Real normalmatch(const Halfedge *b, const Halfedge *g) const
Real eps_p
Definition: Overlay.h:292
Vertex_overlay * origin()
Definition: HDS_overlay.h:135
const Point & point() const
Node destination() const
Obtain the (primary copy of the) destination of the edge.
Definition: Manifold_2.h:472
HDS_accessor< Tag_true > acc
Definition: Overlay.h:284
Overlay_primitives op
Definition: Overlay.h:283
bool is_border() const
Is the edge a border edge?
Definition: Manifold_2.h:476
const Point_3< Real > & point() const
Obtain the coordinates of a node.
Definition: Manifold_2.h:394
NT abs(const NT &x)
Definition: number_utils.h:130
Vertex * get_destination(Halfedge *h) const
Definition: HDS_accessor.h:93
bool verbose
Definition: Overlay.h:287
Node origin() const
Obtain the (primary copy of the) origin of the edge.
Definition: Manifold_2.h:468
#define RFC_assertion
Definition: rfc_basic.h:65
bool contains(const Halfedge *e1, const Parent_type t1, const Halfedge *e2, const Parent_type t2) const
Definition: Overlay.C:1488

Here is the call graph for this function:

Here is the caller graph for this function:

bool intersect_link_helper2 ( Real cb,
Real cg,
Halfedge **  g,
Parent_type t 
)
protected

Definition at line 1223 of file Overlay.C.

References acc, HDS_accessor< _MP >::get_next(), PARENT_EDGE, and PARENT_VERTEX.

Referenced by intersect_link().

1226  {
1227  if ( *cb > 1.) {
1228  if ( *cg>1) { *cg = 1; } else if ( *cg <0) { *cg = 0.; }
1229  return true; // Preserve the parent-type.
1230  }
1231  else {
1232  // Otherwise, there is an inconsistency.
1233  if ( *cb <=0.) *cb = 0.;
1234 
1235  if ( *cg > 0. && *cg < 1.){ *t = PARENT_EDGE; }
1236  else if ( *cg >= 1.)
1237  { *g = acc.get_next(*g); *t = PARENT_VERTEX; *cg = 0.; }
1238  else if ( *cg <= 0.)
1239  { *t = PARENT_VERTEX; *cg = 0.; }
1240  return false;
1241  }
1242 }
Halfedge * get_next(Halfedge *h) const
Definition: HDS_accessor.h:108
HDS_accessor< Tag_true > acc
Definition: Overlay.h:284

Here is the call graph for this function:

Here is the caller graph for this function:

bool is_queue_empty ( std::queue< Halfedge * > &  q,
std::queue< Halfedge * > &  q_rdg,
std::queue< Halfedge * > &  q_crn 
)
private

Definition at line 546 of file Overlay.C.

References acc, HDS_accessor< _MP >::get_opposite(), i, HDS_accessor< _MP >::mark(), and HDS_accessor< _MP >::marked().

Referenced by intersect_blue_with_green().

548  {
549  if ( !q.empty()) return false;
550 
551  for ( int i=0; i<2; ++i) {
552  std::queue<Halfedge*> &qbuf = (i==0) ? q_rdg : q_crn;
553  while ( !qbuf.empty()) {
554  Halfedge *h = qbuf.front(); qbuf.pop();
555  Halfedge *hopp = acc.get_opposite(h);
556  if ( !acc.marked( hopp)) {
557  q.push( h); acc.mark( acc.get_opposite(h));
558  return false;
559  }
560  }
561  }
562 
563  return true;
564 }
Halfedge * get_opposite(Halfedge *h) const
Definition: HDS_accessor.h:99
This class encapsulate a halfedge over a window manifold.
Definition: Manifold_2.h:446
bool marked(const Halfedge *h) const
Definition: HDS_accessor.h:299
blockLoc i
Definition: read.cpp:79
HDS_accessor< Tag_true > acc
Definition: Overlay.h:284
void mark(Halfedge *h) const
Definition: HDS_accessor.h:295

Here is the call graph for this function:

Here is the caller graph for this function:

bool logical_xor ( bool  a,
bool  b 
) const
inlineprivate

Definition at line 277 of file Overlay.h.

Referenced by project_adjacent_green_vertices().

277 { return a&&!b || !a&&b; }

Here is the caller graph for this function:

void match_features_0 ( )
protected

Definition at line 51 of file Overlay_0d.C.

References acc, B, BLUE, d, RFC_Window_overlay::flist_0(), G, HDS_accessor< _MP >::get_halfedge(), RFC_Pane_overlay::get_index(), HDS_accessor< _MP >::get_inode(), HDS_accessor< _MP >::get_next(), HDS_accessor< _MP >::get_next_around_destination(), HDS_accessor< _MP >::get_next_around_origin(), HDS_accessor< _MP >::get_opposite(), HDS_accessor< _MP >::get_origin(), HDS_accessor< _MP >::get_pane(), GREEN, i, RFC_Pane_base::id(), iend, insert_node_in_blue_edge(), HDS_accessor< _MP >::is_border(), k, n, RFC_Window_base::name(), Halfedge_overlay::origin(), Vertex_overlay::point(), RFC_Window_overlay::remove_feature_0(), s, INode::set_parent(), RFC_Window_overlay::snap_on_features(), sq_length(), sqrt(), v, verbose, verbose2, and x.

Referenced by overlay().

51  {
52 
53  const Real w2e_ratio = 1;
54  const Real d2e_ratio_sq = 1;
55 
56  std::list<Feature_0> &bf0 = B->flist_0();
57  std::list<Feature_0> &gf0 = G->flist_0();
58 
59  std::vector< Point_3_ref> gf0_1;
60  gf0_1.reserve( gf0.size());
61  for ( std::list<Feature_0>::iterator it=gf0.begin(); it!=gf0.end(); ++it)
62  gf0_1.push_back( Point_3_ref( it->point(), it->vertex()));
63 
64  // Create a 3-dimensional KD-tree for the 0-features of green mesh
65  KD_tree kdtree(3); kdtree.build( gf0_1);
66 
67  int dropped=0;
68  // Query every 0-feature of the blue mesh in the KD-tree to find
69  // whether there is a unique corresponding one in the other mesh.
70  for ( std::list<Feature_0>::iterator
71  it=bf0.begin(), iend=bf0.end(); it != iend; ++it) {
72  Vertex *v = it->vertex();
73  // Find the corresponding green feature of *it in the KD-tree
74  const Point_3 &p = v->point();
75 
76  // Compute the tolerance.
77  Real tol=HUGE_VAL;
78  Halfedge *b=acc.get_halfedge(v), *b0=b;
79  do {
80  Real t = sq_length( *b);
81  if ( t<tol) tol=t;
82  } while ( (b=acc.get_next_around_destination( b))!=b0);
83  tol = std::sqrt( tol);
84 
85  const Vector_3 vtol(tol*w2e_ratio, tol*w2e_ratio, tol*w2e_ratio);
86  KD_tree::Box box( p-vtol, p+vtol, 3);
87 
88  std::vector< Point_3_ref> outList; outList.reserve(2);
89  kdtree.search( std::back_inserter( outList), box);
90 
91  // Find the closest corner in the list
92  Real dist_min = HUGE_VAL;
93  int k=-1;
94 
95  for ( int i=0, n = outList.size(); i<n; ++i) {
96  Real d=(p-reinterpret_cast<const Point_3&>(outList[i])).squared_norm();
97  if ( d <= dist_min) {
98  dist_min = d; k=i;
99  }
100  }
101 
102  if ( dist_min<HUGE_VAL) {
103  Halfedge *g = acc.get_halfedge( outList[k].vertex());
104  if ( acc.is_border(g)) g = acc.get_opposite(g);
105  else g = acc.get_next(g);
106 
107  Real s=tol*tol;
108  Halfedge *h=g, *h0=h;
109  do {
110  Real t = sq_length( *h);
111  if ( t<s) s=t;
112  } while ( (h=acc.get_next_around_origin( h))!=h0);
113 
114  if ( dist_min < s*d2e_ratio_sq) {
115  if ( verbose2) {
116  std::cout << "Matched\t blue vertex "
117  << acc.get_pane(b)->get_index(b->origin())+1
118  << " in pane " << acc.get_pane(b)->id() << " at " << p
119  << "\n with\t green vertex "
120  << acc.get_pane(g)->get_index(g->origin())+1
121  << " in pane " << acc.get_pane(g)->id() << " at "
122  << g->origin()->point() << std::endl;
123  }
124 
125  Halfedge *b = acc.get_halfedge( v);
126  if ( acc.is_border(b)) b = acc.get_opposite(b);
127  else b = acc.get_next(b);
128 
129  // Create an inode for the o-feature
130  INode *x = new INode();
131  x->set_parent( b, Point_2(0,0), BLUE);
132  x->set_parent( g, Point_2(0,0), GREEN);
133 
134  if ( B->snap_on_features()) {
135  // Update the coordinates for the blue point
136  Point_3 &pnt = const_cast<Point_3&>( acc.get_origin(b)->point());
137  pnt = acc.get_origin( g)->point();
138  }
139 
140  insert_node_in_blue_edge( *x, b);
141  continue;
142  }
143  }
144 
145  if ( verbose) {
146  std::cout << "\nRocface Warning: Dropping blue corner vertex "
147  << acc.get_pane(b)->get_index(b->origin())+1
148  << " in pane " << acc.get_pane(b)->id()
149  << " at " << p << std::endl;
150  }
151 
152  // Remove the false blue 0-feature
153  it = --B->remove_feature_0( it);
154  ++dropped;
155  }
156 
157  if ( verbose && dropped) {
158  std::cout << "Dropped " << dropped << " corners in \"" << B->name()
159  << "\" after feature matching" << std::endl;
160  }
161 
162  dropped=0;
163  // Remove the false green 0-features
164  for ( std::list<Feature_0>::iterator
165  it=gf0.begin(), iend=gf0.end(); it != iend; ++it) {
166  Vertex *v = it->vertex();
167  if ( acc.get_inode( v) == NULL) {
168 
169  if ( verbose) {
170  std::cout << "\nRocface Warning: Dropping green corner vertex "
171  << acc.get_pane(v)->get_index(v)+1
172  << " in pane " << acc.get_pane(v)->id()
173  << " at " << v->point() << std::endl;
174  }
175 
176  // Unmark the 0-features in the green window
177  it = --G->remove_feature_0( it);
178  ++dropped;
179  }
180  }
181 
182  if ( verbose && dropped) {
183  std::cout << "Dropped " << dropped << " corners in \"" << G->name()
184  << "\" after feature matching" << std::endl;
185  }
186 }
std::string name() const
The name of the window.
Vertex * get_origin(Halfedge *h) const
Definition: HDS_accessor.h:87
Halfedge * get_next(Halfedge *h) const
Definition: HDS_accessor.h:108
Feature_list_0::iterator remove_feature_0(Feature_list_0::iterator i)
Remove the given 0-feature from the list.
const NT & d
Halfedge * get_opposite(Halfedge *h) const
Definition: HDS_accessor.h:99
j indices k indices k
Definition: Indexing.h:6
double s
Definition: blastest.C:80
RFC_Pane_overlay * get_pane(Vertex *v) const
Definition: HDS_accessor.h:128
KD_tree::Box box
Definition: Overlay_0d.C:47
This class encapsulate a halfedge over a window manifold.
Definition: Manifold_2.h:446
double Real
Definition: mapbasic.h:322
double sqrt(double d)
Definition: double.h:73
INode * get_inode(Vertex *v) const
Definition: HDS_accessor.h:370
const Color GREEN
Definition: Color.C:59
Halfedge * get_halfedge(Vertex *v) const
Definition: HDS_accessor.h:75
*********************************************************************Illinois Open Source License ****University of Illinois NCSA **Open Source License University of Illinois All rights reserved ****Developed free of to any person **obtaining a copy of this software and associated documentation to deal with the Software without including without limitation the rights to and or **sell copies of the and to permit persons to whom the **Software is furnished to do subject to the following this list of conditions and the following disclaimers ****Redistributions in binary form must reproduce the above **copyright this list of conditions and the following **disclaimers in the documentation and or other materials **provided with the distribution ****Neither the names of the Center for Simulation of Advanced the University of nor the names of its **contributors may be used to endorse or promote products derived **from this Software without specific prior written permission ****THE SOFTWARE IS PROVIDED AS WITHOUT WARRANTY OF ANY **EXPRESS OR INCLUDING BUT NOT LIMITED TO THE WARRANTIES **OF FITNESS FOR A PARTICULAR PURPOSE AND **NONINFRINGEMENT IN NO EVENT SHALL THE CONTRIBUTORS OR **COPYRIGHT HOLDERS BE LIABLE FOR ANY DAMAGES OR OTHER WHETHER IN AN ACTION OF TORT OR **ARISING OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE **USE OR OTHER DEALINGS WITH THE SOFTWARE v
Definition: roccomf90.h:20
RFC_Window_overlay::Vertex Vertex
Definition: Overlay.h:59
Point object that represents a single point.
Definition: datatypedef.h:68
bool snap_on_features() const
const Point & point() const
**********************************************************************Rocstar Simulation Suite Illinois Rocstar LLC All rights reserved ****Illinois Rocstar LLC IL **www illinoisrocstar com **sales illinoisrocstar com WITHOUT WARRANTY OF ANY **EXPRESS OR INCLUDING BUT NOT LIMITED TO THE WARRANTIES **OF FITNESS FOR A PARTICULAR PURPOSE AND **NONINFRINGEMENT IN NO EVENT SHALL THE CONTRIBUTORS OR **COPYRIGHT HOLDERS BE LIABLE FOR ANY DAMAGES OR OTHER WHETHER IN AN ACTION OF TORT OR **Arising OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE **USE OR OTHER DEALINGS WITH THE SOFTWARE **********************************************************************INTERFACE SUBROUTINE knode iend
RFC_Window_overlay * G
Definition: Overlay.h:281
Feature_list_0 & flist_0()
blockLoc i
Definition: read.cpp:79
CGAL::Kdtree_d< KD_interface > KD_tree
Definition: Overlay_0d.C:46
void int int REAL * x
Definition: read.cpp:74
const NT & n
const Color BLUE
Definition: Color.C:62
Real sq_length(const Halfedge &h) const
Definition: Overlay.C:178
HDS_accessor< Tag_true > acc
Definition: Overlay.h:284
int get_index(const Vertex *v) const
Halfedge * get_next_around_origin(Halfedge *h) const
Definition: HDS_accessor.h:136
const Point_3< Real > & point() const
Obtain the coordinates of a node.
Definition: Manifold_2.h:394
void insert_node_in_blue_edge(INode &x, Halfedge *b)
Definition: Overlay.C:187
Halfedge * get_next_around_destination(Halfedge *h) const
Definition: HDS_accessor.h:146
Some basic geometric data types.
Definition: mapbasic.h:54
bool verbose
Definition: Overlay.h:287
bool is_border(const Halfedge *h) const
Definition: HDS_accessor.h:153
RFC_Window_overlay * B
Definition: Overlay.h:280
int id() const
Node origin() const
Obtain the (primary copy of the) origin of the edge.
Definition: Manifold_2.h:468
void set_parent(Halfedge *h, const Point_2 &p, int color)
Definition: HDS_overlay.h:337
bool verbose2
Definition: Overlay.h:288
SURF::Vector_2< Real > Point_2
Definition: rfc_basic.h:43

Here is the call graph for this function:

Here is the caller graph for this function:

void number_a_subnode ( INode i,
int  color,
std::map< int, std::pair< int, int > > &  cnts 
)
private

Definition at line 165 of file Overlay_IO.C.

References acc, HDS_accessor< _MP >::get_next_around_origin(), HDS_accessor< _MP >::get_opposite(), HDS_accessor< _MP >::get_pane(), Vertex_overlay::halfedge(), INode::halfedge(), RFC_Pane_base::id(), Halfedge_overlay::is_border(), Halfedge_overlay::origin(), PARENT_EDGE, PARENT_FACE, INode::parent_type(), PARENT_VERTEX, RFC_assertion, and set_subnode_id().

Referenced by number_subnodes().

166  {
167  Parent_type t = i->parent_type( color);
168  Halfedge *h = i->halfedge( color);
169 
170  switch ( t) {
171  case PARENT_FACE: {
172  int pane_id = acc.get_pane(h)->id();
173  set_subnode_id( i, color, pane_id, ++(cnts[ pane_id].second));
174  break;
175  }
176  case PARENT_EDGE: {
177  Halfedge *h0 = h;
178  int last_id = -1;
179  do {
180  int pane_id = acc.get_pane(h)->id();
181  if ( pane_id == last_id) continue;
182  set_subnode_id( i, color, pane_id, ++(cnts[ pane_id].second));
183  last_id = pane_id;
184  } while ( (h=acc.get_opposite(h)) != h0);
185  break;
186  }
187  default: {
189 
190  Halfedge *h0 = h;
191  int last_id = -1;
192  std::set<int> panes;
193  bool first_iter = true;
194  do {
195  int pane_id = acc.get_pane(h)->id();
196  if ( !first_iter && (pane_id==last_id||panes.find(pane_id)!=panes.end()))
197  continue;
198  set_subnode_id( i, color, pane_id, ++(cnts[ pane_id].first));
199  panes.insert(last_id=pane_id);
200 
201  // Optimization assuming the halfedge structure is normalized
202  if ( first_iter && !h->origin()->halfedge()->is_border()) break;
203  first_iter = false;
204  } while ( (h=acc.get_next_around_origin(h)) != h0);
205  break;
206  }
207  }
208 }
Parent_type parent_type(const int color) const
Definition: HDS_overlay.h:350
void set_subnode_id(INode *i, int color, int pane_id, int l_id)
Definition: Overlay_IO.C:45
Halfedge * get_opposite(Halfedge *h) const
Definition: HDS_accessor.h:99
RFC_Pane_overlay * get_pane(Vertex *v) const
Definition: HDS_accessor.h:128
This class encapsulate a halfedge over a window manifold.
Definition: Manifold_2.h:446
bool is_border() const
Definition: HDS_overlay.h:131
Parent_type
Definition: rfc_basic.h:49
Halfedge * halfedge(const int color) const
Definition: HDS_overlay.h:357
HDS_accessor< Tag_true > acc
Definition: Overlay.h:284
Halfedge * get_next_around_origin(Halfedge *h) const
Definition: HDS_accessor.h:136
int id() const
Node origin() const
Obtain the (primary copy of the) origin of the edge.
Definition: Manifold_2.h:468
#define RFC_assertion
Definition: rfc_basic.h:65
Halfedge halfedge() const
Get an incident halfedge originated from the node.
Definition: Manifold_2.h:670

Here is the call graph for this function:

Here is the caller graph for this function:

void number_subfaces ( )
private

Definition at line 281 of file Overlay_IO.C.

References acc, RFC_Pane_overlay::allocate_subfaces(), B, BLUE, COM_assertion_msg, convert_nat_coordinates(), count_edges(), Halfedge_overlay::facet(), G, RFC_Pane_overlay::get_index(), get_inodes_of_face(), RFC_Pane_overlay::get_lid(), get_nat_coor(), HDS_accessor< _MP >::get_pane(), get_parent_face(), GREEN, RFC_Pane_overlay::hds(), i, RFC_Pane_base::id(), RFC_Pane_overlay::insert_subface(), k, n, RFC_Window_derived< _Pane >::panes(), pi, RFC_assertion, RFC_assertion_code, s, subdivide(), and Triangulation::triangulate().

Referenced by overlay().

281  {
282  std::vector<RFC_Pane_overlay*> b_ps, g_ps;
283  B->panes( b_ps); G->panes( g_ps);
284 
285  typedef std::map< int, std::vector< int> > Subface_counts;
286  Subface_counts cnts_b, cnts_g;
287 
288  std::vector<RFC_Pane_overlay*>::iterator pi;
289  for ( pi=b_ps.begin(); pi!=b_ps.end(); ++pi)
290  cnts_b[(*pi)->id()].resize( (*pi)->size_of_faces(), 0);
291  for ( pi=g_ps.begin(); pi!=g_ps.end(); ++pi)
292  cnts_g[(*pi)->id()].resize( (*pi)->size_of_faces(), 0);
293 
294  // First, count the number of S-faces by looping through all the blue faces
295  for ( pi=b_ps.begin(); pi!=b_ps.end(); ++pi) {
296  RFC_Pane_overlay *pane_b = *pi;
297  Subface_counts::iterator cnts_it_b = cnts_b.find(pane_b->id());
298  Subface_counts::iterator cnts_it_g = cnts_g.begin();
299 
300  for ( HDS::Facet_iterator fi=pane_b->hds().facets_begin();
301  fi!=pane_b->hds().facets_end(); ++fi) {
302  // Construct a list of nodes for the blue face
303  INode_const_list nodes;
304  get_inodes_of_face( &*fi, nodes);
305  RFC_assertion( nodes.size() > 2);
306 
307  Subface_list sub_faces;
308  // subdivide the face
309  bool ret = subdivide( nodes, ++nodes.begin(), sub_faces, BLUE);
310  if ( ret) {
311  std::cerr << "ERROR: Got error code " << ret
312  << " when subdividing face "
313  << fi - pane_b->hds().facets_begin() + 1
314  << " with node "
315  << pane_b->get_index( fi->halfedge()->origin())+1
316  << " in pane " << pane_b->id() << std::endl;
317 
318  sub_faces.clear();
319  subdivide( nodes, ++nodes.begin(), sub_faces, BLUE);
320  RFC_assertion(!ret); abort();
321  }
322  if (sub_faces.empty()) {
323  std::cerr << "ERROR: Error in enumerating subface in face "
324  << fi - pane_b->hds().facets_begin() + 1
325  << " in pane " << pane_b->id() << std::endl;
326  RFC_assertion(!sub_faces.empty()); abort();
327  }
328 
329  // Count the subfaces in the blue face
330  for (Subface_list::iterator
331  si=sub_faces.begin(), send=sub_faces.end(); si != send; ++si) {
332  int num_tris = si->size()-2;
333  Halfedge *s = get_parent_face( *si, GREEN);
334  RFC_Pane_overlay *pane_g = acc.get_pane(s);
335  if ( cnts_it_g->first != pane_g->id())
336  cnts_it_g=cnts_g.find(pane_g->id());
337 
338  cnts_it_b->second[pane_b->get_index(&*fi)] += num_tris;
339  cnts_it_g->second[pane_g->get_index(s->facet())] += num_tris;
340  }
341  }
342  }
343 
344  // Allocate space for subfaces and convert counts into offsets.
345  for ( pi=b_ps.begin(); pi!=b_ps.end(); ++pi) {
346  std::vector< int> &cnts = cnts_b[ (*pi)->id()];
347  (*pi)->allocate_subfaces( cnts);
348  if ( cnts.empty()) continue;
349  // Convert counts into offsets
350  int t1=cnts[0];
351  cnts[0] = 0;
352  for ( int i=1, n=cnts.size(); i<n; ++i) {
353  int t2 = cnts[i];
354  cnts[i] = cnts[i-1] + t1;
355  t1 = t2;
356  }
357  }
358 
359  for ( pi=g_ps.begin(); pi!=g_ps.end(); ++pi) {
360  std::vector< int> &cnts = cnts_g[ (*pi)->id()];
361  (*pi)->allocate_subfaces( cnts);
362  if ( cnts.empty()) continue;
363  // Convert counts into offsets
364  int t1=cnts[0];
365  cnts[0] = 0;
366  for ( int i=1, n=cnts.size(); i<n; ++i) {
367  int t2 = cnts[i];
368  cnts[i] = cnts[i-1] + t1;
369  t1 = t2;
370  }
371  }
372 
373  Subface_counts &offsets_b=cnts_b, &offsets_g=cnts_g;
374 
375  // Third, we fill up the arrays for face-list and etc.
376  for ( pi=b_ps.begin(); pi!=b_ps.end(); ++pi) {
377  RFC_Pane_overlay *pane_b = *pi;
378  const int pane_id_b = pane_b->id();
379 
380  Subface_counts::iterator offsets_it_b = offsets_b.find(pane_b->id());
381  Subface_counts::iterator offsets_it_g = offsets_g.begin();
382 
383  for ( HDS::Facet_iterator fi=(*pi)->hds().facets_begin();
384  fi!=(*pi)->hds().facets_end(); ++fi) {
385 
386  // Construct a list of nodes for the blue face
387  INode_const_list nodes;
388  get_inodes_of_face( &*fi, nodes);
389  RFC_assertion( nodes.size() > 2);
390 
391  Subface_list sub_faces;
392  // subdivide the face
393  RFC_assertion_code( bool ret = )
394  subdivide( nodes, ++nodes.begin(), sub_faces, BLUE);
395  RFC_assertion( !ret);
396 
397  Halfedge *b = fi->halfedge();
398  Generic_element e_b( count_edges(b));
399 
400  // output the subfaces of the blue face
401  for (Subface_list::iterator
402  si=sub_faces.begin(), send=sub_faces.end(); si != send; ++si) {
403  int n = si->size(), num_tris = n-2;
404 
405  Halfedge *g = get_parent_face( *si, GREEN);
406  Generic_element e_g( count_edges(g));
407 
408  std::vector< Point_2> pnts_b( n), pnts_g( n);
409  for ( int k=0; k<n; ++k) {
410  pnts_b[k] = get_nat_coor( *(*si)[k], e_b, b, BLUE);
411  pnts_g[k] = get_nat_coor( *(*si)[k], e_g, g, GREEN);
412  }
413 
414  std::vector< Three_tuple<int> > tris( num_tris);
415  Triangulation triangulation;
416  // Triangulate the sub-face in both B and G.
417  triangulation.triangulate( &pnts_b[0], n, &tris);
418 
419  RFC_Pane_overlay *pane_g = acc.get_pane(g);
420  const int pane_id_g = pane_g->id();
421  // Insert the triangles into the blue and green panes
422  for ( int k=0; k<num_tris; ++k) {
423  int lids_b[3], lids_g[3];
424  RFC_Pane_overlay::Edge_ID eids_b[3], eids_g[3];
425  Point_2 ncs_b[3], ncs_g[3];
426 
427  for ( int i=0; i<3; ++i) {
428  COM_assertion_msg( (*si)[tris[k][i]], "Empty intersection.");
429 
430  convert_nat_coordinates( (*si)[tris[k][i]], b, BLUE, pane_id_b,
431  lids_b[i], eids_b[i], ncs_b[i]);
432  convert_nat_coordinates( (*si)[tris[k][i]], g, GREEN, pane_id_g,
433  lids_g[i], eids_g[i], ncs_g[i]);
434  }
435 
436  if ( offsets_it_g->first != pane_g->id())
437  offsets_it_g=offsets_g.find(pane_g->id());
438 
439  int idx_b = offsets_it_b->second[pane_b->get_index(&*fi)]++;
440  int idx_g = offsets_it_g->second[pane_g->get_index(g->facet())]++;
441 
442  pane_b->insert_subface(idx_b, pane_b->get_lid( b->facet()),
443  lids_b, eids_b, ncs_b,
444  pane_id_g, idx_g+1, lids_g);
445  pane_g->insert_subface(idx_g, pane_g->get_lid( g->facet()),
446  lids_g, eids_g, ncs_g,
447  pane_id_b, idx_b+1, lids_b);
448  }
449  }
450  }
451  }
452 }
std::list< const INode * > INode_const_list
Definition: Overlay.h:63
void insert_subface(int idx, int plid, const int *lids, const Edge_ID *eids, const Point_2 *nc, int rp_id, int cnt, const int *rids)
Insert all the infomation related to a subface into the database.
j indices k indices k
Definition: Indexing.h:6
#define COM_assertion_msg(EX, msg)
double s
Definition: blastest.C:80
RFC_Pane_overlay * get_pane(Vertex *v) const
Definition: HDS_accessor.h:128
This class encapsulate a halfedge over a window manifold.
Definition: Manifold_2.h:446
Halfedge * get_parent_face(const Subface &sf, int color)
Definition: Overlay.C:1841
void triangulate(const Point_2 *ps, int n, Connectivity *tri)
Main entry for triangulation.
Definition: Triangulation.h:87
SURF::Generic_element_2 Generic_element
Definition: rfc_basic.h:46
const Color GREEN
Definition: Color.C:59
int get_lid(const Vertex *v) const
void panes(std::vector< Pane * > &ps)
Get a vector of local panes contained in the window.
void get_inodes_of_face(const Facet *f, INode_const_list &nodes)
Definition: Overlay.C:1922
void convert_nat_coordinates(const INode *i, Halfedge *h, int color, int pane_id, int &lid, RFC_Pane_overlay::Edge_ID &eid, Point_2 &nc) const
Definition: Overlay_IO.C:123
RFC_Window_overlay * G
Definition: Overlay.h:281
A local ID of an edge.
blockLoc i
Definition: read.cpp:79
Triangulating a convex polygon by ear-removal.
Definition: Triangulation.h:50
const NT & n
int count_edges(const Halfedge *e) const
Definition: Overlay.h:224
const Color BLUE
Definition: Color.C:62
HDS_accessor< Tag_true > acc
Definition: Overlay.h:284
bool subdivide(const INode_const_list &face, INode_const_list::const_iterator last_checked, Subface_list &sub_faces, int color, int depth=0) const
Definition: Overlay.C:1759
std::list< Subface > Subface_list
Definition: Overlay.h:65
#define RFC_assertion_code
Definition: rfc_basic.h:68
int get_index(const Vertex *v) const
const double pi
Point_2 get_nat_coor(const INode &i, const Generic_element &e, const Halfedge *h, int color) const
Definition: Overlay.C:1854
for(;;)
RFC_Window_overlay * B
Definition: Overlay.h:280
int id() const
void allocate_subfaces(const std::vector< int > &cnts)
Allocate memory space for the arrays for storing the subdivision.
#define RFC_assertion
Definition: rfc_basic.h:65

Here is the call graph for this function:

Here is the caller graph for this function:

void number_subnodes ( )
private

Definition at line 236 of file Overlay_IO.C.

References _subnode_copies_b, _subnode_copies_g, _subnode_ids_b, _subnode_ids_g, B, BLUE, count_subnodes(), G, GREEN, i, inodes, n, number_a_subnode(), RFC_Window_derived< _Pane >::panes(), and pi.

Referenced by overlay().

236  {
237  std::vector<RFC_Pane_overlay*> b_ps, g_ps;
238  B->panes( b_ps); G->panes( g_ps);
239 
240  // Maps from pane ids to the number of S-vertices processed
241  std::map< int, std::pair<int,int> > b_vertex_counts;
242  std::map< int, std::pair<int,int> > g_vertex_counts;
243 
244  std::vector<RFC_Pane_overlay*>::iterator pi;
245  for ( pi=b_ps.begin(); pi!=b_ps.end(); ++pi)
246  b_vertex_counts[(*pi)->id()] = std::make_pair(0,0);
247  for ( pi=g_ps.begin(); pi!=g_ps.end(); ++pi)
248  g_vertex_counts[(*pi)->id()] = std::make_pair(0,0);
249 
250  // Loop through the S-vertices
251  // First, count the number of subvertices host at vertices
252  for ( std::list< INode*>::const_iterator
253  it=inodes.begin(); it!=inodes.end(); ++it) {
254  count_subnodes( *it, BLUE, b_vertex_counts);
255  count_subnodes( *it, GREEN, g_vertex_counts);
256  }
257 
258  // Second, assign IDs for subnodes
259  int n=inodes.size();
260  _subnode_ids_b.resize( n, Node_ID( 0,-1));
261  _subnode_ids_g.resize( n, Node_ID( 0,-1));
262  _subnode_copies_b.resize( n, 0);
263  _subnode_copies_g.resize( n, 0);
264  int i=0;
265  for ( std::list< INode*>::const_iterator
266  it=inodes.begin(); it!=inodes.end(); ++it,++i) {
267  (*it)->set_id( i);
268  number_a_subnode( *it, BLUE, b_vertex_counts);
269  number_a_subnode( *it, GREEN, g_vertex_counts);
270  }
271 
272  // Allocate space for subnodes.
273  for ( pi=b_ps.begin(); pi!=b_ps.end(); ++pi)
274  (*pi)->allocate_subnodes( b_vertex_counts[(*pi)->id()].second);
275  for ( pi=g_ps.begin(); pi!=g_ps.end(); ++pi)
276  (*pi)->allocate_subnodes( g_vertex_counts[(*pi)->id()].second);
277 }
std::pair< int, int > Node_ID
std::vector< Node_ID > _subnode_ids_b
Definition: Overlay.h:247
const Color GREEN
Definition: Color.C:59
void panes(std::vector< Pane * > &ps)
Get a vector of local panes contained in the window.
std::vector< char > _subnode_copies_g
Definition: Overlay.h:250
void number_a_subnode(INode *i, int color, std::map< int, std::pair< int, int > > &cnts)
Definition: Overlay_IO.C:165
RFC_Window_overlay * G
Definition: Overlay.h:281
std::vector< Node_ID > _subnode_ids_g
Definition: Overlay.h:248
blockLoc i
Definition: read.cpp:79
const NT & n
const Color BLUE
Definition: Color.C:62
const double pi
std::vector< char > _subnode_copies_b
Definition: Overlay.h:249
RFC_Window_overlay * B
Definition: Overlay.h:280
std::list< INode * > inodes
Definition: Overlay.h:282
void count_subnodes(INode *i, int color, std::map< int, std::pair< int, int > > &cnts)
Definition: Overlay_IO.C:212

Here is the call graph for this function:

Here is the caller graph for this function:

int overlay ( )

Definition at line 73 of file Overlay.C.

References associate_green_vertices(), B, RFC_Window_overlay::create_overlay_data(), RFC_Window_overlay::delete_overlay_data(), RFC_Window_overlay::detect_features(), Bbox_3::do_match(), RFC_Window_overlay::evaluate_normals(), G, RFC_Window_base::get_bounding_box(), get_wtime(), inodes, intersect_blue_with_green(), match_features_0(), min(), RFC_Window_base::name(), number_subfaces(), number_subnodes(), RFC_Window_base::size_of_faces(), RFC_Window_base::size_of_nodes(), sort_on_green_edges(), verbose, x, Bbox_3::xmax(), Bbox_3::xmin(), Bbox_3::ymax(), Bbox_3::ymin(), Bbox_3::zmax(), and Bbox_3::zmin().

73  {
74  Bbox_3 bbox=B->get_bounding_box(), gbox = G->get_bounding_box();
75 
76  std::cout << "\tMesh " << B->name() << ": "
77  << B->size_of_nodes() << " vertices, "
78  << B->size_of_faces() << " faces, with bounding box "
79  << bbox << "\n\tMesh " << G->name() << ": "
80  << G->size_of_nodes() << " vertices, "
81  << G->size_of_faces() << " faces, with bounding box "
82  << gbox << std::endl;
83 
84  double tol_high = 3.e-1, tol_low=1.e-1;
85 
86  // First, check whether the scales of the two bounding boxes are
87  // the same by comparing the total lengths of bounding boxes and
88  // the individual dimensions.
89  double bl = (bbox.xmax()-bbox.xmin()) +
90  (bbox.ymax()-bbox.ymin()) + (bbox.zmax()-bbox.zmin());
91  double gl = (gbox.xmax()-gbox.xmin()) +
92  (gbox.ymax()-gbox.ymin()) + (gbox.zmax()-gbox.zmin());
93 
94  if ( bl>gl*(1+tol_high) || gl>bl*(1+tol_high) ||
95  !bbox.do_match( gbox, std::min(bl,gl)*tol_high)) {
96  std::cerr << "ERROR: The bounding boxes differ by more than "
97  << tol_high*100 << "%. Please check the geometries. Stopping..."
98  << std::endl;
99  abort();
100  }
101 
102  // If the bounding boxes do not match at all sides within a fraction
103  // of the longest dimension, then stop the code.
104  // the difference between the two boxes is smaller than a fraction (eps)
105  // of the largest dimension of the two boxes.
106  if ( !bbox.do_match( gbox, std::min(bl,gl)*tol_low)) {
107  std::cerr << "WARNING: The bounding boxes differ by more than "
108  << tol_low*100 << "% but less than "
109  << tol_high*100 << "%. Continuing anyway." << std::endl;
110  }
111 
112  double t0 = get_wtime();
113 
114  // Create helper data in two input meshes.
117 
118  // Detect the 0-features of the two meshes.
119  std::cerr << "Detecting features in " << B->name() << "..." << std::endl;
120  B->detect_features();
121 
122  std::cerr << "Detecting features in " << G->name() << "..." << std::endl;
123  G->detect_features();
124 
126 
127  // Evaluate normals for the nodes.
128  B->evaluate_normals();
129  G->evaluate_normals();
130 
131  std::cout << "Performing mesh overlay..." << std::flush;
132  // Step 1: Project the blue vertices onto G and
133  // compute the intersection points of blue edges with green
134  // edges, and insert the intersections into the blue edges on the fly.
136  std::cout << "..." << std::flush;
137 
138  // Step 2: Sort the intersection points corresponding to each green
139  // edge and insert them into green edges (in linear time).
141  std::cout << "..." << std::flush;
142 
143  // Step 3: Compute the projection of the green vertices on B.
145  std::cout << "..." << std::flush;
146 
147  if ( verbose) {
148  std::cout << "\n\tLocated " << inodes.size()
149  << " edge intersections.\n\tDone in "
150  << get_wtime()-t0 << " sec.\n"
151  << "Exporting the subdivision..." << std::flush;
152  t0 = get_wtime();
153  }
154 
155  // Finally, assign local ids to the subnodes within panes and
156  number_subnodes();
157 
158  // subdivide the faces and assign local ids to these subfaces,and
159  // create the nodal and face lists for the panes.
160  number_subfaces();
161 
162  // Now, clean up the overlay data
163  // Destroy helper data in the input windows
165  while ( !inodes.empty()) {
166  INode* x = inodes.front(); inodes.pop_front();
167  delete x;
168  }
169 
170  std::cout << "Done";
171  if ( verbose) {
172  std::cout << " in " << get_wtime()-t0 << " sec.";
173  }
174  std::cout << std::endl;
175  return 0;
176 }
std::string name() const
The name of the window.
void number_subnodes()
Definition: Overlay_IO.C:236
double xmax() const
void number_subfaces()
Definition: Overlay_IO.C:281
double xmin() const
double zmin() const
double ymax() const
void match_features_0()
Definition: Overlay_0d.C:51
RFC_Window_overlay * G
Definition: Overlay.h:281
int size_of_faces() const
Get the total number of faces contained the window.
void intersect_blue_with_green()
Definition: Overlay.C:572
void sort_on_green_edges()
Definition: Overlay.C:771
void int int REAL * x
Definition: read.cpp:74
double zmax() const
bool do_match(const Bbox_3 &bb, double tol) const
int size_of_nodes() const
Get the total number of nodes contained the window.
Vector_n min(const Array_n_const &v1, const Array_n_const &v2)
Definition: Vector_n.h:346
void detect_features()
The main entry of feature detection.
double ymin() const
bool verbose
Definition: Overlay.h:287
Bbox_3 get_bounding_box() const
Get the bounding box of the window.
RFC_Window_overlay * B
Definition: Overlay.h:280
RFC_BEGIN_NAME_SPACE double get_wtime()
Definition: Timing.h:33
void associate_green_vertices()
Definition: Overlay.C:898
std::list< INode * > inodes
Definition: Overlay.h:282

Here is the call graph for this function:

RFC_BEGIN_NAME_SPACE INode * overlay_init ( )
protected

Definition at line 48 of file Overlay_init.C.

References acc, B, BLUE, RFC_Window_overlay::get_an_unmarked_halfedge(), get_green_parent(), HDS_accessor< _MP >::get_pane(), RFC_Pane_overlay::get_point(), GREEN, HDS_accessor< _MP >::is_border(), Halfedge_overlay::next(), Halfedge_overlay::origin(), PARENT_EDGE, PARENT_FACE, PARENT_NONE, PARENT_VERTEX, RFC_assertion, INode::set_parent(), v, verbose2, and x.

Referenced by intersect_blue_with_green().

48  {
49  INode *v=NULL;
50 
51  // get an unmarked halfedge from the blue mesh and take its origin as x.
53  if ( b==NULL) return NULL;
54 
55  Vertex *x = b->origin(); RFC_assertion( !acc.is_border(x));
56 
57  // locate the green parent of x.
58  Parent_type t;
59  Point_2 nc;
60  get_green_parent( x, b, &g, &t, &nc);
61  RFC_assertion ( t != PARENT_NONE && g != NULL);
62 
63  // create a new inode for x
64  v = new INode();
65  v->set_parent( b, Point_2(0,0), BLUE);
66  v->set_parent( g, nc, GREEN);
67 
68  if ( verbose2) {
69  std::cout << "\nFound a seed at blue vertex ("
70  << acc.get_pane(x)->get_point(x) << ") \nin green ";
71  const RFC_Pane_overlay *gpane=acc.get_pane(g);
72  switch ( t) {
73  case PARENT_VERTEX:
74  std::cout << "vertex (" << gpane->get_point( g->origin()) << ")\n";
75  break;
76  case PARENT_EDGE:
77  std::cout << "edge (" << gpane->get_point( g->origin()) << "), ("
78  << gpane->get_point( g->destination()) << ")\n";
79  break;
80  case PARENT_FACE: {
81  std::cout << "face ";
82  Halfedge *gt = g;
83  do {
84  std::cout << "\t(" << gpane->get_point( gt->origin()) << "), ";
85  } while ( (gt = gt->next()) != g);
86  std::cout << std::endl;
87  break;
88  }
89  default:
90  RFC_assertion( false);
91  }
92  std::cout << std::endl;
93  }
94 
95  return v;
96 }
RFC_Pane_overlay * get_pane(Vertex *v) const
Definition: HDS_accessor.h:128
This class encapsulate a halfedge over a window manifold.
Definition: Manifold_2.h:446
Halfedge next() const
Get the next halfedge of its owner element.
Definition: Manifold_2.h:465
const Color GREEN
Definition: Color.C:59
*********************************************************************Illinois Open Source License ****University of Illinois NCSA **Open Source License University of Illinois All rights reserved ****Developed free of to any person **obtaining a copy of this software and associated documentation to deal with the Software without including without limitation the rights to and or **sell copies of the and to permit persons to whom the **Software is furnished to do subject to the following this list of conditions and the following disclaimers ****Redistributions in binary form must reproduce the above **copyright this list of conditions and the following **disclaimers in the documentation and or other materials **provided with the distribution ****Neither the names of the Center for Simulation of Advanced the University of nor the names of its **contributors may be used to endorse or promote products derived **from this Software without specific prior written permission ****THE SOFTWARE IS PROVIDED AS WITHOUT WARRANTY OF ANY **EXPRESS OR INCLUDING BUT NOT LIMITED TO THE WARRANTIES **OF FITNESS FOR A PARTICULAR PURPOSE AND **NONINFRINGEMENT IN NO EVENT SHALL THE CONTRIBUTORS OR **COPYRIGHT HOLDERS BE LIABLE FOR ANY DAMAGES OR OTHER WHETHER IN AN ACTION OF TORT OR **ARISING OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE **USE OR OTHER DEALINGS WITH THE SOFTWARE v
Definition: roccomf90.h:20
RFC_Window_overlay::Vertex Vertex
Definition: Overlay.h:59
const Point_3 & get_point(int id) const
Parent_type
Definition: rfc_basic.h:49
void get_green_parent(const Vertex *v, const Halfedge *b, Halfedge **o, Parent_type *t, Point_2 *nc)
Definition: Overlay_init.C:101
void int int REAL * x
Definition: read.cpp:74
const Color BLUE
Definition: Color.C:62
HDS_accessor< Tag_true > acc
Definition: Overlay.h:284
const Halfedge * get_an_unmarked_halfedge() const
bool is_border(const Halfedge *h) const
Definition: HDS_accessor.h:153
RFC_Window_overlay * B
Definition: Overlay.h:280
Node origin() const
Obtain the (primary copy of the) origin of the edge.
Definition: Manifold_2.h:468
void set_parent(Halfedge *h, const Point_2 &p, int color)
Definition: HDS_overlay.h:337
bool verbose2
Definition: Overlay.h:288
#define RFC_assertion
Definition: rfc_basic.h:65
SURF::Vector_2< Real > Point_2
Definition: rfc_basic.h:43

Here is the call graph for this function:

Here is the caller graph for this function:

void project_adjacent_green_vertices ( const INode i,
Halfedge b 
)
protected

Helper for associate_green_vertices().

Definition at line 940 of file Overlay.C.

References acc, In_place_list_n< T, managed >::back(), BLUE, contains(), Halfedge_overlay::destination(), In_place_list_n< T, managed >::empty(), eps_p, In_place_list_n< T, managed >::front(), HDS_accessor< _MP >::get_destination(), Overlay_primitives::get_face_normal(), HDS_accessor< _MP >::get_inode(), HDS_accessor< _MP >::get_inode_list(), HDS_accessor< _MP >::get_next(), RFC_Pane_overlay::get_normal(), HDS_accessor< _MP >::get_opposite(), HDS_accessor< _MP >::get_origin(), HDS_accessor< _MP >::get_pane(), GREEN, INode::halfedge(), i, inodes, is_opposite, j, logical_xor(), In_place_list_n_base< T, n >::next_link, op, PARENT_EDGE, PARENT_FACE, INode::parent_type(), PARENT_VERTEX, Vertex_overlay::point(), In_place_list_n_base< T, n >::prev_link, Overlay_primitives::project_onto_element(), q, RFC_assertion, HDS_accessor< _MP >::set_inode(), INode::set_parent(), In_place_list_n< T, managed >::size(), sqrt(), verify_inode(), and x.

Referenced by associate_green_vertices().

940  {
941  std::queue< INode*> q;
942 
943  // From every known subnode, projects its adjacent green vertices
944  // onto blue faces and creates new subnodes for the green vertices.
945  do {
946  Halfedge *g = i->halfedge(GREEN), *gopp, *g0=g;
947  Parent_type igp = i->parent_type( GREEN);
948  // Loop through all the incident halfedges.
949  do {
950  gopp = acc.get_opposite( g);
952 
953  INode_list &il = acc.get_inode_list( g);
954  INode_list &ilr = acc.get_inode_list( gopp);
955 
956  // If there is any subnode between i and dst, skip the edge.
957  if ( igp == PARENT_VERTEX) {
958  if (!il.empty() || !ilr.empty())
959  continue;
960  }
961  else if ( igp == PARENT_EDGE) {
962  INode *j;
963  if ( !il.empty()) {
964  if ( &il.back() != i) continue;
965  j = ( il.size() > 1 ? i->prev_link[GREEN] :
966  acc.get_inode( acc.get_origin( g)));
967  }
968  else {
969  if ( &ilr.front() != i) continue;
970  j = ( ilr.size() > 1 ? i->next_link[GREEN] :
971  acc.get_inode( acc.get_origin( g)));
972  }
973  if ( j && contains( b, PARENT_FACE,
974  j->halfedge( BLUE), j->parent_type( BLUE)))
975  continue;
976  }
977 
978  // If dst has already been projected, skip the edge.
979  INode *x=NULL;
980  if ( (x=acc.get_inode( dst)) != NULL) {
983  i->halfedge(BLUE), i->parent_type(BLUE)));
984  continue;
985  }
986 
987  // Determine whether the vertex projects onto the blue face, and if so,
988  // create a new subnode at it and insert the subnode into the queue.
989  Halfedge *b1 = b; Parent_type t=PARENT_FACE;
990  Point_2 nc;
991  const RFC_Pane_overlay *gpane = acc.get_pane(g);
992  Vector_3 v1 = gpane->get_normal( g, g->destination());
994  &b1, &t, v1, &nc, eps_p)) {
995  Vector_3 v2 = op.get_face_normal( b1, nc);
996  if (v2 != Vector_3(0,0,0)) v2 = v2 / std::sqrt( v2*v2);
997 
998  if ( logical_xor( is_opposite, v1 * v2 < 0.15)) continue;
999  RFC_assertion( nc[0] != 0. && nc[1] != 0.);
1000 
1001  x = new INode();
1002 
1003  x->set_parent( b1, nc, BLUE);
1004  x->set_parent( gopp, Point_2(0,0), GREEN);
1005  // Check whether consistency rules are satisfied
1006  if ( verify_inode( x)) {
1007  inodes.push_back( x);
1008  acc.set_inode( dst, x);
1009  q.push( x);
1010  }
1011  else
1012  delete x;
1013  }
1014  RFC_assertion( igp != PARENT_FACE); // Must have been projected.
1015  } while ( ( g = ( igp==PARENT_VERTEX ? acc.get_next(gopp) : gopp)) != g0);
1016  if ( !q.empty()) { i = q.front(); q.pop(); } else i = NULL;
1017  } while (i);
1018 
1019 }
Vertex * get_origin(Halfedge *h) const
Definition: HDS_accessor.h:87
Halfedge * get_next(Halfedge *h) const
Definition: HDS_accessor.h:108
Parent_type parent_type(const int color) const
Definition: HDS_overlay.h:350
Halfedge * get_opposite(Halfedge *h) const
Definition: HDS_accessor.h:99
RFC_Pane_overlay * get_pane(Vertex *v) const
Definition: HDS_accessor.h:128
bool is_opposite
Definition: Overlay.h:286
size_type size() const
This class encapsulate a halfedge over a window manifold.
Definition: Manifold_2.h:446
SURF::Vector_3< Real > Vector_3
Definition: rfc_basic.h:42
double sqrt(double d)
Definition: double.h:73
INode * get_inode(Vertex *v) const
Definition: HDS_accessor.h:370
const Color GREEN
Definition: Color.C:59
Vector_3 get_face_normal(const Halfedge *b, const Point_2 &nc, int scheme=0) const
Real eps_p
Definition: Overlay.h:292
bool empty() const
Parent_type
Definition: rfc_basic.h:49
blockLoc i
Definition: read.cpp:79
void int int REAL * x
Definition: read.cpp:74
Node destination() const
Obtain the (primary copy of the) destination of the edge.
Definition: Manifold_2.h:472
INode_list & get_inode_list(Halfedge *h) const
Definition: HDS_accessor.h:377
const Color BLUE
Definition: Color.C:62
bool verify_inode(const INode *i)
Definition: Overlay.C:1022
bool project_onto_element(const Point_3 &p, Halfedge **g, Parent_type *pt, Vector_3 dir, Point_2 *nc_out, const Real eps_p, Real eps_np=-1.) const
Halfedge * halfedge(const int color) const
Definition: HDS_overlay.h:357
bool logical_xor(bool a, bool b) const
Definition: Overlay.h:277
HDS_accessor< Tag_true > acc
Definition: Overlay.h:284
Overlay_primitives op
Definition: Overlay.h:283
j indices j
Definition: Indexing.h:6
NT q
const Point_3< Real > & point() const
Obtain the coordinates of a node.
Definition: Manifold_2.h:394
Vertex * get_destination(Halfedge *h) const
Definition: HDS_accessor.h:93
Some basic geometric data types.
Definition: mapbasic.h:54
void set_inode(Vertex *v, INode *i) const
Definition: HDS_accessor.h:374
void set_parent(Halfedge *h, const Point_2 &p, int color)
Definition: HDS_overlay.h:337
Vector_3 & get_normal(int v)
#define RFC_assertion
Definition: rfc_basic.h:65
reference front()
std::list< INode * > inodes
Definition: Overlay.h:282
SURF::Vector_2< Real > Point_2
Definition: rfc_basic.h:43
reference back()
bool contains(const Halfedge *e1, const Parent_type t1, const Halfedge *e2, const Parent_type t2) const
Definition: Overlay.C:1488

Here is the call graph for this function:

Here is the caller graph for this function:

RFC_BEGIN_NAME_SPACE INode * project_next_vertex ( Halfedge b,
Halfedge g 
)
protected

Definition at line 33 of file Overlay_1d.C.

References acc, B, BLUE, Halfedge_overlay::destination(), eps_e, RFC_Pane_overlay::get_normal(), HDS_accessor< _MP >::get_pane(), RFC_Pane_overlay::get_tangent(), GREEN, insert_node_in_blue_edge(), op, Halfedge_overlay::origin(), Vertex_overlay::point(), Overlay_primitives::project_blue_feature(), Overlay_primitives::project_green_feature(), s, HDS_accessor< _MP >::set_parent(), RFC_Window_overlay::snap_on_features(), and x.

33  {
34  const RFC_Pane_overlay *gpane = acc.get_pane(g);
35  const Vertex *borg = b->origin(), *bdst = b->destination();
36  const Vertex *gorg = g->origin(), *gdst = g->destination();
37 
38  double eps_e;
39 
40  if ( B->snap_on_features()) eps_e = 5.e-3; // Increase the threshold for RSRM
41  else eps_e = Overlay::eps_e;
42 
43  Real s = op.project_green_feature( gpane->get_normal( g, gdst),
44  gpane->get_tangent( g, gdst),
45  borg->point(), bdst->point(),
46  gdst->point(), eps_e);
47  INode *x = new INode();
48  if ( s < 1) {
49  if ( s < 0) s = 0; // Adjust the origin of the blue edge.
50  acc.set_parent( x, b, Point_2( s,0), BLUE);
51  acc.set_parent( x, g, Point_2( 1,0), GREEN);
52  }
53  else if ( s>= 1) {
54  // The blue parent is bdst, so we locate a non-border
55  // blue halfedge originated from b.
56  acc.set_parent( x, b, Point_2( 1,0), BLUE);
57  // Project green vertex onto blue edge
58  Real t;
59  if ( s > 1) {
60  // Project the blue vertex onto the green halfedge
61  t=op.project_blue_feature( gpane->get_normal(g, gorg),
62  gpane->get_normal(g, gdst),
63  gpane->get_tangent(g, gorg),
64  gpane->get_tangent(g, gdst),
65  gorg->point(), gdst->point(),
66  bdst->point(), eps_e);
67  if ( t>1) t=1;
68  }
69  else
70  t = 1;
71  acc.set_parent( x, g, Point_2(t,0), GREEN);
72 
73  if ( B->snap_on_features()) {
74  // Update the coordinates for the blue point
75  Point_3 &pnt = const_cast<Point_3&>(bdst->point());
76  pnt = gorg->point()+t*(gdst->point()-gorg->point());
77  }
78  }
79 
80  // Insert the new edge into the blue edge.
81  insert_node_in_blue_edge( *x, b);
82 
83  return x;
84 }
Real project_green_feature(const Vector_3 &n, const Vector_3 &t, const Point_3 &p1, const Point_3 &p2, const Point_3 &q, const Real eps_p) const
Real eps_e
Definition: Overlay.h:291
double s
Definition: blastest.C:80
RFC_Pane_overlay * get_pane(Vertex *v) const
Definition: HDS_accessor.h:128
double Real
Definition: mapbasic.h:322
const Color GREEN
Definition: Color.C:59
Vector_3 & get_tangent(Halfedge *h, Vertex *v)
RFC_Window_overlay::Vertex Vertex
Definition: Overlay.h:59
Point object that represents a single point.
Definition: datatypedef.h:68
bool snap_on_features() const
Real project_blue_feature(const Vector_3 &n1, const Vector_3 &n2, const Vector_3 &t1, const Vector_3 &t2, const Point_3 &q1, const Point_3 &q2, const Point_3 &p, const Real eps_p) const
void int int REAL * x
Definition: read.cpp:74
Node destination() const
Obtain the (primary copy of the) destination of the edge.
Definition: Manifold_2.h:472
const Color BLUE
Definition: Color.C:62
void set_parent(INode *i, Halfedge *h, const Point_2 &p, int color)
Definition: HDS_accessor.h:355
HDS_accessor< Tag_true > acc
Definition: Overlay.h:284
Overlay_primitives op
Definition: Overlay.h:283
void insert_node_in_blue_edge(INode &x, Halfedge *b)
Definition: Overlay.C:187
RFC_Window_overlay * B
Definition: Overlay.h:280
Node origin() const
Obtain the (primary copy of the) origin of the edge.
Definition: Manifold_2.h:468
Vector_3 & get_normal(int v)
SURF::Vector_2< Real > Point_2
Definition: rfc_basic.h:43

Here is the call graph for this function:

RFC_BEGIN_NAME_SPACE void set_subnode_id ( INode i,
int  color,
int  pane_id,
int  l_id 
)
private

Insert the local id within a pane for a given subnode into the global-to-local-mapping. The mapping is composed of two data structures, _subnode_ids storing one id for every subnode, and _subnode_imap, which stores a mapping from pane_id to local_id for the subnodes present in more than one panes.

See Also
get_subnode_id

Definition at line 45 of file Overlay_IO.C.

References _subnode_copies_b, _subnode_copies_g, _subnode_ids_b, _subnode_ids_g, _subnode_imap_b, _subnode_imap_g, BLUE, GREEN, INode::id(), Node_ID::node_id, Node_ID::pane_id, and RFC_assertion.

Referenced by number_a_subnode().

45  {
46  if ( color==BLUE) {
47  int global_id = i->id();
48  Node_ID &vid = _subnode_ids_b[ global_id];
49  if ( vid.node_id < 0) { // Uninitialized
50  vid = Node_ID( pane_id, l_id);
51  _subnode_copies_b[global_id] = 1;
52  }
53  else {
54  _subnode_imap_b[global_id][ vid.pane_id] = vid.node_id;
55  std::map<int,int> &imap=_subnode_imap_b[global_id];
56  RFC_assertion( imap.find(pane_id) == imap.end());
57  imap[ pane_id] = l_id;
58  ++_subnode_copies_b[global_id];
59  }
60  }
61  else {
62  RFC_assertion( color==GREEN);
63  int global_id = i->id();
64  Node_ID &vid = _subnode_ids_g[ global_id];
65  if ( vid.node_id < 0) { // Uninitialized
66  vid = Node_ID( pane_id, l_id);
67  _subnode_copies_g[global_id] = 1;
68  }
69  else {
70  _subnode_imap_g[global_id][ vid.pane_id] = vid.node_id;
71  std::map<int,int> &imap=_subnode_imap_g[global_id];
72  RFC_assertion( imap.find(pane_id) == imap.end());
73  imap[ pane_id] = l_id;
74  ++_subnode_copies_g[global_id];
75  }
76  }
77 }
std::pair< int, int > Node_ID
std::vector< Node_ID > _subnode_ids_b
Definition: Overlay.h:247
int node_id
the local id within the pane starting from 1.
int id() const
Definition: HDS_overlay.h:347
std::map< int, std::map< int, int > > _subnode_imap_g
Definition: Overlay.h:253
const Color GREEN
Definition: Color.C:59
std::vector< char > _subnode_copies_g
Definition: Overlay.h:250
int pane_id
the id of the owner pane.
std::vector< Node_ID > _subnode_ids_g
Definition: Overlay.h:248
std::map< int, std::map< int, int > > _subnode_imap_b
Definition: Overlay.h:252
const Color BLUE
Definition: Color.C:62
std::vector< char > _subnode_copies_b
Definition: Overlay.h:249
A global ID of a node.
#define RFC_assertion
Definition: rfc_basic.h:65

Here is the call graph for this function:

Here is the caller graph for this function:

void set_tolerance ( double  tol)

Definition at line 66 of file Overlay.C.

References COM_assertion_msg, eps_e, and max().

66  {
67  COM_assertion_msg( tol<=0.2, "Tolerance too large");
68 
69  eps_e = std::max(tol, 1.e-3); // Set snap tolerance.
70 }
Real eps_e
Definition: Overlay.h:291
#define COM_assertion_msg(EX, msg)
Vector_n max(const Array_n_const &v1, const Array_n_const &v2)
Definition: Vector_n.h:354

Here is the call graph for this function:

void sort_on_green_edges ( )
protected

Definition at line 771 of file Overlay.C.

References acc, B, In_place_list_n< T, managed >::begin(), In_place_list_n< T, managed >::empty(), empty(), In_place_list_n< T, managed >::end(), HDS_accessor< _MP >::get_halfedge(), HDS_accessor< _MP >::get_inode(), HDS_accessor< _MP >::get_inode_list(), HDS_accessor< _MP >::get_next(), HDS_accessor< _MP >::get_opposite(), HDS_accessor< _MP >::get_origin(), GREEN, INode::halfedge(), i, inodes, insert_node_in_green_edge(), HDS_accessor< _MP >::is_primary(), j, In_place_list_n_base< T, n >::next_link, RFC_Window_derived< _Pane >::panes(), PARENT_EDGE, INode::parent_type(), In_place_list_n_base< T, n >::prev_link, In_place_list_n< T, managed >::push_back(), In_place_list_n< T, managed >::rbegin(), In_place_list_n< T, managed >::rend(), RFC_assertion, and v.

Referenced by overlay().

771  {
772  std::vector<RFC_Pane_overlay*> ps;
773  B->panes( ps);
774 
775  inodes.clear();
776  // Loop through all the panes of B to insert the inodes into a list
777  for ( std::vector<RFC_Pane_overlay*>::iterator
778  pit=ps.begin(); pit!=ps.end(); ++pit){
779  // Loop through the vertices.
780  for ( HDS::Vertex_iterator vit=(*pit)->hds().vertices_begin();
781  vit!=(*pit)->hds().vertices_end(); ++vit)
782  if ( vit->halfedge() && vit->halfedge()->destination() == &*vit
783  && acc.is_primary( &*vit)) {
784  INode *i = acc.get_inode( &*vit); RFC_assertion( i);
785  i->prev_link[GREEN]=i->next_link[GREEN]=NULL;
786  inodes.push_back( i);
787  }
788 
789  for ( HDS::Halfedge_iterator hit=(*pit)->hds().halfedges_begin();
790  hit!=(*pit)->hds().halfedges_end(); ++hit) {
791  INode_list &il = acc.get_inode_list( &*hit);
792  for ( INode_list::iterator it=il.begin(); it!=il.end(); ++it) {
793  INode *i = &*it; RFC_assertion( i);
794  i->prev_link[GREEN]=i->next_link[GREEN]=NULL;
795  inodes.push_back( i);
796  }
797  }
798  }
799 
800  int count = 1;
801  // Loop through all the panes of B
802  for ( std::vector<RFC_Pane_overlay*>::iterator
803  pit=ps.begin(); pit!=ps.end(); ++pit) {
804  // Loop through the real faces of each pane.
805  for ( HDS::Facet_iterator fit=(*pit)->hds().facets_begin();
806  fit!=(*pit)->hds().facets_end(); ++fit, ++count) {
807  // if ( !acc.is_master( &*fit)) continue;
808  Halfedge *b = acc.get_halfedge( &*fit), *h=b;
809  do {
810  INode *i=acc.get_inode( acc.get_origin(h));
811  if ( i) insert_node_in_green_edge( i, count);
812 
813  INode_list &il = acc.get_inode_list( h);
814  if ( !il.empty()) {
816  // Loop through the intersections on the edges
817  INode_list::iterator v = il.begin(), vend = il.end();
818  for ( ; v != vend; ++v)
819  insert_node_in_green_edge( &*v, count);
820  }
821  else {
823  if ( !ilr.empty()) {
824  INode_list::reverse_iterator vr=ilr.rbegin(),vrend=ilr.rend();
825  for ( ; vr != vrend; ++vr)
826  insert_node_in_green_edge(&*vr, count);
827  }
828  }
829  // Increment the iterator
830  } while ( (h = acc.get_next(h)) != b);
831  }
832  }
833 
834  // Loop through all the inodes
835  for (std::list<INode*>::iterator it=inodes.begin(); it!=inodes.end(); ++it) {
836  INode *i=*it;
837  if ( i->parent_type( GREEN) == PARENT_EDGE) {
839  if ( il.empty()) {
840  while ( i->prev_link[GREEN]) { i = i->prev_link[GREEN]; }
841 
842  for (;;) {
843  INode *j = i->next_link[GREEN];
844  il.push_back(*i);
845  if ( j) i=j; else break;
846  }
847  }
848  }
849  }
850 }
Vertex * get_origin(Halfedge *h) const
Definition: HDS_accessor.h:87
Halfedge * get_next(Halfedge *h) const
Definition: HDS_accessor.h:108
Parent_type parent_type(const int color) const
Definition: HDS_overlay.h:350
bool is_primary(const Vertex *v) const
Definition: HDS_accessor.h:187
Halfedge * get_opposite(Halfedge *h) const
Definition: HDS_accessor.h:99
std::reverse_iterator< iterator > reverse_iterator
boolean empty(T_VertexSet s)
This class encapsulate a halfedge over a window manifold.
Definition: Manifold_2.h:446
void push_back(T &x)
INode * get_inode(Vertex *v) const
Definition: HDS_accessor.h:370
const Color GREEN
Definition: Color.C:59
void insert_node_in_green_edge(INode *v, int tag)
Definition: Overlay.C:856
void panes(std::vector< Pane * > &ps)
Get a vector of local panes contained in the window.
Halfedge * get_halfedge(Vertex *v) const
Definition: HDS_accessor.h:75
*********************************************************************Illinois Open Source License ****University of Illinois NCSA **Open Source License University of Illinois All rights reserved ****Developed free of to any person **obtaining a copy of this software and associated documentation to deal with the Software without including without limitation the rights to and or **sell copies of the and to permit persons to whom the **Software is furnished to do subject to the following this list of conditions and the following disclaimers ****Redistributions in binary form must reproduce the above **copyright this list of conditions and the following **disclaimers in the documentation and or other materials **provided with the distribution ****Neither the names of the Center for Simulation of Advanced the University of nor the names of its **contributors may be used to endorse or promote products derived **from this Software without specific prior written permission ****THE SOFTWARE IS PROVIDED AS WITHOUT WARRANTY OF ANY **EXPRESS OR INCLUDING BUT NOT LIMITED TO THE WARRANTIES **OF FITNESS FOR A PARTICULAR PURPOSE AND **NONINFRINGEMENT IN NO EVENT SHALL THE CONTRIBUTORS OR **COPYRIGHT HOLDERS BE LIABLE FOR ANY DAMAGES OR OTHER WHETHER IN AN ACTION OF TORT OR **ARISING OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE **USE OR OTHER DEALINGS WITH THE SOFTWARE v
Definition: roccomf90.h:20
bool empty() const
blockLoc i
Definition: read.cpp:79
INode_list & get_inode_list(Halfedge *h) const
Definition: HDS_accessor.h:377
reverse_iterator rbegin()
Halfedge * halfedge(const int color) const
Definition: HDS_overlay.h:357
HDS_accessor< Tag_true > acc
Definition: Overlay.h:284
j indices j
Definition: Indexing.h:6
RFC_Window_overlay * B
Definition: Overlay.h:280
reverse_iterator rend()
#define RFC_assertion
Definition: rfc_basic.h:65
std::list< INode * > inodes
Definition: Overlay.h:282

Here is the call graph for this function:

Here is the caller graph for this function:

Real sq_length ( const Halfedge h) const
private

Definition at line 178 of file Overlay.C.

References Halfedge_overlay::destination(), Halfedge_overlay::origin(), and Vertex_overlay::point().

Referenced by get_green_parent(), and match_features_0().

178  {
179  return (h.origin()->point() - h.destination()->point()).squared_norm();
180 }
Node destination() const
Obtain the (primary copy of the) destination of the edge.
Definition: Manifold_2.h:472
const Point_3< Real > & point() const
Obtain the coordinates of a node.
Definition: Manifold_2.h:394
Node origin() const
Obtain the (primary copy of the) origin of the edge.
Definition: Manifold_2.h:468

Here is the call graph for this function:

Here is the caller graph for this function:

bool subdivide ( const INode_const_list face,
INode_const_list::const_iterator  last_checked,
Subface_list sub_faces,
int  color,
int  depth = 0 
) const

Definition at line 1759 of file Overlay.C.

References get_next_inode(), i, iend, RFC_assertion, and RFC_assertion_code.

Referenced by number_subfaces(), write_overlay_off(), and write_overlay_tec().

1762  {
1763  if ( face.size() < 3) return true; // Do nothing
1764  RFC_assertion( last_checked != face.begin() && last_checked != face.end() && depth < 1000);
1765 
1766  INode_const_list::const_iterator it=last_checked, iend=face.end(),inext;
1767  const INode *v0 = *(--last_checked), *v1 = *it, *v2;
1768  // v0 and v1 are the last pair of adjacent nodes that are known belonging
1769  // to the sub-face of previous nodes in the node list.
1770 
1771  for ( RFC_assertion_code(unsigned int c=0);;RFC_assertion(++c<face.size())) {
1772  inext = it; ++inext; // Equivalent to inext = it + 1;
1773  if ( inext == iend) { // All nodes in the list are processed.
1774  if ( face.front() == get_next_inode( v0, v1, color)) {
1775  // Insert a new item in the sub-face list.
1776  sub_faces.push_back( std::vector< const INode*>());
1777  std::vector< const INode*> &vec = sub_faces.back();
1778  vec.reserve( face.size());
1779  vec.insert( vec.end(),face.begin(), face.end());
1780  return false;
1781  }
1782  return true;
1783  }
1784  else {
1785  v2 = get_next_inode( v0, v1, color);
1786  if ( !v2) {
1787  INode_const_list sub2( it, face.end());
1788  subdivide( sub2, ++sub2.begin(), sub_faces, color, depth+1);
1789  return true;
1790  }
1791  v0 = v1; v1 = v2;
1792  if ( v2 != *inext) break; // the face is split at v2
1793 
1794  it = inext;
1795  }
1796  }
1797 
1798  // The sub-face is a proper subset of given face. We split it into two parts.
1799  // Create a binary tree structure for the nodes.
1800  typedef std::map< const INode *, INode_const_list::const_iterator> IMap;
1801  IMap imap;
1802  for ( INode_const_list::const_iterator i = face.begin(); i!=iend; ++i)
1803  imap.insert( std::make_pair( *i, i));
1804 
1805  IMap::const_iterator mit;
1806  // Create two sub lists
1807  std::list< const INode *> sub1, sub2;
1808  sub1.insert( sub1.end(), face.begin(), inext);
1809 
1810  // Find the end of the chain that cuts the face
1811  for ( RFC_assertion_code( int count=0);;RFC_assertion(++count<100)) {
1812  if ( (mit=imap.find( v1)) == imap.end()) {
1813  sub1.push_back( v1);
1814  sub2.push_front( v1);
1815  v2 = get_next_inode( v0, v1, color);
1816  if (v2) { v0=v1; v1 = v2; } else break;
1817  }
1818  else {
1819  break;
1820  }
1821  }
1822 
1823  bool ret1=true, ret2=true;
1824  // Cut the face along the inodes (*mit->second,sub2.front,...,sub2.end(),*it)
1825  INode_const_list::const_iterator sub_it1 = --sub1.end();
1826  if (v2 && mit->second != face.begin())
1827  { sub1.insert( sub1.end(), mit->second, iend); ++sub_it1; }
1828  if (v2) ret1 = subdivide( sub1, sub_it1, sub_faces, color, depth+1);
1829  sub1.clear();
1830 
1831  if ( v2) sub2.push_front( *mit->second);
1832  if ( v2 && mit->second != face.begin())
1833  { sub2.insert(sub2.end(),it,mit->second); }
1834  else
1835  { sub2.insert(sub2.end(),it,iend); }
1836  ret2 = subdivide( sub2, ++sub2.begin(), sub_faces, color, depth+1);
1837  return ret1 || ret2;
1838 }
std::list< const INode * > INode_const_list
Definition: Overlay.h:63
const INode * get_next_inode(const INode *v1, const INode *v2, int) const
Definition: Overlay.C:1728
Definition: face.h:90
**********************************************************************Rocstar Simulation Suite Illinois Rocstar LLC All rights reserved ****Illinois Rocstar LLC IL **www illinoisrocstar com **sales illinoisrocstar com WITHOUT WARRANTY OF ANY **EXPRESS OR INCLUDING BUT NOT LIMITED TO THE WARRANTIES **OF FITNESS FOR A PARTICULAR PURPOSE AND **NONINFRINGEMENT IN NO EVENT SHALL THE CONTRIBUTORS OR **COPYRIGHT HOLDERS BE LIABLE FOR ANY DAMAGES OR OTHER WHETHER IN AN ACTION OF TORT OR **Arising OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE **USE OR OTHER DEALINGS WITH THE SOFTWARE **********************************************************************INTERFACE SUBROUTINE knode iend
blockLoc i
Definition: read.cpp:79
bool subdivide(const INode_const_list &face, INode_const_list::const_iterator last_checked, Subface_list &sub_faces, int color, int depth=0) const
Definition: Overlay.C:1759
#define RFC_assertion_code
Definition: rfc_basic.h:68
#define RFC_assertion
Definition: rfc_basic.h:65

Here is the call graph for this function:

Here is the caller graph for this function:

bool verify_inode ( const INode i)
protected

Definition at line 1022 of file Overlay.C.

References acc, In_place_list_n< T, managed >::back(), BLUE, contains(), In_place_list_n< T, managed >::empty(), In_place_list_n< T, managed >::front(), HDS_accessor< _MP >::get_destination(), HDS_accessor< _MP >::get_inode(), HDS_accessor< _MP >::get_inode_list(), HDS_accessor< _MP >::get_next(), HDS_accessor< _MP >::get_opposite(), HDS_accessor< _MP >::get_origin(), GREEN, INode::halfedge(), i, j, In_place_list_n_base< T, n >::next_link, PARENT_FACE, INode::parent_type(), In_place_list_n_base< T, n >::prev_link, RFC_precondition, and In_place_list_n< T, managed >::size().

Referenced by project_adjacent_green_vertices().

1022  {
1024 
1025  Halfedge *g = i->halfedge(GREEN), *gopp, *g0=g;
1026  // Loop through all the incident halfedges.
1027  do {
1028  gopp = acc.get_opposite( g);
1029 
1030  INode_list &il = acc.get_inode_list( g);
1031  INode_list &ilr = acc.get_inode_list( gopp);
1032 
1033  // If there is any subnode between i and dst, skip the edge.
1034  INode *j;
1035  if ( !il.empty()) {
1036  if ( &il.back() != i) continue;
1037  j = ( il.size() > 1 ? i->prev_link[GREEN] :
1038  acc.get_inode( acc.get_origin( g)));
1039  }
1040  else if ( !ilr.empty()) {
1041  if ( &ilr.front() != i) continue;
1042  j = ( ilr.size() > 1 ? i->next_link[GREEN] :
1043  acc.get_inode( acc.get_origin( g)));
1044  }
1045  else
1046  j = acc.get_inode( acc.get_destination(g));
1047 
1048  if ( j && !contains( i->halfedge( BLUE), PARENT_FACE,
1049  j->halfedge( BLUE), j->parent_type( BLUE)))
1050  return false;
1051  } while ( ( g = acc.get_next(gopp)) != g0);
1052 
1053  return true;
1054 }
Vertex * get_origin(Halfedge *h) const
Definition: HDS_accessor.h:87
Halfedge * get_next(Halfedge *h) const
Definition: HDS_accessor.h:108
Parent_type parent_type(const int color) const
Definition: HDS_overlay.h:350
Halfedge * get_opposite(Halfedge *h) const
Definition: HDS_accessor.h:99
size_type size() const
This class encapsulate a halfedge over a window manifold.
Definition: Manifold_2.h:446
INode * get_inode(Vertex *v) const
Definition: HDS_accessor.h:370
const Color GREEN
Definition: Color.C:59
bool empty() const
blockLoc i
Definition: read.cpp:79
INode_list & get_inode_list(Halfedge *h) const
Definition: HDS_accessor.h:377
const Color BLUE
Definition: Color.C:62
Halfedge * halfedge(const int color) const
Definition: HDS_overlay.h:357
HDS_accessor< Tag_true > acc
Definition: Overlay.h:284
j indices j
Definition: Indexing.h:6
#define RFC_precondition
Definition: rfc_basic.h:63
Vertex * get_destination(Halfedge *h) const
Definition: HDS_accessor.h:93
reference front()
reference back()
bool contains(const Halfedge *e1, const Parent_type t1, const Halfedge *e2, const Parent_type t2) const
Definition: Overlay.C:1488

Here is the call graph for this function:

Here is the caller graph for this function:

void write_inodes_tec ( std::ostream &  os,
const char *  color 
)

Definition at line 1541 of file Overlay.C.

References BLUE, Overlay_primitives::get_point(), GREEN, INode::halfedge(), i, iend, inodes, min(), n, INode::nat_coor(), op, and set_ascii_mode().

1541  {
1542  set_ascii_mode(os);
1543 
1544  int n=0;
1545  std::list<INode*>::iterator it = inodes.begin(), iend = inodes.end();
1546  for ( ; it != iend; ++it,++n) {
1547  if ( n%50==0) {
1548  os << "GEOMETRY T=LINE3D";
1549  if ( color) os << " C=" << color;
1550  os << " LT=0.2" << std::endl;
1551  os << std::min(int(inodes.size()-n),int(50)) << std::endl;
1552  }
1553  INode *i = *it;
1554  os << 2 << ' ' << op.get_point( i->halfedge(BLUE), i->nat_coor( BLUE))
1555  << ' ' << op.get_point( i->halfedge(GREEN), i->nat_coor( GREEN))
1556  << std::endl;
1557  }
1558 }
const Color GREEN
Definition: Color.C:59
**********************************************************************Rocstar Simulation Suite Illinois Rocstar LLC All rights reserved ****Illinois Rocstar LLC IL **www illinoisrocstar com **sales illinoisrocstar com WITHOUT WARRANTY OF ANY **EXPRESS OR INCLUDING BUT NOT LIMITED TO THE WARRANTIES **OF FITNESS FOR A PARTICULAR PURPOSE AND **NONINFRINGEMENT IN NO EVENT SHALL THE CONTRIBUTORS OR **COPYRIGHT HOLDERS BE LIABLE FOR ANY DAMAGES OR OTHER WHETHER IN AN ACTION OF TORT OR **Arising OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE **USE OR OTHER DEALINGS WITH THE SOFTWARE **********************************************************************INTERFACE SUBROUTINE knode iend
const Point_2S & nat_coor(const int color) const
Definition: HDS_overlay.h:327
blockLoc i
Definition: read.cpp:79
const NT & n
const Color BLUE
Definition: Color.C:62
Halfedge * halfedge(const int color) const
Definition: HDS_overlay.h:357
Overlay_primitives op
Definition: Overlay.h:283
Vector_n min(const Array_n_const &v1, const Array_n_const &v2)
Definition: Vector_n.h:346
Point_3 get_point(const Halfedge *b, const Point_2S &nc) const
IO::Mode set_ascii_mode(std::ios &i)
Definition: io.C:70
std::list< INode * > inodes
Definition: Overlay.h:282

Here is the call graph for this function:

void write_inodes_vec ( std::ostream &  os)

Definition at line 1561 of file Overlay.C.

References BLUE, Overlay_primitives::get_point(), GREEN, INode::halfedge(), i, iend, inodes, n, INode::nat_coor(), op, and set_ascii_mode().

1561  {
1562  set_ascii_mode(os);
1563 
1564  int n = inodes.size();
1565 
1566  os << "VECT\n";
1567  os << n << ' ' << n*2 << ' ' << 0 << '\n';
1568 
1569  int i;
1570  // Print the number of vertices in each inode
1571  for ( i=n; i>0; --i) os << 2 << '\n';
1572  for ( i=n; i>0; --i) os << 0 << '\n';
1573 
1574  // Print the coordinates of each node
1575  std::list<INode*>::iterator it = inodes.begin(), iend = inodes.end();
1576  for ( ; it != iend; ++it) {
1577  INode *i = *it;
1578  os << op.get_point( i->halfedge(BLUE), i->nat_coor( BLUE))
1579  << ' ' << op.get_point( i->halfedge(GREEN), i->nat_coor( GREEN))
1580  << std::endl;
1581  }
1582 }
const Color GREEN
Definition: Color.C:59
**********************************************************************Rocstar Simulation Suite Illinois Rocstar LLC All rights reserved ****Illinois Rocstar LLC IL **www illinoisrocstar com **sales illinoisrocstar com WITHOUT WARRANTY OF ANY **EXPRESS OR INCLUDING BUT NOT LIMITED TO THE WARRANTIES **OF FITNESS FOR A PARTICULAR PURPOSE AND **NONINFRINGEMENT IN NO EVENT SHALL THE CONTRIBUTORS OR **COPYRIGHT HOLDERS BE LIABLE FOR ANY DAMAGES OR OTHER WHETHER IN AN ACTION OF TORT OR **Arising OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE **USE OR OTHER DEALINGS WITH THE SOFTWARE **********************************************************************INTERFACE SUBROUTINE knode iend
const Point_2S & nat_coor(const int color) const
Definition: HDS_overlay.h:327
blockLoc i
Definition: read.cpp:79
const NT & n
const Color BLUE
Definition: Color.C:62
Halfedge * halfedge(const int color) const
Definition: HDS_overlay.h:357
Overlay_primitives op
Definition: Overlay.h:283
Point_3 get_point(const Halfedge *b, const Point_2S &nc) const
IO::Mode set_ascii_mode(std::ios &i)
Definition: io.C:70
std::list< INode * > inodes
Definition: Overlay.h:282

Here is the call graph for this function:

void write_overlay_off ( std::ostream &  os,
const COM::Window *  w 
)

Definition at line 2006 of file Overlay.C.

References B, RFC_Window_base::base(), BLUE, G, get_inodes_of_face(), Overlay_primitives::get_point(), GREEN, i, inodes, op, RFC_Window_derived< _Pane >::panes(), RFC_assertion, RFC_assertion_code, set_ascii_mode(), subdivide(), and verbose.

2006  {
2007  int color = (w==B->base()) ? BLUE : GREEN;
2008  os << "OFF" << std::endl;
2009  set_ascii_mode(os);
2010 
2011  // Loop through all the original blue faces
2012  std::vector<RFC_Pane_overlay*> ps;
2013  if ( color==GREEN) G->panes( ps); else B->panes( ps);
2014 
2015  int nfaces = 0;
2016 
2017  // Loop through all the panes of the window to count the number of faces
2018  for (std::vector<RFC_Pane_overlay*>::iterator
2019  pit=ps.begin(); pit != ps.end(); ++pit) {
2020  // Loop through the faces of each pane.
2021  for ( HDS::Facet_iterator fit=(*pit)->hds().facets_begin();
2022  fit!=(*pit)->hds().facets_end(); ++fit) {
2023 
2024  // Construct a list of nodes for the blue face
2025  INode_const_list nodes;
2026  get_inodes_of_face( &*fit, nodes);
2027  if ( nodes.size() <= 2) continue;
2028 
2029  Subface_list sub_faces;
2030  // subdivide the face
2031  RFC_assertion_code( bool ret = )
2032  subdivide( nodes, ++nodes.begin(), sub_faces, color);
2033  RFC_assertion( !ret);
2034 
2035  // output the subfaces of the blue face
2036  nfaces += sub_faces.size();
2037  }
2038  }
2039 
2040  os << inodes.size() << ' ' << nfaces << " 0" << std::endl;
2041 
2042  // Assign ids for the vertices
2043  int id=0;
2044  std::map< const void*, int> ids;
2045  for ( std::list< INode*>::const_iterator
2046  i = inodes.begin(); i != inodes.end(); ++i) {
2047  os << op.get_point( (*i)->halfedge( color),
2048  (*i)->nat_coor( color))
2049  << std::endl;
2050  ids[*i] = id++;
2051  }
2052 
2053  // Loop through all the original blue faces
2054  for (std::vector<RFC_Pane_overlay*>::iterator
2055  pit=ps.begin(); pit != ps.end(); ++pit) {
2056  // Loop through the faces of each pane.
2057  for ( HDS::Facet_iterator fit=(*pit)->hds().facets_begin();
2058  fit!=(*pit)->hds().facets_end(); ++fit) {
2059 
2060  // Construct a list of nodes for the blue face
2061  INode_const_list nodes;
2062  get_inodes_of_face( &*fit, nodes);
2063  if ( nodes.size() <= 2) continue;
2064 
2065  Subface_list sub_faces;
2066  // subdivide the face
2067  RFC_assertion_code( bool ret = )
2068  subdivide( nodes, ++nodes.begin(), sub_faces, color);
2069  RFC_assertion( !ret);
2070 
2071  // output the subfaces of the blue face
2072  Subface_list::iterator sfit = sub_faces.begin(), sfend=sub_faces.end();
2073 
2074  for ( ; sfit != sfend; ++sfit) {
2075  // Loop through the points in the sub face
2076  os << sfit->size();
2077  for ( Subface_list::value_type::iterator
2078  vit=sfit->begin(); vit!=sfit->end(); ++vit) {
2079  os << " " << ids[*vit];
2080  }
2081  os << std::endl;
2082  }
2083  }
2084  }
2085 
2086  if ( verbose)
2087  std::cout << "\tTotal number of sub-faces in the overlay is "
2088  << nfaces << std::endl;
2089 }
std::list< const INode * > INode_const_list
Definition: Overlay.h:63
const Color GREEN
Definition: Color.C:59
void panes(std::vector< Pane * > &ps)
Get a vector of local panes contained in the window.
void get_inodes_of_face(const Facet *f, INode_const_list &nodes)
Definition: Overlay.C:1922
RFC_Window_overlay * G
Definition: Overlay.h:281
const COM::Window * base() const
Get a reference to the base COM::Window object.
blockLoc i
Definition: read.cpp:79
const Color BLUE
Definition: Color.C:62
Overlay_primitives op
Definition: Overlay.h:283
bool subdivide(const INode_const_list &face, INode_const_list::const_iterator last_checked, Subface_list &sub_faces, int color, int depth=0) const
Definition: Overlay.C:1759
std::list< Subface > Subface_list
Definition: Overlay.h:65
#define RFC_assertion_code
Definition: rfc_basic.h:68
Point_3 get_point(const Halfedge *b, const Point_2S &nc) const
bool verbose
Definition: Overlay.h:287
for(;;)
RFC_Window_overlay * B
Definition: Overlay.h:280
IO::Mode set_ascii_mode(std::ios &i)
Definition: io.C:70
#define RFC_assertion
Definition: rfc_basic.h:65
std::list< INode * > inodes
Definition: Overlay.h:282

Here is the call graph for this function:

void write_overlay_tec ( std::ostream &  os,
const COM::Window *  w 
)

Definition at line 1956 of file Overlay.C.

References B, RFC_Window_base::base(), BLUE, G, get_inodes_of_face(), Overlay_primitives::get_point(), GREEN, op, RFC_Window_derived< _Pane >::panes(), RFC_assertion, RFC_assertion_code, subdivide(), and verbose.

1956  {
1957  int color = (w==B->base()) ? BLUE : GREEN;
1958  int num_faces=0;
1959  // Loop through all the original blue faces
1960  std::vector<RFC_Pane_overlay*> ps;
1961  if ( color==GREEN) G->panes( ps); else B->panes( ps);
1962  // Loop through all the panes of G
1963  for (std::vector<RFC_Pane_overlay*>::iterator
1964  pit=ps.begin(); pit != ps.end(); ++pit) {
1965  // Loop through the faces of each pane.
1966  for ( HDS::Facet_iterator fit=(*pit)->hds().facets_begin();
1967  fit!=(*pit)->hds().facets_end(); ++fit) {
1968 
1969  // Construct a list of nodes for the blue face
1970  INode_const_list nodes;
1971  get_inodes_of_face( &*fit, nodes);
1972  if ( nodes.size() <= 2) continue;
1973 
1974  Subface_list sub_faces;
1975  // subdivide the face
1976  RFC_assertion_code( bool ret = )
1977  subdivide( nodes, ++nodes.begin(), sub_faces, color);
1978  RFC_assertion( !ret);
1979 
1980  // output the subfaces of the blue face
1981  num_faces += sub_faces.size();
1982  Subface_list::iterator sfit = sub_faces.begin(), sfend=sub_faces.end();
1983  os << "GEOMETRY T=LINE3D C=BLACK"
1984  << " LT=0.15\n" << sub_faces.size() << std::endl;
1985  for ( ; sfit != sfend; ++sfit) {
1986  // Loop through the points in the sub face
1987  os << sfit->size()+1 << " ";
1988  for ( Subface_list::value_type::iterator
1989  vit=sfit->begin(); vit!=sfit->end(); ++vit) {
1990  os << op.get_point( (*vit)->halfedge( color),
1991  (*vit)->nat_coor( color))
1992  << std::endl;
1993  }
1994  os << op.get_point( (*sfit->begin())->halfedge( color),
1995  (*sfit->begin())->nat_coor( color))
1996  << std::endl;
1997  }
1998  }
1999  }
2000  if ( verbose)
2001  std::cout << "\tTotal number of sub-faces in the overlay is "
2002  << num_faces << std::endl;
2003 }
const Color BLACK
Definition: Color.C:55
std::list< const INode * > INode_const_list
Definition: Overlay.h:63
const Color GREEN
Definition: Color.C:59
void panes(std::vector< Pane * > &ps)
Get a vector of local panes contained in the window.
void get_inodes_of_face(const Facet *f, INode_const_list &nodes)
Definition: Overlay.C:1922
RFC_Window_overlay * G
Definition: Overlay.h:281
const COM::Window * base() const
Get a reference to the base COM::Window object.
const NT & n
const Color BLUE
Definition: Color.C:62
Overlay_primitives op
Definition: Overlay.h:283
bool subdivide(const INode_const_list &face, INode_const_list::const_iterator last_checked, Subface_list &sub_faces, int color, int depth=0) const
Definition: Overlay.C:1759
std::list< Subface > Subface_list
Definition: Overlay.h:65
#define RFC_assertion_code
Definition: rfc_basic.h:68
Point_3 get_point(const Halfedge *b, const Point_2S &nc) const
bool verbose
Definition: Overlay.h:287
for(;;)
RFC_Window_overlay * B
Definition: Overlay.h:280
#define RFC_assertion
Definition: rfc_basic.h:65

Here is the call graph for this function:

Member Data Documentation

std::vector< char> _subnode_copies_b
private

Definition at line 249 of file Overlay.h.

Referenced by get_subnode_copies(), number_subnodes(), and set_subnode_id().

std::vector< char> _subnode_copies_g
private

Definition at line 250 of file Overlay.h.

Referenced by get_subnode_copies(), number_subnodes(), and set_subnode_id().

std::vector< Node_ID> _subnode_ids_b
private

Definition at line 247 of file Overlay.h.

Referenced by get_subnode_id(), number_subnodes(), and set_subnode_id().

std::vector< Node_ID> _subnode_ids_g
private

Definition at line 248 of file Overlay.h.

Referenced by get_subnode_id(), number_subnodes(), and set_subnode_id().

std::map< int,std::map<int,int> > _subnode_imap_b
private

Definition at line 252 of file Overlay.h.

Referenced by get_subnode_id(), and set_subnode_id().

std::map< int,std::map<int,int> > _subnode_imap_g
private

Definition at line 253 of file Overlay.h.

Referenced by get_subnode_id(), and set_subnode_id().

Real eps_p
protected

Definition at line 292 of file Overlay.h.

Referenced by intersect_link_helper(), and project_adjacent_green_vertices().

bool is_opposite
protected
std::string out_pre
protected

Definition at line 289 of file Overlay.h.

Referenced by Overlay().

bool verbose2
protected

Definition at line 288 of file Overlay.h.

Referenced by match_features_0(), Overlay(), and overlay_init().


The documentation for this class was generated from the following files: