Merge branch 'feature-free-functions' into 'master'
Feature free functions Closes #52 See merge request OpenMesh/OpenMesh!168
This commit is contained in:
@@ -117,6 +117,8 @@ cd unittests
|
|||||||
|
|
||||||
unittests.exe --gtest_output=xml
|
unittests.exe --gtest_output=xml
|
||||||
|
|
||||||
|
unittests_customvec.exe --gtest_output=xml
|
||||||
|
|
||||||
cd ..
|
cd ..
|
||||||
|
|
||||||
cd ..
|
cd ..
|
||||||
@@ -143,6 +145,8 @@ cd unittests
|
|||||||
|
|
||||||
unittests.exe --gtest_output=xml
|
unittests.exe --gtest_output=xml
|
||||||
|
|
||||||
|
unittests_customvec.exe --gtest_output=xml
|
||||||
|
|
||||||
IF %errorlevel% NEQ 0 exit /b %errorlevel%
|
IF %errorlevel% NEQ 0 exit /b %errorlevel%
|
||||||
|
|
||||||
cd ..
|
cd ..
|
||||||
|
|||||||
@@ -96,6 +96,15 @@ cd Unittests
|
|||||||
#execute tests
|
#execute tests
|
||||||
./unittests --gtest_color=yes --gtest_output=xml
|
./unittests --gtest_color=yes --gtest_output=xml
|
||||||
|
|
||||||
|
echo -e "${OUTPUT}"
|
||||||
|
echo ""
|
||||||
|
echo "======================================================================"
|
||||||
|
echo "Running unittests Release version with custom vector type"
|
||||||
|
echo "======================================================================"
|
||||||
|
echo -e "${NC}"
|
||||||
|
|
||||||
|
./unittests_customvec --gtest_color=yes --gtest_output=xml
|
||||||
|
|
||||||
cd ..
|
cd ..
|
||||||
cd ..
|
cd ..
|
||||||
|
|
||||||
@@ -134,5 +143,14 @@ cd Unittests
|
|||||||
#execute tests
|
#execute tests
|
||||||
./unittests --gtest_color=yes --gtest_output=xml
|
./unittests --gtest_color=yes --gtest_output=xml
|
||||||
|
|
||||||
|
echo -e "${OUTPUT}"
|
||||||
|
echo ""
|
||||||
|
echo "======================================================================"
|
||||||
|
echo "Running unittests Debug version with custom vector type"
|
||||||
|
echo "======================================================================"
|
||||||
|
echo -e "${NC}"
|
||||||
|
|
||||||
|
./unittests_customvec --gtest_color=yes --gtest_output=xml
|
||||||
|
|
||||||
cd ..
|
cd ..
|
||||||
cd ..
|
cd ..
|
||||||
|
|||||||
18
CI/ci-mac.sh
18
CI/ci-mac.sh
@@ -78,6 +78,15 @@ cd Unittests
|
|||||||
#execute tests
|
#execute tests
|
||||||
./unittests --gtest_color=yes --gtest_output=xml
|
./unittests --gtest_color=yes --gtest_output=xml
|
||||||
|
|
||||||
|
echo -e "${OUTPUT}"
|
||||||
|
echo ""
|
||||||
|
echo "======================================================================"
|
||||||
|
echo "Running unittests Release version with minimal vector type"
|
||||||
|
echo "======================================================================"
|
||||||
|
echo -e "${NC}"
|
||||||
|
|
||||||
|
./unittests_customvec --gtest_color=yes --gtest_output=xml
|
||||||
|
|
||||||
cd ..
|
cd ..
|
||||||
cd ..
|
cd ..
|
||||||
|
|
||||||
@@ -116,6 +125,15 @@ cd Unittests
|
|||||||
#execute tests
|
#execute tests
|
||||||
./unittests --gtest_color=yes --gtest_output=xml
|
./unittests --gtest_color=yes --gtest_output=xml
|
||||||
|
|
||||||
|
echo -e "${OUTPUT}"
|
||||||
|
echo ""
|
||||||
|
echo "======================================================================"
|
||||||
|
echo "Running unittests Debug version with minimal vector type"
|
||||||
|
echo "======================================================================"
|
||||||
|
echo -e "${NC}"
|
||||||
|
|
||||||
|
./unittests_customvec --gtest_color=yes --gtest_output=xml
|
||||||
|
|
||||||
cd ..
|
cd ..
|
||||||
cd ..
|
cd ..
|
||||||
|
|
||||||
|
|||||||
@@ -718,6 +718,47 @@ noexcept(noexcept(_v1.swap(_v2))) {
|
|||||||
_v1.swap(_v2);
|
_v1.swap(_v2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// \relates OpenMesh::VectorT
|
||||||
|
/// non-member norm
|
||||||
|
template<typename Scalar, int DIM>
|
||||||
|
Scalar norm(const VectorT<Scalar, DIM>& _v) {
|
||||||
|
return _v.norm();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// \relates OpenMesh::VectorT
|
||||||
|
/// non-member sqrnorm
|
||||||
|
template<typename Scalar, int DIM>
|
||||||
|
Scalar sqrnorm(const VectorT<Scalar, DIM>& _v) {
|
||||||
|
return _v.sqrnorm();
|
||||||
|
}
|
||||||
|
/// \relates OpenMesh::VectorT
|
||||||
|
/// non-member vectorize
|
||||||
|
template<typename Scalar, int DIM, typename OtherScalar>
|
||||||
|
VectorT<Scalar, DIM>& vectorize(VectorT<Scalar, DIM>& _v, OtherScalar const& _val) {
|
||||||
|
return _v.vectorize(_val);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// \relates OpenMesh::VectorT
|
||||||
|
/// non-member normalize
|
||||||
|
template<typename Scalar, int DIM>
|
||||||
|
VectorT<Scalar, DIM>& normalize(VectorT<Scalar, DIM>& _v) {
|
||||||
|
return _v.normalize();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// \relates OpenMesh::VectorT
|
||||||
|
/// non-member maximize
|
||||||
|
template<typename Scalar, int DIM>
|
||||||
|
VectorT<Scalar, DIM>& maximize(VectorT<Scalar, DIM>& _v1, VectorT<Scalar, DIM>& _v2) {
|
||||||
|
return _v1.maximize(_v2);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// \relates OpenMesh::VectorT
|
||||||
|
/// non-member minimize
|
||||||
|
template<typename Scalar, int DIM>
|
||||||
|
VectorT<Scalar, DIM>& minimize(VectorT<Scalar, DIM>& _v1, VectorT<Scalar, DIM>& _v2) {
|
||||||
|
return _v1.minimize(_v2);
|
||||||
|
}
|
||||||
|
|
||||||
//== TYPEDEFS =================================================================
|
//== TYPEDEFS =================================================================
|
||||||
|
|
||||||
/** 1-byte signed vector */
|
/** 1-byte signed vector */
|
||||||
|
|||||||
@@ -274,6 +274,52 @@ cross(const VectorT<Scalar,N>& _v1, const VectorT<Scalar,N>& _v2) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// \relates OpenMesh::VectorT
|
||||||
|
/// non-member norm
|
||||||
|
template<typename Scalar, int DIM>
|
||||||
|
Scalar norm(const VectorT<Scalar, DIM>& _v) {
|
||||||
|
return _v.norm();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// \relates OpenMesh::VectorT
|
||||||
|
/// non-member sqrnorm
|
||||||
|
template<typename Scalar, int DIM>
|
||||||
|
Scalar sqrnorm(const VectorT<Scalar, DIM>& _v) {
|
||||||
|
return _v.sqrnorm();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// \relates OpenMesh::VectorT
|
||||||
|
/// non-member vectorize
|
||||||
|
template<typename Scalar, int DIM, typename OtherScalar>
|
||||||
|
VectorT<Scalar, DIM>& vectorize(VectorT<Scalar, DIM>& _v, OtherScalar const& _val) {
|
||||||
|
return _v.vectorize(_val);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// \relates OpenMesh::VectorT
|
||||||
|
/// non-member normalize
|
||||||
|
template<typename Scalar, int DIM>
|
||||||
|
VectorT<Scalar, DIM>& normalize(VectorT<Scalar, DIM>& _v) {
|
||||||
|
return _v.normalize();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// \relates OpenMesh::VectorT
|
||||||
|
/// non-member maximize
|
||||||
|
template<typename Scalar, int DIM>
|
||||||
|
VectorT<Scalar, DIM>& maximize(VectorT<Scalar, DIM>& _v1, VectorT<Scalar, DIM>& _v2) {
|
||||||
|
return _v1.maximize(_v2);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// \relates OpenMesh::VectorT
|
||||||
|
/// non-member minimize
|
||||||
|
template<typename Scalar, int DIM>
|
||||||
|
VectorT<Scalar, DIM>& minimize(VectorT<Scalar, DIM>& _v1, VectorT<Scalar, DIM>& _v2) {
|
||||||
|
return _v1.minimize(_v2);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//== TYPEDEFS =================================================================
|
//== TYPEDEFS =================================================================
|
||||||
|
|||||||
@@ -139,18 +139,18 @@ PolyMeshT<Kernel>::calc_face_normal_impl(FaceHandle _fh, PointIs3DTag) const
|
|||||||
|
|
||||||
// Due to traits, the value types of normals and points can be different.
|
// Due to traits, the value types of normals and points can be different.
|
||||||
// Therefore we cast them here.
|
// Therefore we cast them here.
|
||||||
n[0] += static_cast<typename Normal::value_type>(a[1] * b[2]);
|
n[0] += static_cast<typename vector_traits<Normal>::value_type>(a[1] * b[2]);
|
||||||
n[1] += static_cast<typename Normal::value_type>(a[2] * b[0]);
|
n[1] += static_cast<typename vector_traits<Normal>::value_type>(a[2] * b[0]);
|
||||||
n[2] += static_cast<typename Normal::value_type>(a[0] * b[1]);
|
n[2] += static_cast<typename vector_traits<Normal>::value_type>(a[0] * b[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
const typename vector_traits<Normal>::value_type norm = n.length();
|
const typename vector_traits<Normal>::value_type length = norm(n);
|
||||||
|
|
||||||
// The expression ((n *= (1.0/norm)),n) is used because the OpenSG
|
// The expression ((n *= (1.0/norm)),n) is used because the OpenSG
|
||||||
// vector class does not return self after component-wise
|
// vector class does not return self after component-wise
|
||||||
// self-multiplication with a scalar!!!
|
// self-multiplication with a scalar!!!
|
||||||
return (norm != typename vector_traits<Normal>::value_type(0))
|
return (length != typename vector_traits<Normal>::value_type(0))
|
||||||
? ((n *= (typename vector_traits<Normal>::value_type(1)/norm)), n)
|
? ((n *= (typename vector_traits<Normal>::value_type(1)/length)), n)
|
||||||
: Normal(0, 0, 0);
|
: Normal(0, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -194,20 +194,22 @@ calc_face_normal_impl(const Point& _p0,
|
|||||||
Normal p1p2(vector_cast<Normal>(_p2)); p1p2 -= vector_cast<Normal>(_p1);
|
Normal p1p2(vector_cast<Normal>(_p2)); p1p2 -= vector_cast<Normal>(_p1);
|
||||||
|
|
||||||
Normal n = cross(p1p2, p1p0);
|
Normal n = cross(p1p2, p1p0);
|
||||||
typename vector_traits<Normal>::value_type norm = n.length();
|
typename vector_traits<Normal>::value_type length = norm(n);
|
||||||
|
|
||||||
// The expression ((n *= (1.0/norm)),n) is used because the OpenSG
|
// The expression ((n *= (1.0/norm)),n) is used because the OpenSG
|
||||||
// vector class does not return self after component-wise
|
// vector class does not return self after component-wise
|
||||||
// self-multiplication with a scalar!!!
|
// self-multiplication with a scalar!!!
|
||||||
return (norm != typename vector_traits<Normal>::value_type(0)) ? ((n *= (typename vector_traits<Normal>::value_type(1)/norm)),n) : Normal(0,0,0);
|
return (length != typename vector_traits<Normal>::value_type(0))
|
||||||
|
? ((n *= (typename vector_traits<Normal>::value_type(1)/length)),n)
|
||||||
|
: Normal(0,0,0);
|
||||||
#else
|
#else
|
||||||
Point p1p0 = _p0; p1p0 -= _p1;
|
Point p1p0 = _p0; p1p0 -= _p1;
|
||||||
Point p1p2 = _p2; p1p2 -= _p1;
|
Point p1p2 = _p2; p1p2 -= _p1;
|
||||||
|
|
||||||
Normal n = vector_cast<Normal>(cross(p1p2, p1p0));
|
Normal n = vector_cast<Normal>(cross(p1p2, p1p0));
|
||||||
typename vector_traits<Normal>::value_type norm = n.length();
|
typename vector_traits<Normal>::value_type length = norm(n);
|
||||||
|
|
||||||
return (norm != 0.0) ? n *= (1.0/norm) : Normal(0,0,0);
|
return (length != 0.0) ? n *= (1.0/length) : Normal(0,0,0);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -226,7 +228,7 @@ PolyMeshT<Kernel>::
|
|||||||
calc_face_centroid(FaceHandle _fh) const
|
calc_face_centroid(FaceHandle _fh) const
|
||||||
{
|
{
|
||||||
Point _pt;
|
Point _pt;
|
||||||
_pt.vectorize(0);
|
vectorize(_pt, 0);
|
||||||
Scalar valence = 0.0;
|
Scalar valence = 0.0;
|
||||||
for (ConstFaceVertexIter cfv_it = this->cfv_iter(_fh); cfv_it.is_valid(); ++cfv_it, valence += 1.0)
|
for (ConstFaceVertexIter cfv_it = this->cfv_iter(_fh); cfv_it.is_valid(); ++cfv_it, valence += 1.0)
|
||||||
{
|
{
|
||||||
@@ -331,7 +333,7 @@ calc_halfedge_normal(HalfedgeHandle _heh, const double _feature_angle) const
|
|||||||
for(unsigned int i=0; i<fhs.size(); ++i)
|
for(unsigned int i=0; i<fhs.size(); ++i)
|
||||||
n += Kernel::normal(fhs[i]);
|
n += Kernel::normal(fhs[i]);
|
||||||
|
|
||||||
return n.normalize();
|
return normalize(n);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -378,8 +380,8 @@ calc_vertex_normal(VertexHandle _vh) const
|
|||||||
Normal n;
|
Normal n;
|
||||||
calc_vertex_normal_fast(_vh,n);
|
calc_vertex_normal_fast(_vh,n);
|
||||||
|
|
||||||
Scalar norm = n.length();
|
Scalar length = norm(n);
|
||||||
if (norm != 0.0) n *= (Scalar(1.0)/norm);
|
if (length != 0.0) n *= (Scalar(1.0)/length);
|
||||||
|
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
@@ -389,7 +391,7 @@ template <class Kernel>
|
|||||||
void PolyMeshT<Kernel>::
|
void PolyMeshT<Kernel>::
|
||||||
calc_vertex_normal_fast(VertexHandle _vh, Normal& _n) const
|
calc_vertex_normal_fast(VertexHandle _vh, Normal& _n) const
|
||||||
{
|
{
|
||||||
_n.vectorize(0.0);
|
vectorize(_n, 0.0);
|
||||||
for (ConstVertexFaceIter vf_it = this->cvf_iter(_vh); vf_it.is_valid(); ++vf_it)
|
for (ConstVertexFaceIter vf_it = this->cvf_iter(_vh); vf_it.is_valid(); ++vf_it)
|
||||||
_n += this->normal(*vf_it);
|
_n += this->normal(*vf_it);
|
||||||
}
|
}
|
||||||
@@ -399,7 +401,7 @@ template <class Kernel>
|
|||||||
void PolyMeshT<Kernel>::
|
void PolyMeshT<Kernel>::
|
||||||
calc_vertex_normal_correct(VertexHandle _vh, Normal& _n) const
|
calc_vertex_normal_correct(VertexHandle _vh, Normal& _n) const
|
||||||
{
|
{
|
||||||
_n.vectorize(0.0);
|
vectorize(_n, 0.0);
|
||||||
ConstVertexIHalfedgeIter cvih_it = this->cvih_iter(_vh);
|
ConstVertexIHalfedgeIter cvih_it = this->cvih_iter(_vh);
|
||||||
if (! cvih_it.is_valid() )
|
if (! cvih_it.is_valid() )
|
||||||
{//don't crash on isolated vertices
|
{//don't crash on isolated vertices
|
||||||
|
|||||||
@@ -406,7 +406,7 @@ public:
|
|||||||
{
|
{
|
||||||
Normal edge_vec;
|
Normal edge_vec;
|
||||||
calc_edge_vector(_heh, edge_vec);
|
calc_edge_vector(_heh, edge_vec);
|
||||||
return edge_vec.sqrnorm();
|
return sqrnorm(edge_vec);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Calculates the midpoint of the halfedge _heh, defined by the positions of
|
/** Calculates the midpoint of the halfedge _heh, defined by the positions of
|
||||||
@@ -444,7 +444,7 @@ public:
|
|||||||
{
|
{
|
||||||
Normal v0, v1;
|
Normal v0, v1;
|
||||||
calc_sector_vectors(_in_heh, v0, v1);
|
calc_sector_vectors(_in_heh, v0, v1);
|
||||||
Scalar denom = v0.norm()*v1.norm();
|
Scalar denom = norm(v0)*norm(v1);
|
||||||
if ( denom == Scalar(0))
|
if ( denom == Scalar(0))
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
@@ -470,7 +470,7 @@ public:
|
|||||||
Normal in_vec, out_vec;
|
Normal in_vec, out_vec;
|
||||||
calc_edge_vector(_in_heh, in_vec);
|
calc_edge_vector(_in_heh, in_vec);
|
||||||
calc_edge_vector(next_halfedge_handle(_in_heh), out_vec);
|
calc_edge_vector(next_halfedge_handle(_in_heh), out_vec);
|
||||||
Scalar denom = in_vec.norm()*out_vec.norm();
|
Scalar denom = norm(in_vec)*norm(out_vec);
|
||||||
if (is_zero(denom))
|
if (is_zero(denom))
|
||||||
{
|
{
|
||||||
_cos_a = 1;
|
_cos_a = 1;
|
||||||
@@ -479,7 +479,7 @@ public:
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
_cos_a = dot(in_vec, out_vec)/denom;
|
_cos_a = dot(in_vec, out_vec)/denom;
|
||||||
_sin_a = cross(in_vec, out_vec).norm()/denom;
|
_sin_a = norm(cross(in_vec, out_vec))/denom;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
@@ -499,7 +499,7 @@ public:
|
|||||||
{
|
{
|
||||||
Normal sector_normal;
|
Normal sector_normal;
|
||||||
calc_sector_normal(_in_heh, sector_normal);
|
calc_sector_normal(_in_heh, sector_normal);
|
||||||
return sector_normal.norm()/2;
|
return norm(sector_normal)/2;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** calculates the dihedral angle on the halfedge _heh
|
/** calculates the dihedral angle on the halfedge _heh
|
||||||
@@ -539,7 +539,7 @@ public:
|
|||||||
calc_sector_normal(_heh, n0);
|
calc_sector_normal(_heh, n0);
|
||||||
calc_sector_normal(this->opposite_halfedge_handle(_heh), n1);
|
calc_sector_normal(this->opposite_halfedge_handle(_heh), n1);
|
||||||
calc_edge_vector(_heh, he);
|
calc_edge_vector(_heh, he);
|
||||||
Scalar denom = n0.norm()*n1.norm();
|
Scalar denom = norm(n0)*norm(n1);
|
||||||
if (denom == Scalar(0))
|
if (denom == Scalar(0))
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -359,9 +359,9 @@ public:
|
|||||||
VertexHandle p2 = this->to_vertex_handle(he2);
|
VertexHandle p2 = this->to_vertex_handle(he2);
|
||||||
|
|
||||||
// Calculate midpoint coordinates
|
// Calculate midpoint coordinates
|
||||||
const Point new0 = (this->point(p0) + this->point(p2)) * static_cast< typename Point::value_type >(0.5);
|
const Point new0 = (this->point(p0) + this->point(p2)) * static_cast<typename vector_traits<Point>::value_type >(0.5);
|
||||||
const Point new1 = (this->point(p0) + this->point(p1)) * static_cast< typename Point::value_type >(0.5);
|
const Point new1 = (this->point(p0) + this->point(p1)) * static_cast<typename vector_traits<Point>::value_type >(0.5);
|
||||||
const Point new2 = (this->point(p1) + this->point(p2)) * static_cast< typename Point::value_type >(0.5);
|
const Point new2 = (this->point(p1) + this->point(p2)) * static_cast<typename vector_traits<Point>::value_type >(0.5);
|
||||||
|
|
||||||
// Add vertices at midpoint coordinates
|
// Add vertices at midpoint coordinates
|
||||||
VertexHandle v0 = this->add_vertex(new0);
|
VertexHandle v0 = this->add_vertex(new0);
|
||||||
|
|||||||
@@ -95,7 +95,6 @@ inline void vector_cast( const src_t & /*_src*/, dst_t & /*_dst*/, GenProg::Int2
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template <typename src_t, typename dst_t, int n>
|
template <typename src_t, typename dst_t, int n>
|
||||||
inline void vector_copy( const src_t &_src, dst_t &_dst, GenProg::Int2Type<n> )
|
inline void vector_copy( const src_t &_src, dst_t &_dst, GenProg::Int2Type<n> )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -181,7 +181,7 @@ compute_new_positions_C1()
|
|||||||
if (diag) uu *= static_cast<typename Mesh::Scalar>(1.0) / diag;
|
if (diag) uu *= static_cast<typename Mesh::Scalar>(1.0) / diag;
|
||||||
|
|
||||||
// damping
|
// damping
|
||||||
uu *= static_cast<typename Mesh::Normal::value_type>(0.25);
|
uu *= static_cast<typename vector_traits<typename Mesh::Normal>::value_type>(0.25);
|
||||||
|
|
||||||
// store new position
|
// store new position
|
||||||
p = vector_cast<typename Mesh::Normal>(Base::mesh_.point(*v_it));
|
p = vector_cast<typename Mesh::Normal>(Base::mesh_.point(*v_it));
|
||||||
|
|||||||
@@ -263,13 +263,13 @@ set_relative_local_error(Scalar _err)
|
|||||||
bb_min = bb_max = mesh_.point(*v_it);
|
bb_min = bb_max = mesh_.point(*v_it);
|
||||||
for (++v_it; v_it!=v_end; ++v_it)
|
for (++v_it; v_it!=v_end; ++v_it)
|
||||||
{
|
{
|
||||||
bb_min.minimize(mesh_.point(*v_it));
|
minimize(bb_min, mesh_.point(*v_it));
|
||||||
bb_max.maximize(mesh_.point(*v_it));
|
maximize(bb_max, mesh_.point(*v_it));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// abs. error = rel. error * bounding-diagonal
|
// abs. error = rel. error * bounding-diagonal
|
||||||
set_absolute_local_error(_err * (bb_max-bb_min).norm());
|
set_absolute_local_error(norm(_err * (bb_max-bb_min)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -346,7 +346,7 @@ CatmullClarkT<MeshType,RealType>::update_vertex( MeshType& _m, const VertexHandl
|
|||||||
for ( ve_itr = _m.ve_iter( _vh); ve_itr.is_valid(); ++ve_itr)
|
for ( ve_itr = _m.ve_iter( _vh); ve_itr.is_valid(); ++ve_itr)
|
||||||
if ( _m.is_boundary( *ve_itr))
|
if ( _m.is_boundary( *ve_itr))
|
||||||
pos += _m.property( ep_pos_, *ve_itr);
|
pos += _m.property( ep_pos_, *ve_itr);
|
||||||
pos /= static_cast<typename MeshType::Point::value_type>(3.0);
|
pos /= static_cast<typename vector_traits<typename MeshType::Point>::value_type>(3.0);
|
||||||
}
|
}
|
||||||
else // inner vertex
|
else // inner vertex
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -30,22 +30,28 @@ if ( OPENMESH_BUILD_UNIT_TESTS )
|
|||||||
FILE(GLOB UNITTEST_SRC *.cc)
|
FILE(GLOB UNITTEST_SRC *.cc)
|
||||||
# Create unittest executable
|
# Create unittest executable
|
||||||
acg_add_executable(unittests ${UNITTEST_SRC})
|
acg_add_executable(unittests ${UNITTEST_SRC})
|
||||||
|
acg_add_executable(unittests_customvec ${UNITTEST_SRC})
|
||||||
|
target_compile_definitions(unittests_customvec PRIVATE TEST_CUSTOM_TRAITS)
|
||||||
|
|
||||||
# For the unittest we don't want the install rpath as set by acg_add_executable
|
# For the unittest we don't want the install rpath as set by acg_add_executable
|
||||||
set_target_properties ( unittests PROPERTIES BUILD_WITH_INSTALL_RPATH 0 )
|
set_target_properties ( unittests PROPERTIES BUILD_WITH_INSTALL_RPATH 0 )
|
||||||
|
set_target_properties ( unittests_customvec PROPERTIES BUILD_WITH_INSTALL_RPATH 0 )
|
||||||
|
|
||||||
# Set output directory to ${BINARY_DIR}/Unittests
|
# Set output directory to ${BINARY_DIR}/Unittests
|
||||||
set (OUTPUT_DIR "${CMAKE_BINARY_DIR}/Unittests")
|
set (OUTPUT_DIR "${CMAKE_BINARY_DIR}/Unittests")
|
||||||
set_target_properties(unittests PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${OUTPUT_DIR})
|
set_target_properties(unittests PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${OUTPUT_DIR})
|
||||||
|
set_target_properties(unittests_customvec PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${OUTPUT_DIR})
|
||||||
foreach(CONFIG ${CMAKE_CONFIGURATION_TYPES})
|
foreach(CONFIG ${CMAKE_CONFIGURATION_TYPES})
|
||||||
string(TOUPPER ${CONFIG} UPCONFIG)
|
string(TOUPPER ${CONFIG} UPCONFIG)
|
||||||
set_target_properties(unittests PROPERTIES RUNTIME_OUTPUT_DIRECTORY_${UPCONFIG} ${OUTPUT_DIR})
|
set_target_properties(unittests PROPERTIES RUNTIME_OUTPUT_DIRECTORY_${UPCONFIG} ${OUTPUT_DIR})
|
||||||
|
set_target_properties(unittests_customvec PROPERTIES RUNTIME_OUTPUT_DIRECTORY_${UPCONFIG} ${OUTPUT_DIR})
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
|
|
||||||
if ( NOT WIN32)
|
if ( NOT WIN32)
|
||||||
# Link against all necessary libraries
|
# Link against all necessary libraries
|
||||||
target_link_libraries(unittests OpenMeshCore OpenMeshTools ${GTEST_LIBRARIES} ${GTEST_MAIN_LIBRARIES} pthread)
|
target_link_libraries(unittests OpenMeshCore OpenMeshTools ${GTEST_LIBRARIES} ${GTEST_MAIN_LIBRARIES} pthread)
|
||||||
|
target_link_libraries(unittests_customvec OpenMeshCore OpenMeshTools ${GTEST_LIBRARIES} ${GTEST_MAIN_LIBRARIES} pthread)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -56,6 +62,7 @@ if ( OPENMESH_BUILD_UNIT_TESTS )
|
|||||||
|
|
||||||
endif()
|
endif()
|
||||||
target_link_libraries(unittests OpenMeshCore OpenMeshTools ${GTEST_LIBRARIES} ${GTEST_MAIN_LIBRARIES})
|
target_link_libraries(unittests OpenMeshCore OpenMeshTools ${GTEST_LIBRARIES} ${GTEST_MAIN_LIBRARIES})
|
||||||
|
target_link_libraries(unittests_customvec OpenMeshCore OpenMeshTools ${GTEST_LIBRARIES} ${GTEST_MAIN_LIBRARIES})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
@@ -63,10 +70,11 @@ if ( OPENMESH_BUILD_UNIT_TESTS )
|
|||||||
if ( NOT WIN32 )
|
if ( NOT WIN32 )
|
||||||
# Set compiler flags
|
# Set compiler flags
|
||||||
set_target_properties(unittests PROPERTIES COMPILE_FLAGS "-g -pedantic -Wno-long-long")
|
set_target_properties(unittests PROPERTIES COMPILE_FLAGS "-g -pedantic -Wno-long-long")
|
||||||
|
set_target_properties(unittests_customvec PROPERTIES COMPILE_FLAGS "-g -pedantic -Wno-long-long")
|
||||||
else()
|
else()
|
||||||
# Set compiler flags
|
# Set compiler flags
|
||||||
set_target_properties(unittests PROPERTIES COMPILE_FLAGS "" )
|
set_target_properties(unittests PROPERTIES COMPILE_FLAGS "" )
|
||||||
|
set_target_properties(unittests_customvec PROPERTIES COMPILE_FLAGS "" )
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if ( OPENMESH_BUILD_SHARED )
|
if ( OPENMESH_BUILD_SHARED )
|
||||||
@@ -80,12 +88,19 @@ if ( OPENMESH_BUILD_UNIT_TESTS )
|
|||||||
"$<TARGET_FILE:${TAR}>"
|
"$<TARGET_FILE:${TAR}>"
|
||||||
"${CMAKE_BINARY_DIR}/Unittests/$<TARGET_FILE_NAME:${TAR}>"
|
"${CMAKE_BINARY_DIR}/Unittests/$<TARGET_FILE_NAME:${TAR}>"
|
||||||
COMMENT "Copying OpenMesh targets to unittests directory")
|
COMMENT "Copying OpenMesh targets to unittests directory")
|
||||||
|
add_custom_command(TARGET unittests_customvec POST_BUILD
|
||||||
|
COMMAND "${CMAKE_COMMAND}" -E copy
|
||||||
|
"$<TARGET_FILE:${TAR}>"
|
||||||
|
"${CMAKE_BINARY_DIR}/Unittests/$<TARGET_FILE_NAME:${TAR}>"
|
||||||
|
COMMENT "Copying OpenMesh targets to unittests directory")
|
||||||
endforeach(TAR)
|
endforeach(TAR)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
acg_copy_after_build(unittests ${CMAKE_CURRENT_SOURCE_DIR}/TestFiles ${CMAKE_BINARY_DIR}/Unittests/)
|
acg_copy_after_build(unittests ${CMAKE_CURRENT_SOURCE_DIR}/TestFiles ${CMAKE_BINARY_DIR}/Unittests/)
|
||||||
|
acg_copy_after_build(unittests_customvec ${CMAKE_CURRENT_SOURCE_DIR}/TestFiles ${CMAKE_BINARY_DIR}/Unittests/)
|
||||||
|
|
||||||
add_test(NAME AllTestsIn_OpenMesh_tests WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/Unittests" COMMAND "${CMAKE_BINARY_DIR}/Unittests/unittests")
|
add_test(NAME AllTestsIn_OpenMesh_tests WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/Unittests" COMMAND "${CMAKE_BINARY_DIR}/Unittests/unittests")
|
||||||
|
add_test(NAME AllTestsIn_OpenMesh_tests_with_minimal_vector WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/Unittests" COMMAND "${CMAKE_BINARY_DIR}/Unittests/unittests_customvec")
|
||||||
|
|
||||||
else(GTEST_FOUND)
|
else(GTEST_FOUND)
|
||||||
message(STATUS "Google testing framework was not found, unittests disabled.")
|
message(STATUS "Google testing framework was not found, unittests disabled.")
|
||||||
|
|||||||
@@ -7,8 +7,13 @@
|
|||||||
#include <OpenMesh/Core/Mesh/TriMesh_ArrayKernelT.hh>
|
#include <OpenMesh/Core/Mesh/TriMesh_ArrayKernelT.hh>
|
||||||
#include <OpenMesh/Core/Mesh/PolyMesh_ArrayKernelT.hh>
|
#include <OpenMesh/Core/Mesh/PolyMesh_ArrayKernelT.hh>
|
||||||
|
|
||||||
|
#ifdef TEST_CUSTOM_TRAITS
|
||||||
|
#include <Unittests/unittests_common_customtraits.hh>
|
||||||
|
#else
|
||||||
struct CustomTraits : public OpenMesh::DefaultTraits {
|
struct CustomTraits : public OpenMesh::DefaultTraits {
|
||||||
};
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
typedef OpenMesh::TriMesh_ArrayKernelT<CustomTraits> Mesh;
|
typedef OpenMesh::TriMesh_ArrayKernelT<CustomTraits> Mesh;
|
||||||
|
|
||||||
|
|||||||
139
src/Unittests/unittests_common_customtraits.hh
Normal file
139
src/Unittests/unittests_common_customtraits.hh
Normal file
@@ -0,0 +1,139 @@
|
|||||||
|
#ifndef UNITTESTS_COMMON_DUMMYTRAITS
|
||||||
|
#define UNITTESTS_COMMON_DUMMYTRAITS
|
||||||
|
#include <OpenMesh/Core/Mesh/TriMesh_ArrayKernelT.hh>
|
||||||
|
#include <OpenMesh/Core/Utils/color_cast.hh>
|
||||||
|
#include <array>
|
||||||
|
|
||||||
|
namespace Custom {
|
||||||
|
|
||||||
|
/// A Vector class with the absolute minimum of built-in methods to test the
|
||||||
|
/// interface expected from Vectors used in Traits
|
||||||
|
template <int DIM> class Vec {
|
||||||
|
public:
|
||||||
|
// Constructor with DIM components
|
||||||
|
Vec(float x) : data({ x }) {}
|
||||||
|
Vec(float x, float y) : data({ x, y }) {}
|
||||||
|
Vec(float x, float y, float z) : data({ x, y, z }) {}
|
||||||
|
Vec(float x, float y, float z, float w) : data({ x, y, z, w }) {}
|
||||||
|
|
||||||
|
Vec() = default;
|
||||||
|
Vec(Vec<DIM> const &) = default;
|
||||||
|
|
||||||
|
float &operator[](int i) { return data[i]; }
|
||||||
|
float operator[](int i) const { return data[i]; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::array<float, DIM> data;
|
||||||
|
};
|
||||||
|
|
||||||
|
template <int DIM> bool operator==(Vec<DIM> const &lhs, Vec<DIM> const &rhs) {
|
||||||
|
for (int i = 0; i < DIM; i++)
|
||||||
|
if (lhs[i] != rhs[i]) return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <int DIM>
|
||||||
|
Vec<DIM> operator+(Vec<DIM> const &lhs, Vec<DIM> const &rhs) {
|
||||||
|
Vec<DIM> result;
|
||||||
|
for (int i = 0; i < DIM; i++)
|
||||||
|
result[i] = lhs[i] + rhs[i];
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <int DIM>
|
||||||
|
Vec<DIM> operator-(Vec<DIM> const &lhs, Vec<DIM> const &rhs) {
|
||||||
|
Vec<DIM> result;
|
||||||
|
for (int i = 0; i < DIM; i++)
|
||||||
|
result[i] = lhs[i] - rhs[i];
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <int DIM> Vec<DIM> operator*(Vec<DIM> const &lhs, float rhs) {
|
||||||
|
Vec<DIM> result;
|
||||||
|
for (int i = 0; i < DIM; i++)
|
||||||
|
result[i] = lhs[i] * rhs;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <int DIM> Vec<DIM> operator*(float lhs, Vec<DIM> const &rhs) {
|
||||||
|
return rhs * lhs;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <int DIM> Vec<DIM> operator/(Vec<DIM> const &lhs, float rhs) {
|
||||||
|
Vec<DIM> result;
|
||||||
|
for (int i = 0; i < DIM; i++)
|
||||||
|
result[i] = lhs[i] / rhs;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <int DIM> Vec<DIM> &operator+=(Vec<DIM> &lhs, Vec<DIM> const &rhs) {
|
||||||
|
return lhs = lhs + rhs;
|
||||||
|
}
|
||||||
|
template <int DIM> Vec<DIM> &operator-=(Vec<DIM> &lhs, Vec<DIM> const &rhs) {
|
||||||
|
return lhs = lhs - rhs;
|
||||||
|
}
|
||||||
|
template <int DIM> Vec<DIM> &operator*=(Vec<DIM> &lhs, float rhs) {
|
||||||
|
return lhs = lhs * rhs;
|
||||||
|
}
|
||||||
|
template <int DIM> Vec<DIM> &operator/=(Vec<DIM> &lhs, float rhs) {
|
||||||
|
return lhs = lhs / rhs;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <int DIM> float norm(Vec<DIM> const &v) {
|
||||||
|
float sum = 0.0f;
|
||||||
|
for (int i = 0; i < DIM; i++)
|
||||||
|
sum += v[i] * v[i];
|
||||||
|
return std::sqrt(sum);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <int DIM> Vec<DIM> &normalize(Vec<DIM> &v) { return v /= norm(v); }
|
||||||
|
template <int DIM> Vec<DIM> &vectorize(Vec<DIM> &v, float val) {
|
||||||
|
for (int i = 0; i < DIM; i++)
|
||||||
|
v[i] = val;
|
||||||
|
return v;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <int DIM> Vec<DIM> &minimize(Vec<DIM> &v1, Vec<DIM> const &v2) {
|
||||||
|
for (int i = 0; i < DIM; i++)
|
||||||
|
v1[i] = std::min(v1[i], v2[i]);
|
||||||
|
return v1;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <int DIM> Vec<DIM> &maximize(Vec<DIM> &v1, Vec<DIM> const &v2) {
|
||||||
|
for (int i = 0; i < DIM; i++)
|
||||||
|
v1[i] = std::max(v1[i], v2[i]);
|
||||||
|
return v1;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <int DIM> float dot(Vec<DIM> const &v1, Vec<DIM> const &v2) {
|
||||||
|
float sum = 0.f;
|
||||||
|
for (int i = 0; i < DIM; i++)
|
||||||
|
sum += v1[i] * v2[i];
|
||||||
|
return sum;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline Vec<3> cross(Vec<3> const &v1, Vec<3> const &v2) {
|
||||||
|
return {v1[1] * v2[2] - v1[2] * v2[1], //
|
||||||
|
v1[2] * v2[0] - v1[0] * v2[2], //
|
||||||
|
v1[0] * v2[1] - v1[1] * v2[0]};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace OpenMesh {
|
||||||
|
template <int DIM> struct vector_traits<Custom::Vec<DIM>> {
|
||||||
|
using vector_type = Custom::Vec<DIM>;
|
||||||
|
using value_type = float;
|
||||||
|
static const size_t size_ = DIM;
|
||||||
|
static size_t size() { return size_; }
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
struct CustomTraits : public OpenMesh::DefaultTraits {
|
||||||
|
typedef Custom::Vec<3> Point;
|
||||||
|
typedef Custom::Vec<3> Normal;
|
||||||
|
|
||||||
|
typedef Custom::Vec<2> TexCoord2D;
|
||||||
|
typedef Custom::Vec<3> TexCoord3D;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // UNITTESTS_COMMON_DUMMYTRAITS
|
||||||
@@ -247,7 +247,7 @@ TEST_F(OpenMeshNormals, NormalCalculations_calc_vertex_normal_fast) {
|
|||||||
mesh_.request_face_normals();
|
mesh_.request_face_normals();
|
||||||
|
|
||||||
|
|
||||||
OpenMesh::Vec3f normal;
|
Mesh::Normal normal;
|
||||||
|
|
||||||
mesh_.calc_vertex_normal_fast(vhandle[2],normal);
|
mesh_.calc_vertex_normal_fast(vhandle[2],normal);
|
||||||
|
|
||||||
@@ -304,7 +304,7 @@ TEST_F(OpenMeshNormals, NormalCalculations_calc_vertex_normal_correct) {
|
|||||||
mesh_.request_halfedge_normals();
|
mesh_.request_halfedge_normals();
|
||||||
mesh_.request_face_normals();
|
mesh_.request_face_normals();
|
||||||
|
|
||||||
OpenMesh::Vec3f normal;
|
Mesh::Normal normal;
|
||||||
|
|
||||||
|
|
||||||
mesh_.calc_vertex_normal_correct(vhandle[2],normal);
|
mesh_.calc_vertex_normal_correct(vhandle[2],normal);
|
||||||
@@ -361,7 +361,7 @@ TEST_F(OpenMeshNormals, NormalCalculations_calc_vertex_normal_loop) {
|
|||||||
mesh_.request_halfedge_normals();
|
mesh_.request_halfedge_normals();
|
||||||
mesh_.request_face_normals();
|
mesh_.request_face_normals();
|
||||||
|
|
||||||
OpenMesh::Vec3f normal;
|
Mesh::Normal normal;
|
||||||
|
|
||||||
mesh_.calc_vertex_normal_loop(vhandle[2],normal);
|
mesh_.calc_vertex_normal_loop(vhandle[2],normal);
|
||||||
|
|
||||||
|
|||||||
@@ -164,7 +164,8 @@ TEST_F(OpenMeshOthers, CalcDihedralAngre ) {
|
|||||||
EXPECT_EQ( 0.0 , mesh_.calc_dihedral_angle(eh) ) << "Wrong Dihedral angle!" << std::endl;
|
EXPECT_EQ( 0.0 , mesh_.calc_dihedral_angle(eh) ) << "Wrong Dihedral angle!" << std::endl;
|
||||||
|
|
||||||
// Modify point
|
// Modify point
|
||||||
Mesh::Point tmp = ( Mesh::Point(0.0, 0.0, -1.0) + Mesh::Point(1.0, 1.0, -1.0) ) * static_cast<Mesh::Point::value_type>(0.5);
|
Mesh::Point tmp = ( Mesh::Point(0.0, 0.0, -1.0) + Mesh::Point(1.0, 1.0, -1.0) )
|
||||||
|
* static_cast<OpenMesh::vector_traits<Mesh::Point>::value_type>(0.5);
|
||||||
mesh_.point(vhandle[2]) = tmp;
|
mesh_.point(vhandle[2]) = tmp;
|
||||||
|
|
||||||
double difference = fabs( 1.36944 - mesh_.calc_dihedral_angle(eh) );
|
double difference = fabs( 1.36944 - mesh_.calc_dihedral_angle(eh) );
|
||||||
|
|||||||
@@ -619,20 +619,20 @@ TEST_F(OpenMeshTutorials, deleting_geometry_elements) {
|
|||||||
mesh.request_vertex_status();
|
mesh.request_vertex_status();
|
||||||
|
|
||||||
// generate vertices
|
// generate vertices
|
||||||
MyMeshWithStatus::VertexHandle vhandle[8];
|
Mesh::VertexHandle vhandle[8];
|
||||||
MyMeshWithStatus::FaceHandle fhandle[6];
|
Mesh::FaceHandle fhandle[6];
|
||||||
|
|
||||||
vhandle[0] = mesh.add_vertex(MyMesh::Point(-1, -1, 1));
|
vhandle[0] = mesh.add_vertex(Mesh::Point(-1, -1, 1));
|
||||||
vhandle[1] = mesh.add_vertex(MyMesh::Point( 1, -1, 1));
|
vhandle[1] = mesh.add_vertex(Mesh::Point( 1, -1, 1));
|
||||||
vhandle[2] = mesh.add_vertex(MyMesh::Point( 1, 1, 1));
|
vhandle[2] = mesh.add_vertex(Mesh::Point( 1, 1, 1));
|
||||||
vhandle[3] = mesh.add_vertex(MyMesh::Point(-1, 1, 1));
|
vhandle[3] = mesh.add_vertex(Mesh::Point(-1, 1, 1));
|
||||||
vhandle[4] = mesh.add_vertex(MyMesh::Point(-1, -1, -1));
|
vhandle[4] = mesh.add_vertex(Mesh::Point(-1, -1, -1));
|
||||||
vhandle[5] = mesh.add_vertex(MyMesh::Point( 1, -1, -1));
|
vhandle[5] = mesh.add_vertex(Mesh::Point( 1, -1, -1));
|
||||||
vhandle[6] = mesh.add_vertex(MyMesh::Point( 1, 1, -1));
|
vhandle[6] = mesh.add_vertex(Mesh::Point( 1, 1, -1));
|
||||||
vhandle[7] = mesh.add_vertex(MyMesh::Point(-1, 1, -1));
|
vhandle[7] = mesh.add_vertex(Mesh::Point(-1, 1, -1));
|
||||||
|
|
||||||
// generate (quadrilateral) faces
|
// generate (quadrilateral) faces
|
||||||
std::vector<MyMesh::VertexHandle> tmp_face_vhandles;
|
std::vector<Mesh::VertexHandle> tmp_face_vhandles;
|
||||||
tmp_face_vhandles.clear();
|
tmp_face_vhandles.clear();
|
||||||
tmp_face_vhandles.push_back(vhandle[0]);
|
tmp_face_vhandles.push_back(vhandle[0]);
|
||||||
tmp_face_vhandles.push_back(vhandle[1]);
|
tmp_face_vhandles.push_back(vhandle[1]);
|
||||||
@@ -807,10 +807,10 @@ TEST_F(OpenMeshTutorials, flipping_edges) {
|
|||||||
Mesh mesh;
|
Mesh mesh;
|
||||||
// Add some vertices
|
// Add some vertices
|
||||||
Mesh::VertexHandle vhandle[4];
|
Mesh::VertexHandle vhandle[4];
|
||||||
vhandle[0] = mesh.add_vertex(MyMesh::Point(0, 0, 0));
|
vhandle[0] = mesh.add_vertex(Mesh::Point(0, 0, 0));
|
||||||
vhandle[1] = mesh.add_vertex(MyMesh::Point(0, 1, 0));
|
vhandle[1] = mesh.add_vertex(Mesh::Point(0, 1, 0));
|
||||||
vhandle[2] = mesh.add_vertex(MyMesh::Point(1, 1, 0));
|
vhandle[2] = mesh.add_vertex(Mesh::Point(1, 1, 0));
|
||||||
vhandle[3] = mesh.add_vertex(MyMesh::Point(1, 0, 0));
|
vhandle[3] = mesh.add_vertex(Mesh::Point(1, 0, 0));
|
||||||
// Add two faces
|
// Add two faces
|
||||||
std::vector<Mesh::VertexHandle> face_vhandles;
|
std::vector<Mesh::VertexHandle> face_vhandles;
|
||||||
face_vhandles.push_back(vhandle[2]);
|
face_vhandles.push_back(vhandle[2]);
|
||||||
@@ -846,13 +846,13 @@ TEST_F(OpenMeshTutorials, collapsing_edges) {
|
|||||||
mesh.request_edge_status();
|
mesh.request_edge_status();
|
||||||
// Add some vertices as in the illustration above
|
// Add some vertices as in the illustration above
|
||||||
PolyMesh::VertexHandle vhandle[7];
|
PolyMesh::VertexHandle vhandle[7];
|
||||||
vhandle[0] = mesh.add_vertex(MyMesh::Point(-1, 1, 0));
|
vhandle[0] = mesh.add_vertex(PolyMesh::Point(-1, 1, 0));
|
||||||
vhandle[1] = mesh.add_vertex(MyMesh::Point(-1, 3, 0));
|
vhandle[1] = mesh.add_vertex(PolyMesh::Point(-1, 3, 0));
|
||||||
vhandle[2] = mesh.add_vertex(MyMesh::Point(0, 0, 0));
|
vhandle[2] = mesh.add_vertex(PolyMesh::Point(0, 0, 0));
|
||||||
vhandle[3] = mesh.add_vertex(MyMesh::Point(0, 2, 0));
|
vhandle[3] = mesh.add_vertex(PolyMesh::Point(0, 2, 0));
|
||||||
vhandle[4] = mesh.add_vertex(MyMesh::Point(0, 4, 0));
|
vhandle[4] = mesh.add_vertex(PolyMesh::Point(0, 4, 0));
|
||||||
vhandle[5] = mesh.add_vertex(MyMesh::Point(1, 1, 0));
|
vhandle[5] = mesh.add_vertex(PolyMesh::Point(1, 1, 0));
|
||||||
vhandle[6] = mesh.add_vertex(MyMesh::Point(1, 3, 0));
|
vhandle[6] = mesh.add_vertex(PolyMesh::Point(1, 3, 0));
|
||||||
// Add three quad faces
|
// Add three quad faces
|
||||||
std::vector<PolyMesh::VertexHandle> face_vhandles;
|
std::vector<PolyMesh::VertexHandle> face_vhandles;
|
||||||
face_vhandles.push_back(vhandle[1]);
|
face_vhandles.push_back(vhandle[1]);
|
||||||
|
|||||||
@@ -185,7 +185,7 @@ LoadInfo open_progresult_mesh(const std::string& _filename)
|
|||||||
OpenMesh::IO::restore(ifs, vr, swap);
|
OpenMesh::IO::restore(ifs, vr, swap);
|
||||||
|
|
||||||
PMInfo pminfo;
|
PMInfo pminfo;
|
||||||
pminfo.p0 = p;
|
pminfo.p0 = OpenMesh::vector_cast<Mesh::Point>(p);
|
||||||
pminfo.v0 = result.mesh.add_vertex(p);
|
pminfo.v0 = result.mesh.add_vertex(p);
|
||||||
pminfo.v1 = Mesh::VertexHandle(v1);
|
pminfo.v1 = Mesh::VertexHandle(v1);
|
||||||
pminfo.vl = Mesh::VertexHandle(vl);
|
pminfo.vl = Mesh::VertexHandle(vl);
|
||||||
|
|||||||
Reference in New Issue
Block a user