minor changes

This commit is contained in:
Marc Pouget 2006-06-16 16:05:37 +00:00
parent 25ed1d9a52
commit e760336cd2
11 changed files with 113 additions and 60 deletions

View File

@ -11,3 +11,4 @@ it displays an OpenGL view of both the mesh and the ridge lines
./introspect-qt.exe ../../examples/Ridges_3/data/ellipe0.003.off ../../examples/Ridges_3/data_ellipe0.003.off.4ogl.txt
./introspect-qt.exe ../../examples/Ridges_3/data/poly2x^2+y^2-0.062500.off ../../examples/Ridges_3/data_poly2x^2+y^2-0.062500.off.4ogl.txt

View File

@ -16,17 +16,17 @@ SketchSample::~SketchSample() {
}
void SketchSample::buildDisplayList(GLuint surf) {
glNewList(surf, GL_COMPILE);
glShadeModel(GL_SMOOTH);
//mesh
//glMaterialfv is def in the mesh
glEnable(GL_LIGHTING);
// glShadeModel(GL_SMOOTH);
glShadeModel(GL_FLAT);
//mesh glMaterialfv is def in the mesh with offset to see the lines z_buffered
p_mesh->gl_draw_facets(true);
//ridges, drawn without light
glDisable(GL_LIGHTING);
glColor3d(1., 1., 0.);
for (DS_iterator it=p_ridge_data->begin();it!=p_ridge_data->end();it++)
draw_one_ridge(*it);
@ -108,11 +108,11 @@ void SketchSample::draw_one_ridge(data_line* line)
if (line->ridge_type == RH) glColor3f(1.,1.,0.);
if (line->ridge_type == RC) glColor3f(1.,0.,0.);
std::list<Point>::iterator iter = line->ridge_points.begin(),
std::vector<Point>::iterator iter = line->ridge_points.begin(),
ite = line->ridge_points.end();
glLineWidth(3 );
glBegin(GL_LINES);
for (;iter!=ite;iter++) glVertex3d(iter->x(), iter->y(), iter->z());
glBegin(GL_LINE_STRIP);
for (;iter!=ite;iter++) glVertex3d(iter->x(), iter->y(), iter->z());
glEnd();
}

View File

@ -17,9 +17,9 @@ enum Ridge_type {NONE=0, BLUE_RIDGE, RED_RIDGE, CREST, BE, BH, BC, RE, RH, RC};
struct data_line{
int ridge_type;
double strength, sharpness;
std::list<Point> ridge_points;
std::vector<Point> ridge_points;
data_line(int ridge_type, double strength, double sharpness,
std::list<Point> ridge_points):
std::vector<Point> ridge_points):
ridge_type(ridge_type), strength(strength), sharpness(sharpness),
ridge_points(ridge_points)
{};

View File

@ -254,9 +254,12 @@ public :
// draw edges
void gl_draw_edges()
{
::glColor3f(1,0,0);
::glBegin(GL_LINES);
Halfedge_iterator it;
for(it = edges_begin();
it != edges_end();
for(it = this->edges_begin();
it != this->edges_end();
it++)
{
Halfedge_handle he = it;
@ -265,7 +268,8 @@ public :
::glVertex3d(p1[0],p1[1],p1[2]);
::glVertex3d(p2[0],p2[1],p2[2]);
}
}
::glEnd();
}
// draw vertices
@ -274,8 +278,8 @@ public :
::glPointSize(5.0f);
::glBegin(GL_POINTS);
Point_iterator it;
for(it = points_begin();
it != points_end();
for(it = this->points_begin();
it != this->points_end();
it++)
{
const Point& p = *it;
@ -291,16 +295,19 @@ public :
static GLfloat agray[4] = {1,1,1, 1.0 };
glMaterialfv( GL_FRONT, GL_AMBIENT_AND_DIFFUSE, agray);
glPolygonOffset( 1.0, 1.0 );
glPolygonMode(GL_FRONT, GL_FILL);
glEnable(GL_POLYGON_OFFSET_FILL);
glEnable(GL_POLYGON_OFFSET_FILL);
glPolygonOffset( 1.0, 1.0 );
glPolygonMode(GL_FRONT, GL_FILL);
Facet_iterator hFacet;
for(hFacet = facets_begin();
hFacet != facets_end();
for(hFacet = this->facets_begin();
hFacet != this->facets_end();
hFacet++)
gl_draw_facet(hFacet,smooth);
glPolygonOffset( 0.0, 0.0 );
glDisable(GL_POLYGON_OFFSET_FILL);
}
void gl_draw_facet(Facet_handle hFacet,
@ -362,8 +369,8 @@ public :
::glBegin(GL_LINES);
Facet_iterator hFacet;
for(hFacet = facets_begin();
hFacet != facets_end();
for(hFacet = this->facets_begin();
hFacet != this->facets_end();
hFacet++)
{
Point p = iso_barycentre(hFacet);
@ -383,8 +390,8 @@ public :
{
::glBegin(GL_LINES);
Vertex_iterator it;
for(it = vertices_begin();
it != vertices_end();
for(it = this->vertices_begin();
it != this->vertices_end();
it++)
{
const typename Vertex::Normal_3& normal = it->normal();
@ -400,11 +407,11 @@ public :
// normals (per facet, then per vertex)
void compute_normals_per_facet()
{
std::for_each(facets_begin(),facets_end(),Facet_normal());
std::for_each(this->facets_begin(),this->facets_end(),Facet_normal());
}
void compute_normals_per_vertex()
{
std::for_each(vertices_begin(),vertices_end(),Vertex_normal());
std::for_each(this->vertices_begin(),this->vertices_end(),Vertex_normal());
}
void compute_normals()
{
@ -419,7 +426,7 @@ int nb_component()
unsigned int nb = 0;
tag_facets(0);
Facet_handle seed_facet = NULL;
while((seed_facet = get_facet_tag(0)) != NULL)
while((seed_facet = this->get_facet_tag(0)) != NULL)
{
nb++;
tag_component(seed_facet,0,1);
@ -430,8 +437,8 @@ int nb_component()
// tag all facets
void tag_facets(const int tag)
{
for(Facet_iterator pFace = facets_begin();
pFace != facets_end();
for(Facet_iterator pFace = this->facets_begin();
pFace != this->facets_end();
pFace++)
pFace->tag(tag);
}
@ -467,8 +474,8 @@ void tag_component(Facet_handle pSeedFacet,
// tag all halfedges
void tag_halfedges(const int tag)
{
for(Halfedge_iterator pHalfedge = halfedges_begin();
pHalfedge != halfedges_end();
for(Halfedge_iterator pHalfedge = this->halfedges_begin();
pHalfedge != this->halfedges_end();
pHalfedge++)
pHalfedge->tag(tag);
}
@ -479,7 +486,7 @@ unsigned int nb_boundaries()
unsigned int nb = 0;
tag_halfedges(0);
Halfedge_handle seed_halfedge = NULL;
while((seed_halfedge = get_border_halfedge_tag(0)) != NULL)
while((seed_halfedge = this->get_border_halfedge_tag(0)) != NULL)
{
nb++;
seed_halfedge->tag(1);
@ -501,21 +508,21 @@ unsigned int nb_boundaries()
void subdivide_sqrt3 ()
{
// check for valid polygon mesh
if(size_of_facets() == 0)
if(this->size_of_facets() == 0)
return;
// subdivision
// We use that new vertices/halfedges/facets are appended at the end.
std::size_t nv = size_of_vertices();
Vertex_iterator last_v = vertices_end();
std::size_t nv = this->size_of_vertices();
Vertex_iterator last_v = this->vertices_end();
-- last_v; // the last of the old vertices
Edge_iterator last_e = edges_end();
Edge_iterator last_e = this->edges_end();
-- last_e; // the last of the old edges
Facet_iterator last_f = facets_end();
Facet_iterator last_f = this->facets_end();
-- last_f; // the last of the old facets
Facet_iterator f = facets_begin(); // create new centre vertices
Facet_iterator f = this->facets_begin(); // create new centre vertices
do {
star_facet( f);
} while ( f++ != last_f);
@ -527,7 +534,7 @@ void subdivide_sqrt3 ()
// ++e; // careful, incr. before flip since flip destroys current edge
// flip_edge( h);
//};
CGAL_postcondition(is_valid());
CGAL_postcondition(this->is_valid());
}

View File

@ -3,7 +3,7 @@
#---------------------------------------------------------------------#
# include platform specific settings
#---------------------------------------------------------------------#
#--------------------------------------------------------------------#
# Choose the right include file from the <cgalroot>/make directory.
include $(CGAL_MAKEFILE)
@ -46,7 +46,7 @@ QTLDFLAGS = \
$(CGAL_QT_LDFLAGS) -lGL -lglut
INTRO_LD_FLAGS=-L$(INTROSPEC_DIR) -lInstrospect
INTRO_LD_FLAGS=-L$(INTROSPEC_DIR) -lIntrospect
#---------------------------------------------------------------------#

View File

@ -16,6 +16,9 @@
#include <sstream>
#include <string>
#include "jv_writer.h"
Mesh m_mesh;
DS ridge_data;
@ -36,7 +39,7 @@ void clean_DS(DS& L)
void
read_line(std::ifstream& stream_res, int& ridge_type,
double& strength, double& sharpness,
std::list<Point>& ridge_points)
std::vector<Point>& ridge_points)
{
const int max_line_size = 100000;
char cline[max_line_size];
@ -74,7 +77,7 @@ void load_data_from_file(DS& l, const char* file_res)
{
int ridge_type;
double strength, sharpness;
std::list<Point> ridge_points;
std::vector<Point> ridge_points;
read_line(stream_res, ridge_type, strength, sharpness,
ridge_points);
@ -115,6 +118,7 @@ int main(int argc, char** argv) {
load_geom(argc, argv);
QApplication app(argc, argv);
glutInit(&argc, argv);
if ( !QGLFormat::hasOpenGL() ) {
qWarning( "This system has no OpenGL support. Exiting." );
@ -133,5 +137,45 @@ int main(int argc, char** argv) {
main.show();
//debug visu with a jvx file
std::cout << ridge_data.size() << std::endl;
DS_iterator iter_lines = ridge_data.begin(), iter_end = ridge_data.end();
std::ofstream out_jvx("debug.jvx");
CGAL::Javaview_writer<std::ofstream> jvw(out_jvx);
jvw.set_title("ridges");
jvw.write_header();
// //first the polysurf
// jvw.set_geometry_name("polysurf");
// jvw.begin_geometry();
// polyhedron_javaview_writer(jvw, P);
// jvw.end_geometry();
int compt = 0;
for (;iter_lines!=iter_end;iter_lines++) {
compt++;
// create the name of the ridge
std::ostringstream str;
str << "ridge " << compt;
jvw.set_geometry_name(str.str());
//color
if ((*iter_lines)->ridge_type ==BC) jvw.set_color(CGAL::BLUE);
else jvw.set_color(CGAL::RED);
//lines
jvw.begin_geometry();
polyline_javaview_writer(jvw, (*iter_lines)->ridge_points.begin(),
(*iter_lines)->ridge_points.end());
jvw.end_geometry();
}
jvw.write_footer();
return app.exec();
}

View File

@ -17,7 +17,7 @@
//----------------------------------------------------------------
// A redefined items class for the Polyhedron_3 with
// a refined vertex class that contains monge data and ring_tag
// a refined facet with a normal vector
// a refined facet with a normal vector + tag is_visited
// a refined halfedge with length
template < class Refs, class Tag, class Pt, class FGeomTraits >
class My_vertex:public CGAL::HalfedgeDS_vertex_base < Refs, Tag, Pt >

View File

@ -31,7 +31,7 @@ Note : if the nb of collected points is less than the required min number of
./blind.exe -f data/ellipe0.003.off -d3 -m3 -a3
./blind.exe -f data/ellipe0.003.off -d4 -m4 -a3 -t4
./blind.exe -f data/poly2x^2+y^2-0.062500.off -d4 -m4 -a0 -t4
./blind.exe -f data/poly2x^2+y^2-0.062500.off -d4 -m4 -p20 -t4

View File

@ -383,19 +383,19 @@ int main(int argc, char *argv[])
//UMBOLICS
Umbilic_approximation umbilic_approximation;
std::vector<Umbilic*> umbilics;
back_insert_iterator<std::vector<Umbilic*> > umb_it(umbilics);
umbilic_approximation.compute(P, umb_it, umb_size);
std::vector<Umbilic*>::iterator iter_umb = umbilics.begin(),
iter_umb_end = umbilics.end();
// output
std::cout << "nb of umbilics " << umbilics.size() << std::endl;
for (;iter_umb!=iter_umb_end;iter_umb++)
{
std::cout << "umbilic type " << (*iter_umb)->umb_type << std::endl;
}
// //UMBOLICS
// Umbilic_approximation umbilic_approximation;
// std::vector<Umbilic*> umbilics;
// back_insert_iterator<std::vector<Umbilic*> > umb_it(umbilics);
// umbilic_approximation.compute(P, umb_it, umb_size);
// std::vector<Umbilic*>::iterator iter_umb = umbilics.begin(),
// iter_umb_end = umbilics.end();
// // output
// std::cout << "nb of umbilics " << umbilics.size() << std::endl;
// for (;iter_umb!=iter_umb_end;iter_umb++)
// {
// std::cout << "umbilic type " << (*iter_umb)->umb_type << std::endl;
// }

View File

@ -133,6 +133,7 @@ compute_one_ring(Vertex_handle v,
Vector_3 p0p;
FT d = OneRingSize;
for (; itb != ite; itb++){
p = (*itb)->point();
p0p = p0 - p;
d = CGAL::sqrt(p0p*p0p);

View File

@ -2,7 +2,7 @@
#define _RIDGE_3_H_
#include <CGAL/basic.h>
#include <pair.h>
#include <utility>
#include <list>
#include "PolyhedralSurf_neighbors.h"
#include "Umbilic.h"