mirror of https://github.com/CGAL/cgal
Move some dormant packages out of the way of Progress
This commit is contained in:
parent
e1037b0d61
commit
259fb286a1
|
|
@ -2276,8 +2276,6 @@ Tutorial/tutorial/Polyhedron/sgp2004/paper/figs/stock.ppt -text svneol=unset#uns
|
|||
Tutorial/tutorial/Polyhedron/sgp2004/paper/figs/subdivision.eps -text
|
||||
Tutorial/tutorial/Polyhedron/sgp2004/paper/figs/teaser.eps -text
|
||||
Tutorial/tutorial/Polyhedron/sgp2004/paper/figs/trimming.eps -text
|
||||
Viewer_3/doc_tex/Viewer_3/viewer.eps -text
|
||||
Viewer_3/doc_tex/Viewer_3/viewer.gif -text svneol=unset#unset
|
||||
Visibility_complex/demo/Visibility_complex/pixmaps/cw_flip.xpm -text
|
||||
Visibility_complex/demo/Visibility_complex/pixmaps/cw_flip_parallele.xpm -text
|
||||
Visibility_complex/demo/Visibility_complex/pixmaps/flip.xpm -text
|
||||
|
|
|
|||
|
|
@ -1,66 +0,0 @@
|
|||
# Makefile for CGAL's Triangulation3 package.
|
||||
|
||||
#CVS_MODULE_NAME=tet
|
||||
Package=Viewer_3
|
||||
|
||||
#.PHONY: doc package test submit version rtag
|
||||
VERSION=0.5
|
||||
WWW_base=/u/www-sop/0/www/htdocs/files/equipes/prisme/CGAL/DR:/Members
|
||||
WWW_dir=$(WWW_base)/$(Package)
|
||||
TMP_file=/tmp/submit-mail
|
||||
|
||||
package: $(Package).tar.gz
|
||||
@echo "-----------------------------------"
|
||||
@echo "------------ Penser à: ------------"
|
||||
@echo "-----------------------------------"
|
||||
@echo "---- changes.txt ----"
|
||||
@echo "---- make test ----"
|
||||
@echo "---- make VERSION=4.11 version ----"
|
||||
@echo "---- cvs commit ----"
|
||||
@echo "---- make VERSION=4.11 rtag ----"
|
||||
@echo "---- make package ----"
|
||||
@echo "---- make submit ----"
|
||||
@echo "-----------------------------------"
|
||||
|
||||
version:
|
||||
echo "$(VERSION) (`date '+%e %b %Y'`)" > version
|
||||
echo "maintainer: Francois Rebufat <Francois.Rebufat@sophia.inria.fr>" >> version
|
||||
|
||||
#rtag:
|
||||
# cvs rtag v`echo $(VERSION) | sed -e "s/\./_/g"` $(CVS_MODULE_NAME)
|
||||
|
||||
submit: package
|
||||
cp $(Package).tar.gz doc_ps/$(Package).ps version description.txt \
|
||||
$(WWW_dir)
|
||||
# cvs update $(LOCAL)/Tetrahedralization
|
||||
rm -f $(WWW_dir)/$(Package).ps.gz
|
||||
gzip -9 $(WWW_dir)/$(Package).ps
|
||||
echo > $(TMP_file)
|
||||
echo "submission::" >> $(TMP_file)
|
||||
echo "http://www-sop.inria.fr/prisme/CGAL/DR:/Members" >> $(TMP_file)
|
||||
echo "/$(Package)/$(Package).tar.gz" >> $(TMP_file)
|
||||
mail -s autohandle cgal-submit@cs.uu.nl rebufat < $(TMP_file)
|
||||
rm -f $(TMP_file)
|
||||
|
||||
test: ./test/Viewer_3/Viewer_test.o
|
||||
$(MAKE) -C test/$(Package)
|
||||
|
||||
clean:
|
||||
# $(MAKE) -C doc_tex/support/$(Package) clean
|
||||
# $(MAKE) -C examples/$(Package) clean
|
||||
$(MAKE) -C test/$(Package) clean
|
||||
rm -f $(Package).tar.gz
|
||||
|
||||
$(Package).tar.gz:
|
||||
tar -zcvf $(Package).tar.gz \
|
||||
--exclude=CVS --exclude=manual.tex --exclude=Makefile \
|
||||
--exclude=Viewer_3_ref \
|
||||
--exclude=TODO \
|
||||
--exclude=.pure --exclude=*.pv \
|
||||
--exclude=.nfs*\
|
||||
version description.txt \
|
||||
demo include doc_tex doc_ps src
|
||||
|
||||
doc: doc_ps/$(Package).ps
|
||||
$(MAKE) -C doc_tex/support/$(Package)
|
||||
cp doc_tex/support/$(Package)/$(Package).ps doc_ps/
|
||||
|
|
@ -1,117 +0,0 @@
|
|||
//#include <CGAL/Cartesian.h>
|
||||
#include <CGAL/point_generators_2.h>
|
||||
#include "triang_2.h"
|
||||
|
||||
|
||||
|
||||
|
||||
void close_c(Fl_Widget* w, void* v)
|
||||
{
|
||||
|
||||
Fl_Window* win = (Fl_Window*) v;
|
||||
delete win;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void tri_cb(Fl_Widget* w, void* v)
|
||||
{
|
||||
CGAL::Viewer_3* win = (CGAL::Viewer_3*) v;
|
||||
typedef Triangulation_2::Point Point;
|
||||
Triangulation_2* tr = new Triangulation_2();
|
||||
CGAL::Vector_2<rep_t> disp( 425.0, 425.0 );
|
||||
CGAL::Random_points_in_square_2<Point,CGAL::Creator_uniform_2<double,Point> >
|
||||
g ( 500.0 );
|
||||
for (int i=0; i<100; i++)
|
||||
tr->insert(*g++ + disp);
|
||||
CGAL::Drawable_triangulation_2<Triangulation_2>* dtr = new CGAL::Drawable_triangulation_2<Triangulation_2>(*tr,win->get_color(1), CGAL::ORANGE,CGAL::RAW, 2);
|
||||
win->add_drawable(dtr, win->get_group() + 1);
|
||||
win->display();
|
||||
}
|
||||
|
||||
|
||||
void del_cb(Fl_Widget* w, void* v)
|
||||
{
|
||||
CGAL::Viewer_3* win = (CGAL::Viewer_3*) v;
|
||||
typedef Delaunay_2::Point Point;
|
||||
Delaunay_2* tr = new Delaunay_2();
|
||||
CGAL::Vector_2<rep_t> disp( 425.0, 425.0 );
|
||||
CGAL::Random_points_in_square_2<Point,CGAL::Creator_uniform_2<double,Point> >
|
||||
g ( 500.0 );
|
||||
for (int i=0; i<100; i++)
|
||||
tr->insert(*g++ + disp);
|
||||
CGAL::Drawable_triangulation_2<Delaunay_2>* dtr = new CGAL::Drawable_triangulation_2<Delaunay_2>(*tr,win->get_color(1), CGAL::ORANGE,CGAL::RAW, 2);
|
||||
win->add_drawable(dtr, win->get_group() + 1);
|
||||
win->display();
|
||||
}
|
||||
|
||||
|
||||
void vor_cb(Fl_Widget* w, void* v)
|
||||
{
|
||||
CGAL::Viewer_3* win = (CGAL::Viewer_3*) v;
|
||||
typedef Delaunay_2::Point Point;
|
||||
Delaunay_2* tr = new Delaunay_2();
|
||||
CGAL::Vector_2<rep_t> disp( 425.0, 425.0 );
|
||||
CGAL::Random_points_in_square_2<Point,CGAL::Creator_uniform_2<double,Point> >
|
||||
g ( 500.0 );
|
||||
for (int i=0; i<100; i++)
|
||||
tr->insert(*g++ + disp);
|
||||
CGAL:: Drawable_voronoi_2<Delaunay_2>* vo = new CGAL::Drawable_voronoi_2<Delaunay_2>(*tr,win->get_color(1), CGAL::RAW, 2);
|
||||
win->add_drawable(vo, win->get_group() + 1);
|
||||
win->display();
|
||||
}
|
||||
|
||||
|
||||
void vord_cb(Fl_Widget* w, void* v)
|
||||
{
|
||||
CGAL::Viewer_3* win = (CGAL::Viewer_3*) v;
|
||||
typedef Delaunay_2::Point Point;
|
||||
Delaunay_2* tr = new Delaunay_2();
|
||||
CGAL::Vector_2<rep_t> disp( 425.0, 425.0 );
|
||||
CGAL::Random_points_in_square_2<Point,CGAL::Creator_uniform_2<double,Point> >
|
||||
g ( 500.0 );
|
||||
for (int i=0; i<100; i++)
|
||||
tr->insert(*g++ + disp);
|
||||
CGAL::Drawable_voronoi_2<Delaunay_2>* vor = new CGAL::Drawable_voronoi_2<Delaunay_2>(*tr,CGAL::ORANGE, CGAL::RAW, 2);
|
||||
win->add_drawable(vor, win->get_group() + 1);
|
||||
CGAL::Drawable_triangulation_2<Delaunay_2>* dtr = new
|
||||
CGAL::Drawable_triangulation_2<Delaunay_2>(*tr,CGAL::BLUE,
|
||||
CGAL::GREEN ,CGAL::RAW, 2);
|
||||
win->add_drawable(dtr, win->get_group() );
|
||||
|
||||
win->display();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void my_panel(CGAL::GL_win* win, CGAL::Viewer_3* view)
|
||||
{
|
||||
|
||||
|
||||
Fl_Window* flwin = new Fl_Window(100,500,"Demo win");
|
||||
|
||||
Fl_Button* tri = new Fl_Button(5,5,80,25,"Triangulation");
|
||||
tri->callback(tri_cb,(void *) view);
|
||||
|
||||
Fl_Button* del = new Fl_Button(5,35,80,25,"Delaunay");
|
||||
del->callback(del_cb,(void *) view);
|
||||
|
||||
|
||||
Fl_Button* vor = new Fl_Button(5,65,80,25,"Voronoi");
|
||||
vor->callback(vor_cb,(void *) view);
|
||||
|
||||
Fl_Button* vord = new Fl_Button(5,95,80,25,"Vor. and Del.");
|
||||
vord->callback(vord_cb,(void *) view);
|
||||
|
||||
|
||||
Fl_Button* close = new Fl_Button(5,470,80,25,"Done");
|
||||
close->callback(close_c,(void *) flwin);
|
||||
flwin->end();
|
||||
flwin->show();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1,132 +0,0 @@
|
|||
#include <CGAL/Cartesian.h>
|
||||
#include <CGAL/Viewer_stream.h>
|
||||
|
||||
#include "custom_win.h"
|
||||
#include "myhandler.h"
|
||||
|
||||
|
||||
typedef CGAL::Point_3<rep_t> point_t;
|
||||
typedef CGAL::Point_2<rep_t> point2;
|
||||
typedef CGAL::Segment_3<rep_t> segment;
|
||||
typedef CGAL::Segment_2<rep_t> segment2;
|
||||
typedef CGAL::Triangle_3<rep_t> triangle;
|
||||
typedef CGAL::Triangle_2<rep_t> triangle2;
|
||||
typedef CGAL::Tetrahedron_3<rep_t> tetra;
|
||||
typedef CGAL::Line_3<rep_t> Line;
|
||||
//typedef CGAL::Line_2<rep_t> Line2;
|
||||
typedef CGAL::Ray_3<rep_t> Ray;
|
||||
//typedef CGAL::Ray_2<rep_t> Ray2;
|
||||
typedef CGAL::Circle_2<rep_t> circle2;
|
||||
std::list<point_t> all_points;
|
||||
|
||||
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
|
||||
CGAL::Viewer_3 W(500);
|
||||
W.init_window_thread();
|
||||
W.set_custom_panel(my_panel);
|
||||
W.set_mouse_push_handler(myhandler);
|
||||
stop();
|
||||
std::cerr << "after 1st stop" << std::endl;
|
||||
point_t p1(100,100,100);
|
||||
point_t p2(200,100,100);
|
||||
point_t p3(300,100,100);
|
||||
CGAL::Drawable_point_3<point_t> dp1(p1,CGAL::RED,CGAL::FILL,25,50);
|
||||
|
||||
CGAL::Drawable_point_3<point_t> dp2(p2,CGAL::RED,CGAL::FILL,25,50);
|
||||
CGAL::Drawable_point_3<point_t> dp3(p3,CGAL::RED,CGAL::FILL,25,50);
|
||||
|
||||
|
||||
point_t p4(100,200,100);
|
||||
point_t p5(200,200,100);
|
||||
point_t p6(300,200,100);
|
||||
|
||||
CGAL::Drawable_point_3<point_t> dp4(p4,CGAL::VIOLET,CGAL::FILL,5,50);
|
||||
CGAL::Drawable_point_3<point_t> dp5(p5,CGAL::GRAY,CGAL::FILL,10,50);
|
||||
CGAL::Drawable_point_3<point_t> dp6(p6,CGAL::DEEPBLUE,CGAL::FILL,15,50);
|
||||
|
||||
point_t p7(100,300,-100);
|
||||
point_t p8(200,300,-100);
|
||||
point_t p9(300,300,-100);
|
||||
|
||||
CGAL::Drawable_point_3<point_t> dp7(p7,CGAL::ORANGE,CGAL::FILL,10,15);
|
||||
CGAL::Drawable_point_3<point_t> dp8(p8,CGAL::GREEN,CGAL::WIRE,10,15);
|
||||
CGAL::Drawable_point_3<point_t> dp9(p9,CGAL::GREEN,CGAL::RAW,10,15);
|
||||
|
||||
point_t p10(100,400,500);
|
||||
point_t p11(200,400,500);
|
||||
point_t p12(300,400,500);
|
||||
|
||||
CGAL::Drawable_point_3<point_t> dp10(p10,CGAL::WHITE,CGAL::RAW,5,8);
|
||||
CGAL::Drawable_point_3<point_t> dp11(p11,CGAL::PURPLE,CGAL::FILL,5,15);
|
||||
CGAL::Drawable_point_3<point_t> dp12(p12,CGAL::YELLOW,CGAL::WIRE,50,20);
|
||||
|
||||
Line ln(point_t(300,300,1),point_t(300,300,-1));
|
||||
Ray ry1(point_t(300,300,0), point_t(400,300,0));
|
||||
Ray ry2(point_t(300,300,0), point_t(400,350,0));
|
||||
|
||||
CGAL::Drawable_line_3<Line> dln(ln,CGAL::RED,CGAL::FILL,5,20);
|
||||
CGAL::Drawable_ray_3<Ray> dry1(ry1,CGAL::BLUE,CGAL::FILL,5,10);
|
||||
CGAL::Drawable_ray_3<Ray> dry2(ry2,CGAL::BLUE,CGAL::RAW,5,10);
|
||||
|
||||
|
||||
triangle tr(point_t(10,10,-200),point_t(300,10,-200),point_t(200,200,-100));
|
||||
|
||||
tetra
|
||||
tet(point_t(100,100,-200),point_t(400,100,-300),point_t(400,300,-100),point_t(250,250, 100));
|
||||
|
||||
|
||||
CGAL::Drawable_triangle_3<triangle> dtr(tr,CGAL::GRAY,CGAL::RAW);
|
||||
|
||||
CGAL::Drawable_tetrahedron_3<tetra> dtet(tet,CGAL::ORANGE);
|
||||
|
||||
segment s(p10,p11);
|
||||
CGAL::Drawable_segment_3<segment> ds1(s,CGAL::VIOLET,CGAL::FILL,5,10);
|
||||
|
||||
|
||||
std::list<point_t> lp;
|
||||
lp.push_back(point_t(10,10,0));
|
||||
lp.push_back(point_t(20,20,0));
|
||||
lp.push_back(point_t(30,30,0));
|
||||
lp.push_back(point_t(40,40,0));
|
||||
std::list<point_t>::iterator first=lp.begin(), last=lp.end();
|
||||
CGAL::Drawable_points_set_3<std::list<point_t>::iterator,point_t>
|
||||
dlp(first,last,CGAL::RED,CGAL::FILL,5,30);
|
||||
|
||||
// W << tr ;
|
||||
W.add_drawable(&dp1);
|
||||
W.add_drawable(&dp2);
|
||||
W.add_drawable(&dp3);
|
||||
W.display();
|
||||
stop();
|
||||
W.add_drawable(&dp4);
|
||||
W.add_drawable(&dp5);
|
||||
W.add_drawable(&dp6);
|
||||
|
||||
W.add_drawable(&dp7);
|
||||
W.add_drawable(&dp8);
|
||||
W.add_drawable(&dp9);
|
||||
|
||||
W.add_drawable(&dp10,2);
|
||||
W.add_drawable(&dp11,2);
|
||||
W.add_drawable(&dp12,2);
|
||||
|
||||
W.add_drawable(&dln,3);
|
||||
W.add_drawable(&dry1,3);
|
||||
W.add_drawable(&dry2,3);
|
||||
|
||||
|
||||
W.add_drawable(&dtr,4);
|
||||
W.add_drawable(&dtet,5);
|
||||
|
||||
W.add_drawable(&ds1,6);
|
||||
|
||||
W.add_drawable(&dlp,7);
|
||||
W.display();
|
||||
pthread_join(W.get_window_thread(), NULL);
|
||||
// W.main_loop();
|
||||
return 0; // to satisfy MSVC...
|
||||
}
|
||||
|
||||
|
|
@ -1,208 +0,0 @@
|
|||
#include <CGAL/point_generators_2.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
|
||||
#if !defined(_MSC_VER) && !defined(__BORLANDC__)
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
//#include "triang_2.h"
|
||||
|
||||
typedef CGAL::Cartesian<double> rep_t;
|
||||
typedef CGAL::Triangulation_euclidean_traits_2< rep_t > Ttraits;
|
||||
typedef CGAL::Triangulation_vertex_base_2<Ttraits> Vertex_base ;
|
||||
typedef CGAL::Triangulation_face_base_2<Ttraits> Face_base ;
|
||||
typedef CGAL::Triangulation_default_data_structure_2<Ttraits,Vertex_base,Face_base> TDS ;
|
||||
typedef CGAL::Delaunay_triangulation_2<Ttraits, TDS> Delaunay_2;
|
||||
typedef Delaunay_2::Point Point;
|
||||
Delaunay_2* tr;
|
||||
|
||||
|
||||
void step(int val)
|
||||
{
|
||||
double a=5;
|
||||
for (int i=0; i!=val*1000;i++)
|
||||
a= (a*a)/3 + (a*a)/3;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void close_c(Fl_Widget* w, void* v)
|
||||
{
|
||||
|
||||
Fl_Window* win = (Fl_Window*) v;
|
||||
delete win;
|
||||
|
||||
}
|
||||
|
||||
|
||||
void del_cb(Fl_Widget* w, void* v)
|
||||
{
|
||||
CGAL::Viewer_3* win = (CGAL::Viewer_3*) v;
|
||||
tr->clear();
|
||||
CGAL::Vector_2<rep_t> disp( 425.0, 425.0 );
|
||||
CGAL::Random_points_in_square_2<Point,CGAL::Creator_uniform_2<double,Point> >
|
||||
g ( 500.0 );
|
||||
for (int i=0; i<50; i++)
|
||||
tr->insert(*g++ + disp);
|
||||
CGAL::Drawable_triangulation_2<Delaunay_2>* dtr = new CGAL::Drawable_triangulation_2<Delaunay_2>(*tr,win->get_color(1), CGAL::ORANGE,CGAL::RAW, 2);
|
||||
win->add_drawable(dtr, win->get_group()+1);
|
||||
win->display();
|
||||
}
|
||||
|
||||
|
||||
void parab_cb(Fl_Widget* w, void* v)
|
||||
{
|
||||
CGAL::Viewer_3* win = (CGAL::Viewer_3*) v;
|
||||
tr->clear();
|
||||
|
||||
float i= 0.00000000000001 ;
|
||||
while (i < 0.0000000001) {
|
||||
tr->insert(Point(i, i*i));
|
||||
i=i+0.00000000000001;
|
||||
}
|
||||
std::cerr << "number of faces : " << tr->number_of_faces() << std::endl;
|
||||
CGAL::Drawable_triangulation_2<Delaunay_2>* dtr = new CGAL::Drawable_triangulation_2<Delaunay_2>(*tr,win->get_color(1), CGAL::ORANGE,CGAL::RAW, 2);
|
||||
win->add_drawable(dtr, win->get_group()+1);
|
||||
win->display();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void iterator_cb(Fl_Widget* w, void* v)
|
||||
{
|
||||
CGAL::Viewer_3* win = (CGAL::Viewer_3*) v;
|
||||
Delaunay_2::Face_iterator it=tr->finite_faces_begin();
|
||||
int gr = win->get_group()+1;
|
||||
int i=1;
|
||||
int count = 1;
|
||||
for (; it != tr->finite_faces_end() ;it++)
|
||||
{
|
||||
Delaunay_2::Triangle trg = tr->triangle(it);
|
||||
CGAL::Drawable_triangle_2<Delaunay_2::Triangle>*
|
||||
tri= new
|
||||
CGAL::Drawable_triangle_2<Delaunay_2::Triangle>(trg, CGAL::ORANGE, CGAL::DEEPBLUE);
|
||||
|
||||
win->add_drawable(tri,gr);
|
||||
|
||||
win->display();
|
||||
|
||||
// step(1000);
|
||||
// sleep(1);
|
||||
win->remove_drawable(gr, 1);
|
||||
if (i==500) {
|
||||
std::cerr << "nombre de faces visitees : " << count << std::endl;
|
||||
i=0;
|
||||
}
|
||||
count ++;
|
||||
i++;
|
||||
}
|
||||
std::cerr << "delete group" << std::endl;
|
||||
win->delete_group(gr);
|
||||
}
|
||||
|
||||
void line_face_cb(Fl_Widget* w, void* v)
|
||||
{
|
||||
CGAL::Viewer_3* win = (CGAL::Viewer_3*) v;
|
||||
CGAL::Vector_2<rep_t> disp( 425.0, 425.0 );
|
||||
CGAL::Random_points_on_segment_2<Point,CGAL::Creator_uniform_2<double,Point> >
|
||||
g1 (Point(-100,10),Point(-100,900));
|
||||
CGAL::Random_points_on_segment_2<Point,CGAL::Creator_uniform_2<double,Point> >
|
||||
g2 (Point(900,10),Point(900,900));
|
||||
int gr = win->get_group()+1;
|
||||
Delaunay_2::Segment sg=Delaunay_2::Segment(*g1,*g2);
|
||||
CGAL::Drawable_segment_2<Delaunay_2::Segment>*
|
||||
seg= new
|
||||
CGAL::Drawable_segment_2<Delaunay_2::Segment>(sg, CGAL::PURPLE);
|
||||
win->add_drawable(seg,gr);
|
||||
Delaunay_2::Line_face_circulator lfc=tr->line_walk(*g1,*g2);
|
||||
Delaunay_2::Line_face_circulator lfc_o=lfc;
|
||||
|
||||
do {
|
||||
if (!(tr->is_infinite(lfc))) {
|
||||
Delaunay_2::Triangle trg = tr->triangle(lfc);
|
||||
CGAL::Drawable_triangle_2<Delaunay_2::Triangle>*
|
||||
tri= new
|
||||
CGAL::Drawable_triangle_2<Delaunay_2::Triangle>(trg, CGAL::ORANGE, CGAL::DEEPBLUE);
|
||||
|
||||
win->add_drawable(tri,gr);
|
||||
|
||||
win->display();
|
||||
|
||||
step(1000);
|
||||
}
|
||||
lfc++;
|
||||
}
|
||||
|
||||
while (lfc != lfc_o);
|
||||
}
|
||||
|
||||
|
||||
void circulator_cb(Fl_Widget* w, void* v)
|
||||
{
|
||||
|
||||
CGAL::Viewer_3* win = (CGAL::Viewer_3*) v;
|
||||
Delaunay_2::Vertex_iterator vit=tr->finite_vertices_begin();
|
||||
Delaunay_2::Face_circulator fct, fct_o;
|
||||
int gr = win->get_group()+1;
|
||||
for (; vit != tr->finite_vertices_end() ;vit++)
|
||||
{
|
||||
fct=tr->incident_faces(vit);
|
||||
fct_o=fct;
|
||||
do
|
||||
{
|
||||
if (!(tr->is_infinite(fct))) {
|
||||
Delaunay_2::Triangle trg = tr->triangle(fct);
|
||||
CGAL::Drawable_triangle_2<Delaunay_2::Triangle>*
|
||||
tri= new
|
||||
CGAL::Drawable_triangle_2<Delaunay_2::Triangle>(trg, CGAL::ORANGE, CGAL::DEEPBLUE);
|
||||
|
||||
win->add_drawable(tri,gr);
|
||||
|
||||
win->display();
|
||||
|
||||
step(1000);
|
||||
|
||||
win->remove_drawable(gr, 1);
|
||||
|
||||
}
|
||||
fct++;
|
||||
}
|
||||
while (fct != fct_o);
|
||||
}
|
||||
win->delete_group(gr);
|
||||
}
|
||||
void demo_panel(CGAL::GL_win* win, CGAL::Viewer_3* view)
|
||||
{
|
||||
|
||||
|
||||
Fl_Window* flwin = new Fl_Window(100,500,"Demo win");
|
||||
|
||||
// Fl_Button* tri = new Fl_Button(5,5,80,25,"Triangulation");
|
||||
// tri->callback(tri_cb,(void *) view);
|
||||
|
||||
Fl_Button* del = new Fl_Button(5,35,80,25,"Delaunay");
|
||||
del->callback(del_cb,(void *) view);
|
||||
|
||||
|
||||
Fl_Button* iter = new Fl_Button(5,65,80,25,"iterator");
|
||||
iter->callback(iterator_cb,(void *) view);
|
||||
|
||||
Fl_Button* circu = new Fl_Button(5,95,80,25,"circulator");
|
||||
circu->callback(circulator_cb,(void *) view);
|
||||
|
||||
Fl_Button* lfc = new Fl_Button(5,125,80,25,"Line face");
|
||||
lfc->callback(line_face_cb,(void *) view);
|
||||
|
||||
Fl_Button* para = new Fl_Button(5,155,80,25,"Parabola");
|
||||
para->callback(parab_cb,(void *) view);
|
||||
|
||||
|
||||
Fl_Button* close = new Fl_Button(5,470,80,25,"Done");
|
||||
close->callback(close_c,(void *) flwin);
|
||||
flwin->end();
|
||||
flwin->show();
|
||||
|
||||
}
|
||||
|
|
@ -1,41 +0,0 @@
|
|||
|
||||
#include "get_data.h"
|
||||
|
||||
typedef CGAL::Point_3<rep_t> point_t;
|
||||
typedef CGAL::Tetrahedron_3<rep_t> tetra;
|
||||
|
||||
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
CGAL::Viewer_3 W(500);
|
||||
W.init_window_thread();
|
||||
stop();
|
||||
Delaunay_3 tr;
|
||||
|
||||
tr.insert(point_t(100,100,100));
|
||||
tr.insert(point_t(-100,450,-100));
|
||||
tr.insert(point_t(0,0,0));
|
||||
tr.insert(point_t(200,-130,170));
|
||||
tr.insert(point_t(100,-100,-100));
|
||||
tr.insert(point_t(400,100,300));
|
||||
tr.insert(point_t(210,140,0));
|
||||
tr.insert(point_t(-200,50,310));
|
||||
tr.insert(point_t(-100,100,-100));
|
||||
tr.insert(point_t(100,-300,0));
|
||||
tr.insert(point_t(500,-100,-200));
|
||||
tr.insert(point_t(200,140,-200));
|
||||
tr.insert(point_t(-140,400,-200));
|
||||
tr.insert(point_t(100,-350,0));
|
||||
tr.insert(point_t(500,-300,-250));
|
||||
tr.insert(point_t(300,-100,250));
|
||||
|
||||
CGAL::Drawable_facets_object_3<Delaunay_3>
|
||||
df(tr,CGAL::ORANGE,CGAL::BLACK,"triangulation3");
|
||||
W.add_drawable(&df);
|
||||
W.display();
|
||||
pthread_join(W.get_window_thread(), NULL);
|
||||
// W.main_loop();
|
||||
std::cerr << "done." << std::endl;
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -1,101 +0,0 @@
|
|||
#include <CGAL/Cartesian.h>
|
||||
#include <CGAL/basic.h>
|
||||
#include <CGAL/Triangulation_3.h>
|
||||
#include <CGAL/Triangulation_geom_traits_3.h>
|
||||
#include <CGAL/Delaunay_triangulation_3.h>
|
||||
#include <CGAL/Viewer_stream.h>
|
||||
#include <CGAL/facet_object.h>
|
||||
|
||||
typedef CGAL::Cartesian<double> rep_t;
|
||||
typedef CGAL::Triangulation_geom_traits_3<rep_t> traits_3;
|
||||
typedef CGAL::Triangulation_vertex_base_3<traits_3> Vb ;
|
||||
typedef CGAL::Triangulation_cell_base_3<traits_3> Fb;
|
||||
typedef CGAL::Triangulation_data_structure_3<Vb,Fb> TDS3 ;
|
||||
typedef CGAL::Delaunay_triangulation_3<traits_3,TDS3> Delaunay_3;
|
||||
|
||||
|
||||
CGAL::list_vertices get_vertices(const Delaunay_3 &fo)
|
||||
{
|
||||
Delaunay_3::Vertex_iterator vit;
|
||||
CGAL::list_vertices res;
|
||||
CGAL::vertex v(3);
|
||||
for (vit=fo.finite_vertices_begin(); vit!=fo.vertices_end();vit++) {
|
||||
v[0]=CGAL::to_double(vit->point().x());
|
||||
v[1]=CGAL::to_double(vit->point().y());
|
||||
v[2]=CGAL::to_double(vit->point().z());
|
||||
res.push_back(v);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
CGAL::list_edges get_edges(const Delaunay_3 &fo)
|
||||
{
|
||||
Delaunay_3::Edge_iterator it;
|
||||
CGAL::list_edges res;
|
||||
CGAL::edge ed(2);
|
||||
CGAL::vertex vx(3);
|
||||
Delaunay_3::Cell_handle f;
|
||||
int n1, n2;
|
||||
Delaunay_3::Vertex_handle v1, v2;
|
||||
for (it=fo.finite_edges_begin(); it!=fo.edges_end();it++) {
|
||||
f = (*it).first;
|
||||
n1 = (*it).second;
|
||||
n2 = (*it).third;
|
||||
v1 = f->vertex(n1);
|
||||
v2 = f->vertex(n2);
|
||||
vx[0]=CGAL::to_double(v1->point().x());
|
||||
vx[1]=CGAL::to_double(v1->point().y());
|
||||
vx[2]=CGAL::to_double(v1->point().z());
|
||||
ed[0]=vx;
|
||||
vx[0]=CGAL::to_double(v2->point().x());
|
||||
vx[1]=CGAL::to_double(v2->point().y());
|
||||
vx[2]=CGAL::to_double(v2->point().z());
|
||||
ed[1]=vx;
|
||||
res.push_back(ed);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
CGAL::list_facets get_facets(const Delaunay_3 &fo)
|
||||
{
|
||||
Delaunay_3::Facet_iterator it;
|
||||
CGAL::list_facets res;
|
||||
CGAL::facet fa;
|
||||
CGAL::vertex v(3);
|
||||
for (it=fo.finite_facets_begin(); it!=fo.facets_end();it++) {
|
||||
fa.clear();
|
||||
v[0]=CGAL::to_double((((*it).first)->vertex(((*it).second +1)
|
||||
&3))->point().x());
|
||||
|
||||
v[1]=CGAL::to_double((((*it).first)->vertex(((*it).second +1)
|
||||
&3))->point().y());
|
||||
|
||||
v[2]=CGAL::to_double((((*it).first)->vertex(((*it).second +1)
|
||||
&3))->point().z());
|
||||
|
||||
fa.push_back(v);
|
||||
v[0]=CGAL::to_double((((*it).first)->vertex(((*it).second +2)
|
||||
&3))->point().x());
|
||||
|
||||
v[1]=CGAL::to_double((((*it).first)->vertex(((*it).second +2)
|
||||
&3))->point().y());
|
||||
|
||||
v[2]=CGAL::to_double((((*it).first)->vertex(((*it).second +2)
|
||||
&3))->point().z());
|
||||
|
||||
fa.push_back(v);
|
||||
v[0]=CGAL::to_double((((*it).first)->vertex(((*it).second +3)
|
||||
&3))->point().x());
|
||||
|
||||
v[1]=CGAL::to_double((((*it).first)->vertex(((*it).second +3)
|
||||
&3))->point().y());
|
||||
|
||||
v[2]=CGAL::to_double((((*it).first)->vertex(((*it).second +3)
|
||||
&3))->point().z());
|
||||
|
||||
fa.push_back(v);
|
||||
res.push_back(fa);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
|
@ -1,103 +0,0 @@
|
|||
# This is the makefile for compiling a CGAL application.
|
||||
|
||||
#---------------------------------------------------------------------#
|
||||
# include platform specific settings
|
||||
#---------------------------------------------------------------------#
|
||||
# Choose the right include file from the <cgalroot>/make directory.
|
||||
|
||||
#CGAL_MAKEFILE=$(UTIL)/CGAL/CGAL-I/make/makefile_sparc_SunOS-5.6_g++-2.95.2_LEDA
|
||||
CGAL_MAKEFILE = $(UTIL)/CGAL/CGAL-2.2/make/makefile_sparc_SunOS-5.6_g++-2.95.2_LEDA
|
||||
#makefile_sparc_SunOS-5.6_eg++-egcs-2.91.66_LEDA
|
||||
#makefile_sparc_SunOS-5.6_eg++-egcs-2.91.66_LEDA
|
||||
#makefile_i686_Linux-2.2.14_g++-2.95.2_LEDA
|
||||
#makefile_sparc_SunOS-5.6_g++-2.95.2_LEDA
|
||||
#makefile_sparc_SunOS-5.6_g++-2.95.2_LEDA
|
||||
|
||||
include $(CGAL_MAKEFILE)
|
||||
|
||||
FLTK_DIR = ${UTIL}/FLTK/SunOS/fltk-1.0.6
|
||||
# ---------------------------------------------------------------------#
|
||||
# compiler flags
|
||||
#---------------------------------------------------------------------#
|
||||
# rajouter CGAL_LOCAL_CXXFLAGS si on veut les packages de Local
|
||||
|
||||
CHECKS_OFF = -DCGAL_NO_PRECONDITIONS -DCGAL_NO_POSTCONDITIONS \
|
||||
-DCGAL_NO_ASSERTIONS -DCGAL_NO_WARNINGS
|
||||
|
||||
CXXFLAGS = \
|
||||
-I../../include \
|
||||
-I../../../Postscript/include/CGAL/IO \
|
||||
-I../../../Postscript/src/ \
|
||||
-I../include/CGAL/IO \
|
||||
-I../include \
|
||||
-I../src/ \
|
||||
-I${FLTK_DIR} \
|
||||
-I/usr/X11R6/include/ \
|
||||
-B$(UTIL)/Binutils/$(UNAME)/bin/ \
|
||||
-B$(GCC_EXEC_PREFIX) $(LONG_NAME_PROBLEM_CXXFLAGS) \
|
||||
$(CGAL_CXXFLAGS) $(CHECKS_OFF) -DUSE_THREAD
|
||||
|
||||
|
||||
#---------------------------------------------------------------------#
|
||||
# linker flags
|
||||
#---------------------------------------------------------------------#
|
||||
|
||||
VIEWER3_LDFLAGS = \
|
||||
$(CGAL_WINDOW_LDFLAGS) \
|
||||
-L$(FLTK_DIR)/lib -L/usr/lib/X11 \
|
||||
-R$(FLTK_DIR)/lib -R/usr/lib/X11 -Wl \
|
||||
-lfltk -lXext -lX11 -lGL -lGLU -lpthread
|
||||
|
||||
|
||||
#---------------------------------------------------------------------#
|
||||
# target entries
|
||||
#---------------------------------------------------------------------#
|
||||
|
||||
|
||||
demo: demo.o
|
||||
$(CGAL_CXX) -o $@ $(OFILES) demo.o -lpthread $(LDFLAGS)
|
||||
|
||||
|
||||
facet_obj: facet_obj.o
|
||||
$(CGAL_CXX) -o $@ $(OFILES) facet_obj.o -lpthread $(LDFLAGS)
|
||||
|
||||
|
||||
tetra1: tetra1.o
|
||||
$(CGAL_CXX) -o $@ $(OFILES) tetra1.o -lpthread $(LDFLAGS)
|
||||
|
||||
tetra2: tetra2.o
|
||||
$(CGAL_CXX) -o $@ $(OFILES) tetra2.o -lpthread $(LDFLAGS)
|
||||
|
||||
tetra3: tetra3.o
|
||||
$(CGAL_CXX) -o $@ $(OFILES) tetra3.o -lpthread $(LDFLAGS)
|
||||
|
||||
terrain: terrain.o
|
||||
$(CGAL_CXX) -o $@ $(OFILES) terrain.o -lpthread $(LDFLAGS)
|
||||
|
||||
testter: testter.o
|
||||
$(CGAL_CXX) -o $@ $(OFILES) testter.o -lpthread $(LDFLAGS)
|
||||
|
||||
stream_ex: stream_ex.o
|
||||
$(CGAL_CXX) -o $@ $(OFILES) stream_ex.o -lpthread $(LDFLAGS)
|
||||
|
||||
all: facet_obj demo tetra1 tetra2 tetra3 terrain stream_ex
|
||||
|
||||
#---------------------------------------------------------------------#
|
||||
# suffix rules
|
||||
#---------------------------------------------------------------------#
|
||||
|
||||
.C.o:
|
||||
$(CGAL_CXX) $(CXXFLAGS) -c -D_REENTRANT $<
|
||||
|
||||
.c.o:
|
||||
$(CGAL_CXX) $(CXXFLAGS) -c -D_REENTRANT $<
|
||||
|
||||
|
||||
|
||||
|
||||
clean:
|
||||
rm -f *.o core *~
|
||||
rm -f ii_files/*
|
||||
distclean: clean
|
||||
rm -f demo facet tetra1 tetra2 tetra3 terrain stream_ex
|
||||
rm ../include/CGAL/*~
|
||||
|
|
@ -1,115 +0,0 @@
|
|||
DEVEL_DIR_INCL = '-I..\..\include'
|
||||
PTHREAD_DIR = d:\tmp\cgal\pthreads-snap-2000-12-29
|
||||
PTHREAD_DIR_INCL = '-I$(PTHREAD_DIR)'
|
||||
# msvc settings.
|
||||
|
||||
FLTK_DIR = d:\tmp\cgal\fltk\vc\fltk-1.0.10
|
||||
FLTK_LIBDIR = d:\tmp\cgal\fltk\vc\fltk-1.0.10\lib
|
||||
FLTK_LIBPATH = '-LIBPATH:$(FLTK_LIBDIR)'
|
||||
PTHREAD_LIBPATH = '-LIBPATH:$(PTHREAD_DIR)'
|
||||
|
||||
FLTK_LIBS = \
|
||||
opengl32.lib glu32.lib fltk.lib wsock32.lib kernel32.lib user32.lib \
|
||||
gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib \
|
||||
oleaut32.lib uuid.lib \
|
||||
pthread.lib
|
||||
|
||||
|
||||
#FLTK_LIBS = -lpthread -lfltk -lXext -lX11 -lGL -lGLU
|
||||
#GL_DIR = /0/prisme_util/MESA/SunOS/Mesa-3.0/include/
|
||||
# GL_DIR = /usr/local/mesa
|
||||
|
||||
CGAL_MAKEFILE=/d/tmp/cgal/CGAL-2.3-I-24/make/CLMT
|
||||
include $(CGAL_MAKEFILE)
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------#
|
||||
# compiler flags
|
||||
#---------------------------------------------------------------------#
|
||||
|
||||
CHECKS_OFF = -DCGAL_NO_PRECONDITIONS -DCGAL_NO_POSTCONDITIONS \
|
||||
-DCGAL_NO_ASSERTIONS -DCGAL_NO_WARNINGS
|
||||
|
||||
|
||||
CXXFLAGS = $(DEVEL_DIR_INCL) $(PTHREAD_DIR_INCL) '-I$(FLTK_DIR)' \
|
||||
$(CGAL_CXXFLAGS) $(DEBUG_OPT) \
|
||||
$(CHECKS_OFF) \
|
||||
-DUSE_THREAD \
|
||||
-MT -DWIN32 -DNDEBUG -D_WINDOWS -DWIN32_LEAN_AND_MEAN \
|
||||
-DVC_EXTRA_LEAN -DWIN32_EXTRA_LEAN
|
||||
|
||||
# -DUSE_THREAD \
|
||||
# -I../../include \
|
||||
# -I/usr/X11R6/include/ \
|
||||
# -B$(UTIL)/Binutils/SunOS/bin/ \
|
||||
# -B$(GCC_EXEC_PREFIX) $(LONG_NAME_PROBLEM_CXXFLAGS) \
|
||||
|
||||
#-I${GL_DIR}/include \
|
||||
|
||||
LDFLAGS = $(CGAL_LDFLAGS) $(FLTK_LIBPATH) $(PTHREAD_LIBPATH) $(FLTK_LIBS)
|
||||
|
||||
#-lMesaGL -lMesaGLU
|
||||
|
||||
#-L$(GL_DIR)/lib
|
||||
#-R$(GL_DIR)/lib
|
||||
#---------------------------------------------------------------------#
|
||||
# target entries
|
||||
#---------------------------------------------------------------------#
|
||||
|
||||
|
||||
demo$(EXE_EXT): demo$(OBJ_EXT)
|
||||
$(CGAL_CXX) $(LIBPATH) $(EXE_OPT)demo $(OFILES) demo$(OBJ_EXT) $(LDFLAGS)
|
||||
|
||||
facet_obj$(EXE_EXT): facet_obj$(OBJ_EXT)
|
||||
$(CGAL_CXX) $(LIBPATH) $(EXE_OPT)facet_obj $(OFILES) facet_obj$(OBJ_EXT) $(LDFLAGS)
|
||||
|
||||
|
||||
tetra1$(EXE_EXT): tetra1$(OBJ_EXT)
|
||||
$(CGAL_CXX) $(LIBPATH) $(EXE_OPT)tetra1 $(OFILES) tetra1$(OBJ_EXT) $(LDFLAGS)
|
||||
|
||||
tetra2$(EXE_EXT): tetra2$(OBJ_EXT)
|
||||
$(CGAL_CXX) $(LIBPATH) $(EXE_OPT)tetra2 $(OFILES) tetra2$(OBJ_EXT) $(LDFLAGS)
|
||||
|
||||
tetra3$(EXE_EXT): tetra3$(OBJ_EXT)
|
||||
$(CGAL_CXX) $(LIBPATH) $(EXE_OPT)tetra3 $(OFILES) tetra3$(OBJ_EXT) $(LDFLAGS)
|
||||
|
||||
terrain$(EXE_EXT): terrain$(OBJ_EXT)
|
||||
$(CGAL_CXX) $(LIBPATH) $(EXE_OPT)terrain $(OFILES) terrain$(OBJ_EXT) $(LDFLAGS)
|
||||
|
||||
testter$(EXE_EXT): testter$(OBJ_EXT)
|
||||
$(CGAL_CXX) $(LIBPATH) $(EXE_OPT)testter $(OFILES) testter$(OBJ_EXT) $(LDFLAGS)
|
||||
|
||||
stream_ex$(EXE_EXT): stream_ex$(OBJ_EXT)
|
||||
$(CGAL_CXX) $(LIBPATH) $(EXE_OPT)stream_ex $(OFILES) stream_ex$(OBJ_EXT) $(LDFLAGS)
|
||||
|
||||
all: tetra3$(EXE_EXT) terrain$(EXE_EXT) stream_ex$(EXE_EXT)
|
||||
|
||||
#all: facet$(EXE_EXT) demo$(EXE_EXT) tetra1$(EXE_EXT) tetra2$(EXE_EXT) tetra3$(EXE_EXT) terrain$(EXE_EXT) stream_ex$(EXE_EXT)
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------#
|
||||
# suffix rules
|
||||
#---------------------------------------------------------------------#
|
||||
|
||||
.C$(OBJ_EXT):
|
||||
$(CGAL_CXX) $(CXXFLAGS) -c -D_REENTRANT $<
|
||||
|
||||
.c$(OBJ_EXT):
|
||||
$(CGAL_CXX) $(CXXFLAGS) -c -D_REENTRANT $<
|
||||
|
||||
|
||||
|
||||
|
||||
clean: \
|
||||
demo.clean \
|
||||
facet_obj.clean \
|
||||
tetra1.clean \
|
||||
tetra2.clean \
|
||||
tetra3.clean \
|
||||
terrain.clean \
|
||||
stream_ex.clean
|
||||
|
||||
distclean: clean
|
||||
rm ../include/CGAL/*~
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
|
||||
void myhandler(int x, int y, int but, CGAL::GL_win *W) {
|
||||
std::vector<double> v(3);
|
||||
v[0]=x*2; v[1]=y*2; v[2]=0;
|
||||
W->add_point_to_object(1,1,v);
|
||||
|
||||
}
|
||||
|
|
@ -1,353 +0,0 @@
|
|||
/* readtex.c */
|
||||
|
||||
/*
|
||||
* Read an SGI .rgb image file and generate a mipmap texture set.
|
||||
* Much of this code was borrowed from SGI's tk OpenGL toolkit.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glu.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
|
||||
#ifndef SEEK_SET
|
||||
# define SEEK_SET 0
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
** RGB Image Structure
|
||||
*/
|
||||
|
||||
typedef struct _TK_RGBImageRec {
|
||||
GLint sizeX, sizeY;
|
||||
GLint components;
|
||||
unsigned char *data;
|
||||
} TK_RGBImageRec;
|
||||
|
||||
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
typedef struct _rawImageRec {
|
||||
unsigned short imagic;
|
||||
unsigned short type;
|
||||
unsigned short dim;
|
||||
unsigned short sizeX, sizeY, sizeZ;
|
||||
unsigned long min, max;
|
||||
unsigned long wasteBytes;
|
||||
char name[80];
|
||||
unsigned long colorMap;
|
||||
FILE *file;
|
||||
unsigned char *tmp, *tmpR, *tmpG, *tmpB, *tmpA;
|
||||
unsigned long rleEnd;
|
||||
GLuint *rowStart;
|
||||
GLint *rowSize;
|
||||
} rawImageRec;
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
static void ConvertShort(unsigned short *array, long length)
|
||||
{
|
||||
unsigned long b1, b2;
|
||||
unsigned char *ptr;
|
||||
|
||||
ptr = (unsigned char *)array;
|
||||
while (length--) {
|
||||
b1 = *ptr++;
|
||||
b2 = *ptr++;
|
||||
*array++ = (unsigned short) ((b1 << 8) | (b2));
|
||||
}
|
||||
}
|
||||
|
||||
static void ConvertLong(GLuint *array, long length)
|
||||
{
|
||||
unsigned long b1, b2, b3, b4;
|
||||
unsigned char *ptr;
|
||||
|
||||
ptr = (unsigned char *)array;
|
||||
while (length--) {
|
||||
b1 = *ptr++;
|
||||
b2 = *ptr++;
|
||||
b3 = *ptr++;
|
||||
b4 = *ptr++;
|
||||
*array++ = (b1 << 24) | (b2 << 16) | (b3 << 8) | (b4);
|
||||
}
|
||||
}
|
||||
|
||||
static rawImageRec *RawImageOpen(const char *fileName)
|
||||
{
|
||||
union {
|
||||
int testWord;
|
||||
char testByte[4];
|
||||
} endianTest;
|
||||
rawImageRec *raw;
|
||||
GLenum swapFlag;
|
||||
int x;
|
||||
|
||||
endianTest.testWord = 1;
|
||||
if (endianTest.testByte[0] == 1) {
|
||||
swapFlag = GL_TRUE;
|
||||
} else {
|
||||
swapFlag = GL_FALSE;
|
||||
}
|
||||
|
||||
raw = (rawImageRec *)malloc(sizeof(rawImageRec));
|
||||
if (raw == NULL) {
|
||||
fprintf(stderr, "Out of memory!\n");
|
||||
return NULL;
|
||||
}
|
||||
if ((raw->file = fopen(fileName, "rb")) == NULL) {
|
||||
perror(fileName);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
fread(raw, 1, 12, raw->file);
|
||||
|
||||
if (swapFlag) {
|
||||
ConvertShort(&raw->imagic, 6);
|
||||
}
|
||||
|
||||
raw->tmp = (unsigned char *)malloc(raw->sizeX*256);
|
||||
raw->tmpR = (unsigned char *)malloc(raw->sizeX*256);
|
||||
raw->tmpG = (unsigned char *)malloc(raw->sizeX*256);
|
||||
raw->tmpB = (unsigned char *)malloc(raw->sizeX*256);
|
||||
if (raw->sizeZ==4) {
|
||||
raw->tmpA = (unsigned char *)malloc(raw->sizeX*256);
|
||||
}
|
||||
if (raw->tmp == NULL || raw->tmpR == NULL || raw->tmpG == NULL ||
|
||||
raw->tmpB == NULL) {
|
||||
fprintf(stderr, "Out of memory!\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if ((raw->type & 0xFF00) == 0x0100) {
|
||||
x = raw->sizeY * raw->sizeZ * sizeof(GLuint);
|
||||
raw->rowStart = (GLuint *)malloc(x);
|
||||
raw->rowSize = (GLint *)malloc(x);
|
||||
if (raw->rowStart == NULL || raw->rowSize == NULL) {
|
||||
fprintf(stderr, "Out of memory!\n");
|
||||
return NULL;
|
||||
}
|
||||
raw->rleEnd = 512 + (2 * x);
|
||||
fseek(raw->file, 512, SEEK_SET);
|
||||
fread(raw->rowStart, 1, x, raw->file);
|
||||
fread(raw->rowSize, 1, x, raw->file);
|
||||
if (swapFlag) {
|
||||
ConvertLong(raw->rowStart, (long) (x/sizeof(GLuint)));
|
||||
ConvertLong((GLuint *)raw->rowSize, (long) (x/sizeof(GLint)));
|
||||
}
|
||||
}
|
||||
return raw;
|
||||
}
|
||||
|
||||
static void RawImageClose(rawImageRec *raw)
|
||||
{
|
||||
|
||||
fclose(raw->file);
|
||||
free(raw->tmp);
|
||||
free(raw->tmpR);
|
||||
free(raw->tmpG);
|
||||
free(raw->tmpB);
|
||||
if (raw->sizeZ>3) {
|
||||
free(raw->tmpA);
|
||||
}
|
||||
free(raw);
|
||||
}
|
||||
|
||||
static void RawImageGetRow(rawImageRec *raw, unsigned char *buf, int y, int z)
|
||||
{
|
||||
unsigned char *iPtr, *oPtr, pixel;
|
||||
int count, done = 0;
|
||||
|
||||
if ((raw->type & 0xFF00) == 0x0100) {
|
||||
fseek(raw->file, (long) raw->rowStart[y+z*raw->sizeY], SEEK_SET);
|
||||
fread(raw->tmp, 1, (unsigned int)raw->rowSize[y+z*raw->sizeY],
|
||||
raw->file);
|
||||
|
||||
iPtr = raw->tmp;
|
||||
oPtr = buf;
|
||||
while (!done) {
|
||||
pixel = *iPtr++;
|
||||
count = (int)(pixel & 0x7F);
|
||||
if (!count) {
|
||||
done = 1;
|
||||
return;
|
||||
}
|
||||
if (pixel & 0x80) {
|
||||
while (count--) {
|
||||
*oPtr++ = *iPtr++;
|
||||
}
|
||||
} else {
|
||||
pixel = *iPtr++;
|
||||
while (count--) {
|
||||
*oPtr++ = pixel;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
fseek(raw->file, 512+(y*raw->sizeX)+(z*raw->sizeX*raw->sizeY),
|
||||
SEEK_SET);
|
||||
fread(buf, 1, raw->sizeX, raw->file);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void RawImageGetData(rawImageRec *raw, TK_RGBImageRec *final)
|
||||
{
|
||||
unsigned char *ptr;
|
||||
int i, j;
|
||||
|
||||
final->data = (unsigned char *)malloc((raw->sizeX+1)*(raw->sizeY+1)*4);
|
||||
if (final->data == NULL) {
|
||||
fprintf(stderr, "Out of memory!\n");
|
||||
}
|
||||
|
||||
ptr = final->data;
|
||||
for (i = 0; i < (int)(raw->sizeY); i++) {
|
||||
RawImageGetRow(raw, raw->tmpR, i, 0);
|
||||
RawImageGetRow(raw, raw->tmpG, i, 1);
|
||||
RawImageGetRow(raw, raw->tmpB, i, 2);
|
||||
if (raw->sizeZ>3) {
|
||||
RawImageGetRow(raw, raw->tmpA, i, 3);
|
||||
}
|
||||
for (j = 0; j < (int)(raw->sizeX); j++) {
|
||||
*ptr++ = *(raw->tmpR + j);
|
||||
*ptr++ = *(raw->tmpG + j);
|
||||
*ptr++ = *(raw->tmpB + j);
|
||||
if (raw->sizeZ>3) {
|
||||
*ptr++ = *(raw->tmpA + j);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static TK_RGBImageRec *tkRGBImageLoad(const char *fileName)
|
||||
{
|
||||
rawImageRec *raw;
|
||||
TK_RGBImageRec *final;
|
||||
|
||||
raw = RawImageOpen(fileName);
|
||||
if (!raw) {
|
||||
fprintf(stderr, "File not found\n");
|
||||
return NULL;
|
||||
}
|
||||
final = (TK_RGBImageRec *)malloc(sizeof(TK_RGBImageRec));
|
||||
if (final == NULL) {
|
||||
fprintf(stderr, "Out of memory!\n");
|
||||
return NULL;
|
||||
}
|
||||
final->sizeX = raw->sizeX;
|
||||
final->sizeY = raw->sizeY;
|
||||
final->components = raw->sizeZ;
|
||||
RawImageGetData(raw, final);
|
||||
RawImageClose(raw);
|
||||
return final;
|
||||
}
|
||||
|
||||
|
||||
static void FreeImage( TK_RGBImageRec *image )
|
||||
{
|
||||
free(image->data);
|
||||
free(image);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Load an SGI .rgb file and generate a set of 2-D mipmaps from it.
|
||||
* Input: imageFile - name of .rgb to read
|
||||
* intFormat - internal texture format to use, or number of components
|
||||
* Return: GL_TRUE if success, GL_FALSE if error.
|
||||
*/
|
||||
GLboolean LoadRGBMipmaps( const char *imageFile, GLint intFormat )
|
||||
{
|
||||
GLint error;
|
||||
GLenum format;
|
||||
TK_RGBImageRec *image;
|
||||
|
||||
image = tkRGBImageLoad( imageFile );
|
||||
if (!image) {
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
if (image->components==3) {
|
||||
format = GL_RGB;
|
||||
}
|
||||
else if (image->components==4) {
|
||||
format = GL_RGBA;
|
||||
}
|
||||
else {
|
||||
/* not implemented */
|
||||
fprintf(stderr,
|
||||
"Error in LoadRGBMipmaps %d-component images not implemented\n",
|
||||
image->components );
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
error = gluBuild2DMipmaps( GL_TEXTURE_2D,
|
||||
intFormat,
|
||||
image->sizeX, image->sizeY,
|
||||
format,
|
||||
GL_UNSIGNED_BYTE,
|
||||
image->data );
|
||||
|
||||
FreeImage(image);
|
||||
return error ? GL_FALSE : GL_TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Load an SGI .rgb file and return a pointer to the image data.
|
||||
* Input: imageFile - name of .rgb to read
|
||||
* Output: width - width of image
|
||||
* height - height of image
|
||||
* format - format of image (GL_RGB or GL_RGBA)
|
||||
* Return: pointer to image data or NULL if error
|
||||
*/
|
||||
GLubyte *LoadRGBImage( const char *imageFile, GLint *width, GLint *height,
|
||||
GLenum *format )
|
||||
{
|
||||
TK_RGBImageRec *image;
|
||||
GLint bytes;
|
||||
GLubyte *buffer;
|
||||
|
||||
image = tkRGBImageLoad( imageFile );
|
||||
if (!image) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (image->components==3) {
|
||||
*format = GL_RGB;
|
||||
}
|
||||
else if (image->components==4) {
|
||||
*format = GL_RGBA;
|
||||
}
|
||||
else {
|
||||
/* not implemented */
|
||||
fprintf(stderr,
|
||||
"Error in LoadRGBImage %d-component images not implemented\n",
|
||||
image->components );
|
||||
return NULL;
|
||||
}
|
||||
|
||||
*width = image->sizeX;
|
||||
*height = image->sizeY;
|
||||
|
||||
bytes = image->sizeX * image->sizeY * image->components;
|
||||
buffer = (GLubyte *) malloc(bytes);
|
||||
if (!buffer)
|
||||
return NULL;
|
||||
|
||||
memcpy( (void *) buffer, (void *) image->data, bytes );
|
||||
|
||||
FreeImage(image);
|
||||
|
||||
return buffer;
|
||||
}
|
||||
|
||||
|
|
@ -1,35 +0,0 @@
|
|||
#include <CGAL/Cartesian.h>
|
||||
#include <CGAL/Viewer_stream.h>
|
||||
|
||||
typedef CGAL::Cartesian<double> rep_t;
|
||||
typedef CGAL::Point_3<rep_t> point_t;
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
|
||||
CGAL::Viewer_3 W(500);
|
||||
W.init_window_thread();
|
||||
stop();
|
||||
point_t p1(100,50,0);
|
||||
point_t p2(200,50,0);
|
||||
point_t p3(300,50,0);
|
||||
point_t p4(100,200,100);
|
||||
point_t p5(200,200,100);
|
||||
point_t p6(300,200,100);
|
||||
point_t p7(100,300,-100);
|
||||
point_t p8(200,300,-100);
|
||||
point_t p9(300,300,-100);
|
||||
W << CGAL::set_precision(100);
|
||||
W << CGAL::set_color_1(CGAL::RED) << p1 << CGAL::set_precision(10) << p2
|
||||
<< CGAL::set_precision(100) << p3;
|
||||
W.display();
|
||||
stop();
|
||||
W << CGAL::set_size(50);
|
||||
W << CGAL::set_color_1(CGAL::ORANGE) << p4 << p5 << p6;
|
||||
W.display();
|
||||
stop();
|
||||
W << CGAL::set_style(CGAL::WIRE)<< CGAL::set_precision(10);
|
||||
W << CGAL::set_color_1(CGAL::BLUE) << p7 << p8 << p9;
|
||||
W.display();
|
||||
pthread_join(W.get_window_thread(), NULL);
|
||||
}
|
||||
|
|
@ -1,85 +0,0 @@
|
|||
#include <CGAL/basic.h>
|
||||
#include <CGAL/Gmpz.h>
|
||||
#include <sys/time.h>
|
||||
#include <fstream>
|
||||
#include <stack>
|
||||
#include <set>
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
|
||||
#include <CGAL/Homogeneous.h>
|
||||
#include <CGAL/Cartesian.h>
|
||||
#include <CGAL/Triangulation_euclidean_traits_xy_3.h>
|
||||
#include <CGAL/Constrained_Delaunay_triangulation_2.h>
|
||||
#include <CGAL/Delaunay_triangulation_2.h>
|
||||
#include <CGAL/Point_3.h>
|
||||
|
||||
|
||||
#include <CGAL/Viewer_stream.h>
|
||||
//#include "demo_win.h"
|
||||
#ifndef V_UTILS
|
||||
#include <CGAL/v_utils.h>
|
||||
#endif
|
||||
|
||||
#include <CGAL/draw_CGAL_Objects.h>
|
||||
|
||||
typedef double db;
|
||||
typedef CGAL::Cartesian<db> Rpp;
|
||||
typedef CGAL::Triangulation_euclidean_traits_xy_3<Rpp> Gtt;
|
||||
typedef Gtt::Point Point_t ;
|
||||
typedef Gtt::Segment Segment_t;
|
||||
typedef Gtt::Triangle Triangle_t;
|
||||
typedef CGAL::Triangulation_vertex_base_2<Gtt> Vbt;
|
||||
typedef CGAL::Constrained_triangulation_face_base_2<Gtt> Fbt;
|
||||
typedef CGAL::Triangulation_default_data_structure_2<Gtt,Vbt,Fbt> Tdst;
|
||||
typedef CGAL::Constrained_Delaunay_triangulation_2<Gtt,Tdst> Triangulation;
|
||||
typedef Triangulation::Face_handle Face_handle;
|
||||
typedef Triangulation::Vertex_handle Vertex_handle;
|
||||
typedef Triangulation::Line_face_circulator Line_face_circulator;
|
||||
typedef Triangulation::Face_iterator Face_iterator;
|
||||
|
||||
typedef CGAL::Point_3<Rpp> point3;
|
||||
typedef CGAL::Triangle_3<Rpp> triangle3;
|
||||
|
||||
|
||||
std::list<point3> lpt;
|
||||
|
||||
|
||||
std::list<point3> set_z_zero(std::list<point3> lp)
|
||||
{
|
||||
|
||||
std::list<point3>::iterator it;
|
||||
std::list<point3> res;
|
||||
for (it=lp.begin(); it!=lp.end(); it++)
|
||||
res.push_back(point3(it->hx(),it->hy(),-200,1));
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
|
||||
Triangulation dtp;
|
||||
|
||||
std::ifstream is("./terrain_2.dat");
|
||||
CGAL::set_ascii_mode(is);
|
||||
std::istream_iterator<Point_t> it(is);
|
||||
std::istream_iterator<Point_t> end;
|
||||
|
||||
for( ; it != end; it++) {
|
||||
dtp.insert( *it);
|
||||
}
|
||||
|
||||
CGAL::Drawable_triangulation_3<Triangulation> ddtp(dtp,CGAL::PURPLE,CGAL::WHITE);
|
||||
|
||||
CGAL::Viewer_3 W(500);
|
||||
W.init_window_thread();
|
||||
// W.set_custom_panel(demo_panel);
|
||||
W.add_drawable(&ddtp,1);
|
||||
W.display();
|
||||
stop();
|
||||
pthread_join(W.get_window_thread(), NULL);
|
||||
}
|
||||
|
|
@ -1,51 +0,0 @@
|
|||
#include <CGAL/Cartesian.h>
|
||||
#include <CGAL/Triangulation_3.h>
|
||||
#include <CGAL/Triangulation_geom_traits_3.h>
|
||||
#include <CGAL/Delaunay_triangulation_3.h>
|
||||
#include <CGAL/Viewer_stream.h>
|
||||
|
||||
|
||||
typedef CGAL::Cartesian<double> rep_t;
|
||||
typedef CGAL::Point_3<rep_t> point_t;
|
||||
typedef CGAL::Tetrahedron_3<rep_t> tetra;
|
||||
|
||||
typedef CGAL::Triangulation_geom_traits_3<rep_t> traits_3;
|
||||
typedef CGAL::Triangulation_vertex_base_3<traits_3> Vb ;
|
||||
typedef CGAL::Triangulation_cell_base_3<traits_3> Fb;
|
||||
typedef CGAL::Triangulation_data_structure_3<Vb,Fb> TDS3 ;
|
||||
typedef CGAL::Triangulation_3< traits_3 , TDS3> Triangulation_3;
|
||||
typedef CGAL::Delaunay_triangulation_3<traits_3,TDS3> Delaunay_3;
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
CGAL::Viewer_3 W(-140, 500, -350, 400, 0, 500);
|
||||
|
||||
Delaunay_3 tr;
|
||||
|
||||
tr.insert(point_t(100,100,100));
|
||||
tr.insert(point_t(400,100,300));
|
||||
tr.insert(point_t(-100,100,-100));
|
||||
tr.insert(point_t(100,-300,0));
|
||||
tr.insert(point_t(500,-100,-200));
|
||||
tr.insert(point_t(-140,400,-200));
|
||||
tr.insert(point_t(100,-350,0));
|
||||
tr.insert(point_t(500,-300,-250));
|
||||
#ifndef _MSC_VER
|
||||
W << CGAL::set_color_1(CGAL::ORANGE) ;
|
||||
#else
|
||||
{
|
||||
CGAL::O_manip<CGAL::Color> xxx = CGAL::set_color_1(CGAL::ORANGE);
|
||||
xxx.f(W,xxx.i);
|
||||
}
|
||||
#endif
|
||||
Delaunay_3::Cell_iterator cit;
|
||||
tetra t;
|
||||
for (cit = tr.finite_cells_begin(); cit != tr.cells_end(); cit++) {
|
||||
t = tr.tetrahedron(cit->handle());
|
||||
W << t;
|
||||
}
|
||||
W.main_loop();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1,99 +0,0 @@
|
|||
#include <CGAL/Cartesian.h>
|
||||
|
||||
#include <CGAL/Triangulation_3.h>
|
||||
#include <CGAL/Triangulation_geom_traits_3.h>
|
||||
|
||||
#include <CGAL/Delaunay_triangulation_3.h>
|
||||
|
||||
#include <CGAL/Viewer_stream.h>
|
||||
|
||||
typedef CGAL::Cartesian<double> rep_t;
|
||||
typedef CGAL::Point_3<rep_t> point_t;
|
||||
typedef CGAL::Tetrahedron_3<rep_t> tetra;
|
||||
|
||||
typedef CGAL::Triangle_3<rep_t> triangle;
|
||||
typedef CGAL::Line_3<rep_t> line;
|
||||
typedef CGAL::Segment_3<rep_t> segment;
|
||||
|
||||
|
||||
typedef CGAL::Triangulation_geom_traits_3<rep_t> traits_3;
|
||||
typedef CGAL::Triangulation_vertex_base_3<traits_3> Vb ;
|
||||
typedef CGAL::Triangulation_cell_base_3<traits_3> Fb;
|
||||
typedef CGAL::Triangulation_data_structure_3<Vb,Fb> TDS3 ;
|
||||
typedef CGAL::Triangulation_3< traits_3 , TDS3> Triangulation_3;
|
||||
typedef CGAL::Delaunay_triangulation_3<traits_3,TDS3> Delaunay_3;
|
||||
|
||||
CGAL::Color change(CGAL::Color &c)
|
||||
{
|
||||
if (c==CGAL::RED) return CGAL::YELLOW;
|
||||
if (c==CGAL::YELLOW) return CGAL::ORANGE;
|
||||
if (c==CGAL::ORANGE) return CGAL::RED;
|
||||
return CGAL::WHITE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
tetra schrink(tetra tet)
|
||||
{
|
||||
point_t p1,p2,p3,p4;
|
||||
double sx,sy,sz;
|
||||
double bx= (tet[0].x()+ tet[1].x()+ tet[2].x()+tet[3].x())/4;
|
||||
double by= (tet[0].y()+ tet[1].y()+ tet[2].y()+tet[3].y())/4;
|
||||
double bz= (tet[0].z()+ tet[1].z()+ tet[2].z()+tet[3].z())/4;
|
||||
sx= (bx - tet[0].x())/3;
|
||||
sy= (by - tet[0].y())/3;
|
||||
sz= (bz - tet[0].z())/3;
|
||||
p1 = point_t(tet[0].x()+sx,tet[0].y()+sy,tet[0].z()+sz);
|
||||
sx= (bx - tet[1].x())/3;
|
||||
sy= (by - tet[1].y())/3;
|
||||
sz= (bz - tet[1].z())/3;
|
||||
p2 = point_t(tet[1].x()+sx,tet[1].y()+sy,tet[1].z()+sz);
|
||||
sx= (bx - tet[2].x())/3;
|
||||
sy= (by - tet[2].y())/3;
|
||||
sz= (bz - tet[2].z())/3;
|
||||
p3 = point_t(tet[2].x()+sx,tet[2].y()+sy,tet[2].z()+sz);
|
||||
sx= (bx - tet[3].x())/3;
|
||||
sy= (by - tet[3].y())/3;
|
||||
sz= (bz - tet[3].z())/3;
|
||||
p4 = point_t(tet[3].x()+sx,tet[3].y()+sy,tet[3].z()+sz);
|
||||
return tetra(p1,p2,p3,p4);
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
|
||||
CGAL::Viewer_3 W(-200, 600, -400, 400, -250, 300);
|
||||
|
||||
Delaunay_3 tr;
|
||||
|
||||
tr.insert(point_t(100,100,100));
|
||||
// tr.insert(point_t(100,100,100));
|
||||
tr.insert(point_t(400,100,300));
|
||||
tr.insert(point_t(-100,100,-100));
|
||||
tr.insert(point_t(100,-300,0));
|
||||
tr.insert(point_t(500,-100,-200));
|
||||
|
||||
tr.insert(point_t(-140,400,-200));
|
||||
tr.insert(point_t(100,-350,0));
|
||||
tr.insert(point_t(500,-300,-250));
|
||||
|
||||
CGAL::Color c=CGAL::ORANGE ;
|
||||
Delaunay_3::Cell_iterator cit;
|
||||
int i=1;
|
||||
tetra t;
|
||||
for (cit = tr.finite_cells_begin(); cit != tr.cells_end(); cit++) {
|
||||
t= schrink(tr.tetrahedron(cit->handle()));
|
||||
CGAL::Drawable_tetrahedron_3<Delaunay_3::Tetrahedron>* tet = new CGAL::Drawable_tetrahedron_3<Delaunay_3::Tetrahedron>(t,c,CGAL::FILL);
|
||||
W.add_drawable(tet,i);
|
||||
i++;
|
||||
c=change(c);
|
||||
}
|
||||
|
||||
|
||||
W.main_loop();
|
||||
return 0;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1,48 +0,0 @@
|
|||
#include <CGAL/Cartesian.h>
|
||||
|
||||
#include <CGAL/Triangulation_3.h>
|
||||
#include <CGAL/Triangulation_geom_traits_3.h>
|
||||
|
||||
#include <CGAL/Delaunay_triangulation_3.h>
|
||||
|
||||
#include <CGAL/Viewer_stream.h>
|
||||
#include "text.h"
|
||||
|
||||
|
||||
typedef CGAL::Cartesian<double> rep_t;
|
||||
typedef CGAL::Point_3<rep_t> point_t;
|
||||
typedef CGAL::Tetrahedron_3<rep_t> tetra;
|
||||
|
||||
|
||||
typedef CGAL::Triangulation_geom_traits_3<rep_t> traits_3;
|
||||
typedef CGAL::Triangulation_vertex_base_3<traits_3> Vb ;
|
||||
typedef CGAL::Triangulation_cell_base_3<traits_3> Fb;
|
||||
typedef CGAL::Triangulation_data_structure_3<Vb,Fb> TDS3 ;
|
||||
typedef CGAL::Triangulation_3< traits_3 , TDS3> Triangulation_3;
|
||||
typedef CGAL::Delaunay_triangulation_3<traits_3,TDS3> Delaunay_3;
|
||||
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
CGAL::Viewer_3 W(500);
|
||||
|
||||
|
||||
Delaunay_3 tr;
|
||||
|
||||
tr.insert(point_t(100,100,100));
|
||||
tr.insert(point_t(100,100,100));
|
||||
tr.insert(point_t(400,100,300));
|
||||
tr.insert(point_t(-100,100,-100));
|
||||
tr.insert(point_t(100,-300,0));
|
||||
tr.insert(point_t(500,-100,-200));
|
||||
tr.insert(point_t(-140,400,-200));
|
||||
tr.insert(point_t(100,-350,0));
|
||||
tr.insert(point_t(500,-300,-250));
|
||||
|
||||
CGAL::Drawable_triangulation_3<Delaunay_3> dtr(tr,CGAL::PURPLE);
|
||||
W.add_drawable(&dtr,1);
|
||||
W.main_loop();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1,226 +0,0 @@
|
|||
|
||||
|
||||
#include "readtex.c"
|
||||
|
||||
|
||||
|
||||
typedef CGAL::Point_3<CGAL::Cartesian<double> > point_3;
|
||||
|
||||
|
||||
#define TABLE_TEXTURE "psy.rgb"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
static GLubyte *Image = NULL;
|
||||
|
||||
|
||||
|
||||
static int ImgWidth, ImgHeight;
|
||||
static GLenum ImgFormat;
|
||||
|
||||
|
||||
|
||||
void draw_tri_tex(double x1, double y1, double z1,double x2, double
|
||||
y2, double z2,double x3, double y3, double z3)
|
||||
|
||||
{
|
||||
glPolygonMode(GL_FRONT,GL_FILL);
|
||||
glBegin(GL_TRIANGLES);
|
||||
|
||||
std::vector<double> v1(3);
|
||||
std::vector<double> v2(3);
|
||||
v1 = CGAL::normal(x1,y1,z1,x2,y2,z2,x3,y3,z3);
|
||||
|
||||
v2[0]= -v1[0]; v2[1]=-v1[1] ; v2[2]= -v1[2];
|
||||
glNormal3d(v1[0],v1[1],v1[2]);
|
||||
glTexCoord2f( 0.0, 0.0 );
|
||||
glVertex3f(x1,y1,z1);
|
||||
glNormal3d(v2[0],v2[1],v2[2]);
|
||||
glTexCoord2f( 1.0, 0.0 );
|
||||
glVertex3f(x2,y2,z2);
|
||||
glNormal3d(v1[0],v1[1],v1[2]);
|
||||
glTexCoord2f( 1,1 );
|
||||
glVertex3f(x3,y3,z3);
|
||||
glEnd();
|
||||
}
|
||||
|
||||
|
||||
void schrink_point(point_3 &p1, point_3 &p2, point_3 &p3, point_3 &p4)
|
||||
{
|
||||
double sx,sy,sz;
|
||||
double bx= (p1.x()+ p2.x()+ p3.x()+p4.x())/4;
|
||||
double by= (p1.y()+ p2.y()+ p3.y()+p4.y())/4;
|
||||
double bz= (p1.z()+ p2.z()+ p3.z()+p4.z())/4;
|
||||
sx= (bx - p1.x())/3;
|
||||
sy= (by - p1.y())/3;
|
||||
sz= (bz - p1.z())/3;
|
||||
p1 = point_3(p1.x()+sx,p1.y()+sy,p1.z()+sz);
|
||||
sx= (bx - p2.x())/3;
|
||||
sy= (by - p2.y())/3;
|
||||
sz= (bz - p2.z())/3;
|
||||
p2 = point_3(p2.x()+sx,p2.y()+sy,p2.z()+sz);
|
||||
sx= (bx - p3.x())/3;
|
||||
sy= (by - p3.y())/3;
|
||||
sz= (bz - p3.z())/3;
|
||||
p3 = point_3(p3.x()+sx,p3.y()+sy,p3.z()+sz);
|
||||
sx= (bx - p4.x())/3;
|
||||
sy= (by - p4.y())/3;
|
||||
sz= (bz - p4.z())/3;
|
||||
p4 = point_3(p4.x()+sx,p4.y()+sy,p4.z()+sz);
|
||||
}
|
||||
|
||||
CGAL_BEGIN_NAMESPACE
|
||||
|
||||
template<class tetrahedron>
|
||||
class Drawable_tetrahedron_tex: public Drawable_object
|
||||
{
|
||||
private:
|
||||
tetrahedron tr;
|
||||
|
||||
public:
|
||||
|
||||
Drawable_tetrahedron_tex(){type="Tetrahedron";}
|
||||
Drawable_tetrahedron_tex(const tetrahedron &tet,Color c, Style
|
||||
sty=WIRE, Size s=5, Precision prec=15)
|
||||
|
||||
{
|
||||
tr=tet;
|
||||
color = c; size=s;
|
||||
set_center();lind=0;type="Tetrahedron";style=sty;precision=prec;
|
||||
}
|
||||
|
||||
void set_center()
|
||||
{
|
||||
o_center[0]=(tr[0].x()+tr[1].x()+tr[2].x()+tr[3].x())/4;
|
||||
o_center[1]=(tr[0].y()+tr[1].y()+tr[2].y()+tr[3].y())/4;
|
||||
o_center[2]=(tr[0].z()+tr[1].z()+tr[2].z()+tr[3].z())/4;
|
||||
}
|
||||
|
||||
void draw()
|
||||
{
|
||||
glEnable( GL_TEXTURE_2D );
|
||||
if(lind)
|
||||
glCallList(lind);
|
||||
else {
|
||||
lind = glGenLists(1);
|
||||
Image = LoadRGBImage( TABLE_TEXTURE, &ImgWidth, &ImgHeight, &ImgFormat
|
||||
);
|
||||
|
||||
gluBuild2DMipmaps(GL_TEXTURE_2D, 3, ImgWidth, ImgHeight,
|
||||
GL_RGB, GL_UNSIGNED_BYTE, Image);
|
||||
//glTexImage2D(GL_TEXTURE_2D,0,3, ImgWidth, ImgHeight,0,GL_RGB, GL_UNSIGNED_//BYTE, Image);
|
||||
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT );
|
||||
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT );
|
||||
// glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST );
|
||||
// glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST
|
||||
// );
|
||||
// glEnable( GL_TEXTURE_2D );
|
||||
|
||||
glNewList(lind,GL_COMPILE_AND_EXECUTE);
|
||||
glLineWidth(size);
|
||||
set_color(color);
|
||||
draw_tri_tex(tr[0].x(),tr[0].y(),tr[0].z(),tr[1].x(),tr[1].y(),
|
||||
tr[1].z(),tr[2].x(),tr[2].y(),tr[2].z());
|
||||
draw_tri_tex(tr[0].x(),tr[0].y(),tr[0].z(),tr[1].x(),tr[1].y(),
|
||||
tr[1].z(),tr[3].x(),tr[3].y(),tr[3].z());
|
||||
draw_tri_tex(tr[0].x(),tr[0].y(),tr[0].z(),tr[3].x(),tr[3].y(),
|
||||
tr[3].z(),tr[2].x(),tr[2].y(),tr[2].z());
|
||||
draw_tri_tex(tr[1].x(),tr[1].y(),tr[1].z(),tr[2].x(),tr[2].y(),
|
||||
tr[2].z(),tr[3].x(),tr[3].y(),tr[3].z());
|
||||
}
|
||||
|
||||
glEndList();
|
||||
glDisable( GL_TEXTURE_2D );
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
template<class triangulation_3>
|
||||
class Drawable_triangulation_3: public CGAL::Drawable_object
|
||||
{
|
||||
private:
|
||||
triangulation_3 tr;
|
||||
|
||||
public:
|
||||
|
||||
|
||||
Drawable_triangulation_3(){type="Tetrahedron";}
|
||||
|
||||
|
||||
Drawable_triangulation_3(const triangulation_3 &tet,Color c, Style
|
||||
sty=WIRE, Size s=5, Precision prec=15)
|
||||
|
||||
{
|
||||
tr=tet;
|
||||
color = c; size=s;
|
||||
set_center();lind=0;type="Triangulation_3";style=sty;precision=prec;
|
||||
// Image = LoadRGBImage( TABLE_TEXTURE, &ImgWidth, &ImgHeight, &ImgFormat);
|
||||
// int i =gluBuild2DMipmaps(GL_TEXTURE_2D, 3,ImgWidth,ImgHeight ,
|
||||
// GL_RGB, GL_UNSIGNED_BYTE, Image);
|
||||
// glTexImage2D(GL_TEXTURE_2D,0,3, ImgWidth, ImgHeight,0,G// L_RGB, GL_UNSIGNED_BYTE, Image);
|
||||
|
||||
// glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT );
|
||||
// glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT );
|
||||
// glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
// glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
}
|
||||
|
||||
void set_center()
|
||||
{
|
||||
|
||||
typename triangulation_3::Vertex_iterator vit;
|
||||
o_center[0]=0;o_center[1]=0;o_center[2]=0;
|
||||
for (vit=tr.finite_vertices_begin() ; vit != tr.vertices_end(); vit++) {
|
||||
o_center[0]= o_center[0] + vit->point().x();
|
||||
o_center[1]= o_center[1] + vit->point().y();
|
||||
o_center[2]= o_center[2] + vit->point().z();
|
||||
}
|
||||
o_center[0] = o_center[0]/tr.number_of_vertices();
|
||||
o_center[1] = o_center[1]/tr.number_of_vertices();
|
||||
o_center[2] = o_center[2]/tr.number_of_vertices();
|
||||
}
|
||||
|
||||
void draw()
|
||||
{
|
||||
// glEnable( GL_TEXTURE_2D );
|
||||
if(lind)
|
||||
glCallList(lind);
|
||||
else {
|
||||
lind = glGenLists(1);
|
||||
glNewList(lind,GL_COMPILE_AND_EXECUTE);
|
||||
point_3 p0,p1,p2, p3;
|
||||
set_color(color);
|
||||
typename triangulation_3::Cell_iterator cit;
|
||||
for (cit = tr.finite_cells_begin(); cit != tr.cells_end(); cit++)
|
||||
{
|
||||
p0=(cit->vertex(0))->point();
|
||||
p1=(cit->vertex(1))->point();
|
||||
p2=(cit->vertex(2))->point();
|
||||
p3=(cit->vertex(3))->point();
|
||||
schrink_point(p0,p1,p2,p3);
|
||||
|
||||
draw_tri_tex(p1.x(),p1.y(),p1.z(),p3.x(),p3.y(),p3.z(),p2.x(),p2.y(),p2.z());
|
||||
|
||||
draw_tri_tex(p0.x(),p0.y(),p0.z(),p2.x(),p2.y(),p2.z(),p3.x(),p3.y(),p3.z());
|
||||
draw_tri_tex(p0.x(),p0.y(),p0.z(),p3.x(),p3.y(),p3.z(),p1.x(),p1.y(),p1.z());
|
||||
draw_tri_tex(p0.x(),p0.y(),p0.z(),p1.x(),p1.y(),p1.z(),p2.x(),p2.y(),p2.z());
|
||||
}
|
||||
}
|
||||
glEndList();
|
||||
// glDisable( GL_TEXTURE_2D );
|
||||
}
|
||||
|
||||
void add_point(double x, double y ,double z)
|
||||
{
|
||||
glDeleteLists(lind,1);
|
||||
lind=0;
|
||||
typedef typename triangulation_3::Point Point;
|
||||
tr.insert(Point(x,y,z));
|
||||
set_center();
|
||||
}
|
||||
};
|
||||
|
||||
CGAL_END_NAMESPACE
|
||||
|
|
@ -1,111 +0,0 @@
|
|||
|
||||
#include <CGAL/Triangulation_euclidean_traits_2.h>
|
||||
#include <CGAL/Triangulation_default_data_structure_2.h>
|
||||
#include <CGAL/Triangulation_vertex_base_2.h>
|
||||
#include <CGAL/Triangulation_face_base_2.h>
|
||||
#include <CGAL/Triangulation_2.h>
|
||||
#include <CGAL/Delaunay_triangulation_2.h>
|
||||
|
||||
#include <CGAL/Line_2.h>
|
||||
|
||||
#include <CGAL/Ray_2.h>
|
||||
|
||||
|
||||
typedef CGAL::Cartesian<double> rep_t;
|
||||
|
||||
typedef CGAL::Line_2 <rep_t> Line2;
|
||||
typedef CGAL::Ray_2 <rep_t> Ray2;
|
||||
|
||||
typedef CGAL::Triangulation_euclidean_traits_2< rep_t > Ttraits;
|
||||
typedef CGAL::Triangulation_vertex_base_2<Ttraits> Vertex_base ;
|
||||
typedef CGAL::Triangulation_face_base_2<Ttraits> Face_base ;
|
||||
typedef CGAL::Triangulation_default_data_structure_2<Ttraits,Vertex_base,Face_base> TDS ;
|
||||
typedef CGAL::Triangulation_2< Ttraits , TDS> Triangulation_2;
|
||||
typedef CGAL::Delaunay_triangulation_2< Ttraits , TDS> Delaunay_2;
|
||||
|
||||
|
||||
CGAL_BEGIN_NAMESPACE
|
||||
|
||||
|
||||
template<class triangulation_2>
|
||||
class Drawable_voronoi_2: public Drawable_object
|
||||
{
|
||||
private:
|
||||
triangulation_2 tr;
|
||||
|
||||
public:
|
||||
|
||||
|
||||
Drawable_voronoi_2(){type="voronoi_2";}
|
||||
|
||||
Drawable_voronoi_2(const triangulation_2 &tet,Color c, Style
|
||||
sty=WIRE, Size s=5, Precision prec=15)
|
||||
{
|
||||
tr=tet;
|
||||
color = c; size=s;
|
||||
set_center();lind=0;type="voronoi_2";style=sty;precision=prec;
|
||||
}
|
||||
|
||||
void set_center()
|
||||
{
|
||||
|
||||
typename triangulation_2::Vertex_iterator vit;
|
||||
o_center[0]=0;o_center[1]=0;o_center[2]=0;
|
||||
for (vit=tr.finite_vertices_begin() ; vit != tr.vertices_end(); vit++) {
|
||||
o_center[0]= o_center[0] + vit->point().x();
|
||||
o_center[1]= o_center[1] + vit->point().y();
|
||||
}
|
||||
o_center[0] = o_center[0]/tr.number_of_vertices();
|
||||
o_center[1] = o_center[1]/tr.number_of_vertices();
|
||||
}
|
||||
|
||||
void draw()
|
||||
{
|
||||
if(lind)
|
||||
glCallList(lind);
|
||||
else {
|
||||
lind = glGenLists(1);
|
||||
glNewList(lind,GL_COMPILE_AND_EXECUTE);
|
||||
set_color(color);
|
||||
glLineWidth(size);
|
||||
|
||||
typedef typename triangulation_2::Edge_iterator Edge_iterator;
|
||||
|
||||
Edge_iterator it = tr.edges_begin(),
|
||||
beyond = tr.edges_end();
|
||||
glBegin( GL_LINES );
|
||||
for ( ;it != beyond; ++it) {
|
||||
CGAL::Object o = tr.dual(it);
|
||||
Line2 l;
|
||||
Ray2 r;
|
||||
typename triangulation_2::Segment s;
|
||||
if (assign(s,o)) {
|
||||
glVertex2f(s.source().x(),s.source().y() );
|
||||
glVertex2f(s.target().x(),s.target().y());
|
||||
}
|
||||
if (assign(r,o)) {
|
||||
glVertex2f(r.source().x(),r.source().y() );
|
||||
glVertex2f(r.point(1000).x(),r.point(1000).y());
|
||||
}
|
||||
if (assign(l,o)) {
|
||||
glVertex2f(l.point(-1000).x(),l.point(-1000).y());
|
||||
glVertex2f(l.point(1000).x(),l.point(1000).y());
|
||||
}
|
||||
}
|
||||
glEnd();
|
||||
}
|
||||
glEndList();
|
||||
}
|
||||
|
||||
|
||||
void add_point(double x, double y ,double z)
|
||||
{
|
||||
glDeleteLists(lind,1);
|
||||
lind=0;
|
||||
typedef typename triangulation_2::Point Point;
|
||||
tr.insert(Point(x,y));
|
||||
set_center();
|
||||
}
|
||||
};
|
||||
|
||||
CGAL_END_NAMESPACE
|
||||
|
|
@ -1 +0,0 @@
|
|||
A 3D viewer for CGAL objects. Based on OpenGL and FLTK.
|
||||
|
|
@ -1,30 +0,0 @@
|
|||
% +------------------------------------------------------------------------+
|
||||
% | CGAL Reference Manual: wrapper.tex
|
||||
% +------------------------------------------------------------------------+
|
||||
% | Main TeX file for testing CGAL packages.
|
||||
% +------------------------------------------------------------------------+
|
||||
|
||||
%\documentclass{book}
|
||||
|
||||
%\usepackage{cprog}
|
||||
%\usepackage{cc_manual}
|
||||
%\usepackage{cc_manual_index}
|
||||
%\usepackage{amssymb}
|
||||
%\usepackage{graphicx}
|
||||
%\usepackage{path}
|
||||
%\usepackage{ipe}
|
||||
%\input{psfig}
|
||||
% page dimensions
|
||||
% ---------------
|
||||
% The page dimensions are compulsory and may not be changed in main.tex.
|
||||
|
||||
|
||||
% default column layout
|
||||
% ---------------------
|
||||
% This is the recommended layout. It may be changed inside main.tex.
|
||||
|
||||
|
||||
\input{Viewer_3/viewer}
|
||||
|
||||
|
||||
%% EOF %%
|
||||
|
|
@ -1,217 +0,0 @@
|
|||
%!PS-Adobe-2.0 EPSF-2.0
|
||||
%%Title: viewer.eps
|
||||
%%Creator: fig2dev Version 3.2 Patchlevel 1
|
||||
%%CreationDate: Tue Nov 23 14:08:47 1999
|
||||
%%For: frebufat@algorab (Francois Rebufat,L016,657762)
|
||||
%%Orientation: Portrait
|
||||
%%BoundingBox: 0 0 306 347
|
||||
%%Pages: 0
|
||||
%%BeginSetup
|
||||
%%EndSetup
|
||||
%%Magnification: 1.0000
|
||||
%%EndComments
|
||||
/$F2psDict 200 dict def
|
||||
$F2psDict begin
|
||||
$F2psDict /mtrx matrix put
|
||||
/col-1 {0 setgray} bind def
|
||||
/col0 {0.000 0.000 0.000 srgb} bind def
|
||||
/col1 {0.000 0.000 1.000 srgb} bind def
|
||||
/col2 {0.000 1.000 0.000 srgb} bind def
|
||||
/col3 {0.000 1.000 1.000 srgb} bind def
|
||||
/col4 {1.000 0.000 0.000 srgb} bind def
|
||||
/col5 {1.000 0.000 1.000 srgb} bind def
|
||||
/col6 {1.000 1.000 0.000 srgb} bind def
|
||||
/col7 {1.000 1.000 1.000 srgb} bind def
|
||||
/col8 {0.000 0.000 0.560 srgb} bind def
|
||||
/col9 {0.000 0.000 0.690 srgb} bind def
|
||||
/col10 {0.000 0.000 0.820 srgb} bind def
|
||||
/col11 {0.530 0.810 1.000 srgb} bind def
|
||||
/col12 {0.000 0.560 0.000 srgb} bind def
|
||||
/col13 {0.000 0.690 0.000 srgb} bind def
|
||||
/col14 {0.000 0.820 0.000 srgb} bind def
|
||||
/col15 {0.000 0.560 0.560 srgb} bind def
|
||||
/col16 {0.000 0.690 0.690 srgb} bind def
|
||||
/col17 {0.000 0.820 0.820 srgb} bind def
|
||||
/col18 {0.560 0.000 0.000 srgb} bind def
|
||||
/col19 {0.690 0.000 0.000 srgb} bind def
|
||||
/col20 {0.820 0.000 0.000 srgb} bind def
|
||||
/col21 {0.560 0.000 0.560 srgb} bind def
|
||||
/col22 {0.690 0.000 0.690 srgb} bind def
|
||||
/col23 {0.820 0.000 0.820 srgb} bind def
|
||||
/col24 {0.500 0.190 0.000 srgb} bind def
|
||||
/col25 {0.630 0.250 0.000 srgb} bind def
|
||||
/col26 {0.750 0.380 0.000 srgb} bind def
|
||||
/col27 {1.000 0.500 0.500 srgb} bind def
|
||||
/col28 {1.000 0.630 0.630 srgb} bind def
|
||||
/col29 {1.000 0.750 0.750 srgb} bind def
|
||||
/col30 {1.000 0.880 0.880 srgb} bind def
|
||||
/col31 {1.000 0.840 0.000 srgb} bind def
|
||||
/col32 {0.286 0.271 0.278 srgb} bind def
|
||||
/col33 {0.780 0.780 0.745 srgb} bind def
|
||||
|
||||
end
|
||||
save
|
||||
-146.0 430.0 translate
|
||||
1 -1 scale
|
||||
|
||||
/cp {closepath} bind def
|
||||
/ef {eofill} bind def
|
||||
/gr {grestore} bind def
|
||||
/gs {gsave} bind def
|
||||
/sa {save} bind def
|
||||
/rs {restore} bind def
|
||||
/l {lineto} bind def
|
||||
/m {moveto} bind def
|
||||
/rm {rmoveto} bind def
|
||||
/n {newpath} bind def
|
||||
/s {stroke} bind def
|
||||
/sh {show} bind def
|
||||
/slc {setlinecap} bind def
|
||||
/slj {setlinejoin} bind def
|
||||
/slw {setlinewidth} bind def
|
||||
/srgb {setrgbcolor} bind def
|
||||
/rot {rotate} bind def
|
||||
/sc {scale} bind def
|
||||
/sd {setdash} bind def
|
||||
/ff {findfont} bind def
|
||||
/sf {setfont} bind def
|
||||
/scf {scalefont} bind def
|
||||
/sw {stringwidth} bind def
|
||||
/tr {translate} bind def
|
||||
/tnt {dup dup currentrgbcolor
|
||||
4 -2 roll dup 1 exch sub 3 -1 roll mul add
|
||||
4 -2 roll dup 1 exch sub 3 -1 roll mul add
|
||||
4 -2 roll dup 1 exch sub 3 -1 roll mul add srgb}
|
||||
bind def
|
||||
/shd {dup dup currentrgbcolor 4 -2 roll mul 4 -2 roll mul
|
||||
4 -2 roll mul srgb} bind def
|
||||
/DrawEllipse {
|
||||
/endangle exch def
|
||||
/startangle exch def
|
||||
/yrad exch def
|
||||
/xrad exch def
|
||||
/y exch def
|
||||
/x exch def
|
||||
/savematrix mtrx currentmatrix def
|
||||
x y tr xrad yrad sc 0 0 1 startangle endangle arc
|
||||
closepath
|
||||
savematrix setmatrix
|
||||
} def
|
||||
|
||||
/$F2psBegin {$F2psDict begin /$F2psEnteredState save def} def
|
||||
/$F2psEnd {$F2psEnteredState restore end} def
|
||||
%%EndProlog
|
||||
|
||||
$F2psBegin
|
||||
10 setmiterlimit
|
||||
n -1000 8158 m -1000 -1000 l 8533 -1000 l 8533 8158 l cp clip
|
||||
0.06000 0.06000 sc
|
||||
% Polyline
|
||||
30.000 slw
|
||||
n 2475 2850 m 7500 2850 l 7500 7125 l 2475 7125 l cp gs col33 1.00 shd ef gr gs col0 s gr
|
||||
% Polyline
|
||||
15.000 slw
|
||||
n 2625 3675 m 3450 3675 l 3450 7050 l 2625 7050 l cp gs col33 1.00 shd ef gr gs col0 s gr
|
||||
% Polyline
|
||||
7.500 slw
|
||||
gs clippath
|
||||
6630 3504 m 6600 3600 l 6570 3504 l 6570 3615 l 6630 3615 l cp
|
||||
clip
|
||||
n 5325 1725 m 6600 1725 l 6600 3600 l gs col0 s gr gr
|
||||
|
||||
% arrowhead
|
||||
n 6630 3504 m 6600 3600 l 6570 3504 l 6600 3480 l 6630 3504 l cp gs 0.00 setgray ef gr col0 s
|
||||
% Polyline
|
||||
15.000 slw
|
||||
n 3675 3675 m 7350 3675 l 7350 6975 l 3675 6975 l cp gs col32 1.00 shd ef gr gs col0 s gr
|
||||
/Times-Bold ff 180.00 scf sf
|
||||
2775 3900 m
|
||||
gs 1 -1 sc (Group) col0 sh gr
|
||||
% Polyline
|
||||
[15 68] 68 sd
|
||||
n 3000 4125 m 3000 5700 l gs col33 1.00 shd ef gr gs col0 s gr [] 0 sd
|
||||
7.500 slw
|
||||
% Ellipse
|
||||
n 4875 5025 480 480 0 360 DrawEllipse gs col7 s gr
|
||||
|
||||
% Polyline
|
||||
n 4275 5775 m 5400 4125 l gs col7 s gr
|
||||
% Polyline
|
||||
n 5550 4950 m 5025 5625 l 5925 5850 l cp gs col7 s gr
|
||||
% Polyline
|
||||
n 2625 3000 m 3375 3000 l 3375 3225 l 2625 3225 l cp gs col33 1.00 shd ef gr gs col0 s gr
|
||||
% Polyline
|
||||
n 3525 3000 m 4275 3000 l 4275 3225 l 3525 3225 l cp gs col33 1.00 shd ef gr gs col0 s gr
|
||||
% Polyline
|
||||
n 4425 3000 m 5175 3000 l 5175 3225 l 4425 3225 l cp gs col33 1.00 shd ef gr gs col0 s gr
|
||||
% Polyline
|
||||
gs clippath
|
||||
3180 3429 m 3150 3525 l 3120 3429 l 3120 3540 l 3180 3540 l cp
|
||||
clip
|
||||
n 3150 1875 m 3150 3525 l gs col33 1.00 shd ef gr gs col0 s gr gr
|
||||
|
||||
% arrowhead
|
||||
n 3180 3429 m 3150 3525 l 3120 3429 l 3150 3405 l 3180 3429 l cp gs 0.00 setgray ef gr col0 s
|
||||
% Polyline
|
||||
gs clippath
|
||||
3596 3529 m 3525 3600 l 3543 3501 l 3491 3599 l 3545 3627 l cp
|
||||
clip
|
||||
n 3525 3600 m 4350 2025 l gs col33 1.00 shd ef gr gs col0 s gr gr
|
||||
|
||||
% arrowhead
|
||||
n 3596 3529 m 3525 3600 l 3543 3501 l 3581 3494 l 3596 3529 l cp gs 0.00 setgray ef gr col0 s
|
||||
% Polyline
|
||||
gs clippath
|
||||
5055 4404 m 5025 4500 l 4995 4404 l 4995 4515 l 5055 4515 l cp
|
||||
clip
|
||||
n 5025 2475 m 5025 4500 l gs col33 1.00 shd ef gr gs col0 s gr gr
|
||||
|
||||
% arrowhead
|
||||
n 5055 4404 m 5025 4500 l 4995 4404 l 5025 4380 l 5055 4404 l cp gs 0.00 setgray ef gr col0 s
|
||||
% Polyline
|
||||
gs clippath
|
||||
3541 2826 m 3525 2925 l 3482 2834 l 3497 2944 l 3557 2936 l cp
|
||||
clip
|
||||
n 3375 1875 m 3525 2925 l gs col33 1.00 shd ef gr gs col0 s gr gr
|
||||
|
||||
% arrowhead
|
||||
n 3541 2826 m 3525 2925 l 3482 2834 l 3508 2806 l 3541 2826 l cp gs 0.00 setgray ef gr col0 s
|
||||
% Polyline
|
||||
gs clippath
|
||||
2824 2837 m 2775 2925 l 2766 2825 l 2743 2933 l 2801 2946 l cp
|
||||
clip
|
||||
n 3000 1875 m 2775 2925 l gs col33 1.00 shd ef gr gs col0 s gr gr
|
||||
|
||||
% arrowhead
|
||||
n 2824 2837 m 2775 2925 l 2766 2825 l 2800 2808 l 2824 2837 l cp gs 0.00 setgray ef gr col0 s
|
||||
% Polyline
|
||||
gs clippath
|
||||
3457 3842 m 3375 3900 l 3410 3806 l 3342 3894 l 3390 3930 l cp
|
||||
clip
|
||||
n 4650 2250 m 3375 3900 l gs col33 1.00 shd ef gr gs col0 s gr gr
|
||||
|
||||
% arrowhead
|
||||
n 3457 3842 m 3375 3900 l 3410 3806 l 3448 3805 l 3457 3842 l cp gs 0.00 setgray ef gr col0 s
|
||||
/Times-Bold ff 210.00 scf sf
|
||||
3300 1575 m
|
||||
gs 1 -1 sc (Viewer_3) col0 sh gr
|
||||
/Times-Bold ff 210.00 scf sf
|
||||
4050 1800 m
|
||||
gs 1 -1 sc (GL_window) col0 sh gr
|
||||
/Times-Bold ff 210.00 scf sf
|
||||
4350 2025 m
|
||||
gs 1 -1 sc (Scene_Graph) col0 sh gr
|
||||
/Times-Bold ff 210.00 scf sf
|
||||
4650 2250 m
|
||||
gs 1 -1 sc (Scene_Group) col0 sh gr
|
||||
/Times-Bold ff 210.00 scf sf
|
||||
4950 2475 m
|
||||
gs 1 -1 sc (Drawable_object) col0 sh gr
|
||||
/Times-Bold ff 210.00 scf sf
|
||||
2775 1800 m
|
||||
gs 1 -1 sc (widgets) col0 sh gr
|
||||
% Ellipse
|
||||
n 4500 4725 375 375 0 360 DrawEllipse gs col7 s gr
|
||||
|
||||
$F2psEnd
|
||||
rs
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 5.3 KiB |
File diff suppressed because it is too large
Load Diff
|
|
@ -1,116 +0,0 @@
|
|||
// Copyright (c) 1999 Utrecht University (The Netherlands),
|
||||
// ETH Zurich (Switzerland), Freie Universitaet Berlin (Germany),
|
||||
// INRIA Sophia-Antipolis (France), Martin-Luther-University Halle-Wittenberg
|
||||
// (Germany), Max-Planck-Institute Saarbruecken (Germany), RISC Linz (Austria),
|
||||
// and Tel-Aviv University (Israel). All rights reserved.
|
||||
//
|
||||
// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public License as
|
||||
// published by the Free Software Foundation; version 2.1 of the License.
|
||||
// See the file LICENSE.LGPL distributed with CGAL.
|
||||
//
|
||||
// Licensees holding a valid commercial license may use this file in
|
||||
// accordance with the commercial license agreement provided with the software.
|
||||
//
|
||||
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
//
|
||||
//
|
||||
// Author(s) : Francois Rebufat <Francois.Rebufat@sophia.inria.fr>
|
||||
|
||||
#ifndef CGAL_DRAWABLE_OBJECT_H
|
||||
#define CGAL_DRAWABLE_OBJECT_H
|
||||
|
||||
#include "PS_Stream_3.C"
|
||||
|
||||
typedef CGAL::Cartesian<double> D;
|
||||
typedef CGAL::Bbox_3 PS_BBox3;
|
||||
typedef CGAL::Direction_3< D > Direction;
|
||||
typedef CGAL::Point_3< D > Point3;
|
||||
typedef CGAL::Point_2< D > Point2;
|
||||
typedef CGAL::Plane_3< D > Plane3;typedef CGAL::Direction_3< D > Direction;
|
||||
typedef CGAL::Line_3< D > Line3;
|
||||
|
||||
|
||||
#include <CGAL/basic.h>
|
||||
#include <CGAL/IO/Color.h>
|
||||
#include <GL/gl.h>
|
||||
#define DRAWABLE
|
||||
//enum Style {FILL=1, WIRE, RAW, FOS1, FOS2, FOS3, FOS4, FOS5};
|
||||
CGAL_BEGIN_NAMESPACE
|
||||
|
||||
enum Style {FILL=1, WIRE, RAW, FOS1, FOS2, FOS3, FOS4, FOS5};
|
||||
typedef int Size;
|
||||
typedef unsigned char Precision;
|
||||
|
||||
|
||||
|
||||
//############################################################################
|
||||
//#### GENERIC CLASS FOR DRAWABLE OBJECT #########
|
||||
class Drawable_object {
|
||||
|
||||
protected:
|
||||
Color color;
|
||||
Color col2;
|
||||
Style style;
|
||||
Precision precision;
|
||||
Size size;
|
||||
double o_center[3];
|
||||
int lind;
|
||||
|
||||
public:
|
||||
char* type;
|
||||
// Drawable_object(){type="Undefined";}
|
||||
|
||||
Drawable_object()
|
||||
{}
|
||||
|
||||
virtual ~Drawable_object(){}
|
||||
virtual void draw() {std::cerr << "virtual draw object()" << std::endl;}
|
||||
void set_center() {std::cerr << "virtual set_center" <<
|
||||
std::endl;}
|
||||
double get_center(int i)
|
||||
{
|
||||
if ((i<1) || (i>3))
|
||||
std::cerr << "bad indice value : " << i <<std::endl;
|
||||
else if (i==1)
|
||||
return o_center[0];
|
||||
else if (i==2)
|
||||
return o_center[1];
|
||||
else
|
||||
return o_center[2];
|
||||
return 0;
|
||||
}
|
||||
|
||||
void set_style(Style s)
|
||||
{
|
||||
style=s;
|
||||
glDeleteLists(lind,1);
|
||||
lind=0;
|
||||
}
|
||||
|
||||
void set_colors(Color c1, Color c2)
|
||||
{
|
||||
color=c1;
|
||||
col2=c2;
|
||||
glDeleteLists(lind,1);
|
||||
lind=0;
|
||||
}
|
||||
|
||||
void set_color1(Color c) {set_colors(c, col2);}
|
||||
void set_color2(Color c) {set_colors(color, c);}
|
||||
|
||||
virtual void add_point(double x, double y, double z) {}
|
||||
|
||||
virtual void to_ps(PS_Stream_3 &ps){
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
CGAL_END_NAMESPACE
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -1,12 +0,0 @@
|
|||
POUR LE PostScript :
|
||||
|
||||
Dans GL_win.h : il y a la fonction principale draw_ps() qui est appellee par le bouton. Il faut : -> declarer et initialiser le stream.
|
||||
-> decommenter ce qui est commenter.
|
||||
|
||||
Dans scene_group.h : il y a une fonction to_ps(ps_stream &ps). Il faut : lui passer le bon type (ps_stream) et la decommenter.
|
||||
|
||||
Dans le fichier Drawable_object.h : il y a la fonction virtuelle to_ps(ps_stream &ps) : Il faut : lui passer le bon type (ps_stream) et la decommenter.
|
||||
|
||||
Dans le fichier draw_CGAL_Objects.h : chaque drawable objet doit implementer une fonction void to_ps(ps_stream &ps) qui envoie le data member (copie de l'objet CGAL) dans le stream. Un exemple est donne (commente) pour Drawable_point_3.
|
||||
|
||||
Voila, c'est tout... ca devrait marcher... le bouton est en place (dans Viewer.h) et ne fait que appeler draw_ps() dans Dans GL_win.h. Bonne chance...
|
||||
|
|
@ -1,81 +0,0 @@
|
|||
// Copyright (c) 1999 Utrecht University (The Netherlands),
|
||||
// ETH Zurich (Switzerland), Freie Universitaet Berlin (Germany),
|
||||
// INRIA Sophia-Antipolis (France), Martin-Luther-University Halle-Wittenberg
|
||||
// (Germany), Max-Planck-Institute Saarbruecken (Germany), RISC Linz (Austria),
|
||||
// and Tel-Aviv University (Israel). All rights reserved.
|
||||
//
|
||||
// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public License as
|
||||
// published by the Free Software Foundation; version 2.1 of the License.
|
||||
// See the file LICENSE.LGPL distributed with CGAL.
|
||||
//
|
||||
// Licensees holding a valid commercial license may use this file in
|
||||
// accordance with the commercial license agreement provided with the software.
|
||||
//
|
||||
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
//
|
||||
//
|
||||
// Author(s) : Francois Rebufat <Francois.Rebufat@sophia.inria.fr>
|
||||
#include <pthread.h>
|
||||
#include <iostream>
|
||||
|
||||
class Synchronizer
|
||||
{
|
||||
public:
|
||||
static void initAll();
|
||||
|
||||
//to initialize the viewer
|
||||
static pthread_mutex_t InitMutex;
|
||||
|
||||
//to protect the scene graph
|
||||
static pthread_mutex_t sgMutex;
|
||||
|
||||
//to return to the debugger
|
||||
static pthread_mutex_t sMutex;
|
||||
static pthread_cond_t sCond;
|
||||
};
|
||||
|
||||
|
||||
void sendSignal();
|
||||
|
||||
void stop();
|
||||
|
||||
|
||||
pthread_mutex_t Synchronizer::InitMutex;
|
||||
|
||||
pthread_mutex_t Synchronizer::sgMutex;
|
||||
pthread_mutex_t Synchronizer::sMutex;
|
||||
pthread_cond_t Synchronizer::sCond;
|
||||
|
||||
void Synchronizer::initAll()
|
||||
{
|
||||
pthread_mutex_init(&Synchronizer::InitMutex, NULL);
|
||||
pthread_mutex_init(&Synchronizer::sgMutex, NULL);
|
||||
pthread_mutex_init(&Synchronizer::sMutex, NULL);
|
||||
pthread_cond_init(&Synchronizer::sCond, NULL);
|
||||
}
|
||||
|
||||
|
||||
void sendSignal()
|
||||
{
|
||||
std::cerr << "condition...";
|
||||
pthread_mutex_lock(&Synchronizer::sMutex);
|
||||
pthread_cond_signal(&Synchronizer::sCond);
|
||||
pthread_mutex_unlock(&Synchronizer::sMutex);
|
||||
std::cerr << "...signaled\n";
|
||||
}
|
||||
|
||||
|
||||
void stop()
|
||||
{
|
||||
std::cerr << "stop...";
|
||||
pthread_mutex_lock(&Synchronizer::sMutex);
|
||||
pthread_cond_wait(&Synchronizer::sCond, &Synchronizer::sMutex);
|
||||
pthread_mutex_unlock(&Synchronizer::sMutex);
|
||||
std::cerr << "...executed\n";
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -1,277 +0,0 @@
|
|||
// Copyright (c) 1999 Utrecht University (The Netherlands),
|
||||
// ETH Zurich (Switzerland), Freie Universitaet Berlin (Germany),
|
||||
// INRIA Sophia-Antipolis (France), Martin-Luther-University Halle-Wittenberg
|
||||
// (Germany), Max-Planck-Institute Saarbruecken (Germany), RISC Linz (Austria),
|
||||
// and Tel-Aviv University (Israel). All rights reserved.
|
||||
//
|
||||
// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public License as
|
||||
// published by the Free Software Foundation; version 2.1 of the License.
|
||||
// See the file LICENSE.LGPL distributed with CGAL.
|
||||
//
|
||||
// Licensees holding a valid commercial license may use this file in
|
||||
// accordance with the commercial license agreement provided with the software.
|
||||
//
|
||||
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
//
|
||||
//
|
||||
// Author(s) : Francois Rebufat <Francois.Rebufat@sophia.inria.fr>
|
||||
#ifndef CGAL_VIEWER_STREAM_H
|
||||
#define CGAL_VIEWER_STREAM_H
|
||||
|
||||
#include <CGAL/Point_3.h>
|
||||
#include <CGAL/Point_2.h>
|
||||
#include <CGAL/Segment_3.h>
|
||||
#include <CGAL/Segment_2.h>
|
||||
#include <CGAL/Triangle_3.h>
|
||||
#include <CGAL/Triangle_2.h>
|
||||
#include <CGAL/Tetrahedron_3.h>
|
||||
#include <CGAL/Line_3.h>
|
||||
#include <CGAL/Line_2.h>
|
||||
#include <CGAL/Ray_3.h>
|
||||
#include <CGAL/Ray_2.h>
|
||||
#include <CGAL/Circle_2.h>
|
||||
#include <CGAL/Viewer_3.h>
|
||||
|
||||
CGAL_BEGIN_NAMESPACE
|
||||
// Transform a point_3 to a drawable_point_3 with Viewer attributs.
|
||||
template <class R>
|
||||
Drawable_point_3<Point_3<R> >*
|
||||
convert_type(const Point_3<R> p, Viewer_3 &W)
|
||||
{
|
||||
Drawable_point_3<Point_3<R> >* dp = new
|
||||
Drawable_point_3<Point_3<R> >(p,W.get_color(1),W.get_style(),W.get_size(),W.get_precision());
|
||||
return(dp);
|
||||
}
|
||||
|
||||
template <class R>
|
||||
Drawable_point_3<std::vector<R> >*
|
||||
convert_type(const std::vector<R> &p, Viewer_3 &W)
|
||||
{
|
||||
Drawable_point_3<std::vector<R> >* dp = new
|
||||
Drawable_point_3<std::vector<R> >(p[0],p[1],p[2],W.get_color(1),W.get_style(),W.get_size(),W.get_precision());
|
||||
return(dp);
|
||||
}
|
||||
|
||||
|
||||
|
||||
template<class R>
|
||||
Drawable_segment_3<Segment_3<R> >*
|
||||
convert_type(const Segment_3<R> &s, Viewer_3 &W)
|
||||
{
|
||||
Drawable_segment_3<Segment_3<R> >* sp = new
|
||||
Drawable_segment_3<Segment_3<R> >(s,W.get_color(1),W.get_style(),W.get_size(),W.get_precision());
|
||||
return(sp);
|
||||
}
|
||||
|
||||
template<class R>
|
||||
Drawable_triangle_3<Triangle_3<R> >*
|
||||
convert_type(const Triangle_3<R> &s, Viewer_3 &W)
|
||||
{
|
||||
Drawable_triangle_3<Triangle_3<R> >* sp = new
|
||||
Drawable_triangle_3<Triangle_3<R> >(s,W.get_color(1),W.get_style(),W.get_size(),W.get_precision());
|
||||
return(sp);
|
||||
}
|
||||
|
||||
|
||||
template<class R>
|
||||
Drawable_tetrahedron_3<Tetrahedron_3<R> >*
|
||||
convert_type(const Tetrahedron_3<R> &s, Viewer_3 &W)
|
||||
{
|
||||
Drawable_tetrahedron_3<Tetrahedron_3<R> >* sp = new
|
||||
Drawable_tetrahedron_3<Tetrahedron_3<R> >(s,W.get_color(1),W.get_style(),W.get_size(),W.get_precision());
|
||||
return(sp);
|
||||
}
|
||||
|
||||
template<class R>
|
||||
Drawable_line_3<Line_3<R> >*
|
||||
convert_type(const Line_3<R> &s, Viewer_3 &W)
|
||||
{
|
||||
Drawable_line_3<Line_3<R> >* sp = new
|
||||
Drawable_line_3<Line_3<R> >(s,W.get_color(1),W.get_style(),W.get_size(),W.get_precision());
|
||||
return(sp);
|
||||
}
|
||||
|
||||
|
||||
template<class R>
|
||||
Drawable_ray_3<Ray_3<R> >*
|
||||
convert_type(const Ray_3<R> &s, Viewer_3 &W)
|
||||
{
|
||||
Drawable_ray_3<Ray_3<R> >* sp = new
|
||||
Drawable_ray_3<Ray_3<R> >(s,W.get_color(1),W.get_style(),W.get_size(),W.get_precision());
|
||||
return(sp);
|
||||
}
|
||||
|
||||
|
||||
template<class R>
|
||||
Drawable_point_2<Point_2<R> >*
|
||||
convert_type(const Point_2<R> &s, Viewer_3 &W)
|
||||
{
|
||||
Drawable_point_2<Point_2<R> >* sp = new
|
||||
Drawable_point_2<Point_2<R> >(s,W.get_color(1),W.get_style(),W.get_size(),W.get_precision());
|
||||
return(sp);
|
||||
}
|
||||
|
||||
template<class R>
|
||||
Drawable_segment_2<Segment_2<R> >*
|
||||
convert_type(const Segment_2<R> &s, Viewer_3 &W)
|
||||
{
|
||||
Drawable_segment_2<Segment_2<R> >* sp = new
|
||||
Drawable_segment_2<Segment_2<R> >(s,W.get_color(1),W.get_style(),W.get_size(),W.get_precision());
|
||||
return(sp);
|
||||
}
|
||||
|
||||
template<class R>
|
||||
Drawable_line_2<Line_2<R> >*
|
||||
convert_type(const Line_2<R> &s, Viewer_3 &W)
|
||||
{
|
||||
Drawable_line_2<Line_2<R> >* sp = new
|
||||
Drawable_line_2<Line_2<R> >(s,W.get_color(1),W.get_style(),W.get_size(),W.get_precision());
|
||||
return(sp);
|
||||
}
|
||||
|
||||
template<class R>
|
||||
Drawable_ray_2<Ray_2<R> >*
|
||||
convert_type(const Ray_2<R> &s, Viewer_3 &W)
|
||||
{
|
||||
Drawable_ray_2<Ray_2<R> >* sp = new
|
||||
Drawable_ray_2<Ray_2<R> >(s,W.get_color(1),W.get_style(),W.get_size(),W.get_precision());
|
||||
return(sp);
|
||||
}
|
||||
|
||||
template<class R>
|
||||
Drawable_triangle_2<Triangle_2<R> >*
|
||||
convert_type(const Triangle_2<R> &s, Viewer_3 &W)
|
||||
{
|
||||
Drawable_triangle_2<Triangle_2<R> >* sp = new
|
||||
Drawable_triangle_2<Triangle_2<R> >(s,W.get_color(1),W.get_style(),W.get_size(),W.get_precision());
|
||||
return(sp);
|
||||
}
|
||||
|
||||
template<class R>
|
||||
Drawable_circle_2<Circle_2<R> >*
|
||||
convert_type(const Circle_2<R> &s, Viewer_3 &W)
|
||||
{
|
||||
Drawable_circle_2<Circle_2<R> >* sp = new
|
||||
Drawable_circle_2<Circle_2<R> >(s,W.get_color(1),W.get_style(),W.get_size(),W.get_precision());
|
||||
return(sp);
|
||||
}
|
||||
|
||||
// ######## The Stream Manipulator ###############################
|
||||
template<class Obj> class O_manip;
|
||||
template< class Obj > Viewer_3& operator<<(Viewer_3& W, const
|
||||
O_manip<Obj> &m);
|
||||
|
||||
template<class Obj> class O_manip {
|
||||
#ifdef _MSC_VER
|
||||
public:
|
||||
#endif
|
||||
Viewer_3& (*f)(Viewer_3&,Obj);
|
||||
Obj i;
|
||||
|
||||
public:
|
||||
O_manip(Viewer_3& (*ff)(Viewer_3&,Obj), Obj ii)
|
||||
: f(ff), i(ii){}
|
||||
|
||||
friend Viewer_3& operator<< <> (Viewer_3& W, const O_manip<Obj>& m);
|
||||
|
||||
};
|
||||
|
||||
|
||||
template<class Obj>
|
||||
Viewer_3& operator<<(Viewer_3& W, const O_manip<Obj>& m)
|
||||
{
|
||||
return m.f(W,m.i);
|
||||
}
|
||||
|
||||
// ######## The Stream Manipulator END###############################
|
||||
|
||||
// functions used for precision
|
||||
Viewer_3& precision(Viewer_3& W, Precision s)
|
||||
{
|
||||
W.set_precision(s);
|
||||
return W;
|
||||
}
|
||||
|
||||
O_manip<Precision> set_precision(Precision i)
|
||||
{
|
||||
return O_manip<Precision>(&precision, i);
|
||||
}
|
||||
|
||||
// functions used for colors
|
||||
Viewer_3& color_1(Viewer_3& W, Color c)
|
||||
{
|
||||
W.set_color(c,1);
|
||||
return W;
|
||||
}
|
||||
|
||||
O_manip<Color> set_color_1(Color i)
|
||||
{
|
||||
return O_manip<Color>(&color_1, i);
|
||||
}
|
||||
// --------------------
|
||||
Viewer_3& color_2(Viewer_3& W, Color c)
|
||||
{
|
||||
W.set_color(c,2);
|
||||
return W;
|
||||
}
|
||||
|
||||
O_manip<Color> set_color_2(Color i)
|
||||
{
|
||||
return O_manip<Color>(&color_2, i);
|
||||
}
|
||||
// functions used for size
|
||||
Viewer_3& size_f(Viewer_3& W, Size c)
|
||||
{
|
||||
W.set_size(c);
|
||||
return W;
|
||||
}
|
||||
|
||||
O_manip<Size> set_size(Size i)
|
||||
{
|
||||
return O_manip<Size>(&size_f, i);
|
||||
}
|
||||
// functions used for style
|
||||
Viewer_3& style_f(Viewer_3& W, Style c)
|
||||
{
|
||||
W.set_style(c);
|
||||
return W;
|
||||
}
|
||||
|
||||
O_manip<Style> set_style(Style i)
|
||||
{
|
||||
return O_manip<Style>(&style_f, i);
|
||||
}
|
||||
|
||||
// }
|
||||
|
||||
// Stream for style and precision.
|
||||
// Viewer_3&
|
||||
// operator<<(Viewer_3& W, Style s)
|
||||
// {
|
||||
// W.set_style(s);
|
||||
// return W;
|
||||
// }
|
||||
|
||||
// Viewer_3&
|
||||
// operator<<(Viewer_3& W, Precision s)
|
||||
// {
|
||||
// W.set_precision(s);
|
||||
// return W;
|
||||
// }
|
||||
// Stream for a CGAL object that has a convert_type operation
|
||||
template <class object>
|
||||
Viewer_3&
|
||||
operator<<(Viewer_3& W, const object &o)
|
||||
{
|
||||
W.add_drawable(convert_type(o,W));
|
||||
return W;
|
||||
}
|
||||
CGAL_END_NAMESPACE
|
||||
|
||||
#endif //CGAL_VIEWER_STREAM_H
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -1,283 +0,0 @@
|
|||
// Copyright (c) 1999 Utrecht University (The Netherlands),
|
||||
// ETH Zurich (Switzerland), Freie Universitaet Berlin (Germany),
|
||||
// INRIA Sophia-Antipolis (France), Martin-Luther-University Halle-Wittenberg
|
||||
// (Germany), Max-Planck-Institute Saarbruecken (Germany), RISC Linz (Austria),
|
||||
// and Tel-Aviv University (Israel). All rights reserved.
|
||||
//
|
||||
// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public License as
|
||||
// published by the Free Software Foundation; version 2.1 of the License.
|
||||
// See the file LICENSE.LGPL distributed with CGAL.
|
||||
//
|
||||
// Licensees holding a valid commercial license may use this file in
|
||||
// accordance with the commercial license agreement provided with the software.
|
||||
//
|
||||
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
//
|
||||
//
|
||||
// Author(s) : Francois Rebufat <Francois.Rebufat@sophia.inria.fr>
|
||||
#ifndef V_UTILS
|
||||
#include <CGAL/v_utils.h>
|
||||
#endif
|
||||
|
||||
// enum Style {FILL=1, WIRE, RAW, FOS1, FOS2, FOS3, FOS4, FOS5};
|
||||
CGAL_BEGIN_NAMESPACE
|
||||
|
||||
|
||||
typedef std::vector<double> vertex ;
|
||||
typedef std::vector<vertex> edge ;
|
||||
typedef std::list<vertex> facet;
|
||||
|
||||
typedef std::list<vertex> list_vertices;
|
||||
typedef std::list<edge> list_edges;
|
||||
typedef std::list<facet> list_facets;
|
||||
|
||||
|
||||
void draw_vertex(vertex v, Size s, Style sty, Precision prec)
|
||||
{
|
||||
double x = v[0] ;
|
||||
double y = v[1] ;
|
||||
double z = v[2] ;
|
||||
if (sty==FILL) {
|
||||
GLUquadricObj *q= gluNewQuadric();
|
||||
glPushMatrix();
|
||||
glTranslatef(x, y, z);
|
||||
gluQuadricNormals(q, (GLenum) GL_SMOOTH);
|
||||
gluQuadricDrawStyle(q,(GLenum) GLU_FILL);
|
||||
gluSphere(q,s,prec,prec);
|
||||
glPopMatrix();
|
||||
gluDeleteQuadric(q);
|
||||
}
|
||||
else if (sty==WIRE) {
|
||||
glPolygonMode(GL_FRONT_AND_BACK,GL_FILL);
|
||||
glBegin(GL_QUADS);
|
||||
glNormal3f(0,0,1);
|
||||
glVertex3f(x+s,y+s,z+s);
|
||||
glVertex3f(x+s,y-s,z+s);
|
||||
glVertex3f(x-s,y-s,z+s);
|
||||
glVertex3f(x-s,y+s,z+s);
|
||||
|
||||
glNormal3f(0,0,-1);
|
||||
glVertex3f(x+s,y+s,z-s);
|
||||
glVertex3f(x+s,y-s,z-s);
|
||||
glVertex3f(x-s,y-s,z-s);
|
||||
glVertex3f(x-s,y+s,z-s);
|
||||
|
||||
glNormal3f(0,1,0);
|
||||
glVertex3f(x+s,y+s,z+s);
|
||||
glVertex3f(x+s,y+s,z-s);
|
||||
glVertex3f(x-s,y+s,z-s);
|
||||
glVertex3f(x-s,y+s,z+s);
|
||||
|
||||
glNormal3f(0,-1,0);
|
||||
glVertex3f(x+s,y-s,z+s);
|
||||
glVertex3f(x+s,y-s,z-s);
|
||||
glVertex3f(x-s,y-s,z-s);
|
||||
glVertex3f(x-s,y-s,z+s);
|
||||
|
||||
glNormal3f(1,0,0);
|
||||
glVertex3f(x+s,y+s,z+s);
|
||||
glVertex3f(x+s,y+s,z-s);
|
||||
glVertex3f(x+s,y-s,z-s);
|
||||
glVertex3f(x+s,y-s,z+s);
|
||||
|
||||
glNormal3f(-1,0,0);
|
||||
glVertex3f(x-s,y+s,z+s);
|
||||
glVertex3f(x-s,y+s,z-s);
|
||||
glVertex3f(x-s,y-s,z-s);
|
||||
glVertex3f(x-s,y-s,z+s);
|
||||
glEnd();
|
||||
}
|
||||
else if (sty==RAW) {
|
||||
glPointSize(s);
|
||||
glBegin(GL_POINTS);
|
||||
glVertex3f(x,y,z);
|
||||
glEnd();
|
||||
}
|
||||
}
|
||||
|
||||
void draw_edge(edge e, Size s, Style sty, Precision prec)
|
||||
{
|
||||
double x1=e[0][0];
|
||||
double y1=e[0][1];
|
||||
double z1=e[0][2];
|
||||
double x2=e[1][0];
|
||||
double y2=e[1][1];
|
||||
double z2=e[1][2];
|
||||
if (sty==FILL) {
|
||||
GLUquadricObj *q= gluNewQuadric();
|
||||
std::pair<double, double> ag=get_angles(x1,y1,z1,x2,y2,z2);
|
||||
double l=sqrt(pow(x1-x2,2) +pow(y1-y2,2) + pow(z1-z2,2));
|
||||
glPushMatrix();
|
||||
glTranslatef(x1, y1, z1);
|
||||
glRotatef(ag.first,1,0,0);
|
||||
glRotatef(ag.second,0,1,0);
|
||||
gluQuadricNormals(q, (GLenum) GL_SMOOTH);
|
||||
gluCylinder(q, s, s, l, prec, 1);
|
||||
glPopMatrix();
|
||||
gluDeleteQuadric(q);
|
||||
}
|
||||
else {
|
||||
glLineWidth(s);
|
||||
glBegin(GL_LINES);
|
||||
glNormal3f(0,0,1);
|
||||
glVertex3f(x1,y1,z1);
|
||||
glVertex3f(x2,y2,z2);
|
||||
glEnd();
|
||||
}
|
||||
}
|
||||
|
||||
void draw_facet(facet f, Size s, Style sty, Precision prec)
|
||||
{
|
||||
facet::iterator fit=f.begin();
|
||||
vertex v1=*fit;
|
||||
vertex v2=*(++fit);
|
||||
vertex v3=*(++fit);
|
||||
std::vector<double> v(3);
|
||||
v=normal(v1[0],v1[1],v1[2],v2[0],v2[1],v2[2],v3[0],v3[1],v3[2]);
|
||||
glNormal3d(v[0],v[1],v[2]);
|
||||
int l=f.size()/2;
|
||||
int i=0;
|
||||
glBegin(GL_POLYGON);
|
||||
for (fit=f.begin(); fit!=f.end();fit++) {
|
||||
glVertex3f((*fit)[0],(*fit)[1],(*fit)[2]);
|
||||
i++;
|
||||
if (i==l)
|
||||
glNormal3d(-v[0],-v[1],-v[2]);
|
||||
}
|
||||
glEnd();
|
||||
}
|
||||
|
||||
|
||||
void draw_list_vertices(list_vertices v, Size s, Style sty, Precision prec)
|
||||
{
|
||||
list_vertices::iterator it;
|
||||
for (it=v.begin(); it!=v.end(); it++)
|
||||
draw_vertex(*it,s,sty,prec);
|
||||
}
|
||||
|
||||
void draw_list_edges(list_edges v, Size s, Style sty, Precision prec)
|
||||
{
|
||||
list_edges::iterator it;
|
||||
for (it=v.begin(); it!=v.end(); it++)
|
||||
draw_edge(*it,s,sty,prec);
|
||||
}
|
||||
|
||||
void draw_list_facets(list_facets v, Size s, Style sty, Precision prec)
|
||||
{
|
||||
list_facets::iterator it;
|
||||
for (it=v.begin(); it!=v.end(); it++)
|
||||
draw_facet(*it,s,sty,prec);
|
||||
}
|
||||
|
||||
void draw_wire_hidden(list_facets v, Size s, Color fcol, Color bcol)
|
||||
{
|
||||
glLineWidth(s);
|
||||
list_facets::iterator it;
|
||||
glEnable(GL_STENCIL_TEST);
|
||||
glClear(GL_STENCIL_BUFFER_BIT);
|
||||
glStencilFunc(GL_ALWAYS,0,1);
|
||||
glStencilOp(GL_INVERT,GL_INVERT,GL_INVERT);
|
||||
set_color(fcol);
|
||||
for (it=v.begin(); it!=v.end(); it++) {
|
||||
glPolygonMode(GL_FRONT_AND_BACK,GL_LINE);
|
||||
draw_facet((*it),2,WIRE,0);
|
||||
|
||||
set_color(bcol);
|
||||
glPolygonMode(GL_FRONT_AND_BACK,GL_FILL);
|
||||
glStencilFunc(GL_EQUAL,0,1);
|
||||
glStencilOp(GL_KEEP,GL_KEEP,GL_KEEP);
|
||||
draw_facet((*it),0,RAW,0);
|
||||
|
||||
set_color(fcol);
|
||||
glPolygonMode(GL_FRONT_AND_BACK,GL_LINE);
|
||||
glStencilFunc(GL_ALWAYS,0,1);
|
||||
glStencilOp(GL_INVERT,GL_INVERT,GL_INVERT);
|
||||
draw_facet((*it),1,WIRE,0);
|
||||
}
|
||||
glDisable(GL_STENCIL_TEST);
|
||||
glPolygonMode(GL_FRONT_AND_BACK,GL_FILL);
|
||||
}
|
||||
|
||||
|
||||
|
||||
template<class facets_object_3>
|
||||
class Drawable_facets_object_3: public Drawable_object
|
||||
{
|
||||
private:
|
||||
|
||||
list_vertices list_v;
|
||||
list_edges list_e;
|
||||
list_facets list_f;
|
||||
|
||||
public:
|
||||
Drawable_facets_object_3(const facets_object_3 &obj ,Color c, Color
|
||||
c2=BLACK, char* name="Facet Object", Style
|
||||
sty=FOS1, Size s=2, Precision prec=10)
|
||||
{
|
||||
list_v=get_vertices(obj);
|
||||
list_e=get_edges(obj);
|
||||
list_f=get_facets(obj);
|
||||
set_center();
|
||||
lind=0;
|
||||
color=c; col2=c2;type=name;style=sty;size=s;precision=prec;
|
||||
}
|
||||
|
||||
void set_center()
|
||||
{
|
||||
list_vertices::iterator it;
|
||||
o_center[0]=0; o_center[1]=0;o_center[2]=0;
|
||||
for (it=list_v.begin(); it!=list_v.end();it++) {
|
||||
o_center[0]+=(*it)[0];o_center[1]+=(*it)[1];o_center[2]+=(*it)[2];
|
||||
}
|
||||
o_center[0] = o_center[0]/list_v.size();
|
||||
o_center[1] = o_center[1]/list_v.size();
|
||||
o_center[2] = o_center[2]/list_v.size();
|
||||
}
|
||||
|
||||
void draw()
|
||||
{
|
||||
if(lind)
|
||||
glCallList(lind);
|
||||
else {
|
||||
lind = glGenLists(1);
|
||||
glNewList(lind,GL_COMPILE_AND_EXECUTE);
|
||||
switch(style) {
|
||||
case FOS1:
|
||||
set_color(color);
|
||||
draw_list_edges(list_e,size,WIRE,0);
|
||||
break;
|
||||
case FOS2:
|
||||
set_color(color);
|
||||
draw_list_edges(list_e,size,WIRE,0);
|
||||
set_color(col2);
|
||||
draw_list_vertices(list_v,size*2,WIRE,0);
|
||||
break;
|
||||
case FOS3:
|
||||
draw_wire_hidden(list_f,size,color,col2);
|
||||
break;
|
||||
case FOS4:
|
||||
set_color(color);
|
||||
draw_list_facets(list_f,0,RAW,0);
|
||||
break;
|
||||
case FOS5:
|
||||
set_color(color);
|
||||
draw_list_edges(list_e,2*size,FILL,precision);
|
||||
set_color(col2);
|
||||
draw_list_vertices(list_v,3*size,FILL,precision);
|
||||
break;
|
||||
default:
|
||||
draw_wire_hidden(list_f,size,color,col2);
|
||||
break;
|
||||
}
|
||||
glEndList();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
CGAL_END_NAMESPACE
|
||||
|
|
@ -1,286 +0,0 @@
|
|||
// Copyright (c) 1999 Utrecht University (The Netherlands),
|
||||
// ETH Zurich (Switzerland), Freie Universitaet Berlin (Germany),
|
||||
// INRIA Sophia-Antipolis (France), Martin-Luther-University Halle-Wittenberg
|
||||
// (Germany), Max-Planck-Institute Saarbruecken (Germany), RISC Linz (Austria),
|
||||
// and Tel-Aviv University (Israel). All rights reserved.
|
||||
//
|
||||
// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public License as
|
||||
// published by the Free Software Foundation; version 2.1 of the License.
|
||||
// See the file LICENSE.LGPL distributed with CGAL.
|
||||
//
|
||||
// Licensees holding a valid commercial license may use this file in
|
||||
// accordance with the commercial license agreement provided with the software.
|
||||
//
|
||||
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
//
|
||||
//
|
||||
// Author(s) : Francois Rebufat <Francois.Rebufat@sophia.inria.fr>
|
||||
#include <CGAL/scene_group.h>
|
||||
|
||||
|
||||
CGAL_BEGIN_NAMESPACE
|
||||
class Scene_graph
|
||||
{
|
||||
|
||||
typedef std::vector<Scene_group> group_list;
|
||||
group_list LD;
|
||||
double scene_center[3];
|
||||
double* world_rot;
|
||||
double* world_trans;
|
||||
|
||||
|
||||
|
||||
void erase(group_list &v, int n)
|
||||
{
|
||||
group_list::iterator it=v.begin();
|
||||
int i;
|
||||
for (i=0; i<n; i++)
|
||||
it++;
|
||||
v.erase(it);
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
|
||||
typedef group_list::iterator iterator;
|
||||
|
||||
Scene_graph(): LD(0)
|
||||
{
|
||||
set_scene_center();
|
||||
set_identity();
|
||||
Scene_group g;
|
||||
LD.push_back(g);
|
||||
}
|
||||
|
||||
|
||||
void set_identity()
|
||||
{
|
||||
world_rot = new double[16];
|
||||
world_rot[0]=1 ; world_rot[1]=0 ; world_rot[2]=0 ; world_rot[3]=0 ;
|
||||
world_rot[4]=0 ; world_rot[5]=1 ; world_rot[6]=0 ; world_rot[7]=0 ;
|
||||
world_rot[8]=0 ; world_rot[9]=0 ; world_rot[10]=1 ; world_rot[11]=0 ;
|
||||
world_rot[12]=0 ; world_rot[13]=0 ; world_rot[14]=0 ;
|
||||
world_rot[15]=1 ;
|
||||
world_trans = new double[2];
|
||||
world_trans[0]=0; world_trans[1]=0;
|
||||
}
|
||||
|
||||
// Scene_graph(list<Drawable_object_3*> l) {LD=l; set_scene_center();}
|
||||
|
||||
// begin and end for SG_iterator;
|
||||
iterator begin() {return LD.begin();}
|
||||
iterator end() {return LD.end();}
|
||||
|
||||
|
||||
void change_group(int orig, int ind, int dest)
|
||||
{
|
||||
if (( 1 <= orig) && (orig <= (int) LD.size()))
|
||||
if (dest < (int) LD.size()) {
|
||||
Drawable_object* o = get_drawable(orig,ind);
|
||||
remove_drawable(orig,ind);
|
||||
add_drawable(o,dest);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Drawable_object* get_drawable(int g, int i)
|
||||
{
|
||||
return LD[g-1].get_drawable(i);
|
||||
}
|
||||
|
||||
void set_scene_center()
|
||||
{
|
||||
scene_center[0]=0; scene_center[1]=0; scene_center[2]=0;
|
||||
iterator it;
|
||||
int s = LD.size();
|
||||
int sub=0;
|
||||
if (s!=0) {
|
||||
for (it=LD.begin() ; it!=LD.end() ; it++)
|
||||
if ((it->get_center(1)) ||(it->get_center(2)) ||
|
||||
(it->get_center(3))){
|
||||
|
||||
scene_center[0] = scene_center[0] + it->get_center(1);
|
||||
scene_center[1] = scene_center[1] + it->get_center(2);
|
||||
scene_center[2] = scene_center[2] + it->get_center(3);
|
||||
}
|
||||
else
|
||||
sub++;
|
||||
scene_center[0]=scene_center[0]/(s-sub) ;
|
||||
scene_center[1]=scene_center[1]/(s-sub);
|
||||
scene_center[2]=scene_center[2]/(s-sub);
|
||||
}
|
||||
}
|
||||
|
||||
double get_center(int i)
|
||||
{
|
||||
switch(i) {
|
||||
case 1:
|
||||
return scene_center[0];
|
||||
case 2:
|
||||
return scene_center[1];
|
||||
case 3:
|
||||
return scene_center[2];
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int get_size() {return LD.size();}
|
||||
|
||||
void add_new_group(Drawable_object* obj)
|
||||
{
|
||||
Scene_group g(obj);
|
||||
LD.push_back(g);
|
||||
set_scene_center();
|
||||
}
|
||||
|
||||
void add_new_group()
|
||||
{
|
||||
Scene_group g;
|
||||
LD.push_back(g);
|
||||
}
|
||||
|
||||
void delete_group(int i)
|
||||
{
|
||||
erase(LD,i-1);
|
||||
set_scene_center();
|
||||
}
|
||||
|
||||
double* get_rotation()
|
||||
{
|
||||
return world_rot;
|
||||
}
|
||||
|
||||
|
||||
void add_drawable(Drawable_object* obj, int i=1)
|
||||
{
|
||||
int s=LD.size();
|
||||
if ( (i>s) || (i<1) ) {
|
||||
add_new_group(obj);
|
||||
set_scene_center();
|
||||
}
|
||||
else {
|
||||
(LD[i-1]).add_to_group(obj);
|
||||
set_scene_center();
|
||||
}
|
||||
}
|
||||
|
||||
int remove_drawable(int g, int o)
|
||||
{
|
||||
int s=LD.size();
|
||||
int r_val;
|
||||
if ((g>s) || (g<1)) {
|
||||
std::cerr << g << " : No such group number " << std::endl;
|
||||
return 0;
|
||||
}
|
||||
else {
|
||||
r_val=LD[g-1].remove_drawable(o);
|
||||
}
|
||||
if (r_val)
|
||||
set_scene_center();
|
||||
return r_val;
|
||||
}
|
||||
|
||||
int free_drawable(int g, int o)
|
||||
{
|
||||
int s=LD.size();
|
||||
int r_val;
|
||||
if ((g>s) || (g<1)) {
|
||||
std::cerr << g << " : No such group number " << std::endl;
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
r_val=LD[g-1].free_drawable(o);
|
||||
if (r_val)
|
||||
set_scene_center();
|
||||
return r_val;
|
||||
}
|
||||
|
||||
void make_visible(int i)
|
||||
{
|
||||
LD[i-1].all_visible();
|
||||
LD[i-1].group_visible(true);
|
||||
}
|
||||
void change_visibility(int i, int j, bool b)
|
||||
{
|
||||
LD[i-1].change_visibility(j,b);
|
||||
}
|
||||
|
||||
void add_point_to_object(int i, int j, float x, float y, float z)
|
||||
{
|
||||
LD[i-1].add_point_to_object(j, x,y,z) ;
|
||||
}
|
||||
|
||||
void group_visible(bool b, int g)
|
||||
{
|
||||
LD[g-1].group_visible(b);
|
||||
}
|
||||
|
||||
bool group_visible(int g)
|
||||
{
|
||||
return LD[g-1].group_visible();
|
||||
}
|
||||
|
||||
|
||||
void set_rotation()
|
||||
{
|
||||
glGetDoublev(GL_MODELVIEW_MATRIX, world_rot);
|
||||
}
|
||||
|
||||
void set_translation(double x, double y)
|
||||
{
|
||||
world_trans[0] = x;
|
||||
world_trans[1] = y;
|
||||
}
|
||||
|
||||
double* get_group_translation(int g)
|
||||
{
|
||||
if (g <= get_size())
|
||||
return LD[g-1].get_group_translation();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
double* get_group_rotation(int g)
|
||||
{
|
||||
if (g <= get_size())
|
||||
return LD[g-1].get_group_rotation();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
double* get_translation()
|
||||
{
|
||||
return world_trans;
|
||||
}
|
||||
|
||||
void add_translation(double x, double y)
|
||||
{
|
||||
world_trans[0] = world_trans[0] +x;
|
||||
world_trans[1] = world_trans[1] +y;
|
||||
}
|
||||
|
||||
|
||||
void clean_graph()
|
||||
{
|
||||
|
||||
iterator it=begin();
|
||||
if (LD.size() != 1) {
|
||||
while(it!=end()) {
|
||||
if (it->get_size() == 0) {
|
||||
LD.erase(it);
|
||||
it=begin();
|
||||
}
|
||||
else
|
||||
it++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
};
|
||||
CGAL_END_NAMESPACE
|
||||
|
|
@ -1,363 +0,0 @@
|
|||
// Copyright (c) 1999 Utrecht University (The Netherlands),
|
||||
// ETH Zurich (Switzerland), Freie Universitaet Berlin (Germany),
|
||||
// INRIA Sophia-Antipolis (France), Martin-Luther-University Halle-Wittenberg
|
||||
// (Germany), Max-Planck-Institute Saarbruecken (Germany), RISC Linz (Austria),
|
||||
// and Tel-Aviv University (Israel). All rights reserved.
|
||||
//
|
||||
// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public License as
|
||||
// published by the Free Software Foundation; version 2.1 of the License.
|
||||
// See the file LICENSE.LGPL distributed with CGAL.
|
||||
//
|
||||
// Licensees holding a valid commercial license may use this file in
|
||||
// accordance with the commercial license agreement provided with the software.
|
||||
//
|
||||
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
//
|
||||
//
|
||||
// Author(s) : Francois Rebufat <Francois.Rebufat@sophia.inria.fr>
|
||||
#include <list>
|
||||
#include <vector>
|
||||
//#ifndef DRAWABLE
|
||||
#include <CGAL/draw_CGAL_Objects.h>
|
||||
//#endif
|
||||
|
||||
|
||||
CGAL_BEGIN_NAMESPACE
|
||||
class Scene_group
|
||||
{
|
||||
protected:
|
||||
bool is_visible;
|
||||
std::vector<Drawable_object*> LD;
|
||||
std::vector<bool> visible;
|
||||
double scene_center[3];
|
||||
double g_translation[16];
|
||||
double g_rotation[16];
|
||||
|
||||
private:
|
||||
|
||||
void erase(std::vector<bool> &v, int n)
|
||||
{
|
||||
std::vector<bool>::iterator it=v.begin();
|
||||
for (int i=0; i<n; i++)
|
||||
it++;
|
||||
v.erase(it);
|
||||
}
|
||||
|
||||
void erase(std::vector<Drawable_object*> &v, int n)
|
||||
{
|
||||
std::vector<Drawable_object*>::iterator it=v.begin();
|
||||
int i;
|
||||
for (i=0; i<n; i++)
|
||||
it++;
|
||||
delete v[n];
|
||||
v.erase(it);
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
typedef std::vector<Drawable_object*>::iterator iterator;
|
||||
|
||||
|
||||
void set_identity()
|
||||
{
|
||||
g_translation[0]=1 ; g_translation[1]=0 ; g_translation[2]=0 ;
|
||||
g_translation[3]=0 ;
|
||||
g_translation[4]=0 ; g_translation[5]=1 ; g_translation[6]=0 ;
|
||||
g_translation[7]=0 ;
|
||||
g_translation[8]=0 ; g_translation[9]=0 ; g_translation[10]=1 ;
|
||||
g_translation[11]=0 ;
|
||||
g_translation[12]=0 ; g_translation[13]=0 ; g_translation[14]=0 ;
|
||||
g_translation[15]=1 ;
|
||||
|
||||
g_rotation[0]=1 ; g_rotation[1]=0 ; g_rotation[2]=0 ;
|
||||
g_rotation[3]=0 ;
|
||||
g_rotation[4]=0 ; g_rotation[5]=1 ; g_rotation[6]=0 ;
|
||||
g_rotation[7]=0 ;
|
||||
g_rotation[8]=0 ; g_rotation[9]=0 ; g_rotation[10]=1 ;
|
||||
g_rotation[11]=0 ;
|
||||
g_rotation[12]=0 ; g_rotation[13]=0 ; g_rotation[14]=0 ;
|
||||
g_rotation[15]=1 ;
|
||||
}
|
||||
|
||||
~Scene_group() {
|
||||
int iii = LD.size();
|
||||
while (iii > 0) {
|
||||
delete LD[iii];
|
||||
iii--;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Scene_group() : LD(), visible()
|
||||
{
|
||||
is_visible=true;
|
||||
set_scene_center();
|
||||
set_identity();
|
||||
}
|
||||
|
||||
|
||||
|
||||
Scene_group(std::vector<Drawable_object*> l)
|
||||
|
||||
{
|
||||
LD=l;
|
||||
is_visible=true;
|
||||
for (int i = 0; i < (int) LD.size(); i++)
|
||||
visible.push_back(true);
|
||||
set_scene_center();
|
||||
set_identity();
|
||||
}
|
||||
|
||||
Scene_group(Drawable_object* d)
|
||||
: LD(), visible()
|
||||
{
|
||||
LD.push_back(d);
|
||||
is_visible=true;
|
||||
visible.push_back(true);
|
||||
set_scene_center();
|
||||
set_identity();
|
||||
}
|
||||
|
||||
// begin and end for SG_iterator;
|
||||
iterator begin() {return LD.begin();}
|
||||
iterator end() {return LD.end();}
|
||||
|
||||
|
||||
|
||||
void draw_group()
|
||||
{
|
||||
for (int i = 0; i< (int) LD.size() ; i++) {
|
||||
LD[i]->draw();
|
||||
}
|
||||
}
|
||||
//##### POSTSCRIPT : donner la bonne signature!!!!!!!!
|
||||
|
||||
// Parcours le groupe et envoie chaque objet dans le ps_stream.
|
||||
|
||||
void group_to_ps(PS_Stream_3 &ps)
|
||||
{
|
||||
for (int i = 0; i< (int) LD.size() ; i++)
|
||||
LD[i]->to_ps(ps);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void draw_visible()
|
||||
{
|
||||
for (int i = 0; i< (int) LD.size() ; i++)
|
||||
if (visible[i]) {
|
||||
LD[i]->draw();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void draw_invisible()
|
||||
{
|
||||
for (int i = 0; i< (int) LD.size() ; i++)
|
||||
if (!visible[i]) {
|
||||
LD[i]->draw();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void set_scene_center()
|
||||
{
|
||||
scene_center[0]=0; scene_center[1]=0; scene_center[2]=0;
|
||||
iterator it;
|
||||
int s = LD.size();
|
||||
if (s!=0) {
|
||||
for (it=LD.begin() ; it!=LD.end() ; it++) {
|
||||
scene_center[0] = scene_center[0] + (*it)->get_center(1);
|
||||
scene_center[1] = scene_center[1] + (*it)->get_center(2);
|
||||
scene_center[2] = scene_center[2] + (*it)->get_center(3);
|
||||
}
|
||||
scene_center[0]=scene_center[0]/s ;
|
||||
scene_center[1]=scene_center[1]/s ;
|
||||
scene_center[2]=scene_center[2]/s;
|
||||
}
|
||||
}
|
||||
|
||||
double get_center(int i)
|
||||
{
|
||||
switch(i) {
|
||||
case 1:
|
||||
return scene_center[0];
|
||||
case 2:
|
||||
return scene_center[1];
|
||||
case 3:
|
||||
return scene_center[2];
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int get_size() {return LD.size();}
|
||||
|
||||
|
||||
Drawable_object* get_drawable(int i)
|
||||
{
|
||||
int s=LD.size();
|
||||
if ( (i>s) || (i<1) )
|
||||
std::cerr << i << " : No such object (bad indice) "<< std::endl;
|
||||
else
|
||||
return LD[i-1];
|
||||
return 0;
|
||||
}
|
||||
|
||||
void add_to_group(Drawable_object* obj)
|
||||
{
|
||||
int s=LD.size();
|
||||
LD.push_back(obj);
|
||||
visible.push_back(true);
|
||||
scene_center[0]=(scene_center[0]*s + obj->get_center(1))/(s+1);
|
||||
scene_center[1]=(scene_center[1]*s + obj->get_center(2))/(s+1);
|
||||
scene_center[2]=(scene_center[2]*s + obj->get_center(3))/(s+1);
|
||||
}
|
||||
|
||||
|
||||
int remove_drawable(int i)
|
||||
{
|
||||
int s=LD.size();
|
||||
if ( (i>s) || (i<1)) {
|
||||
std::cerr << i << " : No such object indice " << std::endl;
|
||||
return 0;
|
||||
}
|
||||
else {
|
||||
erase(LD,i-1);
|
||||
set_scene_center();
|
||||
erase(visible,i-1);
|
||||
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
int free_drawable(int i)
|
||||
{
|
||||
int s=LD.size();
|
||||
if ( (i>s) || (i<1)) {
|
||||
std::cerr << i << " : No such object indice " << std::endl;
|
||||
return 0;
|
||||
}
|
||||
else {
|
||||
// delete LD[i-1];
|
||||
erase(LD,i-1);
|
||||
set_scene_center();
|
||||
erase(visible,i-1);
|
||||
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
double* get_group_rotation()
|
||||
{
|
||||
return g_rotation;
|
||||
}
|
||||
|
||||
double* get_group_translation()
|
||||
{
|
||||
return g_translation;
|
||||
}
|
||||
|
||||
|
||||
void set_rotation(float x, float y, double* Mw)
|
||||
|
||||
//float c1,float,c2,float c3)
|
||||
{
|
||||
if ( (-5 < x) && (x < 5) )
|
||||
x=x/5 ;
|
||||
if ( ((-10 < x) && (x <= -5)) || ((x >= 5) && (x < 10)))
|
||||
x=x/4;
|
||||
if ( ((-20 < x) && (x <= -10)) || ((x >= 10) && (x < 20)))
|
||||
x=x/3;
|
||||
if ( (x <= -20) || (x >= 20) )
|
||||
x=x/2;
|
||||
|
||||
if ( (-5 < y) && (y < 5) )
|
||||
y=y/5 ;
|
||||
if ( ((-10 < y) && (y <= -5)) || ((y >= 5) && (y < 10)))
|
||||
y=y/4;
|
||||
if ( ((-20 < y) && (y <= -10)) || ((y >= 10) && (y < 20)))
|
||||
y=y/3;
|
||||
if ( (y <= -20) || (y >= 20) )
|
||||
y=y/2;
|
||||
double mat_inv[16];
|
||||
invert(Mw,mat_inv);
|
||||
std::vector <double> v = apply_mat(Mw,get_center(1),get_center(2),get_center(3));
|
||||
glLoadIdentity();
|
||||
glPushMatrix();
|
||||
|
||||
|
||||
glMultMatrixd(mat_inv);
|
||||
|
||||
glTranslatef(v[0],v[1],v[2]);
|
||||
glRotated(y,1,0,0);
|
||||
glRotated(x,0,1,0);
|
||||
glTranslatef(-v[0],-v[1],-v[2]);
|
||||
glMultMatrixd(Mw);
|
||||
|
||||
glMultMatrixd(g_rotation);
|
||||
|
||||
glGetDoublev(GL_MODELVIEW_MATRIX,g_rotation);
|
||||
glPopMatrix();
|
||||
}
|
||||
|
||||
|
||||
|
||||
void set_translation(float x, float y, double* Mw)
|
||||
{
|
||||
|
||||
double mat_inv[16];
|
||||
invert(Mw,mat_inv);
|
||||
glLoadIdentity();
|
||||
glPushMatrix();
|
||||
glMultMatrixd(mat_inv);
|
||||
glTranslatef(x,-y,0);
|
||||
glMultMatrixd(Mw);
|
||||
glMultMatrixd(g_translation);
|
||||
glGetDoublev(GL_MODELVIEW_MATRIX,g_translation);
|
||||
glPopMatrix();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void change_visibility(int i,bool b)
|
||||
{
|
||||
visible[i-1] = b;
|
||||
}
|
||||
|
||||
void all_visible()
|
||||
{
|
||||
for (int i=0 ; i< (int) LD.size() ; i++)
|
||||
visible[i]=true;
|
||||
}
|
||||
|
||||
void add_point_to_object(int i, float x, float y, float z)
|
||||
{
|
||||
LD[i-1]->add_point(x,y,z);
|
||||
}
|
||||
|
||||
void group_visible(bool b)
|
||||
{
|
||||
is_visible=b;
|
||||
}
|
||||
|
||||
bool group_visible()
|
||||
{
|
||||
return is_visible;
|
||||
}
|
||||
};
|
||||
CGAL_END_NAMESPACE
|
||||
|
|
@ -1,347 +0,0 @@
|
|||
// Copyright (c) 1999 Utrecht University (The Netherlands),
|
||||
// ETH Zurich (Switzerland), Freie Universitaet Berlin (Germany),
|
||||
// INRIA Sophia-Antipolis (France), Martin-Luther-University Halle-Wittenberg
|
||||
// (Germany), Max-Planck-Institute Saarbruecken (Germany), RISC Linz (Austria),
|
||||
// and Tel-Aviv University (Israel). All rights reserved.
|
||||
//
|
||||
// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public License as
|
||||
// published by the Free Software Foundation; version 2.1 of the License.
|
||||
// See the file LICENSE.LGPL distributed with CGAL.
|
||||
//
|
||||
// Licensees holding a valid commercial license may use this file in
|
||||
// accordance with the commercial license agreement provided with the software.
|
||||
//
|
||||
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
//
|
||||
//
|
||||
// Author(s) : Francois Rebufat <Francois.Rebufat@sophia.inria.fr>
|
||||
|
||||
#include <CGAL/IO/Color.h>
|
||||
#include <utility>
|
||||
// #include <vector>
|
||||
#ifndef DRAWABLE
|
||||
#include <CGAL/Drawable_object.h>
|
||||
#endif
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glu.h>
|
||||
#define V_UTILS
|
||||
|
||||
CGAL_BEGIN_NAMESPACE
|
||||
|
||||
// typedef int Size;
|
||||
// typedef unsigned char Precision;
|
||||
|
||||
|
||||
void invert(double *, double *);
|
||||
|
||||
void invert(double *);
|
||||
void add_mat(double *, double *);
|
||||
|
||||
void set_matrix(double *, double *);
|
||||
std::vector<double> apply_mat(double *, double , double , double );
|
||||
|
||||
std::vector<double> compute_plan(double , double , double ,double ,
|
||||
double , double ,double , double ,
|
||||
double );
|
||||
|
||||
double intersect_plan(const std::vector<double> &, double , double );
|
||||
|
||||
std::vector<double> translate(const std::vector<double> &, double,double,double );
|
||||
|
||||
std::vector<double> normal(double , double , double , double , double ,
|
||||
double , double , double , double);
|
||||
|
||||
|
||||
|
||||
|
||||
void set_color(Color );
|
||||
|
||||
|
||||
|
||||
double rad2deg(double );
|
||||
|
||||
std::pair<double,double> get_angles(const double & ,const double & ,const
|
||||
double &,const double & ,const
|
||||
double &,const double & );
|
||||
|
||||
|
||||
void draw_tube(double , double , double , double , double ,
|
||||
double , Size, Precision );
|
||||
|
||||
|
||||
void draw_sphere(double , double , double , Size , Precision );
|
||||
|
||||
void draw_triangle(double , double , double ,double , double
|
||||
, double ,double , double , double );
|
||||
|
||||
void draw_triangle_nice(double , double , double ,double , double
|
||||
, double ,double , double , double );
|
||||
|
||||
void draw_triangle_2(double, double, double, double
|
||||
,double , double);
|
||||
|
||||
void draw_shrink_triangle_2(double, double, double, double
|
||||
,double , double);
|
||||
|
||||
|
||||
|
||||
void add_mat(double m[16], double res[16])
|
||||
{
|
||||
for (int i=0; i<16 ; i++)
|
||||
res[i]=res[i] + m[i];
|
||||
}
|
||||
|
||||
void set_matrix(double* m, double* n)
|
||||
{
|
||||
for (int i=0; i<16 ; i++)
|
||||
m[i]=n[i];
|
||||
}
|
||||
|
||||
void invert(double m[16], double res[16])
|
||||
{
|
||||
|
||||
double x[4][4];
|
||||
int i, j, k;
|
||||
double out[4][4];
|
||||
for (i=0; i<=3; i++)
|
||||
for(j=0; j <=3; j++)
|
||||
if (i==j)
|
||||
out[i][j]=1;
|
||||
else
|
||||
out[i][j]=0;
|
||||
|
||||
for (i=0; i<=3; i++)
|
||||
x[0][i]=m[i];
|
||||
for (i=4; i<=7; i++)
|
||||
x[1][i-4]=m[i];
|
||||
for (i=8; i<=11; i++)
|
||||
x[2][i-8]=m[i];
|
||||
for (i=12; i<=15; i++)
|
||||
x[3][i-12]=m[i];
|
||||
|
||||
for (i = 0; i < 4; i++) {
|
||||
if (x[i][i] != 1.0) {
|
||||
double divby = x[i][i];
|
||||
for (j = 0; j < 4; j++) {
|
||||
out[i][j] /= divby;
|
||||
x[i][j] /= divby;
|
||||
}
|
||||
}
|
||||
for (j = 0; j < 4; j++) {
|
||||
if (j != i) {
|
||||
if (x[j][i] != 0.0) {
|
||||
double mulby = x[j][i];
|
||||
for (k = 0; k < 4; k++) {
|
||||
x[j][k] -= mulby * x[i][k];
|
||||
out[j][k] -= mulby * out[i][k];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for (i=0; i<=3; i++)
|
||||
res[i]=out[0][i];
|
||||
for (i=4; i<=7; i++)
|
||||
res[i]=out[1][i-4];
|
||||
for (i=8; i<=11; i++)
|
||||
res[i]=out[2][i-8];
|
||||
for (i=12; i<=15; i++)
|
||||
res[i]=out[3][i-12];
|
||||
|
||||
}
|
||||
|
||||
void invert(double m[16])
|
||||
{
|
||||
invert(m,m);
|
||||
}
|
||||
|
||||
|
||||
|
||||
std::vector<double> apply_mat(double* m, double x, double y, double z)
|
||||
{
|
||||
|
||||
std::vector<double> v(3);
|
||||
v[0]=m[0]*x + m[4]*y + m[8]*z + m[12];
|
||||
v[1]=m[1]*x + m[5]*y + m[9]*z + m[13];
|
||||
v[2]=m[2]*x + m[6]*y + m[10]*z + m[14];
|
||||
return(v);
|
||||
}
|
||||
|
||||
std::vector<double> compute_plan(double x1, double y1, double z1,double x2,
|
||||
double y2, double z2,double x3, double y3,
|
||||
double z3)
|
||||
{
|
||||
std::vector<double> v(4);
|
||||
v[0] = y1*(z2-z3) + y2*(z3-z1) + y3*(z1-z2);
|
||||
v[1] = z1*(x2-x3) + z2*(x3-x1) + z3*(x1-x2);
|
||||
v[2] = x1*(y2-y3) + x2*(y3-y1) + x3*(y1-y2);
|
||||
v[3] = -(x1*(y2*z3-y3*z2) + x2*(y3*z1-y1*z3) + x3*(y1*z2 - y2*z1));
|
||||
return v;
|
||||
}
|
||||
|
||||
double intersect_plan(const std::vector<double> &v, double x, double y)
|
||||
{
|
||||
return((v[0]*x + v[1]*y + v[3])/v[2]);
|
||||
}
|
||||
|
||||
|
||||
std::vector<double> translate(const std::vector<double> &v, double x,double y,double z)
|
||||
{
|
||||
std::vector<double> vr(3);
|
||||
vr[0]= v[0] + x;
|
||||
vr[1]= v[1] + y;
|
||||
vr[2]= v[2] + z;
|
||||
return vr;
|
||||
}
|
||||
|
||||
std::vector<double> normal(double x1, double y1, double z1, double x2, double y2,
|
||||
double z2, double x3, double y3, double z3)
|
||||
{
|
||||
std::vector<double> v(3);
|
||||
v[0] = y1*(z2-z3) + y2*(z3-z1) + y3*(z1-z2);
|
||||
v[1] = z1*(x2-x3) + z2*(x3-x1) + z3*(x1-x2);
|
||||
v[2] = x1*(y2-y3) + x2*(y3-y1) + x3*(y1-y2);
|
||||
double den = sqrt(pow(v[0],2) + pow(v[1],2) + pow(v[2],2) );
|
||||
v[0] = v[0]/den; v[1] = v[1]/den; v[2] = v[2]/den;
|
||||
return v;
|
||||
}
|
||||
|
||||
|
||||
|
||||
const double PI=3.14159265358979323844;
|
||||
|
||||
void set_color(Color c)
|
||||
{
|
||||
glColor4ub(c.red(),c.green(),c.blue(),c.alpha());
|
||||
}
|
||||
|
||||
double rad2deg(double a)
|
||||
{
|
||||
return((a*180)/PI);
|
||||
}
|
||||
|
||||
std::pair<double,double> get_angles(const double &x1,const double &y1,const
|
||||
double &z1,const double &x2,const
|
||||
double &y2,const double &z2)
|
||||
{
|
||||
double X, Y, aux ;
|
||||
double l=sqrt(pow(x1-x2,2) +pow(y1-y2,2) + pow(z1-z2,2));
|
||||
|
||||
Y=asin((x2-x1)/l);
|
||||
aux=-((y2-y1)/l)/cos(asin((x2-x1)/l));
|
||||
if (aux > 1.0) aux = 1.0;
|
||||
if (aux < -1.0) aux = -1.0;
|
||||
X= asin(aux);
|
||||
if ((z2-z1) <0) X=PI-X;
|
||||
|
||||
return std::pair<double,double>(rad2deg(X),rad2deg(Y));
|
||||
}
|
||||
|
||||
|
||||
void draw_tube(double x1, double y1, double z1, double x2, double y2,
|
||||
double z2, Size s, Precision p)
|
||||
{
|
||||
|
||||
|
||||
GLUquadricObj *q= gluNewQuadric();
|
||||
std::pair<double, double> ag=get_angles(x1,y1,z1,x2,y2,z2);
|
||||
double l=sqrt(pow(x1-x2,2) + pow(y1-y2,2) + pow(z1-z2,2));
|
||||
glPushMatrix();
|
||||
glTranslatef(x1, y1, z1);
|
||||
|
||||
glRotatef(ag.first,1,0,0);
|
||||
glRotatef(ag.second,0,1,0);
|
||||
gluQuadricNormals(q, GL_SMOOTH);
|
||||
gluCylinder(q, s, s, l,p, 1);
|
||||
glPopMatrix();
|
||||
gluDeleteQuadric(q);
|
||||
}
|
||||
|
||||
void draw_sphere(double x, double y, double z, Size s, Precision p)
|
||||
{
|
||||
glPushMatrix();
|
||||
glTranslatef(x,y,z);
|
||||
GLUquadricObj *q = gluNewQuadric();
|
||||
gluQuadricNormals(q, GL_SMOOTH);
|
||||
gluQuadricTexture(q, GL_FALSE);
|
||||
gluSphere(q,s,p,p);
|
||||
glPopMatrix();
|
||||
gluDeleteQuadric(q);
|
||||
}
|
||||
|
||||
|
||||
void draw_triangle(double x1, double y1, double z1,double x2, double
|
||||
y2, double z2,double x3, double y3, double z3)
|
||||
|
||||
{
|
||||
glBegin(GL_TRIANGLES);
|
||||
|
||||
std::vector<double> v1(3);
|
||||
v1 = normal(x1,y1,z1,x2,y2,z2,x3,y3,z3);
|
||||
|
||||
glNormal3d(v1[0],v1[1],v1[2]);
|
||||
glVertex3f(x1,y1,z1);
|
||||
glNormal3d(v1[0],v1[1],v1[2]);
|
||||
glVertex3f(x2,y2,z2);
|
||||
glNormal3d(v1[0],v1[1],v1[2]);
|
||||
glVertex3f(x3,y3,z3);
|
||||
glEnd();
|
||||
}
|
||||
|
||||
|
||||
void draw_triangle_nice(double x1, double y1, double z1,double x2, double
|
||||
y2, double z2,double x3, double y3, double z3)
|
||||
|
||||
{
|
||||
glBegin(GL_TRIANGLES);
|
||||
|
||||
std::vector<double> v1(3);
|
||||
v1 = normal(x1,y1,z1,x2,y2,z2,x3,y3,z3);
|
||||
|
||||
glNormal3d(v1[0],v1[1],v1[2]);
|
||||
glVertex3f(x1,y1,z1);
|
||||
glNormal3d(-v1[0],-v1[1],-v1[2]);
|
||||
glVertex3f(x2,y2,z2);
|
||||
glNormal3d(v1[0],v1[1],v1[2]);
|
||||
glVertex3f(x3,y3,z3);
|
||||
glEnd();
|
||||
}
|
||||
|
||||
|
||||
|
||||
void draw_triangle_2(double x1, double y1, double x2, double
|
||||
y2,double x3, double y3)
|
||||
|
||||
{
|
||||
glBegin(GL_TRIANGLES);
|
||||
glVertex2f(x1,y1);
|
||||
glVertex2f(x2,y2);
|
||||
glVertex2f(x3,y3);
|
||||
glEnd();
|
||||
}
|
||||
|
||||
void draw_shrink_triangle_2(double x1, double y1, double x2, double
|
||||
y2,double x3, double y3)
|
||||
{
|
||||
double bx= (x1+x2+x3)/3;
|
||||
double by= (y1+y2+y3)/3;
|
||||
|
||||
x1= x1+(bx - x1)/3;
|
||||
y1= y1+(by - y1)/3;
|
||||
x2= x2+(bx - x2)/3;
|
||||
y2= y2+(by - y2)/3;
|
||||
x3= x3+(bx - x3)/3;
|
||||
y3= y3+(by - y3)/3;
|
||||
glBegin(GL_TRIANGLES);
|
||||
glVertex2f(x1,y1);
|
||||
glVertex2f(x2,y2);
|
||||
glVertex2f(x3,y3);
|
||||
glEnd();
|
||||
}
|
||||
|
||||
CGAL_END_NAMESPACE
|
||||
|
|
@ -1,67 +0,0 @@
|
|||
|
||||
|
||||
FLTK_DIR = ${UTIL}/FLTK/SunOS/fltk-1.0.6
|
||||
#GL_DIR = /0/prisme_util/MESA/SunOS/Mesa-3.0/include/
|
||||
# GL_DIR = /usr/local/mesa
|
||||
CGAL_MAKEFILE = /0/prisme_util/CGAL/CGAL-I/make/makefile_sparc_SunOS-5.6_g++-2.95.2_LEDA
|
||||
include $(CGAL_MAKEFILE)
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------#
|
||||
# compiler flags
|
||||
#---------------------------------------------------------------------#
|
||||
|
||||
CHECKS_OFF = -DCGAL_NO_PRECONDITIONS -DCGAL_NO_POSTCONDITIONS \
|
||||
-DCGAL_NO_ASSERTIONS -DCGAL_NO_WARNINGS
|
||||
|
||||
|
||||
CXXFLAGS = -g \
|
||||
-I${FLTK_DIR} \
|
||||
-I/usr/X11R6/include/ \
|
||||
-B$(UTIL)/Binutils/SunOS/bin/ \
|
||||
-B$(GCC_EXEC_PREFIX) $(LONG_NAME_PROBLEM_CXXFLAGS) \
|
||||
$(CGAL_CXXFLAGS) $(CHECKS_OFF) -DCGAL_USE_FLTK -DCGAL_USE_OPENGL
|
||||
|
||||
#-I${GL_DIR}/include \
|
||||
|
||||
LDFLAGS = $(CGAL_LDFLAGS) -L$(FLTK_DIR)/lib -L/usr/lib/X11 \
|
||||
-R$(FLTK_DIR)/lib -R/usr/lib/X11 \
|
||||
-lfltk -lXext -lX11 -lGL -lGLU
|
||||
|
||||
#-lMesaGL -lMesaGLU
|
||||
|
||||
#-L$(GL_DIR)/lib
|
||||
#-R$(GL_DIR)/lib
|
||||
#---------------------------------------------------------------------#
|
||||
# target entries
|
||||
#---------------------------------------------------------------------#
|
||||
|
||||
|
||||
test: Viewer_test.o
|
||||
$(CGAL_CXX) -o $@ $(OFILES) Viewer_test.o $(LDFLAGS)
|
||||
|
||||
all: test
|
||||
|
||||
#---------------------------------------------------------------------#
|
||||
# suffix rules
|
||||
#---------------------------------------------------------------------#
|
||||
|
||||
.C.o:
|
||||
$(CGAL_CXX) $(CXXFLAGS) -c $<
|
||||
|
||||
.c.o:
|
||||
$(CGAL_CXX) $(CXXFLAGS) -c $<
|
||||
|
||||
|
||||
|
||||
|
||||
clean:
|
||||
rm -f *.o core *~
|
||||
rm -f ii_files/*
|
||||
rm -f test error.txt
|
||||
rm -f CompilerOutput*
|
||||
rm -f ErrorOutput_sparc_SunOS-5.6_g++-2.95.2_LEDA
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,27 +0,0 @@
|
|||
#include <CGAL/basic.h>
|
||||
#if !defined(CGAL_USE_FLTK) || !defined(CGAL_USE_OPENGL)
|
||||
|
||||
#include <iostream>
|
||||
|
||||
int main()
|
||||
{
|
||||
std::cout << "No FLTK or OpenGL or Mesa version installed!\n";
|
||||
return 0;
|
||||
}
|
||||
|
||||
#else
|
||||
#include <CGAL/Cartesian.h>
|
||||
#include <CGAL/Viewer_stream.h>
|
||||
|
||||
typedef CGAL::Cartesian<double> rep_t;
|
||||
typedef CGAL::Point_3<rep_t> point_t;
|
||||
|
||||
int main()
|
||||
{
|
||||
CGAL::Viewer_3 W(500);
|
||||
point_t p(100,100,100);
|
||||
CGAL::Drawable_point_3<point_t> dp(p,CGAL::RED,CGAL::FILL,25,50);
|
||||
W.add_drawable(&dp);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
|
@ -1,67 +0,0 @@
|
|||
#! /bin/sh
|
||||
|
||||
# This is a script for the CGAL test suite. Such a script must obey
|
||||
# the following rules:
|
||||
#
|
||||
# - the name of the script is cgal_test
|
||||
# - for every target two one line messages are written to the file 'error.txt'
|
||||
# the first one indicates if the compilation was successful
|
||||
# the second one indicates if the execution was successful
|
||||
# if one of the two was not successful, the line should start with 'ERROR:'
|
||||
# - running the script should not require any user interaction
|
||||
# - the script should clean up object files and executables
|
||||
|
||||
ERRORFILE=error.txt
|
||||
|
||||
#---------------------------------------------------------------------#
|
||||
# compile_and_run <target>
|
||||
#---------------------------------------------------------------------#
|
||||
|
||||
compile_and_run()
|
||||
{
|
||||
echo "Compiling $1 ... "
|
||||
if eval 'make CGAL_MAKEFILE=$CGAL_MAKEFILE \
|
||||
TESTSUITE_CXXFLAGS="$TESTSUITE_CXXFLAGS" \
|
||||
TESTSUITE_LDFLAGS="$TESTSUITE_LDFLAGS" $1' ; then
|
||||
echo " compilation of $1 succeeded" >> $ERRORFILE
|
||||
else
|
||||
echo " ERROR: compilation of $1 failed" >> $ERRORFILE
|
||||
fi
|
||||
|
||||
if [ -f $1 ] ; then
|
||||
OUTPUTFILE=ProgramOutput.$1.$PLATFORM
|
||||
rm -f $OUTPUTFILE
|
||||
COMMAND="./$1"
|
||||
if [ -f $1.cmd ] ; then
|
||||
COMMAND="$COMMAND '`cat $1.cmd`'"
|
||||
fi
|
||||
if [ -f $1.cin ] ; then
|
||||
COMMAND="echo '`cat $1.cin`' | $COMMAND"
|
||||
fi
|
||||
echo "Executing $1 ... "
|
||||
echo
|
||||
if eval 2>&1 $COMMAND > $OUTPUTFILE ; then
|
||||
echo " execution of $1 succeeded" >> $ERRORFILE
|
||||
else
|
||||
echo " ERROR: execution of $1 failed" >> $ERRORFILE
|
||||
fi
|
||||
else
|
||||
echo " ERROR: could not execute $1" >> $ERRORFILE
|
||||
fi
|
||||
|
||||
eval "2>&1 make CGAL_MAKEFILE=$CGAL_MAKEFILE clean > /dev/null "
|
||||
}
|
||||
|
||||
#---------------------------------------------------------------------#
|
||||
# remove the previous error file
|
||||
#---------------------------------------------------------------------#
|
||||
|
||||
rm -f $ERRORFILE
|
||||
touch $ERRORFILE
|
||||
|
||||
#---------------------------------------------------------------------#
|
||||
# compile and run the tests
|
||||
#---------------------------------------------------------------------#
|
||||
|
||||
compile_and_run Viewer_test
|
||||
|
||||
|
|
@ -1,72 +0,0 @@
|
|||
|
||||
|
||||
#FLTK_DIR = ${UTIL}/FLTK/SunOS/fltk-1.0.6
|
||||
FLTK_DIR = ${UTIL}/FLTK/Linux/fltk-1.0.6
|
||||
GL_DIR = /0/prisme_util/MESA/Linux/Mesa-3.0
|
||||
# GL_DIR = /usr/local/mesa
|
||||
CGAL_MAKEFILE = /0/prisme_util/CGAL/CGAL-I/make/makefile_sparc_SunOS-5.6_g++-2.95.2_LEDA
|
||||
CGAL_MAKEFILE = /0/prisme_util/CGAL/CGAL-I/make/makefile_i686_Linux-2.2.14_g++-2.95.2_LEDA
|
||||
include $(CGAL_MAKEFILE)
|
||||
|
||||
|
||||
|
||||
#---------------------------------------------------------------------#
|
||||
# compiler flags
|
||||
#---------------------------------------------------------------------#
|
||||
|
||||
CHECKS_OFF = -DCGAL_NO_PRECONDITIONS -DCGAL_NO_POSTCONDITIONS \
|
||||
-DCGAL_NO_ASSERTIONS -DCGAL_NO_WARNINGS
|
||||
|
||||
|
||||
CXXFLAGS = -g \
|
||||
-I${FLTK_DIR} \
|
||||
-I${GL_DIR}/include/ \
|
||||
-I/usr/X11R6/include/ \
|
||||
-B$(GCC_EXEC_PREFIX) $(LONG_NAME_PROBLEM_CXXFLAGS) \
|
||||
$(CGAL_CXXFLAGS) $(CHECKS_OFF) -DCGAL_USE_FLTK -DCGAL_USE_OPENGL
|
||||
|
||||
#-I${GL_DIR}/include \
|
||||
|
||||
LDFLAGS = $(CGAL_LDFLAGS) -L$(FLTK_DIR)/lib -L/usr/X11R6/lib \
|
||||
-L$(GL_DIR)/lib \
|
||||
-Wl,-R$(FLTK_DIR)/lib -Wl,-R/usr/X11R6/lib \
|
||||
-Wl,-R$(GL_DIR)/lib \
|
||||
-lfltk -lXext -lX11 -lMesaGL -lMesaGLU -lpthread
|
||||
|
||||
|
||||
#-lMesaGL -lMesaGLU
|
||||
|
||||
#-L$(GL_DIR)/lib
|
||||
#-R$(GL_DIR)/lib
|
||||
#---------------------------------------------------------------------#
|
||||
# target entries
|
||||
#---------------------------------------------------------------------#
|
||||
|
||||
|
||||
test: Viewer_test.o
|
||||
$(CGAL_CXX) -o $@ $(OFILES) Viewer_test.o $(LDFLAGS)
|
||||
|
||||
all: test
|
||||
|
||||
#---------------------------------------------------------------------#
|
||||
# suffix rules
|
||||
#---------------------------------------------------------------------#
|
||||
|
||||
.C.o:
|
||||
$(CGAL_CXX) $(CXXFLAGS) -c $<
|
||||
|
||||
.c.o:
|
||||
$(CGAL_CXX) $(CXXFLAGS) -c $<
|
||||
|
||||
|
||||
|
||||
|
||||
clean:
|
||||
rm -f *.o core *~
|
||||
rm -f ii_files/*
|
||||
rm -f test error.txt
|
||||
rm -f CompilerOutput*
|
||||
rm -f ErrorOutput_sparc_SunOS-5.6_g++-2.95.2_LEDA
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,109 +0,0 @@
|
|||
#! /bin/sh
|
||||
#
|
||||
# This is the test script for the CGAL-library.
|
||||
#
|
||||
# Usage:
|
||||
# run_testsuite for running the test suite in all subdirectories
|
||||
# run_testsuite <directory-list> for running the test suite in the listed
|
||||
# subdirectories
|
||||
#
|
||||
# To use this script you have to do two things:
|
||||
#
|
||||
# 1) enter the makefiles of the platforms that you want to test with (below)
|
||||
# 2) set some additional compiler and or linker flags
|
||||
|
||||
#TESTSUITE_CXXFLAGS="-Wall"
|
||||
TESTSUITE_CXXFLAGS=""
|
||||
TESTSUITE_LDFLAGS=""
|
||||
|
||||
CURRENTDIR=`pwd`
|
||||
ERRORFILE=${CURRENTDIR}/error.txt
|
||||
|
||||
#clear the error file
|
||||
/bin/rm -f $ERRORFILE
|
||||
/bin/touch $ERRORFILE
|
||||
|
||||
#test_directory <directory>
|
||||
test_directory()
|
||||
{
|
||||
cd $CURRENTDIR
|
||||
if [ -d $1 ] ; then
|
||||
echo "DIRECTORY $1:"
|
||||
echo
|
||||
|
||||
echo "DIRECTORY $1:" >> $ERRORFILE
|
||||
echo >> $ERRORFILE
|
||||
cd $1
|
||||
|
||||
COMPILER_OUTPUT=CompilerOutput_$PLATFORM
|
||||
/bin/rm -f $COMPILER_OUTPUT
|
||||
ERROR_OUTPUT=ErrorOutput_$PLATFORM
|
||||
/bin/rm -f $ERROR_OUTPUT
|
||||
|
||||
echo "------------------------------------------------------------------" >> $COMPILER_OUTPUT
|
||||
echo "- Compiler output from platform $PLATFORM" >> $COMPILER_OUTPUT
|
||||
echo "------------------------------------------------------------------" >> $COMPILER_OUTPUT
|
||||
echo >> $COMPILER_OUTPUT
|
||||
|
||||
echo "------------------------------------------------------------------" >> $ERROR_OUTPUT
|
||||
echo "- Error output from platform $PLATFORM" >> $ERROR_OUTPUT
|
||||
echo "------------------------------------------------------------------" >> $ERROR_OUTPUT
|
||||
echo >> $ERROR_OUTPUT
|
||||
|
||||
if [ -f cgal_test -a -x cgal_test ] ; then
|
||||
export PLATFORM CGAL_MAKEFILE TESTSUITE_CXXFLAGS TESTSUITE_LDFLAGS
|
||||
/bin/rm -f error.txt
|
||||
./cgal_test 2>&1 | tee -a $COMPILER_OUTPUT
|
||||
|
||||
if [ -f error.txt ] ; then
|
||||
/bin/cat error.txt >> $ERRORFILE
|
||||
/bin/cat error.txt >> $ERROR_OUTPUT
|
||||
else
|
||||
echo "ERROR: the script cgal_test failed to generate output" >> $ERRORFILE
|
||||
fi
|
||||
else
|
||||
echo " Could not execute the script cgal_test in directory $1"
|
||||
echo "ERROR: could not execute the script $1/cgal_test" >> $ERRORFILE
|
||||
fi
|
||||
echo >> $ERRORFILE
|
||||
echo >> $ERROR_OUTPUT
|
||||
fi
|
||||
echo
|
||||
}
|
||||
|
||||
#run_testsuite <makefile>
|
||||
run_testsuite()
|
||||
{
|
||||
CGAL_MAKEFILE=$1
|
||||
PLATFORM=`/bin/basename $1 | /bin/sed -e "s/makefile_//g"`
|
||||
|
||||
echo "---------------------------------------------------------------"
|
||||
echo "- Testing platform $PLATFORM"
|
||||
echo "---------------------------------------------------------------"
|
||||
echo
|
||||
|
||||
echo "---------------------------------------------------------------" >> $ERRORFILE
|
||||
echo "- TEST RESULTS FROM PLATFORM $PLATFORM" >> $ERRORFILE
|
||||
echo "---------------------------------------------------------------" >> $ERRORFILE
|
||||
echo >> $ERRORFILE
|
||||
|
||||
for DIR in $TEST_DIRECTORIES ; do
|
||||
test_directory $DIR
|
||||
done
|
||||
}
|
||||
|
||||
if [ -z "$1" ] ; then
|
||||
TEST_DIRECTORIES=`/bin/ls`
|
||||
else
|
||||
TEST_DIRECTORIES="$*"
|
||||
fi
|
||||
|
||||
#-------------------------------------------------------------------$
|
||||
# Add a line
|
||||
#
|
||||
# run_testsuite <include makefile>
|
||||
#
|
||||
# for all platforms that you want to test with.
|
||||
#-------------------------------------------------------------------$
|
||||
|
||||
run_testsuite $CGAL_MAKEFILE
|
||||
Loading…
Reference in New Issue