Some singular changes.
git-svn-id: http://www.openmesh.org/svnrepo/OpenMesh/trunk@806 fdac6126-5c0c-442c-9429-916003d36597
This commit is contained in:
@@ -73,9 +73,9 @@ add_subdirectory (src/OpenMesh/Tools)
|
|||||||
add_subdirectory (src/OpenMesh/Apps)
|
add_subdirectory (src/OpenMesh/Apps)
|
||||||
|
|
||||||
# Do not build unit tests when build as external library
|
# Do not build unit tests when build as external library
|
||||||
if(${PROJECT_NAME} MATCHES "OpenMesh")
|
#if(${PROJECT_NAME} MATCHES "OpenMesh")
|
||||||
add_subdirectory (src/Unittests)
|
add_subdirectory (src/Unittests)
|
||||||
endif()
|
#endif()
|
||||||
|
|
||||||
add_subdirectory (Doc)
|
add_subdirectory (Doc)
|
||||||
|
|
||||||
|
|||||||
@@ -106,8 +106,8 @@ class VertexVertexIterT
|
|||||||
|
|
||||||
typedef typename Mesh::HalfedgeHandle HalfedgeHandle;
|
typedef typename Mesh::HalfedgeHandle HalfedgeHandle;
|
||||||
|
|
||||||
typedef typename Mesh::Vertex value_type;
|
|
||||||
typedef typename Mesh::VertexHandle value_handle;
|
typedef typename Mesh::VertexHandle value_handle;
|
||||||
|
typedef value_handle value_type;
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
typedef std::bidirectional_iterator_tag iterator_category;
|
typedef std::bidirectional_iterator_tag iterator_category;
|
||||||
@@ -250,16 +250,14 @@ class VertexVertexIterT
|
|||||||
|
|
||||||
|
|
||||||
/// Return a reference to the current target.
|
/// Return a reference to the current target.
|
||||||
reference operator*() const {
|
typename Mesh::VertexHandle operator*() const {
|
||||||
assert(mesh_);
|
return handle();
|
||||||
return mesh_->deref(handle());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// Return a pointer to the current target.
|
/// Return a pointer to the current target.
|
||||||
pointer operator->() const {
|
typename Mesh::VertexHandle *operator->() const {
|
||||||
assert(mesh_);
|
return &handle();
|
||||||
return &mesh_->deref(handle());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -55,6 +55,9 @@
|
|||||||
//== INCLUDES =================================================================
|
//== INCLUDES =================================================================
|
||||||
|
|
||||||
#include "ModHausdorffT.hh"
|
#include "ModHausdorffT.hh"
|
||||||
|
#ifdef USE_OPENMP
|
||||||
|
#include <omp.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
//== NAMESPACES ===============================================================
|
//== NAMESPACES ===============================================================
|
||||||
@@ -70,7 +73,8 @@ ModHausdorffT<MeshT>::
|
|||||||
distPointTriangleSquared( const Point& _p,
|
distPointTriangleSquared( const Point& _p,
|
||||||
const Point& _v0,
|
const Point& _v0,
|
||||||
const Point& _v1,
|
const Point& _v1,
|
||||||
const Point& _v2 )
|
const Point& _v2,
|
||||||
|
Point& _nearestPoint )
|
||||||
{
|
{
|
||||||
const Point v0v1 = _v1 - _v0;
|
const Point v0v1 = _v1 - _v0;
|
||||||
const Point v0v2 = _v2 - _v0;
|
const Point v0v2 = _v2 - _v0;
|
||||||
@@ -80,10 +84,14 @@ distPointTriangleSquared( const Point& _p,
|
|||||||
|
|
||||||
// Check if the triangle is degenerated
|
// Check if the triangle is degenerated
|
||||||
if (d < FLT_MIN && d > -FLT_MIN) {
|
if (d < FLT_MIN && d > -FLT_MIN) {
|
||||||
|
// std::cerr << "distPointTriangleSquared: Degenerated triangle !\n";
|
||||||
|
// std::cerr << "Points are : " << _v0 << " " << _v1 << " " << _v2 << std::endl;
|
||||||
|
// std::cerr << "d is " << d << std::endl;
|
||||||
return -1.0;
|
return -1.0;
|
||||||
}
|
}
|
||||||
const double invD = 1.0 / d;
|
const double invD = 1.0 / d;
|
||||||
|
|
||||||
|
|
||||||
// these are not needed for every point, should still perform
|
// these are not needed for every point, should still perform
|
||||||
// better with many points against one triangle
|
// better with many points against one triangle
|
||||||
const Point v1v2 = _v2 - _v1;
|
const Point v1v2 = _v2 - _v1;
|
||||||
@@ -98,6 +106,7 @@ distPointTriangleSquared( const Point& _p,
|
|||||||
const double a = (t | v0v2) * -invD;
|
const double a = (t | v0v2) * -invD;
|
||||||
const double b = (t | v0v1) * invD;
|
const double b = (t | v0v1) * invD;
|
||||||
|
|
||||||
|
|
||||||
if (a < 0)
|
if (a < 0)
|
||||||
{
|
{
|
||||||
// Calculate the distance to an edge or a corner vertex
|
// Calculate the distance to an edge or a corner vertex
|
||||||
@@ -176,10 +185,13 @@ distPointTriangleSquared( const Point& _p,
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Calculate the distance to an interior point of the triangle
|
// Calculate the distance to an interior point of the triangle
|
||||||
return ( (_p - n*((n|v0p) * invD)) - _p).sqrnorm();
|
_nearestPoint = _p - n*((n|v0p) * invD);
|
||||||
|
return (_nearestPoint - _p).sqrnorm();
|
||||||
}
|
}
|
||||||
|
|
||||||
return (v0p - _p).sqrnorm();
|
_nearestPoint = v0p;
|
||||||
|
|
||||||
|
return (_nearestPoint - _p).sqrnorm();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -206,7 +218,8 @@ collapse_priority(const CollapseInfo& _ci)
|
|||||||
std::vector<FaceHandle> faces; faces.reserve(20);
|
std::vector<FaceHandle> faces; faces.reserve(20);
|
||||||
typename Mesh::VertexFaceIter vf_it;
|
typename Mesh::VertexFaceIter vf_it;
|
||||||
typename Mesh::FaceHandle fh;
|
typename Mesh::FaceHandle fh;
|
||||||
const typename Mesh::Scalar sqr_tolerace = tolerance_*tolerance_;
|
typename Mesh::Scalar sqr_tolerace = tolerance_*tolerance_;
|
||||||
|
typename Mesh::Point dummy;
|
||||||
typename Mesh::CFVIter fv_it;
|
typename Mesh::CFVIter fv_it;
|
||||||
bool ok;
|
bool ok;
|
||||||
|
|
||||||
@@ -246,7 +259,7 @@ collapse_priority(const CollapseInfo& _ci)
|
|||||||
const Point& p1 = mesh_.point(++fv_it);
|
const Point& p1 = mesh_.point(++fv_it);
|
||||||
const Point& p2 = mesh_.point(++fv_it);
|
const Point& p2 = mesh_.point(++fv_it);
|
||||||
|
|
||||||
if ( distPointTriangleSquared(*p_it, p0, p1, p2) <= sqr_tolerace)
|
if ( distPointTriangleSquared(*p_it, p0, p1, p2, dummy) <= sqr_tolerace)
|
||||||
ok = true;
|
ok = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -322,23 +335,41 @@ postprocess_collapse(const CollapseInfo& _ci)
|
|||||||
|
|
||||||
// re-distribute points
|
// re-distribute points
|
||||||
Scalar emin, e;
|
Scalar emin, e;
|
||||||
|
Point dummy;
|
||||||
typename Mesh::CFVIter fv_it;
|
typename Mesh::CFVIter fv_it;
|
||||||
|
|
||||||
for (p_it=tmp_points_.begin(); p_it!=p_end; ++p_it) {
|
for (p_it=tmp_points_.begin(); p_it!=p_end; ++p_it) {
|
||||||
emin = FLT_MAX;
|
emin = FLT_MAX;
|
||||||
|
|
||||||
|
#ifdef USE_OPENMP
|
||||||
|
int facesCount = faces.size();
|
||||||
|
#pragma omp parallel for private(e) shared(emin)
|
||||||
|
for (int i = 0; i < facesCount; ++i) {
|
||||||
|
const Point& p0 = mesh_.point(fv_it=mesh_.cfv_iter(faces[i]));
|
||||||
|
const Point& p1 = mesh_.point(++fv_it);
|
||||||
|
const Point& p2 = mesh_.point(++fv_it);
|
||||||
|
|
||||||
|
e = distPointTriangleSquared(*p_it, p0, p1, p2, dummy);
|
||||||
|
if (e < emin) {
|
||||||
|
emin = e;
|
||||||
|
fh = faces[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
#else
|
||||||
for (fh_it=faces.begin(); fh_it!=fh_end; ++fh_it) {
|
for (fh_it=faces.begin(); fh_it!=fh_end; ++fh_it) {
|
||||||
const Point& p0 = mesh_.point(fv_it=mesh_.cfv_iter(*fh_it));
|
const Point& p0 = mesh_.point(fv_it=mesh_.cfv_iter(*fh_it));
|
||||||
const Point& p1 = mesh_.point(++fv_it);
|
const Point& p1 = mesh_.point(++fv_it);
|
||||||
const Point& p2 = mesh_.point(++fv_it);
|
const Point& p2 = mesh_.point(++fv_it);
|
||||||
|
|
||||||
e = distPointTriangleSquared(*p_it, p0, p1, p2);
|
e = distPointTriangleSquared(*p_it, p0, p1, p2, dummy);
|
||||||
if (e < emin) {
|
if (e < emin) {
|
||||||
emin = e;
|
emin = e;
|
||||||
fh = *fh_it;
|
fh = *fh_it;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
mesh_.property(points_, fh).push_back(*p_it);
|
mesh_.property(points_, fh).push_back(*p_it);
|
||||||
}
|
}
|
||||||
@@ -364,15 +395,24 @@ compute_sqr_error(FaceHandle _fh, const Point& _p) const
|
|||||||
|
|
||||||
Point dummy;
|
Point dummy;
|
||||||
Scalar e;
|
Scalar e;
|
||||||
Scalar emax = distPointTriangleSquared(_p, p0, p1, p2);
|
Scalar emax = distPointTriangleSquared(_p, p0, p1, p2, dummy);
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef USE_OPENMP
|
||||||
for (; p_it!=p_end; ++p_it) {
|
int pointsCount = points.size();
|
||||||
e = distPointTriangleSquared(*p_it, p0, p1, p2);
|
#pragma omp parallel for private(e) shared(emax)
|
||||||
|
for (int i = 0; i < pointsCount; ++i) {
|
||||||
|
e = distPointTriangleSquared(points[i], p0, p1, p2, dummy);
|
||||||
if (e > emax)
|
if (e > emax)
|
||||||
emax = e;
|
emax = e;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
for (; p_it!=p_end; ++p_it) {
|
||||||
|
e = distPointTriangleSquared(*p_it, p0, p1, p2, dummy);
|
||||||
|
if (e > emax)
|
||||||
|
emax = e;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
return emax;
|
return emax;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -164,7 +164,7 @@ set_active_vertices()
|
|||||||
for (v_it=mesh_.vertices_begin(); v_it!=v_end; ++v_it)
|
for (v_it=mesh_.vertices_begin(); v_it!=v_end; ++v_it)
|
||||||
{
|
{
|
||||||
active = ((nothing_selected || mesh_.status(v_it).selected())
|
active = ((nothing_selected || mesh_.status(v_it).selected())
|
||||||
&& !mesh_.is_boundary(v_it)
|
//&& !mesh_.is_boundary(v_it)
|
||||||
&& !mesh_.status(v_it).locked());
|
&& !mesh_.status(v_it).locked());
|
||||||
|
|
||||||
if ( skip_features_ ) {
|
if ( skip_features_ ) {
|
||||||
|
|||||||
Reference in New Issue
Block a user