Basic Image AlgorithmS Library  2.8.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
BIAS::TriangleMesh Class Reference

Create and represent a 3D triangle mesh. More...

#include <Utils/TriangleMesh.hh>

+ Collaboration diagram for BIAS::TriangleMesh:

Public Member Functions

int ChangeTexture (const BIAS::Image< unsigned char > &texture)
 Replace the texture of this mesh. More...
 
int GenerateDenseMesh (const BIAS::Image< float > &DenseDepthMap, const BIAS::Image< unsigned char > &Texture)
 Calculate a triangle mesh from dense depth map without PMatrix. More...
 
int GenerateDenseMesh (const BIAS::Image< float > &DenseDepthMap, BIAS::PMatrix &P, const BIAS::Image< unsigned char > &Texture)
 Calculate a triangle mesh from dense depth map. More...
 
int GenerateDenseMesh (const BIAS::Image< float > &DenseDepthMap, BIAS::Projection &P, const BIAS::Image< unsigned char > &Texture, BIAS::Projection &TexP, bool reduce, double reduceValue)
 
int GenerateDenseMesh (const BIAS::Image< float > &DenseDepthMap, BIAS::PMatrix &P, const BIAS::Image< unsigned char > &Texture, const ROI &cutout)
 Calculate a triangle mesh only using the given cutout recalculates depthmap, image and p and calls generic interface. More...
 
int GenerateDenseMesh (const BIAS::Image< float > &DenseDepthMap, BIAS::Projection &P, const BIAS::Image< unsigned char > &Texture, BIAS::Projection &TexP, const unsigned int distBetweenPoints=1)
 Calculate a triangle mesh from dense depth map. More...
 
int GenerateDenseMesh (const BIAS::Image< float > &DenseDepthMap, BIAS::Projection &P, const BIAS::Image< unsigned char > &Texture, const unsigned int distBetweenPoints=1)
 old interface without a projection for the texture More...
 
int GenerateDenseMesh (const BIAS::Image< float > &DenseDepthMap, BIAS::Projection &DepthP, const BIAS::Image< unsigned char > &Texture, BIAS::Projection &TexP, const unsigned int x0, const unsigned int y0, const unsigned int width, const unsigned int height, const unsigned int distBetweenPoints=1)
 calculates trianglemesh but only for given part of depth map (can be used for tile mode)! Generated texture coordinates reference are relative to the full depth map size! If distBetweenPoints > 1, the intermediate point are simply ignored, when combining point to triangles More...
 
int GenerateDenseMesh (const BIAS::Image< float > &DenseDepthMap, BIAS::Projection &DepthP, const BIAS::Image< unsigned char > &Texture, const unsigned int x0, const unsigned int y0, const unsigned int width, const unsigned int height, const unsigned int distBetweenPoints=1)
 old interface without a projection for the texture More...
 
int GenerateImagePlane (const BIAS::Projection &P, const BIAS::Image< unsigned char > &Texture, const double &w=1.0)
 backproject image onto a plane in space so far only implemented for perspective cameras More...
 
int GenerateSimplifiedMesh (const Image< float > &DenseDepthMap, const Projection &P, const Image< unsigned char > &Texture, const unsigned int x0, const unsigned int y0, const unsigned int width, const unsigned int height, double minCosAngle=0.8, double maxDiagRatio=3.0)
 
int GenerateSimplifiedMesh (const Image< float > &DenseDepthMap, const Projection &P, const Image< unsigned char > &Texture, const Projection &TexP, const unsigned int x0, const unsigned int y0, const unsigned int width, const unsigned int height, double minCosAngle=0.8, double maxDiagRatio=3.0)
 
void GenerateTexturedCamera (const ProjectionParametersBase *PPB, Image< unsigned char > &rgbtexture, const double &scale=1.0, const double &opacity=1.0, const double &resolution=1.0)
 generates the sensor plane / cylinder / sphere in 3D space More...
 
int GenerateTexturedQuad (const Image< unsigned char > &Texture, const Vector3< double > &UL, const Vector3< double > &UR, const Vector3< double > &LL, const Vector3< double > &LR, const Vector2< double > &ul, const Vector2< double > &ur, const Vector2< double > &ll, const Vector2< double > &lr, const Vector3< double > &normal=Vector3< double >(0, 0, 0))
 Generate planar quad in 3D space with given texture coordinates. More...
 
int GenerateTexturedQuad (PMatrix P, const Image< unsigned char > &Texture, const Vector3< double > &UL, const Vector3< double > &UR, const Vector3< double > &LL, const Vector3< double > &LR, const Vector3< double > &normal=Vector3< double >(0, 0, 0))
 Generate planar quad in 3D space with texture projection using projection matrix P. More...
 
int GenerateTexturedQuadStrip (const Image< unsigned char > &Texture, const std::vector< Vector3< double > > &X, const std::vector< Vector2< double > > &x)
 Generate a strip of planar quads in 3D space using the given texture coordinates. More...
 
int GenerateTexturedQuadStrip (const Projection &P, const Image< unsigned char > &Texture, const std::vector< Vector3< double > > &X)
 Generate a strip of planar quads in 3D space. More...
 
void GenerateVertexNormals (bool leftHanded=true, Vector3< double > normalForUnusedVertices=Vector3< double >(-1.0, 0.0, 0.0))
 Computes the normals for the vertices by averaging the normals of adjacent triangles. More...
 
void GetBiggestConnectedSegment (TriangleMesh &biggestSegment) const
 Returns the biggest connected segment of this triangle mesh. More...
 
void GetBoundingBox (Vector3< double > &minPoint, Vector3< double > &maxPoint) const
 Returns the minimal and maximal point of the axis-aligned bounding box of this triangle mesh. More...
 
void GetNormals (std::vector< BIAS::Vector3< double > > &normals) const
 
const std::vector
< BIAS::Vector3< double > > & 
GetNormalsRef () const
 
void GetTexCoords (std::vector< BIAS::Vector2< float > > &texCoo) const
 
const std::vector
< BIAS::Vector2< float > > & 
GetTexCoordsRef () const
 
void GetTexture (Image< unsigned char > &img) const
 
const BIAS::Image< unsigned
char > & 
GetTextureRef () const
 
void GetTriangleIndices (std::vector< BIAS::Vector< int > > &triangleIndices) const
 
const std::vector
< BIAS::Vector< int > > & 
GetTriangleIndicesRef () const
 
void GetVertexColors (std::vector< BIAS::Vector4< unsigned char > > &colors) const
 
void GetVertices (std::vector< BIAS::Vector3< double > > &vertices) const
 
const std::vector
< BIAS::Vector3< double > > & 
GetVerticesRef () const
 
void SetMesh (BIAS::Image< unsigned char > texture, std::vector< BIAS::Vector3< double > > meshVertices, std::vector< BIAS::Vector3< double > > vertexNormals, std::vector< BIAS::Vector2< float > > textureCoords, std::vector< BIAS::Vector< int > > triangleIndices)
 
void SetMesh (std::vector< BIAS::Vector3< double > > meshVertices, std::vector< BIAS::Vector3< double > > vertexNormals, std::vector< BIAS::Vector2< float > > textureCoords, std::vector< BIAS::Vector< int > > triangleIndices, BIAS::Image< unsigned char > texture=Image< unsigned char >())
 
void SetMesh (std::vector< BIAS::Vector3< double > > meshVertices, std::vector< BIAS::Vector3< double > > vertexNormals, std::vector< BIAS::Vector4< unsigned char > > vertexColors, std::vector< BIAS::Vector< int > > triangleIndices)
 
void SetParams (const double &minCornerAngle=M_PI *5.0/180.0, const double &maxAngle=M_PI *60.0/180.0, const double depthScale=1.0)
 
 TriangleMesh (const double &minCornerAngle=M_PI *5.0/180.0, const double &maxAngle=M_PI *60.0/180.0, const double depthScale=1.0)
 

Protected Member Functions

void GetNeighbours_ (int v1, int v2, std::vector< int > &dead_triangles, std::vector< int > &moved_triangles, int &moved_pivot)
 get the neighbours of the contracted points and returns two list that contains the triangles to remove from the model and triangles that have to be moved to one of the vertices More...
 
bool MakeTriangles_ (const Projection &P, const Projection &TexP, const BIAS::Image< unsigned char > &Texture, std::vector< Image< float > > &depthmaps, float x, float y, float offset, float minoffset, double minCosAngle, double maxDiagRatio, bool simulateOnly)
 
bool SimplifyMeshSurface_ (const BIAS::Image< unsigned char > &Texture, BIAS::Projection &TexP, double reduceValue)
 Simplifies a TriangleMesh to a desired percentage of triangles of the original mesh. More...
 
void TestContraction (int v1, int v2, int edge, bool init=false)
 Tests if a triangle that is involved in the contraction changes direction or overlapps. More...
 
double ThreePointsToPlane_ (Vector3< double > v1, Vector3< double > v2, Vector3< double > v3, Vector4< double > &erg)
 calculates a plan of three points and returns it area More...
 

Protected Attributes

int currentIndex_
 
double depthScale_
 apply this scale to depth values. More...
 
double maxAngle_
 maximum angle between triangle normal and viewing ray More...
 
std::vector< BIAS::Vector3
< double > > 
meshVertices_
 
double minCornerAngle_
 minimum angle of any corner to accept a triangle More...
 
std::vector< std::set< int > > neighboursOfVertex_
 a set with all neighbours of a vertex v More...
 
std::multiset< BIAS::Edge,
BIAS::Edge
sorted
 
BIAS::Image< unsigned char > texture_
 
std::vector< BIAS::Vector2
< float > > 
textureCoords_
 
std::vector< BIAS::Vector< int > > triangleIndices_
 
std::vector< BIAS::EdgevalidPairs_
 
std::vector< BIAS::Vector4
< unsigned char > > 
vertexColors_
 
std::vector< std::set< int > > vertexIsInThisPairs_
 a set with pairs that contain the vertex v More...
 
std::vector< std::set< int > > vertexIsInTriangles_
 a set with triangles that contain the vertex v More...
 
std::vector< BIAS::Vector3
< double > > 
vertexNormals_
 

Detailed Description

Create and represent a 3D triangle mesh.

The parameter minCornerAngle defines a lower bound on the allowed angle in each triangle. If a triangle contains an angle smaller than this threshold, it is dropped. The parameter maxAngle defines an upper bound on the angle between the viewing ray and the normal of the triangle. If the angle if bigger than the threshold, it is dropped. The parameter depthScale can be used to scale the model prior to triangle generation.

Author
bartczak
Examples:
Example3DImagePlane.cpp, ExampleMeshFromImage.cpp, ExampleRectification.cpp, ExampleTriangleMesh.cpp, and ExampleTriangleMeshQuad.cpp.

Definition at line 84 of file TriangleMesh.hh.

Constructor & Destructor Documentation

TriangleMesh::TriangleMesh ( const double &  minCornerAngle = M_PI * 5.0 / 180.0,
const double &  maxAngle = M_PI * 60.0 / 180.0,
const double  depthScale = 1.0 
)

Definition at line 46 of file TriangleMesh.cpp.

Member Function Documentation

int TriangleMesh::ChangeTexture ( const BIAS::Image< unsigned char > &  texture)

Replace the texture of this mesh.

Definition at line 51 of file TriangleMesh.cpp.

References BIAS::ImageBase::SamePixelAndChannelCount().

int TriangleMesh::GenerateDenseMesh ( const BIAS::Image< float > &  DenseDepthMap,
const BIAS::Image< unsigned char > &  Texture 
)

Calculate a triangle mesh from dense depth map without PMatrix.

That's a 3D representation of an Image. All entries in depth map are simply combined to little triangles, if neighboring pixels are set.

Examples:
ExampleMeshFromImage.cpp.

Definition at line 140 of file TriangleMesh.cpp.

References BIAS::HomgPoint3D::GetEuclidean(), BIAS::ImageBase::GetHeight(), BIAS::Image< StorageType >::GetImageDataArray(), BIAS::ImageBase::GetWidth(), BIAS::HomgPoint3D, BIAS::Vector3< T >::Set(), and BIAS::Vector2< T >::Set().

Referenced by BIAS::CylindricDepthTrackingPanorama::GetTriangleMesh(), BIAS::SphericalDepthPanorama::GetTriangleMesh(), and BIAS::CylindricDepthPanorama::GetTriangleMesh().

int TriangleMesh::GenerateDenseMesh ( const BIAS::Image< float > &  DenseDepthMap,
BIAS::PMatrix P,
const BIAS::Image< unsigned char > &  Texture 
)

Calculate a triangle mesh from dense depth map.

No triangles are discarded, hence no smoothing.

Definition at line 266 of file TriangleMesh.cpp.

References BIAS::ImageBase::GetHeight(), BIAS::ImageBase::GetWidth(), BIAS::ProjectionParametersBase::SetImageSize(), and BIAS::ProjectionParametersPerspective::SetP().

int TriangleMesh::GenerateDenseMesh ( const BIAS::Image< float > &  DenseDepthMap,
BIAS::Projection P,
const BIAS::Image< unsigned char > &  Texture,
BIAS::Projection TexP,
bool  reduce,
double  reduceValue 
)

Definition at line 250 of file TriangleMesh.cpp.

References SimplifyMeshSurface_().

int TriangleMesh::GenerateDenseMesh ( const BIAS::Image< float > &  DenseDepthMap,
BIAS::PMatrix P,
const BIAS::Image< unsigned char > &  Texture,
const ROI cutout 
)
int TriangleMesh::GenerateDenseMesh ( const BIAS::Image< float > &  DenseDepthMap,
BIAS::Projection P,
const BIAS::Image< unsigned char > &  Texture,
BIAS::Projection TexP,
const unsigned int  distBetweenPoints = 1 
)

Calculate a triangle mesh from dense depth map.

No triangles are discarded, hence no smoothing.

Definition at line 276 of file TriangleMesh.cpp.

References BIAS::ImageBase::GetHeight(), and BIAS::ImageBase::GetWidth().

int BIAS::TriangleMesh::GenerateDenseMesh ( const BIAS::Image< float > &  DenseDepthMap,
BIAS::Projection P,
const BIAS::Image< unsigned char > &  Texture,
const unsigned int  distBetweenPoints = 1 
)
inline

old interface without a projection for the texture

Definition at line 180 of file TriangleMesh.hh.

References BIAS::ImageBase::GetHeight(), BIAS::ImageBase::GetWidth(), and BIAS::ImageBase::IsEmpty().

int TriangleMesh::GenerateDenseMesh ( const BIAS::Image< float > &  DenseDepthMap,
BIAS::Projection DepthP,
const BIAS::Image< unsigned char > &  Texture,
BIAS::Projection TexP,
const unsigned int  x0,
const unsigned int  y0,
const unsigned int  width,
const unsigned int  height,
const unsigned int  distBetweenPoints = 1 
)

calculates trianglemesh but only for given part of depth map (can be used for tile mode)! Generated texture coordinates reference are relative to the full depth map size! If distBetweenPoints > 1, the intermediate point are simply ignored, when combining point to triangles

Definition at line 294 of file TriangleMesh.cpp.

References BIAS::Projection::DoesPointProjectIntoImage(), BIAS::Projection::GetC(), BIAS::ImageBase::GetHeight(), BIAS::Image< StorageType >::GetImageDataArray(), BIAS::ImageBase::GetWidth(), BIAS::HomgPoint2D, BIAS::Vector3< T >::NormL2(), BIAS::Vector3< T >::Set(), BIAS::Vector2< T >::Set(), and BIAS::Projection::UnProjectToPoint().

int BIAS::TriangleMesh::GenerateDenseMesh ( const BIAS::Image< float > &  DenseDepthMap,
BIAS::Projection DepthP,
const BIAS::Image< unsigned char > &  Texture,
const unsigned int  x0,
const unsigned int  y0,
const unsigned int  width,
const unsigned int  height,
const unsigned int  distBetweenPoints = 1 
)
inline

old interface without a projection for the texture

Definition at line 212 of file TriangleMesh.hh.

References BIAS::ImageBase::GetHeight(), BIAS::ImageBase::GetWidth(), and BIAS::ImageBase::IsEmpty().

int TriangleMesh::GenerateImagePlane ( const BIAS::Projection P,
const BIAS::Image< unsigned char > &  Texture,
const double &  w = 1.0 
)
int BIAS::TriangleMesh::GenerateSimplifiedMesh ( const Image< float > &  DenseDepthMap,
const Projection P,
const Image< unsigned char > &  Texture,
const unsigned int  x0,
const unsigned int  y0,
const unsigned int  width,
const unsigned int  height,
double  minCosAngle = 0.8,
double  maxDiagRatio = 3.0 
)
inline
int TriangleMesh::GenerateSimplifiedMesh ( const Image< float > &  DenseDepthMap,
const Projection P,
const Image< unsigned char > &  Texture,
const Projection TexP,
const unsigned int  x0,
const unsigned int  y0,
const unsigned int  width,
const unsigned int  height,
double  minCosAngle = 0.8,
double  maxDiagRatio = 3.0 
)
void TriangleMesh::GenerateTexturedCamera ( const ProjectionParametersBase PPB,
Image< unsigned char > &  rgbtexture,
const double &  scale = 1.0,
const double &  opacity = 1.0,
const double &  resolution = 1.0 
)
int TriangleMesh::GenerateTexturedQuad ( const Image< unsigned char > &  Texture,
const Vector3< double > &  UL,
const Vector3< double > &  UR,
const Vector3< double > &  LL,
const Vector3< double > &  LR,
const Vector2< double > &  ul,
const Vector2< double > &  ur,
const Vector2< double > &  ll,
const Vector2< double > &  lr,
const Vector3< double > &  normal = Vector3<double>(0,0,0) 
)

Generate planar quad in 3D space with given texture coordinates.

   The quad will be represented by two triangles.
Note
If texture has zero width, an untextured quad is created.

Definition at line 1049 of file TriangleMesh.cpp.

References BIAS::Equal(), BIAS::ImageBase::GetHeight(), BIAS::ImageBase::GetWidth(), and BIAS::Vector3< T >::NormL2().

int TriangleMesh::GenerateTexturedQuad ( PMatrix  P,
const Image< unsigned char > &  Texture,
const Vector3< double > &  UL,
const Vector3< double > &  UR,
const Vector3< double > &  LL,
const Vector3< double > &  LR,
const Vector3< double > &  normal = Vector3<double>(0,0,0) 
)

Generate planar quad in 3D space with texture projection using projection matrix P.

Will be represented by two triangles.

Note
If texture has zero width, an untextured quad is created. If matrix P is zero, image corners of texture will be mapped to quad corners.

Definition at line 1100 of file TriangleMesh.cpp.

References BIAS::HomgPoint2D::GetEuclidean(), BIAS::ImageBase::GetHeight(), BIAS::ImageBase::GetWidth(), BIAS::HomgPoint3D, BIAS::HomgPoint2D::Homogenize(), BIAS::Matrix< T >::NormFrobenius(), and BIAS::HomgPoint2D::Set().

int TriangleMesh::GenerateTexturedQuadStrip ( const Image< unsigned char > &  Texture,
const std::vector< Vector3< double > > &  X,
const std::vector< Vector2< double > > &  x 
)

Generate a strip of planar quads in 3D space using the given texture coordinates.

Each quad will be represented by two triangles.

Attention
The ordering of the 3d points in vector X and corresponding 2d texture coordinates in vector x is upper/lower from left to right, i.e.: UL0, LL0, UR0 = UL1, LR0 = LL1, UR1 = UL2, LR1 = LL2, ...

Definition at line 1136 of file TriangleMesh.cpp.

References BIAS::ImageBase::GetHeight(), and BIAS::ImageBase::GetWidth().

int TriangleMesh::GenerateTexturedQuadStrip ( const Projection P,
const Image< unsigned char > &  Texture,
const std::vector< Vector3< double > > &  X 
)

Generate a strip of planar quads in 3D space.

Projection of the texture onto the quad is done by the given projection matrix P. Each quad will be represented by two triangles.

Attention
The ordering of the 3d points in vector X is upper/lower from left to right, i.e.: UL0, LL0, UR0 = UL1, LR0 = LL1, UR1 = UL2, LR1 = LL2, ...

Definition at line 1187 of file TriangleMesh.cpp.

References BIAS::Equal(), BIAS::HomgPoint2D::GetEuclidean(), BIAS::HomgPoint3D, BIAS::HomgPoint2D::Homogenize(), and BIAS::Projection::Project().

void TriangleMesh::GenerateVertexNormals ( bool  leftHanded = true,
Vector3< double >  normalForUnusedVertices = Vector3<double>(-1.0, 0.0, 0.0) 
)

Computes the normals for the vertices by averaging the normals of adjacent triangles.

Parameters
leftHandeddetermines direction of normals. true = compute in left-handed fashion, false = compute in right-handed fashion
normalForUnusedVerticesnormal to assign to vertices that do not occur in any triangle

Definition at line 2026 of file TriangleMesh.cpp.

References BIAS::Vector3< T >::CrossProduct(), BIAS::Vector3< T >::Normalize(), and BIAS::Vector3< T >::NormL2().

void TriangleMesh::GetBiggestConnectedSegment ( TriangleMesh biggestSegment) const

Returns the biggest connected segment of this triangle mesh.

Note
The returned mesh will only contain the 3D points that are actually referenced by at least one triangle. Therefore the indices of the triangles may differ from the original mesh.
Parameters
[out]biggestSegmentthe biggest subsegment of this triangle mesh
Author
rwulff
Date
02/2012

Definition at line 1852 of file TriangleMesh.cpp.

References SetMesh(), and TNT::Vector< T >::size().

void TriangleMesh::GetBoundingBox ( Vector3< double > &  minPoint,
Vector3< double > &  maxPoint 
) const

Returns the minimal and maximal point of the axis-aligned bounding box of this triangle mesh.

Note
The result is not cached and recomputed each time this method is called.
Parameters
[out]minPointpoint with minimal values in each dimension
[out]maxPointpoint with maximal values in each dimension

Definition at line 1994 of file TriangleMesh.cpp.

References BIAS::Vector3< T >::Set().

void TriangleMesh::GetNeighbours_ ( int  v1,
int  v2,
std::vector< int > &  dead_triangles,
std::vector< int > &  moved_triangles,
int &  moved_pivot 
)
protected

get the neighbours of the contracted points and returns two list that contains the triangles to remove from the model and triangles that have to be moved to one of the vertices

Definition at line 1728 of file TriangleMesh.cpp.

void BIAS::TriangleMesh::GetNormals ( std::vector< BIAS::Vector3< double > > &  normals) const
inline

Definition at line 289 of file TriangleMesh.hh.

Referenced by BIAS::ThreeDOut::AddTriangleMesh().

const std::vector<BIAS::Vector3<double> >& BIAS::TriangleMesh::GetNormalsRef ( ) const
inline

Definition at line 295 of file TriangleMesh.hh.

void BIAS::TriangleMesh::GetTexCoords ( std::vector< BIAS::Vector2< float > > &  texCoo) const
inline

Definition at line 266 of file TriangleMesh.hh.

Referenced by BIAS::ThreeDOut::AddTriangleMesh().

const std::vector<BIAS::Vector2<float> >& BIAS::TriangleMesh::GetTexCoordsRef ( ) const
inline
void BIAS::TriangleMesh::GetTexture ( Image< unsigned char > &  img) const
inline

Definition at line 247 of file TriangleMesh.hh.

Referenced by BIAS::ThreeDOut::AddTriangleMesh().

const BIAS::Image<unsigned char>& BIAS::TriangleMesh::GetTextureRef ( ) const
inline
void BIAS::TriangleMesh::GetTriangleIndices ( std::vector< BIAS::Vector< int > > &  triangleIndices) const
inline

Definition at line 280 of file TriangleMesh.hh.

Referenced by BIAS::ThreeDOut::AddTriangleMesh().

const std::vector<BIAS::Vector<int> >& BIAS::TriangleMesh::GetTriangleIndicesRef ( ) const
inline
void BIAS::TriangleMesh::GetVertexColors ( std::vector< BIAS::Vector4< unsigned char > > &  colors) const
inline

Definition at line 271 of file TriangleMesh.hh.

Referenced by BIAS::ThreeDOut::AddTriangleMesh().

void BIAS::TriangleMesh::GetVertices ( std::vector< BIAS::Vector3< double > > &  vertices) const
inline

Definition at line 257 of file TriangleMesh.hh.

Referenced by BIAS::ThreeDOut::AddTriangleMesh().

const std::vector<BIAS::Vector3<double> >& BIAS::TriangleMesh::GetVerticesRef ( ) const
inline
bool TriangleMesh::MakeTriangles_ ( const Projection P,
const Projection TexP,
const BIAS::Image< unsigned char > &  Texture,
std::vector< Image< float > > &  depthmaps,
float  x,
float  y,
float  offset,
float  minoffset,
double  minCosAngle,
double  maxDiagRatio,
bool  simulateOnly 
)
protected
void BIAS::TriangleMesh::SetMesh ( BIAS::Image< unsigned char >  texture,
std::vector< BIAS::Vector3< double > >  meshVertices,
std::vector< BIAS::Vector3< double > >  vertexNormals,
std::vector< BIAS::Vector2< float > >  textureCoords,
std::vector< BIAS::Vector< int > >  triangleIndices 
)
inline

Definition at line 97 of file TriangleMesh.hh.

Referenced by BIAS::ThreeDOut::AddPlane(), and GetBiggestConnectedSegment().

void BIAS::TriangleMesh::SetMesh ( std::vector< BIAS::Vector3< double > >  meshVertices,
std::vector< BIAS::Vector3< double > >  vertexNormals,
std::vector< BIAS::Vector2< float > >  textureCoords,
std::vector< BIAS::Vector< int > >  triangleIndices,
BIAS::Image< unsigned char >  texture = Image<unsigned char>() 
)
inline
Parameters
textureset to empty image to ignore and use texture that was set before

Definition at line 115 of file TriangleMesh.hh.

void BIAS::TriangleMesh::SetMesh ( std::vector< BIAS::Vector3< double > >  meshVertices,
std::vector< BIAS::Vector3< double > >  vertexNormals,
std::vector< BIAS::Vector4< unsigned char > >  vertexColors,
std::vector< BIAS::Vector< int > >  triangleIndices 
)
inline

Definition at line 131 of file TriangleMesh.hh.

void TriangleMesh::SetParams ( const double &  minCornerAngle = M_PI * 5.0 / 180.0,
const double &  maxAngle = M_PI * 60.0 / 180.0,
const double  depthScale = 1.0 
)

Definition at line 60 of file TriangleMesh.cpp.

bool TriangleMesh::SimplifyMeshSurface_ ( const BIAS::Image< unsigned char > &  Texture,
BIAS::Projection TexP,
double  reduce 
)
protected

Simplifies a TriangleMesh to a desired percentage of triangles of the original mesh.

The method uses the algorithm described by Garland and Heckbert in "Surface Simplification Using Quadric Error Metrics"

Author
bangerer, 09/2008
Parameters
Texturethe texture of the mesh
TexPthe
reducereduces the triangles in the generated mesh to "reduce" percent of the original mesh
Returns
true if mesh could be reduced to the given reduce value

Definition at line 1221 of file TriangleMesh.cpp.

References BIAS::Vector3< T >::AddIP(), BIAS::Projection::DoesPointProjectIntoImage(), BIAS::Quadric3::Evaluate(), BIAS::Quadric3::GetArea(), BIAS::ImageBase::GetHeight(), BIAS::ImageBase::GetWidth(), BIAS::Edge_s::IDv1, BIAS::Edge_s::IDv2, BIAS::Edge_s::newV, BIAS::Quadric3::Optimize(), BIAS::Vector2< T >::Set(), BIAS::Vector2< T >::size(), and BIAS::Vector3< T >::Sub().

Referenced by GenerateDenseMesh().

void TriangleMesh::TestContraction ( int  v1,
int  v2,
int  edge,
bool  init = false 
)
protected

Tests if a triangle that is involved in the contraction changes direction or overlapps.

Definition at line 1762 of file TriangleMesh.cpp.

References BIAS::Vector< T >::IsZero(), BIAS::Vector< T >::NormL2(), and BIAS::Vector< T >::SetZero().

double TriangleMesh::ThreePointsToPlane_ ( Vector3< double >  v1,
Vector3< double >  v2,
Vector3< double >  v3,
Vector4< double > &  erg 
)
protected

calculates a plan of three points and returns it area

Parameters
v1first vector of plane
v2second vector of plane
v3third vector of plane
ergvector in which the plane is stored
Returns
the area of the plan

Definition at line 1697 of file TriangleMesh.cpp.

References BIAS::Vector3< T >::CrossProduct(), BIAS::Vector3< T >::Normalize(), BIAS::Vector3< T >::NormL2(), and BIAS::Vector3< T >::ScalarProduct().

Member Data Documentation

int BIAS::TriangleMesh::currentIndex_
protected

Definition at line 466 of file TriangleMesh.hh.

double BIAS::TriangleMesh::depthScale_
protected

apply this scale to depth values.

Definition at line 464 of file TriangleMesh.hh.

double BIAS::TriangleMesh::maxAngle_
protected

maximum angle between triangle normal and viewing ray

Definition at line 461 of file TriangleMesh.hh.

std::vector<BIAS::Vector3<double> > BIAS::TriangleMesh::meshVertices_
protected

Definition at line 441 of file TriangleMesh.hh.

double BIAS::TriangleMesh::minCornerAngle_
protected

minimum angle of any corner to accept a triangle

Definition at line 459 of file TriangleMesh.hh.

std::vector<std::set<int> > BIAS::TriangleMesh::neighboursOfVertex_
protected

a set with all neighbours of a vertex v

Definition at line 448 of file TriangleMesh.hh.

std::multiset<BIAS::Edge,BIAS::Edge> BIAS::TriangleMesh::sorted
protected

Definition at line 454 of file TriangleMesh.hh.

BIAS::Image<unsigned char> BIAS::TriangleMesh::texture_
protected

Definition at line 440 of file TriangleMesh.hh.

std::vector<BIAS::Vector2<float> > BIAS::TriangleMesh::textureCoords_
protected

Definition at line 444 of file TriangleMesh.hh.

std::vector<BIAS::Vector<int> > BIAS::TriangleMesh::triangleIndices_
protected

Definition at line 445 of file TriangleMesh.hh.

std::vector<BIAS::Edge> BIAS::TriangleMesh::validPairs_
protected

Definition at line 456 of file TriangleMesh.hh.

std::vector<BIAS::Vector4<unsigned char> > BIAS::TriangleMesh::vertexColors_
protected

Definition at line 443 of file TriangleMesh.hh.

std::vector<std::set<int> > BIAS::TriangleMesh::vertexIsInThisPairs_
protected

a set with pairs that contain the vertex v

Definition at line 452 of file TriangleMesh.hh.

std::vector<std::set<int> > BIAS::TriangleMesh::vertexIsInTriangles_
protected

a set with triangles that contain the vertex v

Definition at line 450 of file TriangleMesh.hh.

std::vector<BIAS::Vector3<double> > BIAS::TriangleMesh::vertexNormals_
protected

Definition at line 442 of file TriangleMesh.hh.


The documentation for this class was generated from the following files: