mirror of https://github.com/CGAL/cgal
Cleaned up
This commit is contained in:
parent
93d5fecf1c
commit
4d85bc3e63
|
|
@ -45,8 +45,7 @@ namespace CGAL {
|
||||||
namespace draw_aos {
|
namespace draw_aos {
|
||||||
|
|
||||||
template <typename Arr, typename GSOptions>
|
template <typename Arr, typename GSOptions>
|
||||||
class Draw_arr_tool
|
class Draw_arr_tool {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
using Halfedge_const_handle = typename Arr::Halfedge_const_handle;
|
using Halfedge_const_handle = typename Arr::Halfedge_const_handle;
|
||||||
using Vertex_const_handle = typename Arr::Vertex_const_handle;
|
using Vertex_const_handle = typename Arr::Vertex_const_handle;
|
||||||
|
|
@ -58,39 +57,40 @@ public:
|
||||||
using Point = typename Arr::Point_2;
|
using Point = typename Arr::Point_2;
|
||||||
using X_monotone_curve = typename Arr::X_monotone_curve_2;
|
using X_monotone_curve = typename Arr::X_monotone_curve_2;
|
||||||
|
|
||||||
/*! Construct
|
/*! constructs
|
||||||
*/
|
*/
|
||||||
Draw_arr_tool(Arr& a_aos, CGAL::Graphics_scene& a_gs, const GSOptions& a_gso)
|
Draw_arr_tool(Arr& a_aos, CGAL::Graphics_scene& a_gs, const GSOptions& a_gso) :
|
||||||
: m_aos(a_aos)
|
m_aos(a_aos),
|
||||||
, m_gs(a_gs)
|
m_gs(a_gs),
|
||||||
, m_gso(a_gso) {}
|
m_gso(a_gso)
|
||||||
|
{}
|
||||||
|
|
||||||
/// Add a face.
|
//! adds a face.
|
||||||
void add_face(Face_const_handle face) {
|
void add_face(Face_const_handle face) {
|
||||||
// std::cout << "add_face()\n";
|
// std::cout << "add_face()\n";
|
||||||
for(Inner_ccb_const_iterator it = face->inner_ccbs_begin(); it != face->inner_ccbs_end(); ++it) add_ccb(*it);
|
for (Inner_ccb_const_iterator it = face->inner_ccbs_begin(); it != face->inner_ccbs_end(); ++it) add_ccb(*it);
|
||||||
|
|
||||||
if(!face->is_unbounded()) {
|
if (! face->is_unbounded()) {
|
||||||
for(Outer_ccb_const_iterator it = face->outer_ccbs_begin(); it != face->outer_ccbs_end(); ++it) {
|
for (Outer_ccb_const_iterator it = face->outer_ccbs_begin(); it != face->outer_ccbs_end(); ++it) {
|
||||||
add_ccb(*it);
|
add_ccb(*it);
|
||||||
draw_region(*it);
|
draw_region(*it);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Add a Connected Component of the Boundary.
|
//! adds a Connected Component of the Boundary.
|
||||||
void add_ccb(Ccb_halfedge_const_circulator circ) {
|
void add_ccb(Ccb_halfedge_const_circulator circ) {
|
||||||
// std::cout << "add_ccb()\n";
|
// std::cout << "add_ccb()\n";
|
||||||
auto curr = circ;
|
auto curr = circ;
|
||||||
do {
|
do {
|
||||||
auto new_face = curr->twin()->face();
|
auto new_face = curr->twin()->face();
|
||||||
if(m_visited.find(new_face) != m_visited.end()) continue;
|
if (m_visited.find(new_face) != m_visited.end()) continue;
|
||||||
m_visited[new_face] = true;
|
m_visited[new_face] = true;
|
||||||
add_face(new_face);
|
add_face(new_face);
|
||||||
} while(++curr != circ);
|
} while(++curr != circ);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Draw a region.
|
//! draws a region.
|
||||||
void draw_region(Ccb_halfedge_const_circulator circ) {
|
void draw_region(Ccb_halfedge_const_circulator circ) {
|
||||||
// std::cout << "draw_region()\n";
|
// std::cout << "draw_region()\n";
|
||||||
/* Check whether the traits has a member function called
|
/* Check whether the traits has a member function called
|
||||||
|
|
@ -108,7 +108,7 @@ public:
|
||||||
*
|
*
|
||||||
* For now we use C++14 features.
|
* For now we use C++14 features.
|
||||||
*/
|
*/
|
||||||
if(m_gso.colored_face(m_aos, circ->face()))
|
if (m_gso.colored_face(m_aos, circ->face()))
|
||||||
m_gs.face_begin(m_gso.face_color(m_aos, circ->face()));
|
m_gs.face_begin(m_gso.face_color(m_aos, circ->face()));
|
||||||
else
|
else
|
||||||
m_gs.face_begin();
|
m_gs.face_begin();
|
||||||
|
|
@ -128,21 +128,21 @@ public:
|
||||||
m_gs.face_end();
|
m_gs.face_end();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Compile time dispatching
|
//! Compile time dispatching
|
||||||
|
|
||||||
///
|
//!
|
||||||
template <typename T, typename A, std::enable_if_t<!has_approximate_point_v<T, A>, int> = 0>
|
template <typename T, typename A, std::enable_if_t<!has_approximate_point_v<T, A>, int> = 0>
|
||||||
void draw_region_impl2(const T& /* traits */, const A& /* approximate */, Halfedge_const_handle curr) {
|
void draw_region_impl2(const T& /* traits */, const A& /* approximate */, Halfedge_const_handle curr) {
|
||||||
draw_exact_region(curr);
|
draw_exact_region(curr);
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
//!
|
||||||
template <typename T, typename A, std::enable_if_t<has_approximate_point_v<T, A>, int> = 0>
|
template <typename T, typename A, std::enable_if_t<has_approximate_point_v<T, A>, int> = 0>
|
||||||
auto draw_region_impl2(const T& /* traits */, const A& approx, Halfedge_const_handle curr) {
|
auto draw_region_impl2(const T& /* traits */, const A& approx, Halfedge_const_handle curr) {
|
||||||
draw_approximate_region(curr, approx);
|
draw_approximate_region(curr, approx);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! Draw a region, where the traits does not has approximate_2_object.
|
/*! draws a region, where the traits does not has approximate_2_object.
|
||||||
*/
|
*/
|
||||||
template <typename T, std::enable_if_t<!has_approximate_2_object_v<T> && !is_or_derived_from_agas_v<T>, int> = 0>
|
template <typename T, std::enable_if_t<!has_approximate_2_object_v<T> && !is_or_derived_from_agas_v<T>, int> = 0>
|
||||||
void draw_region_impl1(const T& /* traits */, Halfedge_const_handle curr) {
|
void draw_region_impl1(const T& /* traits */, Halfedge_const_handle curr) {
|
||||||
|
|
@ -156,7 +156,7 @@ public:
|
||||||
draw_region_impl2(traits, traits.approximate_2_object(), curr);
|
draw_region_impl2(traits, traits.approximate_2_object(), curr);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! Draw a geodesic region
|
/*! draws a geodesic region
|
||||||
*/
|
*/
|
||||||
template <typename T, std::enable_if_t<is_or_derived_from_agas_v<T>, int> = 0>
|
template <typename T, std::enable_if_t<is_or_derived_from_agas_v<T>, int> = 0>
|
||||||
void draw_region_impl1(const T& traits, Halfedge_const_handle curr) {
|
void draw_region_impl1(const T& traits, Halfedge_const_handle curr) {
|
||||||
|
|
@ -164,7 +164,7 @@ public:
|
||||||
draw_curve_impl1(traits, curr->curve(), false, CGAL::IO::Color());
|
draw_curve_impl1(traits, curr->curve(), false, CGAL::IO::Color());
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! Draw a region using approximate coordinates.
|
/*! draws a region using approximate coordinates.
|
||||||
* Call this member function only if the geometry traits is equipped with
|
* Call this member function only if the geometry traits is equipped with
|
||||||
* the coordinate-approximation functionality of a curve.
|
* the coordinate-approximation functionality of a curve.
|
||||||
* This function must be inlined (e.g., a template) to enable the
|
* This function must be inlined (e.g., a template) to enable the
|
||||||
|
|
@ -177,13 +177,13 @@ public:
|
||||||
double error(0.01); // TODO? (this->pixel_ratio());
|
double error(0.01); // TODO? (this->pixel_ratio());
|
||||||
bool l2r = curr->direction() == ARR_LEFT_TO_RIGHT;
|
bool l2r = curr->direction() == ARR_LEFT_TO_RIGHT;
|
||||||
approx(curr->curve(), error, std::back_inserter(polyline), l2r);
|
approx(curr->curve(), error, std::back_inserter(polyline), l2r);
|
||||||
if(polyline.empty()) return;
|
if (polyline.empty()) return;
|
||||||
auto it = polyline.begin();
|
auto it = polyline.begin();
|
||||||
auto prev = it++;
|
auto prev = it++;
|
||||||
for(; it != polyline.end(); prev = it++) m_gs.add_point_in_face(*prev);
|
for (; it != polyline.end(); prev = it++) m_gs.add_point_in_face(*prev);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! Draw an exact curve.
|
/*! draws an exact curve.
|
||||||
*/
|
*/
|
||||||
template <typename XMonotoneCurve>
|
template <typename XMonotoneCurve>
|
||||||
void draw_exact_curve(const XMonotoneCurve& curve, bool colored, const CGAL::IO::Color& c) {
|
void draw_exact_curve(const XMonotoneCurve& curve, bool colored, const CGAL::IO::Color& c) {
|
||||||
|
|
@ -191,72 +191,72 @@ public:
|
||||||
auto ctr_min = traits->construct_min_vertex_2_object();
|
auto ctr_min = traits->construct_min_vertex_2_object();
|
||||||
auto ctr_max = traits->construct_max_vertex_2_object();
|
auto ctr_max = traits->construct_max_vertex_2_object();
|
||||||
m_gs.add_segment(ctr_min(curve), ctr_max(curve));
|
m_gs.add_segment(ctr_min(curve), ctr_max(curve));
|
||||||
if(colored)
|
if (colored)
|
||||||
m_gs.add_segment(ctr_min(curve), ctr_max(curve), c);
|
m_gs.add_segment(ctr_min(curve), ctr_max(curve), c);
|
||||||
else
|
else
|
||||||
m_gs.add_segment(ctr_min(curve), ctr_max(curve));
|
m_gs.add_segment(ctr_min(curve), ctr_max(curve));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! Draw a region in an exact manner.
|
/*! draws a region in an exact manner.
|
||||||
* This fallback simply draws the curve in an exact manner (and even this is not guaranteed).
|
* This fallback simply draws the curve in an exact manner (and even this is not guaranteed).
|
||||||
*/
|
*/
|
||||||
void draw_exact_region(Halfedge_const_handle curr) { draw_exact_curve(curr->curve(), false, CGAL::IO::Color()); }
|
void draw_exact_region(Halfedge_const_handle curr) { draw_exact_curve(curr->curve(), false, CGAL::IO::Color()); }
|
||||||
|
|
||||||
/// Add all faces.
|
//! Add all faces.
|
||||||
template <typename Traits>
|
template <typename Traits>
|
||||||
void add_faces(const Traits&) {
|
void add_faces(const Traits&) {
|
||||||
for(auto it = m_aos.unbounded_faces_begin(); it != m_aos.unbounded_faces_end(); ++it) add_face(it);
|
for (auto it = m_aos.unbounded_faces_begin(); it != m_aos.unbounded_faces_end(); ++it) add_face(it);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Compile time dispatching
|
//! Compile time dispatching
|
||||||
|
|
||||||
/*! Draw a point using approximate coordinates.
|
/*! draws a point using approximate coordinates.
|
||||||
*/
|
*/
|
||||||
template <typename Approximate>
|
template <typename Approximate>
|
||||||
void draw_approximate_point(const Point& p, const Approximate& approx, bool colored, const CGAL::IO::Color& color) {
|
void draw_approximate_point(const Point& p, const Approximate& approx, bool colored, const CGAL::IO::Color& color) {
|
||||||
if(colored)
|
if (colored)
|
||||||
m_gs.add_point(approx(p), color);
|
m_gs.add_point(approx(p), color);
|
||||||
else
|
else
|
||||||
m_gs.add_point(approx(p));
|
m_gs.add_point(approx(p));
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
//!
|
||||||
void draw_exact_point(const Point& p, bool colored, const CGAL::IO::Color& color) {
|
void draw_exact_point(const Point& p, bool colored, const CGAL::IO::Color& color) {
|
||||||
if(colored)
|
if (colored)
|
||||||
m_gs.add_point(p, color);
|
m_gs.add_point(p, color);
|
||||||
else
|
else
|
||||||
m_gs.add_point(p);
|
m_gs.add_point(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
//!
|
||||||
template <typename T, typename A, std::enable_if_t<!has_approximate_point_v<T, A>, int> = 0>
|
template <typename T, typename A, std::enable_if_t<!has_approximate_point_v<T, A>, int> = 0>
|
||||||
void draw_point_impl2(
|
void draw_point_impl2(
|
||||||
const T& /* traits */, const A& /* approximate */, const Point& p, bool colored, const CGAL::IO::Color& c) {
|
const T& /* traits */, const A& /* approximate */, const Point& p, bool colored, const CGAL::IO::Color& c) {
|
||||||
draw_exact_point(p, colored, c);
|
draw_exact_point(p, colored, c);
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
//!
|
||||||
template <typename T, typename A, std::enable_if_t<has_approximate_point_v<T, A>, int> = 0>
|
template <typename T, typename A, std::enable_if_t<has_approximate_point_v<T, A>, int> = 0>
|
||||||
auto
|
auto
|
||||||
draw_point_impl2(const T& /* traits */, const A& approx, const Point& p, bool colored, const CGAL::IO::Color& c) {
|
draw_point_impl2(const T& /* traits */, const A& approx, const Point& p, bool colored, const CGAL::IO::Color& c) {
|
||||||
draw_approximate_point(p, approx, colored, c);
|
draw_approximate_point(p, approx, colored, c);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! Draw a point, where the traits does not has approximate_2_object.
|
/*! draws a point, where the traits does not has approximate_2_object.
|
||||||
*/
|
*/
|
||||||
template <typename T, std::enable_if_t<!has_approximate_2_object_v<T> && !is_or_derived_from_agas_v<T>, int> = 0>
|
template <typename T, std::enable_if_t<!has_approximate_2_object_v<T> && !is_or_derived_from_agas_v<T>, int> = 0>
|
||||||
void draw_point_impl1(const T& /* traits */, const Point& p, bool colored, const CGAL::IO::Color& c) {
|
void draw_point_impl1(const T& /* traits */, const Point& p, bool colored, const CGAL::IO::Color& c) {
|
||||||
draw_exact_point(p, colored, c);
|
draw_exact_point(p, colored, c);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! Draw a point, where the traits does have approximate_2_object.
|
/*! draws a point, where the traits does have approximate_2_object.
|
||||||
*/
|
*/
|
||||||
template <typename T, std::enable_if_t<has_approximate_2_object_v<T> && !is_or_derived_from_agas_v<T>, int> = 0>
|
template <typename T, std::enable_if_t<has_approximate_2_object_v<T> && !is_or_derived_from_agas_v<T>, int> = 0>
|
||||||
auto draw_point_impl1(const T& traits, const Point& p, bool colored, const CGAL::IO::Color& c) {
|
auto draw_point_impl1(const T& traits, const Point& p, bool colored, const CGAL::IO::Color& c) {
|
||||||
draw_point_impl2(traits, traits.approximate_2_object(), p, colored, c);
|
draw_point_impl2(traits, traits.approximate_2_object(), p, colored, c);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! Draw a geodesic point.
|
/*! draws a geodesic point.
|
||||||
*/
|
*/
|
||||||
template <typename T, std::enable_if_t<is_or_derived_from_agas_v<T>, int> = 0>
|
template <typename T, std::enable_if_t<is_or_derived_from_agas_v<T>, int> = 0>
|
||||||
void draw_point_impl1(const T& traits, const Point& p, bool colored, const CGAL::IO::Color& color) {
|
void draw_point_impl1(const T& traits, const Point& p, bool colored, const CGAL::IO::Color& color) {
|
||||||
|
|
@ -271,13 +271,13 @@ public:
|
||||||
auto z = ap.dz();
|
auto z = ap.dz();
|
||||||
auto l = std::sqrt(x * x + y * y + z * z);
|
auto l = std::sqrt(x * x + y * y + z * z);
|
||||||
Approx_point_3 p3(x / l, y / l, z / l);
|
Approx_point_3 p3(x / l, y / l, z / l);
|
||||||
if(colored)
|
if (colored)
|
||||||
m_gs.add_point(p3, color);
|
m_gs.add_point(p3, color);
|
||||||
else
|
else
|
||||||
m_gs.add_point(p3);
|
m_gs.add_point(p3);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Draw a point.
|
//! draws a point.
|
||||||
void draw_point(const Point& p, bool colored, const CGAL::IO::Color& c) {
|
void draw_point(const Point& p, bool colored, const CGAL::IO::Color& c) {
|
||||||
const auto* traits = m_aos.geometry_traits();
|
const auto* traits = m_aos.geometry_traits();
|
||||||
draw_point_impl1(*traits, p, colored, c);
|
draw_point_impl1(*traits, p, colored, c);
|
||||||
|
|
@ -286,11 +286,10 @@ public:
|
||||||
///
|
///
|
||||||
template <typename Kernel, int AtanX, int AtanY>
|
template <typename Kernel, int AtanX, int AtanY>
|
||||||
Halfedge_const_handle find_smallest(Ccb_halfedge_const_circulator circ,
|
Halfedge_const_handle find_smallest(Ccb_halfedge_const_circulator circ,
|
||||||
Arr_geodesic_arc_on_sphere_traits_2<Kernel, AtanX, AtanY> const&) {
|
Arr_geodesic_arc_on_sphere_traits_2<Kernel, AtanX, AtanY> const&)
|
||||||
return circ;
|
{ return circ; }
|
||||||
}
|
|
||||||
|
|
||||||
/*! Find the halfedge incident to the lexicographically smallest vertex
|
/*! finds the halfedge incident to the lexicographically smallest vertex
|
||||||
* along the CCB, such that there is no other halfedge underneath.
|
* along the CCB, such that there is no other halfedge underneath.
|
||||||
*/
|
*/
|
||||||
template <typename Traits>
|
template <typename Traits>
|
||||||
|
|
@ -302,8 +301,7 @@ public:
|
||||||
|
|
||||||
// Find the first halfedge directed from left to right
|
// Find the first halfedge directed from left to right
|
||||||
auto curr = circ;
|
auto curr = circ;
|
||||||
do
|
do if (curr->direction() == CGAL::ARR_LEFT_TO_RIGHT) break;
|
||||||
if(curr->direction() == CGAL::ARR_LEFT_TO_RIGHT) break;
|
|
||||||
while(++curr != circ);
|
while(++curr != circ);
|
||||||
Halfedge_const_handle ext = curr;
|
Halfedge_const_handle ext = curr;
|
||||||
|
|
||||||
|
|
@ -311,43 +309,43 @@ public:
|
||||||
// such that there is no other halfedge underneath.
|
// such that there is no other halfedge underneath.
|
||||||
do {
|
do {
|
||||||
// Discard edges not directed from left to right:
|
// Discard edges not directed from left to right:
|
||||||
if(curr->direction() != CGAL::ARR_LEFT_TO_RIGHT) continue;
|
if (curr->direction() != CGAL::ARR_LEFT_TO_RIGHT) continue;
|
||||||
|
|
||||||
auto res = cmp_xy(curr->source()->point(), ext->source()->point());
|
auto res = cmp_xy(curr->source()->point(), ext->source()->point());
|
||||||
|
|
||||||
// Discard the edges inciden to a point strictly larger than the point
|
// Discard the edges inciden to a point strictly larger than the point
|
||||||
// incident to the stored extreme halfedge:
|
// incident to the stored extreme halfedge:
|
||||||
if(res == LARGER) continue;
|
if (res == LARGER) continue;
|
||||||
|
|
||||||
// Store the edge inciden to a point strictly smaller:
|
// Store the edge inciden to a point strictly smaller:
|
||||||
if(res == SMALLER) {
|
if (res == SMALLER) {
|
||||||
ext = curr;
|
ext = curr;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// The incident points are equal; compare the halfedges themselves:
|
// The incident points are equal; compare the halfedges themselves:
|
||||||
if(cmp_y(curr->curve(), ext->curve(), curr->source()->point()) == SMALLER) ext = curr;
|
if (cmp_y(curr->curve(), ext->curve(), curr->source()->point()) == SMALLER) ext = curr;
|
||||||
} while(++curr != circ);
|
} while(++curr != circ);
|
||||||
|
|
||||||
return ext;
|
return ext;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Add all elements to be drawn.
|
//! adds all elements to be drawn.
|
||||||
void add_elements() {
|
void add_elements() {
|
||||||
// std::cout << "add_elements()\n";
|
// std::cout << "add_elements()\n";
|
||||||
// std::cout << "ratio: " << this->pixel_ratio() << std::endl;
|
// std::cout << "ratio: " << this->pixel_ratio() << std::endl;
|
||||||
m_visited.clear();
|
m_visited.clear();
|
||||||
|
|
||||||
if(m_aos.is_empty()) return;
|
if (m_aos.is_empty()) return;
|
||||||
|
|
||||||
if(m_gso.are_faces_enabled()) add_faces(*(this->m_aos.geometry_traits()));
|
if (m_gso.are_faces_enabled()) add_faces(*(this->m_aos.geometry_traits()));
|
||||||
|
|
||||||
// Add edges that do not separate faces.
|
// Add edges that do not separate faces.
|
||||||
if(m_gso.are_edges_enabled()) {
|
if (m_gso.are_edges_enabled()) {
|
||||||
for(auto it = m_aos.edges_begin(); it != m_aos.edges_end(); ++it) {
|
for (auto it = m_aos.edges_begin(); it != m_aos.edges_end(); ++it) {
|
||||||
if(it->face() != it->twin()->face()) {
|
if (it->face() != it->twin()->face()) {
|
||||||
if(m_gso.draw_edge(m_aos, it)) {
|
if (m_gso.draw_edge(m_aos, it)) {
|
||||||
if(m_gso.colored_edge(m_aos, it))
|
if (m_gso.colored_edge(m_aos, it))
|
||||||
draw_curve(it->curve(), true, m_gso.edge_color(m_aos, it));
|
draw_curve(it->curve(), true, m_gso.edge_color(m_aos, it));
|
||||||
else
|
else
|
||||||
draw_curve(it->curve(), false, CGAL::IO::Color());
|
draw_curve(it->curve(), false, CGAL::IO::Color());
|
||||||
|
|
@ -357,9 +355,9 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add all points
|
// Add all points
|
||||||
if(m_gso.are_vertices_enabled()) {
|
if (m_gso.are_vertices_enabled()) {
|
||||||
for(auto it = m_aos.vertices_begin(); it != m_aos.vertices_end(); ++it) {
|
for (auto it = m_aos.vertices_begin(); it != m_aos.vertices_end(); ++it) {
|
||||||
if(m_gso.colored_vertex(m_aos, it))
|
if (m_gso.colored_vertex(m_aos, it))
|
||||||
draw_point(it->point(), true, m_gso.vertex_color(m_aos, it));
|
draw_point(it->point(), true, m_gso.vertex_color(m_aos, it));
|
||||||
else
|
else
|
||||||
draw_point(it->point(), false, CGAL::IO::Color());
|
draw_point(it->point(), false, CGAL::IO::Color());
|
||||||
|
|
@ -369,7 +367,7 @@ public:
|
||||||
m_visited.clear();
|
m_visited.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! Draw a curve using approximate coordinates.
|
/*! draws a curve using approximate coordinates.
|
||||||
* Call this member function only of the geometry traits is equipped with
|
* Call this member function only of the geometry traits is equipped with
|
||||||
* the coordinate-aproximation functionality of a curve.
|
* the coordinate-aproximation functionality of a curve.
|
||||||
* This function must be inlined (e.g., a template) to enable the
|
* This function must be inlined (e.g., a template) to enable the
|
||||||
|
|
@ -384,11 +382,11 @@ public:
|
||||||
std::vector<typename Gt::Approximate_point_2> polyline;
|
std::vector<typename Gt::Approximate_point_2> polyline;
|
||||||
double error(0.01); // TODO? (this->pixel_ratio());
|
double error(0.01); // TODO? (this->pixel_ratio());
|
||||||
approx(curve, error, std::back_inserter(polyline));
|
approx(curve, error, std::back_inserter(polyline));
|
||||||
if(polyline.empty()) return;
|
if (polyline.empty()) return;
|
||||||
auto it = polyline.begin();
|
auto it = polyline.begin();
|
||||||
auto prev = it++;
|
auto prev = it++;
|
||||||
for(; it != polyline.end(); prev = it++) {
|
for (; it != polyline.end(); prev = it++) {
|
||||||
if(colored)
|
if (colored)
|
||||||
m_gs.add_segment(*prev, *it, c);
|
m_gs.add_segment(*prev, *it, c);
|
||||||
else
|
else
|
||||||
m_gs.add_segment(*prev, *it);
|
m_gs.add_segment(*prev, *it);
|
||||||
|
|
@ -412,14 +410,14 @@ public:
|
||||||
draw_approximate_curve(xcv, approx, colored, c);
|
draw_approximate_curve(xcv, approx, colored, c);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! Draw a curve, where the traits does not has approximate_2_object.
|
/*! draws a curve, where the traits does not has approximate_2_object.
|
||||||
*/
|
*/
|
||||||
template <typename T, std::enable_if_t<!has_approximate_2_object_v<T> && !is_or_derived_from_agas_v<T>, int> = 0>
|
template <typename T, std::enable_if_t<!has_approximate_2_object_v<T> && !is_or_derived_from_agas_v<T>, int> = 0>
|
||||||
void draw_curve_impl1(const T& /* traits */, const X_monotone_curve& xcv, bool colored, const CGAL::IO::Color& c) {
|
void draw_curve_impl1(const T& /* traits */, const X_monotone_curve& xcv, bool colored, const CGAL::IO::Color& c) {
|
||||||
draw_exact_curve(xcv, colored, c);
|
draw_exact_curve(xcv, colored, c);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! Draw a curve, where the traits does have approximate_2_object.
|
/*! draws a curve, where the traits does have approximate_2_object.
|
||||||
*/
|
*/
|
||||||
template <typename T, std::enable_if_t<has_approximate_2_object_v<T> && !is_or_derived_from_agas_v<T>, int> = 0>
|
template <typename T, std::enable_if_t<has_approximate_2_object_v<T> && !is_or_derived_from_agas_v<T>, int> = 0>
|
||||||
auto draw_curve_impl1(const T& traits, const X_monotone_curve& xcv, bool colored, const CGAL::IO::Color& c) {
|
auto draw_curve_impl1(const T& traits, const X_monotone_curve& xcv, bool colored, const CGAL::IO::Color& c) {
|
||||||
|
|
@ -427,7 +425,7 @@ public:
|
||||||
draw_curve_impl2(traits, traits.approximate_2_object(), xcv, colored, c);
|
draw_curve_impl2(traits, traits.approximate_2_object(), xcv, colored, c);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! Draw a geodesic curve
|
/*! draws a geodesic curve
|
||||||
*/
|
*/
|
||||||
template <typename T, std::enable_if_t<is_or_derived_from_agas_v<T>, int> = 0>
|
template <typename T, std::enable_if_t<is_or_derived_from_agas_v<T>, int> = 0>
|
||||||
void draw_curve_impl1(const T& traits, const X_monotone_curve& xcv, bool colored, const CGAL::IO::Color& c) {
|
void draw_curve_impl1(const T& traits, const X_monotone_curve& xcv, bool colored, const CGAL::IO::Color& c) {
|
||||||
|
|
@ -448,13 +446,13 @@ public:
|
||||||
auto z = it->dz();
|
auto z = it->dz();
|
||||||
auto l = std::sqrt(x * x + y * y + z * z);
|
auto l = std::sqrt(x * x + y * y + z * z);
|
||||||
Approx_point_3 prev(x / l, y / l, z / l);
|
Approx_point_3 prev(x / l, y / l, z / l);
|
||||||
for(++it; it != apoints.end(); ++it) {
|
for (++it; it != apoints.end(); ++it) {
|
||||||
auto x = it->dx();
|
auto x = it->dx();
|
||||||
auto y = it->dy();
|
auto y = it->dy();
|
||||||
auto z = it->dz();
|
auto z = it->dz();
|
||||||
auto l = std::sqrt(x * x + y * y + z * z);
|
auto l = std::sqrt(x * x + y * y + z * z);
|
||||||
Approx_point_3 next(x / l, y / l, z / l);
|
Approx_point_3 next(x / l, y / l, z / l);
|
||||||
if(colored)
|
if (colored)
|
||||||
m_gs.add_segment(prev, next, c);
|
m_gs.add_segment(prev, next, c);
|
||||||
else
|
else
|
||||||
m_gs.add_segment(prev, next);
|
m_gs.add_segment(prev, next);
|
||||||
|
|
@ -462,7 +460,7 @@ public:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Draw a curve.
|
//! draws a curve.
|
||||||
template <typename XMonotoneCurve>
|
template <typename XMonotoneCurve>
|
||||||
void draw_curve(const XMonotoneCurve& curve, bool colored, const CGAL::IO::Color& c) {
|
void draw_curve(const XMonotoneCurve& curve, bool colored, const CGAL::IO::Color& c) {
|
||||||
/* Check whether the traits has a member function called
|
/* Check whether the traits has a member function called
|
||||||
|
|
@ -511,8 +509,7 @@ static auto map_from_pair_ranges(Range1 range1, Range2 range2) {
|
||||||
boost::make_transform_iterator(end, tuple_to_pair));
|
boost::make_transform_iterator(end, tuple_to_pair));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*! \brief tracking changes between an arrangement and its copy that will be later inserted to.
|
||||||
* \brief tracking changes between an arrangement and its copy that will be later inserted to.
|
|
||||||
*
|
*
|
||||||
* \note tracks insertions only. If any other actions made(e.g. deletions, merging, etc), the state of the tracker
|
* \note tracks insertions only. If any other actions made(e.g. deletions, merging, etc), the state of the tracker
|
||||||
* instance may become invalid.
|
* instance may become invalid.
|
||||||
|
|
@ -520,8 +517,7 @@ static auto map_from_pair_ranges(Range1 range1, Range2 range2) {
|
||||||
* \tparam Arrangement
|
* \tparam Arrangement
|
||||||
*/
|
*/
|
||||||
template <typename Arrangement>
|
template <typename Arrangement>
|
||||||
class Arr_insertion_tracker : Arr_observer<Arrangement>
|
class Arr_insertion_tracker : Arr_observer<Arrangement> {
|
||||||
{
|
|
||||||
using Base = Arr_observer<Arrangement>;
|
using Base = Arr_observer<Arrangement>;
|
||||||
using Halfedge_handle = typename Arrangement::Halfedge_handle;
|
using Halfedge_handle = typename Arrangement::Halfedge_handle;
|
||||||
using Halfedge_const_handle = typename Arrangement::Halfedge_const_handle;
|
using Halfedge_const_handle = typename Arrangement::Halfedge_const_handle;
|
||||||
|
|
@ -539,17 +535,16 @@ protected:
|
||||||
m_halfedge_map[e->twin()] = Halfedge_const_handle(); // twin is created as well
|
m_halfedge_map[e->twin()] = Halfedge_const_handle(); // twin is created as well
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void before_split_edge(Halfedge_handle e,
|
virtual void before_split_edge(Halfedge_handle e, Vertex_handle v,
|
||||||
Vertex_handle v,
|
|
||||||
const X_monotone_curve_2& c1,
|
const X_monotone_curve_2& c1,
|
||||||
const X_monotone_curve_2& c2) override {
|
const X_monotone_curve_2& c2) override {
|
||||||
if(m_vertex_map.find(v) == m_vertex_map.end()) m_vertex_map[v] = Vertex_const_handle(); // v is newly created
|
if (m_vertex_map.find(v) == m_vertex_map.end()) m_vertex_map[v] = Vertex_const_handle(); // v is newly created
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void after_split_edge(Halfedge_handle e1, Halfedge_handle e2) override {
|
virtual void after_split_edge(Halfedge_handle e1, Halfedge_handle e2) override {
|
||||||
if(auto it = m_halfedge_map.find(e1); it == m_halfedge_map.end())
|
if (auto it = m_halfedge_map.find(e1); it == m_halfedge_map.end())
|
||||||
m_halfedge_map[e2] = e1;
|
m_halfedge_map[e2] = e1;
|
||||||
else if(it->second == Halfedge_const_handle())
|
else if (it->second == Halfedge_const_handle())
|
||||||
m_halfedge_map[e2] = Halfedge_const_handle(); // e1 has no corresponding edge in the original arrangement
|
m_halfedge_map[e2] = Halfedge_const_handle(); // e1 has no corresponding edge in the original arrangement
|
||||||
else
|
else
|
||||||
m_halfedge_map[e2] = it->second; // e1 is created by splitting an existing edge
|
m_halfedge_map[e2] = it->second; // e1 is created by splitting an existing edge
|
||||||
|
|
@ -557,51 +552,47 @@ protected:
|
||||||
|
|
||||||
virtual void after_split_face(Face_handle f1, Face_handle f2, bool) override {
|
virtual void after_split_face(Face_handle f1, Face_handle f2, bool) override {
|
||||||
// Face cannot be created but by splitting an existing face.
|
// Face cannot be created but by splitting an existing face.
|
||||||
if(auto it = m_face_map.find(f1); it == m_face_map.end())
|
if (auto it = m_face_map.find(f1); it == m_face_map.end())
|
||||||
m_face_map[f2] = f1;
|
m_face_map[f2] = f1;
|
||||||
else
|
else
|
||||||
m_face_map[f2] = it->second; // f1 is created by splitting an existing face
|
m_face_map[f2] = it->second; // f1 is created by splitting an existing face
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Arr_insertion_tracker(Arrangement& arr)
|
Arr_insertion_tracker(Arrangement& arr) : Base(arr) {}
|
||||||
: Base(arr) {}
|
|
||||||
|
|
||||||
/*!
|
/*! \brief Query the original face of a given face.
|
||||||
* \brief Query the original face of a given face.
|
|
||||||
*
|
*
|
||||||
* \param fh a valid face handle in the modified arrangement.
|
* \param fh a valid face handle in the modified arrangement.
|
||||||
* \return Face_const_handle
|
* \return Face_const_handle
|
||||||
*/
|
*/
|
||||||
Face_const_handle original_face(Face_const_handle fh) const {
|
Face_const_handle original_face(Face_const_handle fh) const {
|
||||||
auto it = m_face_map.find(fh);
|
auto it = m_face_map.find(fh);
|
||||||
if(it == m_face_map.end()) return fh;
|
if (it == m_face_map.end()) return fh;
|
||||||
return it->second; // new face from splitting an existing face
|
return it->second; // new face from splitting an existing face
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*! \brief Query the original halfedge of a given halfedge.
|
||||||
* \brief Query the original halfedge of a given halfedge.
|
|
||||||
*
|
*
|
||||||
* \param heh a valid halfedge handle in the modified arrangement.
|
* \param heh a valid halfedge handle in the modified arrangement.
|
||||||
* \return Halfedge_const_handle
|
* \return Halfedge_const_handle
|
||||||
*/
|
*/
|
||||||
Halfedge_const_handle original_halfedge(Halfedge_const_handle he) const {
|
Halfedge_const_handle original_halfedge(Halfedge_const_handle he) const {
|
||||||
auto it = m_halfedge_map.find(he);
|
auto it = m_halfedge_map.find(he);
|
||||||
if(it == m_halfedge_map.end()) return he;
|
if (it == m_halfedge_map.end()) return he;
|
||||||
if(it->second == Halfedge_const_handle()) return Halfedge_const_handle(); // newly created halfedge
|
if (it->second == Halfedge_const_handle()) return Halfedge_const_handle(); // newly created halfedge
|
||||||
return it->second;
|
return it->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*! \brief Query the original vertex of a given vertex.
|
||||||
* \brief Query the original vertex of a given vertex.
|
|
||||||
*
|
*
|
||||||
* \param vh a valid vertex handle in the modified arrangement.
|
* \param vh a valid vertex handle in the modified arrangement.
|
||||||
* \return Vertex_const_handle
|
* \return Vertex_const_handle
|
||||||
*/
|
*/
|
||||||
Vertex_const_handle original_vertex(Vertex_const_handle vh) const {
|
Vertex_const_handle original_vertex(Vertex_const_handle vh) const {
|
||||||
auto it = m_vertex_map.find(vh);
|
auto it = m_vertex_map.find(vh);
|
||||||
if(it == m_vertex_map.end()) return vh;
|
if (it == m_vertex_map.end()) return vh;
|
||||||
if(it->second == Vertex_const_handle()) return Vertex_const_handle(); // newly created vertex
|
if (it->second == Vertex_const_handle()) return Vertex_const_handle(); // newly created vertex
|
||||||
return it->second; // it will never reach here.
|
return it->second; // it will never reach here.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -634,13 +625,12 @@ void draw_impl_planar(
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Arrangement, typename GSOptions>
|
template <typename Arrangement, typename GSOptions>
|
||||||
void draw_impl_agas(
|
void draw_impl_agas(const Arrangement& arr, const GSOptions& gso,
|
||||||
const Arrangement& arr, const GSOptions& gso, const char* title, Bbox_2 initial_bbox, QApplication& app) {
|
const char* title, Bbox_2 initial_bbox, QApplication& app) {
|
||||||
using Halfedge_const_handle = typename Arrangement::Halfedge_const_handle;
|
using Halfedge_const_handle = typename Arrangement::Halfedge_const_handle;
|
||||||
using Face_const_handle = typename Arrangement::Face_const_handle;
|
using Face_const_handle = typename Arrangement::Face_const_handle;
|
||||||
using Vertex_const_handle = typename Arrangement::Vertex_const_handle;
|
using Vertex_const_handle = typename Arrangement::Vertex_const_handle;
|
||||||
using Geom_traits = typename Arrangement::Geometry_traits_2;
|
using Geom_traits = typename Arrangement::Geometry_traits_2;
|
||||||
using X_monotone_curve_2 = typename Geom_traits::X_monotone_curve_2;
|
|
||||||
using Direction_3 = typename Geom_traits::Direction_3;
|
using Direction_3 = typename Geom_traits::Direction_3;
|
||||||
using Point_2 = typename Geom_traits::Point_2;
|
using Point_2 = typename Geom_traits::Point_2;
|
||||||
using Agas_template_args = tmpl_args<Geom_traits>;
|
using Agas_template_args = tmpl_args<Geom_traits>;
|
||||||
|
|
@ -650,63 +640,63 @@ void draw_impl_agas(
|
||||||
arr.vertex_handles());
|
arr.vertex_handles());
|
||||||
auto halfedge_map = map_from_pair_ranges<Halfedge_const_handle, Halfedge_const_handle>(derived_arr.halfedge_handles(),
|
auto halfedge_map = map_from_pair_ranges<Halfedge_const_handle, Halfedge_const_handle>(derived_arr.halfedge_handles(),
|
||||||
arr.halfedge_handles());
|
arr.halfedge_handles());
|
||||||
auto face_map =
|
auto face_map = map_from_pair_ranges<Face_const_handle, Face_const_handle>(derived_arr.face_handles(),
|
||||||
map_from_pair_ranges<Face_const_handle, Face_const_handle>(derived_arr.face_handles(), arr.face_handles());
|
arr.face_handles());
|
||||||
// setup tracker and insert the identification curve.
|
// setup tracker and insert the identification curve.
|
||||||
Arr_insertion_tracker<Arrangement> tracker(derived_arr);
|
Arr_insertion_tracker<Arrangement> tracker(derived_arr);
|
||||||
X_monotone_curve_2 id_curve = arr.geometry_traits()->construct_x_monotone_curve_2_object()(
|
Point_2 src(Direction_3(0, 0, -1), Point_2::MIN_BOUNDARY_LOC);
|
||||||
Point_2(Direction_3(0, 0, -1), Point_2::MIN_BOUNDARY_LOC),
|
Point_2 trg(Direction_3(0, 0, 1), Point_2::MAX_BOUNDARY_LOC);
|
||||||
Point_2(Direction_3(0, 0, 1), Point_2::MAX_BOUNDARY_LOC),
|
auto ctr_xcv = arr.geometry_traits()->construct_x_monotone_curve_2_object();
|
||||||
Direction_3(Agas_template_args::atan_y, -Agas_template_args::atan_x, 0));
|
auto id_curve = ctr_xcv(src, trg, Direction_3(Agas_template_args::atan_y, -Agas_template_args::atan_x, 0));
|
||||||
insert(derived_arr, id_curve);
|
insert(derived_arr, id_curve);
|
||||||
|
|
||||||
// derived_gso proxies the call to the original gso
|
// derived_gso proxies the call to the original gso
|
||||||
GSOptions derived_gso(gso);
|
GSOptions derived_gso(gso);
|
||||||
derived_gso.draw_vertex = [&](const Arrangement&, const Vertex_const_handle& vh) {
|
derived_gso.draw_vertex = [&](const Arrangement&, const Vertex_const_handle& vh) {
|
||||||
Vertex_const_handle original_vh = tracker.original_vertex(vh);
|
Vertex_const_handle original_vh = tracker.original_vertex(vh);
|
||||||
if(original_vh == Vertex_const_handle() || vertex_map.find(original_vh) == vertex_map.end()) return false;
|
if (original_vh == Vertex_const_handle() || vertex_map.find(original_vh) == vertex_map.end()) return false;
|
||||||
return gso.draw_vertex(arr, vertex_map.at(original_vh));
|
return gso.draw_vertex(arr, vertex_map.at(original_vh));
|
||||||
};
|
};
|
||||||
derived_gso.colored_vertex = [&](const Arrangement&, const Vertex_const_handle& vh) {
|
derived_gso.colored_vertex = [&](const Arrangement&, const Vertex_const_handle& vh) {
|
||||||
Vertex_const_handle original_vh = tracker.original_vertex(vh);
|
Vertex_const_handle original_vh = tracker.original_vertex(vh);
|
||||||
if(original_vh == Vertex_const_handle() || vertex_map.find(original_vh) == vertex_map.end()) return false;
|
if (original_vh == Vertex_const_handle() || vertex_map.find(original_vh) == vertex_map.end()) return false;
|
||||||
return gso.colored_vertex(arr, vertex_map.at(original_vh));
|
return gso.colored_vertex(arr, vertex_map.at(original_vh));
|
||||||
};
|
};
|
||||||
derived_gso.vertex_color = [&](const Arrangement&, const Vertex_const_handle& vh) -> CGAL::IO::Color {
|
derived_gso.vertex_color = [&](const Arrangement&, const Vertex_const_handle& vh) -> CGAL::IO::Color {
|
||||||
Vertex_const_handle original_vh = tracker.original_vertex(vh);
|
Vertex_const_handle original_vh = tracker.original_vertex(vh);
|
||||||
if(original_vh == Vertex_const_handle() || vertex_map.find(original_vh) == vertex_map.end())
|
if (original_vh == Vertex_const_handle() || vertex_map.find(original_vh) == vertex_map.end())
|
||||||
return CGAL::IO::Color();
|
return CGAL::IO::Color();
|
||||||
return gso.vertex_color(arr, vertex_map.at(original_vh));
|
return gso.vertex_color(arr, vertex_map.at(original_vh));
|
||||||
};
|
};
|
||||||
derived_gso.draw_edge = [&](const Arrangement&, const Halfedge_const_handle& he) {
|
derived_gso.draw_edge = [&](const Arrangement&, const Halfedge_const_handle& he) {
|
||||||
Halfedge_const_handle original_he = tracker.original_halfedge(he);
|
Halfedge_const_handle original_he = tracker.original_halfedge(he);
|
||||||
if(original_he == Halfedge_const_handle() || halfedge_map.find(original_he) == halfedge_map.end()) return false;
|
if (original_he == Halfedge_const_handle() || halfedge_map.find(original_he) == halfedge_map.end()) return false;
|
||||||
return gso.draw_edge(arr, halfedge_map.at(original_he));
|
return gso.draw_edge(arr, halfedge_map.at(original_he));
|
||||||
};
|
};
|
||||||
derived_gso.colored_edge = [&](const Arrangement&, const Halfedge_const_handle& he) {
|
derived_gso.colored_edge = [&](const Arrangement&, const Halfedge_const_handle& he) {
|
||||||
Halfedge_const_handle original_he = tracker.original_halfedge(he);
|
Halfedge_const_handle original_he = tracker.original_halfedge(he);
|
||||||
if(original_he == Halfedge_const_handle() || halfedge_map.find(original_he) == halfedge_map.end()) return false;
|
if (original_he == Halfedge_const_handle() || halfedge_map.find(original_he) == halfedge_map.end()) return false;
|
||||||
return gso.colored_edge(arr, halfedge_map.at(original_he));
|
return gso.colored_edge(arr, halfedge_map.at(original_he));
|
||||||
};
|
};
|
||||||
derived_gso.edge_color = [&](const Arrangement&, const Halfedge_const_handle& he) -> CGAL::IO::Color {
|
derived_gso.edge_color = [&](const Arrangement&, const Halfedge_const_handle& he) -> CGAL::IO::Color {
|
||||||
Halfedge_const_handle original_he = tracker.original_halfedge(he);
|
Halfedge_const_handle original_he = tracker.original_halfedge(he);
|
||||||
if(original_he == Halfedge_const_handle() || halfedge_map.find(original_he) == halfedge_map.end())
|
if (original_he == Halfedge_const_handle() || halfedge_map.find(original_he) == halfedge_map.end())
|
||||||
return CGAL::IO::Color();
|
return CGAL::IO::Color();
|
||||||
return gso.edge_color(arr, halfedge_map.at(original_he));
|
return gso.edge_color(arr, halfedge_map.at(original_he));
|
||||||
};
|
};
|
||||||
derived_gso.draw_face = [&](const Arrangement&, const Face_const_handle& fh) {
|
derived_gso.draw_face = [&](const Arrangement&, const Face_const_handle& fh) {
|
||||||
Face_const_handle original_fh = tracker.original_face(fh);
|
Face_const_handle original_fh = tracker.original_face(fh);
|
||||||
if(face_map.find(original_fh) == face_map.end()) return false;
|
if (face_map.find(original_fh) == face_map.end()) return false;
|
||||||
return gso.draw_face(arr, face_map.at(original_fh));
|
return gso.draw_face(arr, face_map.at(original_fh));
|
||||||
};
|
};
|
||||||
derived_gso.colored_face = [&](const Arrangement&, const Face_const_handle& fh) {
|
derived_gso.colored_face = [&](const Arrangement&, const Face_const_handle& fh) {
|
||||||
Face_const_handle original_fh = tracker.original_face(fh);
|
Face_const_handle original_fh = tracker.original_face(fh);
|
||||||
if(face_map.find(original_fh) == face_map.end()) return false;
|
if (face_map.find(original_fh) == face_map.end()) return false;
|
||||||
return gso.draw_face(arr, face_map.at(original_fh));
|
return gso.draw_face(arr, face_map.at(original_fh));
|
||||||
};
|
};
|
||||||
derived_gso.face_color = [&](const Arrangement&, const Face_const_handle& fh) -> CGAL::IO::Color {
|
derived_gso.face_color = [&](const Arrangement&, const Face_const_handle& fh) -> CGAL::IO::Color {
|
||||||
Face_const_handle original_fh = tracker.original_face(fh);
|
Face_const_handle original_fh = tracker.original_face(fh);
|
||||||
if(face_map.find(original_fh) == face_map.end()) return CGAL::IO::Color();
|
if (face_map.find(original_fh) == face_map.end()) return CGAL::IO::Color();
|
||||||
return gso.face_color(arr, face_map.at(original_fh));
|
return gso.face_color(arr, face_map.at(original_fh));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -731,8 +721,7 @@ void draw(const Arrangement& arr, const GSOptions& gso, Args&&... args) {
|
||||||
|
|
||||||
} // namespace draw_aos
|
} // namespace draw_aos
|
||||||
|
|
||||||
/*!
|
/*! \brief draws an arrangement on surface.
|
||||||
* \brief Draw an arrangement on surface.
|
|
||||||
*
|
*
|
||||||
* \tparam Arrangement
|
* \tparam Arrangement
|
||||||
* \tparam GSOptions
|
* \tparam GSOptions
|
||||||
|
|
@ -762,8 +751,7 @@ void draw(const Arrangement& arr,
|
||||||
draw_aos::draw(arr, gso, title, initial_bbox, app);
|
draw_aos::draw(arr, gso, title, initial_bbox, app);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*! \brief draws an arrangement on surface with default graphics scene options. Faces are colored randomly.
|
||||||
* \brief Draw an arrangement on surface with default graphics scene options. Faces are colored randomly.
|
|
||||||
*
|
*
|
||||||
* \tparam Arrangement
|
* \tparam Arrangement
|
||||||
* \param arr the arrangement to be drawn
|
* \param arr the arrangement to be drawn
|
||||||
|
|
@ -820,7 +808,7 @@ template <typename GeometryTraits_2, typename TopologyTraits>
|
||||||
void add_to_graphics_scene(const CGAL_ARR_TYPE& aos, CGAL::Graphics_scene& graphics_scene) {
|
void add_to_graphics_scene(const CGAL_ARR_TYPE& aos, CGAL::Graphics_scene& graphics_scene) {
|
||||||
CGAL::Graphics_scene_options<CGAL_ARR_TYPE, typename CGAL_ARR_TYPE::Vertex_const_handle,
|
CGAL::Graphics_scene_options<CGAL_ARR_TYPE, typename CGAL_ARR_TYPE::Vertex_const_handle,
|
||||||
typename CGAL_ARR_TYPE::Halfedge_const_handle, typename CGAL_ARR_TYPE::Face_const_handle>
|
typename CGAL_ARR_TYPE::Halfedge_const_handle, typename CGAL_ARR_TYPE::Face_const_handle>
|
||||||
gso;
|
gso;
|
||||||
// colored face?
|
// colored face?
|
||||||
gso.colored_face = [](const CGAL_ARR_TYPE&, typename CGAL_ARR_TYPE::Face_const_handle) -> bool { return true; };
|
gso.colored_face = [](const CGAL_ARR_TYPE&, typename CGAL_ARR_TYPE::Face_const_handle) -> bool { return true; };
|
||||||
|
|
||||||
|
|
@ -833,7 +821,7 @@ void add_to_graphics_scene(const CGAL_ARR_TYPE& aos, CGAL::Graphics_scene& graph
|
||||||
add_to_graphics_scene(aos, graphics_scene, gso);
|
add_to_graphics_scene(aos, graphics_scene, gso);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Draw an arrangement on surface.
|
//! draws an arrangement on surface.
|
||||||
template <typename GeometryTraits_2, typename TopologyTraits, class GSOptions>
|
template <typename GeometryTraits_2, typename TopologyTraits, class GSOptions>
|
||||||
void draw_old(const CGAL_ARR_TYPE& aos,
|
void draw_old(const CGAL_ARR_TYPE& aos,
|
||||||
const GSOptions& gso,
|
const GSOptions& gso,
|
||||||
|
|
@ -843,7 +831,7 @@ void draw_old(const CGAL_ARR_TYPE& aos,
|
||||||
draw_graphics_scene(graphics_scene, title);
|
draw_graphics_scene(graphics_scene, title);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Draw an arrangement on surface.
|
//! draws an arrangement on surface.
|
||||||
template <typename GeometryTraits_2, typename TopologyTraits>
|
template <typename GeometryTraits_2, typename TopologyTraits>
|
||||||
void draw_old(const CGAL_ARR_TYPE& aos, const char* title = "2D Arrangement on Surface Basic Viewer") {
|
void draw_old(const CGAL_ARR_TYPE& aos, const char* title = "2D Arrangement on Surface Basic Viewer") {
|
||||||
CGAL::Graphics_scene graphics_scene;
|
CGAL::Graphics_scene graphics_scene;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue