mirror of https://github.com/CGAL/cgal
add the examples colored_face which correpond to one example of the manual
local cgal_test has not been changed yet suppressed a cin < in examples
This commit is contained in:
parent
89b875bc53
commit
3517c2e22c
|
|
@ -0,0 +1,48 @@
|
|||
#include <CGAL/basic.h>
|
||||
#include <CGAL/Cartesian.h>
|
||||
#include <CGAL/IO/Color.h>
|
||||
#include <CGAL/Triangulation_euclidean_traits_2.h>
|
||||
#include <CGAL/Triangulation_default_data_structure_2.h>
|
||||
#include <CGAL/Triangulation_2.h>
|
||||
|
||||
using namespace CGAL;
|
||||
using namespace std;
|
||||
|
||||
/* A facet with a color member variable. */
|
||||
template < class Gt >
|
||||
class My_face_base : public Triangulation_face_base_2<Gt>
|
||||
{
|
||||
public:
|
||||
Color color;
|
||||
My_face_base() :
|
||||
Triangulation_face_base_2<Gt>() {}
|
||||
My_face_base(void* v0, void* v1, void* v2) :
|
||||
Triangulation_face_base_2<Gt>(v0,v1,v2) {}
|
||||
My_face_base(void* v0, void* v1, void* v2, void* n0, void* n1, void* n2) :
|
||||
Triangulation_face_base_2<Gt>(v0,v1,v2,n0,n1,n2) {}
|
||||
};
|
||||
|
||||
typedef Cartesian<double> Rp;
|
||||
typedef Triangulation_euclidean_traits_2<Rp> Gt;
|
||||
typedef Triangulation_vertex_base_2<Gt> Vb;
|
||||
typedef My_face_base<Gt> Fb;
|
||||
typedef Triangulation_default_data_structure_2<Gt,Vb,Fb > Tds;
|
||||
typedef Triangulation_2<Gt,Tds> Triangulation;
|
||||
typedef Triangulation::Face_handle Face_handle;
|
||||
typedef Triangulation::Face_iterator Face_iterator;
|
||||
typedef Triangulation::Vertex_handle Vertex_handle;
|
||||
typedef Point_2<Rp> Point;
|
||||
|
||||
int main() {
|
||||
Triangulation t;
|
||||
Point p;
|
||||
|
||||
while (cin >> p){
|
||||
t.insert(p);
|
||||
}
|
||||
Face_iterator fc = t.faces_begin();
|
||||
while (fc != t.faces_end()) {
|
||||
fc->color = BLUE;
|
||||
++fc;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
0 1
|
||||
1 0
|
||||
0 0
|
||||
0.5 0.5
|
||||
|
|
@ -160,7 +160,6 @@ void faces_along_line(Triangulation &T)
|
|||
{
|
||||
Point p(0.2, 0.6), q(0.7, 0.4);
|
||||
|
||||
cin >> p >> q;
|
||||
Face_handle f = T.locate(p);
|
||||
Line_face_circulator lfc = T.line_walk(p, q, f),
|
||||
done(lfc);
|
||||
|
|
|
|||
Loading…
Reference in New Issue