Port to Linux/g++

This commit is contained in:
Laurent Saboret 2009-04-03 17:51:59 +00:00
parent cb2644dab9
commit f6ddd6ae06
3 changed files with 60 additions and 57 deletions

3
.gitignore vendored
View File

@ -627,7 +627,10 @@ Surface_mesher/test/Surface_mesher/my_makefile
Surface_mesher/test/Surface_mesher/test_c2t3_iterators Surface_mesher/test/Surface_mesher/test_c2t3_iterators
Surface_mesher/test/Surface_mesher/test_canonical_edge Surface_mesher/test/Surface_mesher/test_canonical_edge
Surface_mesher/test/Surface_mesher/test_robust_circumcenter Surface_mesher/test/Surface_mesher/test_robust_circumcenter
Surface_reconstruction_points_3/demo/Surface_reconstruction_points_3/Point_set_demo/*.kdev*
Surface_reconstruction_points_3/demo/Surface_reconstruction_points_3/Point_set_demo/*.vcproj Surface_reconstruction_points_3/demo/Surface_reconstruction_points_3/Point_set_demo/*.vcproj
Surface_reconstruction_points_3/demo/Surface_reconstruction_points_3/Point_set_demo/Makefile
Surface_reconstruction_points_3/demo/Surface_reconstruction_points_3/Point_set_demo/Point_set_demo
Surface_reconstruction_points_3/demo/Surface_reconstruction_points_3/Point_set_demo/Point_set_demo.sln Surface_reconstruction_points_3/demo/Surface_reconstruction_points_3/Point_set_demo/Point_set_demo.sln
Surface_reconstruction_points_3/demo/Surface_reconstruction_points_3/poisson/*.off Surface_reconstruction_points_3/demo/Surface_reconstruction_points_3/poisson/*.off
Surface_reconstruction_points_3/demo/Surface_reconstruction_points_3/poisson/ALL_BUILD.vcproj Surface_reconstruction_points_3/demo/Surface_reconstruction_points_3/poisson/ALL_BUILD.vcproj

View File

@ -17,17 +17,17 @@
#include <CGAL/gl.h> #include <CGAL/gl.h>
/// The Point_set_3 class is array of points + normals of type /// The Point_set_3 class is array of points + normals of type
/// Point_with_normal_3<Gt, Orientable_normal_3<Gt> > (in fact /// Point_with_normal_3<Gt, Orientable_normal_3<Gt> > (in fact
/// UI_point_3 to support a selection flag). /// UI_point_3 to support a selection flag).
/// It provides: /// It provides:
/// - accessors: points and normals iterators, property maps /// - accessors: points and normals iterators, property maps
/// - OpenGL rendering /// - OpenGL rendering
/// - bounding box /// - bounding box
/// ///
/// CAUTION: invalidate_bounds() must be called /// CAUTION: invalidate_bounds() must be called
/// after modifying the points. /// after modifying the points.
/// ///
/// @heading Parameters: /// @heading Parameters:
/// @param Gt Geometric traits class. /// @param Gt Geometric traits class.
@ -37,7 +37,7 @@ class Point_set_3 : public std::deque<UI_point_3<Gt> >
// Private types // Private types
private: private:
// Base class // Base class
typedef std::deque<UI_point_3<Gt> > Base; typedef std::deque<UI_point_3<Gt> > Base;
// Auxiliary class to build a normals iterator // Auxiliary class to build a normals iterator
@ -55,8 +55,8 @@ public:
// Repeat base class' types // Repeat base class' types
/// @cond SKIP_IN_MANUAL /// @cond SKIP_IN_MANUAL
using Base::iterator; typedef typename Base::iterator iterator;
using Base::const_iterator; typedef typename Base::const_iterator const_iterator;
/// @endcond /// @endcond
// Classic CGAL geometric types // Classic CGAL geometric types
@ -71,34 +71,34 @@ public:
typedef UI_point_3<Gt> UI_point; ///< Position + normal + selection flag typedef UI_point_3<Gt> UI_point; ///< Position + normal + selection flag
// Its superclass: // Its superclass:
typedef typename UI_point::Point_with_normal Point_with_normal; ///< Position + normal typedef typename UI_point::Point_with_normal Point_with_normal; ///< Position + normal
// Type of points normal // Type of points normal
typedef typename UI_point::Normal Normal; ///< Model of OrientableNormal_3 concept. typedef typename UI_point::Normal Normal; ///< Model of OrientableNormal_3 concept.
// Iterator over Point_3 points // Iterator over Point_3 points
typedef std::deque<UI_point>::iterator Point_iterator; typedef typename std::deque<UI_point>::iterator Point_iterator;
typedef std::deque<UI_point>::const_iterator Point_const_iterator; typedef typename std::deque<UI_point>::const_iterator Point_const_iterator;
// Iterator over normals // Iterator over normals
typedef CGAL::Iterator_project<iterator, typedef CGAL::Iterator_project<iterator,
Project_normal<UI_point> > Project_normal<UI_point> >
Normal_iterator; Normal_iterator;
typedef CGAL::Iterator_project<const_iterator, typedef CGAL::Iterator_project<const_iterator,
Project_normal<UI_point> > Project_normal<UI_point> >
Normal_const_iterator; Normal_const_iterator;
// Data members // Data members
private: private:
// Indicate if m_barycenter, m_bounding_box, m_bounding_sphere and // Indicate if m_barycenter, m_bounding_box, m_bounding_sphere and
// m_diameter_standard_deviation below are valid. // m_diameter_standard_deviation below are valid.
mutable bool m_bounding_box_is_valid; mutable bool m_bounding_box_is_valid;
mutable Iso_cuboid m_bounding_box; // point set's bounding box mutable Iso_cuboid m_bounding_box; // point set's bounding box
mutable Sphere m_bounding_sphere; // point set's bounding sphere mutable Sphere m_bounding_sphere; // point set's bounding sphere
mutable Point m_barycenter; // point set's barycenter mutable Point m_barycenter; // point set's barycenter
mutable FT m_diameter_standard_deviation; // point set's standard deviation mutable FT m_diameter_standard_deviation; // point set's standard deviation
unsigned int m_nb_selected_points; // number of selected points unsigned int m_nb_selected_points; // number of selected points
// Public methods // Public methods
@ -137,32 +137,32 @@ public:
point->select(is_selected); point->select(is_selected);
m_nb_selected_points += (is_selected ? 1 : -1); m_nb_selected_points += (is_selected ? 1 : -1);
} }
} }
/// Mark a range of points as selected/not selected. /// Mark a range of points as selected/not selected.
/// ///
/// @param first First point to select/unselect. /// @param first First point to select/unselect.
/// @param beyond Past-the-end point to select/unselect. /// @param beyond Past-the-end point to select/unselect.
void select(iterator first, iterator beyond, void select(iterator first, iterator beyond,
bool is_selected = true) bool is_selected = true)
{ {
for (iterator it = first; it != beyond; it++) for (iterator it = first; it != beyond; it++)
it->select(is_selected); it->select(is_selected);
m_nb_selected_points = std::count_if(begin(), end(), m_nb_selected_points = std::count_if(begin(), end(),
std::mem_fun_ref(&UI_point::is_selected)); std::mem_fun_ref(&UI_point::is_selected));
} }
/// Delete selected points. /// Delete selected points.
void delete_selection() void delete_selection()
{ {
// erase-remove idiom // erase-remove idiom
erase(std::remove_if(begin(), end(), std::mem_fun_ref(&UI_point::is_selected)), erase(std::remove_if(begin(), end(), std::mem_fun_ref(&UI_point::is_selected)),
end()); end());
m_nb_selected_points = 0; m_nb_selected_points = 0;
invalidate_bounds(); invalidate_bounds();
} }
/// Get the bounding box. /// Get the bounding box.
Iso_cuboid bounding_box() const Iso_cuboid bounding_box() const
@ -283,7 +283,7 @@ public:
// Draw normals of *non-selected* points // Draw normals of *non-selected* points
if (m_nb_selected_points < size()) if (m_nb_selected_points < size())
{ {
// Draw *oriented* normals // Draw *oriented* normals
::glColor3ub(r,g,b); ::glColor3ub(r,g,b);
::glLineWidth(line_width); ::glLineWidth(line_width);
::glBegin(GL_LINES); ::glBegin(GL_LINES);
@ -300,7 +300,7 @@ public:
} }
::glEnd(); ::glEnd();
// Draw *non-oriented* normals // Draw *non-oriented* normals
::glColor3ub(245,184,0); // non oriented => orange ::glColor3ub(245,184,0); // non oriented => orange
//::glLineWidth(line_width*1.5); // orange is light color //::glLineWidth(line_width*1.5); // orange is light color
::glBegin(GL_LINES); ::glBegin(GL_LINES);
@ -342,7 +342,7 @@ public:
} }
::glEnd(); ::glEnd();
} }
// Draw original normals of *non-selected* points (always oriented) // Draw original normals of *non-selected* points (always oriented)
if (m_nb_selected_points < size()) if (m_nb_selected_points < size())
{ {
@ -424,11 +424,11 @@ private:
/// Helper class: type of the "vertex_point" property map /// Helper class: type of the "vertex_point" property map
/// of an Point_set_3 object. /// of an Point_set_3 object.
template <class Gt> template <class Gt>
class Point_set_vertex_point_const_map class Point_set_vertex_point_const_map
{ {
public: public:
typedef Point_set_3<Gt> Point_set; typedef Point_set_3<Gt> Point_set;
typedef typename Gt::Point_3 Point_3; typedef typename Gt::Point_3 Point_3;
// Property maps required types // Property maps required types
typedef boost::readable_property_map_tag category; typedef boost::readable_property_map_tag category;
@ -439,7 +439,7 @@ public:
Point_set_vertex_point_const_map(const Point_set&) {} Point_set_vertex_point_const_map(const Point_set&) {}
/// Free function to access the map elements. /// Free function to access the map elements.
friend inline friend inline
reference get(const Point_set_vertex_point_const_map&, key_type p) reference get(const Point_set_vertex_point_const_map&, key_type p)
{ {
return *p; return *p;
@ -450,8 +450,8 @@ public:
/// of an Point_set_3 object. /// of an Point_set_3 object.
template <class Gt> template <class Gt>
inline inline
Point_set_vertex_point_const_map<Gt> Point_set_vertex_point_const_map<Gt>
get(CGAL::vertex_point_t, const Point_set_3<Gt>& points) get(CGAL::vertex_point_t, const Point_set_3<Gt>& points)
{ {
Point_set_vertex_point_const_map<Gt> aMap(points); Point_set_vertex_point_const_map<Gt> aMap(points);
return aMap; return aMap;
@ -461,13 +461,13 @@ get(CGAL::vertex_point_t, const Point_set_3<Gt>& points)
/// Helper class: type of the "vertex_normal" property map /// Helper class: type of the "vertex_normal" property map
/// of an Point_set_3 object. /// of an Point_set_3 object.
template <class Gt> template <class Gt>
class Point_set_vertex_normal_map class Point_set_vertex_normal_map
: public boost::put_get_helper<typename Point_set_3<Gt>::Normal&, : public boost::put_get_helper<typename Point_set_3<Gt>::Normal&,
Point_set_vertex_normal_map<Gt> > Point_set_vertex_normal_map<Gt> >
{ {
public: public:
typedef Point_set_3<Gt> Point_set; typedef Point_set_3<Gt> Point_set;
typedef typename Point_set::Normal Normal; typedef typename Point_set::Normal Normal;
// Property maps required types // Property maps required types
typedef boost::lvalue_property_map_tag category; typedef boost::lvalue_property_map_tag category;
@ -485,8 +485,8 @@ public:
/// of an Point_set_3 object. /// of an Point_set_3 object.
template <class Gt> template <class Gt>
inline inline
Point_set_vertex_normal_map<Gt> Point_set_vertex_normal_map<Gt>
get(boost::vertex_normal_t, const Point_set_3<Gt>& points) get(boost::vertex_normal_t, const Point_set_3<Gt>& points)
{ {
Point_set_vertex_normal_map<Gt> aMap(points); Point_set_vertex_normal_map<Gt> aMap(points);
return aMap; return aMap;

View File

@ -11,21 +11,21 @@
#include <algorithm> #include <algorithm>
/// The UI_point_3 class represents a 3D point in Surface_reconstruction_points_3 demo. /// The UI_point_3 class represents a 3D point in Surface_reconstruction_points_3 demo.
/// It contains: /// It contains:
/// - a position, /// - a position,
/// - a normal (oriented or not), /// - a normal (oriented or not),
/// - an original normal (optional, always oriented), /// - an original normal (optional, always oriented),
/// - a selection flag. /// - a selection flag.
/// ///
/// @heading Is Model for the Concepts: /// @heading Is Model for the Concepts:
/// Model of the PointWithOrientableNormal_3 concept. /// Model of the PointWithOrientableNormal_3 concept.
/// ///
/// @heading Parameters: /// @heading Parameters:
/// @param Gt Kernel's geometric traits. /// @param Gt Kernel's geometric traits.
template<class Gt> template<class Gt>
class UI_point_3 class UI_point_3
: public CGAL::Point_with_normal_3<Gt, CGAL::Orientable_normal_3<Gt> > : public CGAL::Point_with_normal_3<Gt, CGAL::Orientable_normal_3<Gt> >
{ {
// Private types // Private types
@ -78,32 +78,32 @@ public:
m_is_selected = false; m_is_selected = false;
} }
template <class K, class N> template <class K, class N>
UI_point_3(const Point_with_normal_3<K,N>& pwn) UI_point_3(const CGAL::Point_with_normal_3<K,N>& pwn)
: Base(pwn) : Base(pwn)
{ {
m_is_selected = false; m_is_selected = false;
} }
/// Copy constructor /// Copy constructor
UI_point_3(const UI_point_3& gpt) UI_point_3(const UI_point_3& upt)
: Base(gpt) : Base(upt)
{ {
m_is_selected = gpt.m_is_selected; m_is_selected = upt.m_is_selected;
m_original_normal = gpt.m_original_normal; m_original_normal = upt.m_original_normal;
} }
template<class K> template<class K>
UI_point_3(const UI_point_3<K>& gpt) UI_point_3(const UI_point_3<K>& upt)
: Base(gpt) : Base(upt)
{ {
m_is_selected = gpt.is_selected(); m_is_selected = upt.is_selected();
m_original_normal = gpt.m_original_normal; m_original_normal = upt.m_original_normal;
} }
/// Operator =() /// Operator =()
UI_point_3& operator=(const UI_point_3& gpt) UI_point_3& operator=(const UI_point_3& upt)
{ {
Base::operator=(gpt); Base::operator=(upt);
m_is_selected = gpt.m_is_selected; m_is_selected = upt.m_is_selected;
m_original_normal = gpt.m_original_normal; m_original_normal = upt.m_original_normal;
return *this; return *this;
} }