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_canonical_edge
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/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/poisson/*.off
Surface_reconstruction_points_3/demo/Surface_reconstruction_points_3/poisson/ALL_BUILD.vcproj

View File

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

View File

@ -11,21 +11,21 @@
#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:
/// - a position,
/// - a normal (oriented or not),
/// - an original normal (optional, always oriented),
/// - a selection flag.
///
/// @heading Is Model for the Concepts:
/// @heading Is Model for the Concepts:
/// Model of the PointWithOrientableNormal_3 concept.
///
/// @heading Parameters:
/// @param Gt Kernel's geometric traits.
template<class Gt>
class UI_point_3
class UI_point_3
: public CGAL::Point_with_normal_3<Gt, CGAL::Orientable_normal_3<Gt> >
{
// Private types
@ -78,32 +78,32 @@ public:
m_is_selected = false;
}
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)
{
m_is_selected = false;
}
/// Copy constructor
UI_point_3(const UI_point_3& gpt)
: Base(gpt)
UI_point_3(const UI_point_3& upt)
: Base(upt)
{
m_is_selected = gpt.m_is_selected;
m_original_normal = gpt.m_original_normal;
m_is_selected = upt.m_is_selected;
m_original_normal = upt.m_original_normal;
}
template<class K>
UI_point_3(const UI_point_3<K>& gpt)
: Base(gpt)
UI_point_3(const UI_point_3<K>& upt)
: Base(upt)
{
m_is_selected = gpt.is_selected();
m_original_normal = gpt.m_original_normal;
m_is_selected = upt.is_selected();
m_original_normal = upt.m_original_normal;
}
/// Operator =()
UI_point_3& operator=(const UI_point_3& gpt)
UI_point_3& operator=(const UI_point_3& upt)
{
Base::operator=(gpt);
m_is_selected = gpt.m_is_selected;
m_original_normal = gpt.m_original_normal;
Base::operator=(upt);
m_is_selected = upt.m_is_selected;
m_original_normal = upt.m_original_normal;
return *this;
}