Пример #1
0
 virtual void after_split_edge (Halfedge_handle h1, Halfedge_handle h2)
 {
     std::string str = h1->data();
     if (str.compare("") == 0)
         str = h2->data();
     if (str.compare("") == 0)
         str = h1->twin()->data();
     if (str.compare("") == 0)
         str = h2->twin()->data();
     h1->set_data(str);
     h2->set_data(str);
     h1->twin()->set_data(str);
     h2->twin()->set_data(str);
 }
Пример #2
0
void	Map_CreateWithLineData(
					Pmwx&									out_map,
					const vector<Segment_2>&				input_curves,
					const vector<GIS_halfedge_data>&		input_data)
{
	DebugAssert(input_curves.size() == input_data.size());

	out_map.clear();

	int n;

	vector<Curve_2>	curves;
	curves.resize(input_curves.size());

	for(n = 0; n < input_curves.size(); ++n)
		curves[n] = Curve_2(input_curves[n], n);

	CGAL::insert(out_map, curves.begin(), curves.end());

	for(Pmwx::Edge_iterator eit = out_map.edges_begin(); eit != out_map.edges_end(); ++eit)
	{
		DebugAssert(eit->curve().data().size() >= 1);

		// CGAL maintains a lot of information for us that makes life easy:
		// 1.	The underlying curve of an edge is a sub-curve of the input curve - it is NEVER flipped.  is_directed_right tells whether
		//		it is lex-right.*
		// 2.	Each half-edge's direction tells us if the half-edge is lex-right...strangely, "SMALLER" means lex-right.
		// Putting these two things together, we can easily detect which of two half-edges is in the same vs. opposite direction of the input
		// curve.
		// * lex-right means lexicographically x-y larger...means target is to the right of source UNLESS it's vertical (then UP = true, down = false).
		Halfedge_handle he = he_is_same_direction(eit) ? eit : eit->twin();

		int cid = eit->curve().data().front();
		DebugAssert(cid >= 0 && cid < input_data.size());
		he->set_data(input_data[cid]);
//		he->data().mDominant = true;
//		he->twin()->data().mDominant = false;

		// Do NOT leave the keys in the map...
		eit->curve().data().clear();
	}
}
Пример #3
0
 /*! Create an edge e that matches the edge e2, contained in the face f1. */
 virtual void create_edge(Face_const_handle f1, Halfedge_const_handle e2,
                          Halfedge_handle e) const
 {
   e->set_data(f1->data() + e2->data());
   e->twin()->set_data(f1->data() + e2->data());
 }
Пример #4
0
 /*! Create an edge e that matches the edge e1, contained in the face f2. */
 virtual void create_edge(Halfedge_const_handle e1, Face_const_handle f2,
                          Halfedge_handle e) const
 {
   e->set_data(e1->data() + f2->data());
   e->twin()->set_data(e1->data() + f2->data());
 }