Loading...
Searching...
No Matches
triangulatedSurface.h
Go to the documentation of this file.
// -*- Mode: C++; tab-width: 2; -*-
// vi: set ts=2:
//
#ifndef BALL_STRUCTURE_TRIANGULATEDSURFACE_H
#define BALL_STRUCTURE_TRIANGULATEDSURFACE_H
#ifndef BALL_STRUCTURE_TRIANGLE_H
# include <BALL/STRUCTURE/triangle.h>
#endif
#ifndef BALL_STRUCTURE_TRIANGLEEDGE_H
# include <BALL/STRUCTURE/triangleEdge.h>
#endif
#ifndef BALL_STRUCTURE_TRIANGLEPOINT_H
# include <BALL/STRUCTURE/trianglePoint.h>
#endif
#ifndef BALL_MATHS_PLANE3_H
# include <BALL/MATHS/plane3.h>
#endif
#ifndef BALL_MATHS_SURFACE_H
# include <BALL/MATHS/surface.h>
#endif
#ifndef BALL_MATHS_VECTOR3_H
# include <BALL/MATHS/vector3.h>
#endif
#include <list>
#include <vector>
namespace BALL
{
class BALL_EXPORT TriangulatedSurface
{
public:
BALL_CREATE(TriangulatedSurface)
typedef std::list<TrianglePoint*>::iterator
PointIterator;
typedef std::list<TrianglePoint*>::const_iterator
ConstPointIterator;
typedef std::list<TriangleEdge*>::iterator
EdgeIterator;
typedef std::list<TriangleEdge*>::const_iterator
ConstEdgeIterator;
typedef std::list<Triangle*>::iterator
TriangleIterator;
typedef std::list<Triangle*>::const_iterator
ConstTriangleIterator;
TriangulatedSurface()
;
TriangulatedSurface(const TriangulatedSurface& surface, bool = true)
;
virtual ~TriangulatedSurface()
;
static TriangulatedSurface* createTube(unsigned int num_vertices, unsigned int subdiv = 0, bool closed = false, bool out = true);
static TriangulatedSurface* createDisk(unsigned int num_vertices, bool out = true);
void clear()
;
void set(const TriangulatedSurface& surface, bool = true)
;
TriangulatedSurface& operator = (const TriangulatedSurface& surface)
;
void insert(TrianglePoint* point);
void insert(TriangleEdge* edge);
void insert(Triangle* triangle);
Size getNumberOfPoints() const;
Size getNumberOfEdges() const;
Size getNumberOfTriangles() const;
void remove(TrianglePoint* point, bool deep = true);
void remove(PointIterator p, bool deep = true);
void remove(TriangleEdge* edge, bool deep = true);
void remove(EdgeIterator e, bool deep = true);
void remove(Triangle* triangle, bool deep = true);
void remove(TriangleIterator t, bool deep = true);
void exportSurface(Surface& surface);
TriangulatedSurface& operator += (const TriangulatedSurface& surface);
void join(TriangulatedSurface& source);
void shift(const TVector3<double>& c);
void blowUp(const double& r);
void setIndices();
void setDensity(const double& density);
double getDensity() const;
void cut(const TPlane3<double>& plane, const double& fuzzy = 0);
void shrink();
void deleteIsolatedEdges();
void deleteIsolatedPoints();
void getBorder(std::list<TriangleEdge*>& border);
PointIterator beginPoint();
ConstPointIterator beginPoint() const;
PointIterator endPoint();
ConstPointIterator endPoint() const;
EdgeIterator beginEdge();
ConstEdgeIterator beginEdge() const;
EdgeIterator endEdge();
ConstEdgeIterator endEdge() const;
TriangleIterator beginTriangle();
ConstTriangleIterator beginTriangle() const;
TriangleIterator endTriangle();
ConstTriangleIterator endTriangle() const;
/*_ @name protected help functions
*/
protected:
/*_ Test whether a TriangulatedSurface object can be copied
*/
bool canBeCopied() const;
/*_ Copy a TriangulatedSurface object
*/
void copy(const TriangulatedSurface& surface);
protected:
/*_ @name Attributes
*/
/*_ the number of points of the triangulated surface
*/
Size number_of_points_;
/*_ the points of the surface.
*/
std::list<TrianglePoint*> points_;
/*_ the number of edges of the triangulated surface
*/
Size number_of_edges_;
/*_ the edges of the surface.
*/
std::list<TriangleEdge*> edges_;
/*_ the number of triangles of the triangulated surface
*/
Size number_of_triangles_;
/*_ the triangles of the surface.
*/
std::list<Triangle*> triangles_;
/*_ the density used by triangulation algorithms
*/
double density_;
};
BALL_EXPORT std::ostream& operator << (std::ostream& s,
const TriangulatedSurface& surface);
class BALL_EXPORT TriangulatedSphere : public TriangulatedSurface
{
public:
BALL_CREATE(TriangulatedSphere)
struct Face
{
TrianglePoint* p[6];
TriangleEdge* e[9];
Position pcount;
Position ecount;
};
TriangulatedSphere()
;
TriangulatedSphere(const TriangulatedSphere& sphere, bool = true)
;
virtual ~TriangulatedSphere()
;
void set(const TriangulatedSphere& sphere, bool = true)
;
TriangulatedSphere& operator = (const TriangulatedSphere& sphere)
;
void icosaeder(bool out = true);
void pentakisDodecaeder(bool out = true);
void refine(Position iterations, bool out = true);
private:
/*_ Refine a triangulated sphere once.
*/
void refine(bool out);
void buildFourTriangles
(Face face,
Triangle* face0,
Triangle* face1,
Triangle* face2,
Triangle* face3)
;
/*_ Set the incidences of a refined triangulated sphere.
*/
void setIncidences();
};
} // namespace BALL
#endif // BALL_STRUCTURE_TRIANGULATEDSURFACE_H
BALL_EXPORT
#define BALL_EXPORT
Definition COMMON/global.h:50
BALL::TPlane3
Definition plane3.h:53
BALL::TVector3
Definition vector3.h:71
BALL::TriangleEdge
Definition triangleEdge.h:39
BALL::TrianglePoint
Definition trianglePoint.h:43
BALL::Triangle
Definition triangle.h:39
BALL::TriangulatedSphere::~TriangulatedSphere
virtual ~TriangulatedSphere()
BALL::TriangulatedSphere::TriangulatedSphere
TriangulatedSphere(const TriangulatedSphere &sphere, bool=true)
BALL::TriangulatedSphere::refine
void refine(Position iterations, bool out=true)
BALL::TriangulatedSphere::TriangulatedSphere
TriangulatedSphere()
BALL::TriangulatedSphere::icosaeder
void icosaeder(bool out=true)
BALL::TriangulatedSphere::set
void set(const TriangulatedSphere &sphere, bool=true)
BALL::TriangulatedSphere::pentakisDodecaeder
void pentakisDodecaeder(bool out=true)
BALL::TriangulatedSurface
Definition triangulatedSurface.h:41
BALL::TriangulatedSurface::getNumberOfTriangles
Size getNumberOfTriangles() const
BALL::TriangulatedSurface::exportSurface
void exportSurface(Surface &surface)
BALL::TriangulatedSurface::deleteIsolatedEdges
void deleteIsolatedEdges()
BALL::TriangulatedSurface::triangles_
std::list< Triangle * > triangles_
Definition triangulatedSurface.h:356
BALL::TriangulatedSurface::density_
double density_
Definition triangulatedSurface.h:360
BALL::TriangulatedSurface::ConstTriangleIterator
std::list< Triangle * >::const_iterator ConstTriangleIterator
Definition triangulatedSurface.h:62
BALL::TriangulatedSurface::TriangulatedSurface
TriangulatedSurface()
BALL::TriangulatedSurface::remove
void remove(TriangleEdge *edge, bool deep=true)
BALL::TriangulatedSurface::number_of_triangles_
Size number_of_triangles_
Definition triangulatedSurface.h:353
BALL::TriangulatedSurface::blowUp
void blowUp(const double &r)
BALL::TriangulatedSurface::deleteIsolatedPoints
void deleteIsolatedPoints()
BALL::TriangulatedSurface::ConstPointIterator
std::list< TrianglePoint * >::const_iterator ConstPointIterator
Definition triangulatedSurface.h:54
BALL::TriangulatedSurface::endEdge
EdgeIterator endEdge()
BALL::TriangulatedSurface::shift
void shift(const TVector3< double > &c)
BALL::TriangulatedSurface::getBorder
void getBorder(std::list< TriangleEdge * > &border)
BALL::TriangulatedSurface::remove
void remove(TriangleIterator t, bool deep=true)
BALL::TriangulatedSurface::copy
void copy(const TriangulatedSurface &surface)
BALL::TriangulatedSurface::join
void join(TriangulatedSurface &source)
BALL::TriangulatedSurface::beginTriangle
ConstTriangleIterator beginTriangle() const
BALL::TriangulatedSurface::EdgeIterator
std::list< TriangleEdge * >::iterator EdgeIterator
Definition triangulatedSurface.h:56
BALL::TriangulatedSurface::setDensity
void setDensity(const double &density)
BALL::TriangulatedSurface::endPoint
ConstPointIterator endPoint() const
BALL::TriangulatedSurface::set
void set(const TriangulatedSurface &surface, bool=true)
BALL::TriangulatedSurface::PointIterator
std::list< TrianglePoint * >::iterator PointIterator
Definition triangulatedSurface.h:52
BALL::TriangulatedSurface::ConstEdgeIterator
std::list< TriangleEdge * >::const_iterator ConstEdgeIterator
Definition triangulatedSurface.h:58
BALL::TriangulatedSurface::endEdge
ConstEdgeIterator endEdge() const
BALL::TriangulatedSurface::getNumberOfEdges
Size getNumberOfEdges() const
BALL::TriangulatedSurface::insert
void insert(Triangle *triangle)
BALL::TriangulatedSurface::beginTriangle
TriangleIterator beginTriangle()
BALL::TriangulatedSurface::insert
void insert(TrianglePoint *point)
BALL::TriangulatedSurface::insert
void insert(TriangleEdge *edge)
BALL::TriangulatedSurface::number_of_edges_
Size number_of_edges_
Definition triangulatedSurface.h:347
BALL::TriangulatedSurface::createDisk
static TriangulatedSurface * createDisk(unsigned int num_vertices, bool out=true)
BALL::TriangulatedSurface::canBeCopied
bool canBeCopied() const
BALL::TriangulatedSurface::remove
void remove(PointIterator p, bool deep=true)
BALL::TriangulatedSurface::setIndices
void setIndices()
BALL::TriangulatedSurface::beginPoint
PointIterator beginPoint()
BALL::TriangulatedSurface::clear
void clear()
BALL::TriangulatedSurface::cut
void cut(const TPlane3< double > &plane, const double &fuzzy=0)
BALL::TriangulatedSurface::beginPoint
ConstPointIterator beginPoint() const
BALL::TriangulatedSurface::~TriangulatedSurface
virtual ~TriangulatedSurface()
BALL::TriangulatedSurface::TriangleIterator
std::list< Triangle * >::iterator TriangleIterator
Definition triangulatedSurface.h:60
BALL::TriangulatedSurface::edges_
std::list< TriangleEdge * > edges_
Definition triangulatedSurface.h:350
BALL::TriangulatedSurface::endTriangle
TriangleIterator endTriangle()
BALL::TriangulatedSurface::getDensity
double getDensity() const
BALL::TriangulatedSurface::TriangulatedSurface
TriangulatedSurface(const TriangulatedSurface &surface, bool=true)
BALL::TriangulatedSurface::remove
void remove(TrianglePoint *point, bool deep=true)
BALL::TriangulatedSurface::remove
void remove(Triangle *triangle, bool deep=true)
BALL::TriangulatedSurface::endTriangle
ConstTriangleIterator endTriangle() const
BALL::TriangulatedSurface::beginEdge
EdgeIterator beginEdge()
BALL::TriangulatedSurface::endPoint
PointIterator endPoint()
BALL::TriangulatedSurface::points_
std::list< TrianglePoint * > points_
Definition triangulatedSurface.h:344
BALL::TriangulatedSurface::createTube
static TriangulatedSurface * createTube(unsigned int num_vertices, unsigned int subdiv=0, bool closed=false, bool out=true)
BALL::TriangulatedSurface::beginEdge
ConstEdgeIterator beginEdge() const
BALL::TriangulatedSurface::number_of_points_
Size number_of_points_
Definition triangulatedSurface.h:341
BALL::TriangulatedSurface::getNumberOfPoints
Size getNumberOfPoints() const
BALL::TriangulatedSurface::shrink
void shrink()
BALL::TriangulatedSurface::remove
void remove(EdgeIterator e, bool deep=true)
BALL_CREATE
#define BALL_CREATE(name)
Definition create.h:62
BALL::operator<<
BALL_EXPORT std::ostream & operator<<(std::ostream &os, const Exception::GeneralException &e)
BALL::Surface
TSurface< float > Surface
Definition surface.h:488
BALL
Definition constants.h:13
BALL::Size
BALL_SIZE_TYPE Size
Definition COMMON/global.h:114
BALL::Position
BALL_SIZE_TYPE Position
Definition COMMON/global.h:140
plane3.h
BALL::TriangulatedSphere::Face
Definition triangulatedSurface.h:395
BALL::TriangulatedSphere::Face::ecount
Position ecount
Definition triangulatedSurface.h:399
BALL::TriangulatedSphere::Face::pcount
Position pcount
Definition triangulatedSurface.h:398
BALL::TriangulatedSphere::Face::e
TriangleEdge * e[9]
Definition triangulatedSurface.h:397
BALL::TriangulatedSphere::Face::p
TrianglePoint * p[6]
Definition triangulatedSurface.h:396
surface.h
triangleEdge.h
trianglePoint.h
triangle.h
vector3.h