Commit 8e0ed488 by Pierre Kraemer

### bounding box : origin centered scale

parent 3bee55cb
 ... @@ -37,7 +37,9 @@ namespace CGoGN ... @@ -37,7 +37,9 @@ namespace CGoGN namespace Algo namespace Algo { { namespace MC { namespace MC { /** /** * Marching Cube * Marching Cube * * ... @@ -257,10 +259,11 @@ public: ... @@ -257,10 +259,11 @@ public: void recalPoints(const Geom::Vec3f& origin); void recalPoints(const Geom::Vec3f& origin); }; }; } // namespace MC } // namespace Algo } // end namespace } // namespace CGoGN } // end namespace } // end namespace #include "Algo/MC/marchingcube.hpp" #include "Algo/MC/marchingcube.hpp" #endif #endif
 ... @@ -89,23 +89,22 @@ class BoundingBox ... @@ -89,23 +89,22 @@ class BoundingBox // fusion with the given bounding box // fusion with the given bounding box void fusion(const BoundingBox& bb) ; void fusion(const BoundingBox& bb) ; //return true if the vector belongs strictly to a bounding box // return true if the vector belongs strictly to a bounding box bool contains(const VEC& p); bool contains(const VEC& p); //return true if the bounding box belongs strictly to a bounding box // return true if the bounding box belongs strictly to a bounding box bool contains(const BoundingBox & bb); bool contains(const BoundingBox & bb); //resize a bounding box // scale the bounding box void scale(float size); void scale(typename VEC::DATA_TYPE size); // 0-centered scale of the bounding box void centeredScale(typename VEC::DATA_TYPE size); /**********************************************/ /**********************************************/ /* STREAM OPERATORS */ /* STREAM OPERATORS */ /**********************************************/ /**********************************************/ // friend std::ostream& operator<<(std::ostream& out, const BoundingBox& bb); // // friend std::istream& operator>>(std::istream& in, BoundingBox& bb); friend std::ostream& operator<<(std::ostream& out, const BoundingBox& bb) friend std::ostream& operator<<(std::ostream& out, const BoundingBox& bb) { { out << bb.min() << " " << bb.max() ; out << bb.min() << " " << bb.max() ; ... ...
 ... @@ -142,7 +142,7 @@ bool BoundingBox::isInitialized() const ... @@ -142,7 +142,7 @@ bool BoundingBox::isInitialized() const template template void BoundingBox::reset() void BoundingBox::reset() { { m_initialized=false; m_initialized = false; } } template template ... @@ -197,7 +197,6 @@ void BoundingBox::fusion(const BoundingBox& bb) ... @@ -197,7 +197,6 @@ void BoundingBox::fusion(const BoundingBox& bb) } } } } template template bool BoundingBox::contains(const VEC& p) bool BoundingBox::contains(const VEC& p) { { ... @@ -221,28 +220,20 @@ bool BoundingBox::contains(const BoundingBox& bb) ... @@ -221,28 +220,20 @@ bool BoundingBox::contains(const BoundingBox& bb) } } template template void BoundingBox::scale(float size) void BoundingBox::scale(typename VEC::DATA_TYPE size) { { assert(m_initialized || !"Bounding box not initialized"); assert(m_initialized || !"Bounding box not initialized"); m_pMin *= size; m_pMin *= size ; m_pMax *= size; m_pMax *= size ; } } template void BoundingBox::centeredScale(typename VEC::DATA_TYPE size) //template { //friend std::ostream& BoundingBox::operator<<(std::ostream& out, const BoundingBox& bb) VEC center = (m_pMin + m_pMax) / typename VEC::DATA_TYPE(2) ; //{ m_pMin = ((m_pMin - center) * size) + center ; // out << bb.min() << " " << bb.max() ; m_pMax = ((m_pMax - center) * size) + center ; // return out ; } //} // //template //friend std::istream& BoundingBox::operator>>(std::istream& in, BoundingBox& bb) //{ // in >> bb.min() >> bb.max() ; // return in ; //} } // namespace Geom } // namespace Geom ... ...
 ... @@ -109,6 +109,6 @@ class Plane3D ... @@ -109,6 +109,6 @@ class Plane3D } // namespace CGoGN } // namespace CGoGN #include "plane_3d.hpp" #include "Geometry/plane_3d.hpp" #endif #endif
 ... @@ -44,8 +44,7 @@ std::string Plane3D::CGoGNnameOfType() ... @@ -44,8 +44,7 @@ std::string Plane3D::CGoGNnameOfType() /**********************************************/ /**********************************************/ template template Plane3D::Plane3D(int d) : Plane3D::Plane3D(int d) : m_normal(0), m_d(d) m_normal(0), m_d(d) { } { } template template ... @@ -56,15 +55,13 @@ Plane3D::Plane3D(const Plane3D& p) ... @@ -56,15 +55,13 @@ Plane3D::Plane3D(const Plane3D& p) } } template template Plane3D::Plane3D(const Vector<3,T>& n, T d) : Plane3D::Plane3D(const Vector<3,T>& n, T d) : m_normal(n), m_d(d) m_normal(n), m_d(d) { { m_normal.normalize(); m_normal.normalize(); } } template template Plane3D::Plane3D(const Vector<3,T>& n, const Vector<3,T>& p) : Plane3D::Plane3D(const Vector<3,T>& n, const Vector<3,T>& p) : m_normal(n), m_d(-(p*n)) m_normal(n), m_d(-(p*n)) { { m_normal.normalize(); m_normal.normalize(); } } ... @@ -118,7 +115,7 @@ T Plane3D::distance(const Vector<3,T>& p) const ... @@ -118,7 +115,7 @@ T Plane3D::distance(const Vector<3,T>& p) const template template void Plane3D::project(Vector<3,T>& p) const void Plane3D::project(Vector<3,T>& p) const { { #define PRECISION 1e-5 #define PRECISION 1e-10 T d = -distance(p) ; T d = -distance(p) ; if(abs(d) > PRECISION) if(abs(d) > PRECISION) { { ... @@ -131,7 +128,7 @@ void Plane3D::project(Vector<3,T>& p) const ... @@ -131,7 +128,7 @@ void Plane3D::project(Vector<3,T>& p) const template template Orientation3D Plane3D::orient(const Vector<3,T>& p) const Orientation3D Plane3D::orient(const Vector<3,T>& p) const { { #define PRECISION 1e-5 #define PRECISION 1e-10 T dist = distance(p) ; T dist = distance(p) ; if(dist < -PRECISION) if(dist < -PRECISION) return UNDER ; return UNDER ; ... ...
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!