Biomedical Image Analysis Library
The Biomedical Image Analysis Library is a poweful tool for developers, physicians, researchers, engineers, and so on.
Bial::TriangleMesh Class Reference

#include <DrawShape.hpp>

Inheritance diagram for Bial::TriangleMesh:
Inheritance graph
Collaboration diagram for Bial::TriangleMesh:
Collaboration graph

Public Member Functions

 TriangleMesh (const Transform3D *o2w, const Transform3D *w2o, bool ro, size_t nt, size_t nv, const size_t *vi, const Point3D *P, const Normal *N=NULL, const Vector3D *S=NULL, const float *uv=NULL)
 TriangleMesh Constructor. More...
 
 ~TriangleMesh ()
 TriangleMesh Destructor. More...
 
virtual BBox ObjectBound () const
 ObjectBound is the shape bounding box. More...
 
virtual BBox WorldBound () const
 WorldBound is the Shape's Bounding box transformed by the ObjectToWorld transform matrix. More...
 
virtual bool CanIntersect () const
 CanIntersect indicates that a shape can compute ray intersections, so only shapes that are nonintersectable need to override this method. More...
 
virtual void Refine (Vector< std::shared_ptr< Shape > > &refined) const
 Refine is a method that splits the shape into a group of new shapes, some of which may be intersectable and some of which may need further refinement. More...
 
template<class O >
void Print (O &os) const
 Print assings Shape information to stream. More...
 
void ExportSTLA (std::string filename) const
 Exports the triange mesh to a ASCII STL file. More...
 
void ExportSTLB (std::string filename) const
 Exports the triange mesh to a Brinary STL file. More...
 
size_t getNtris () const
 
size_t getNverts () const
 
size_t * getVertexIndex () const
 
Point3DgetP () const
 
NormalgetN () const
 
Vector3DgetS () const
 
float * getUvs () const
 
- Public Member Functions inherited from Bial::Shape
 Shape (const Transform3D *o2w, const Transform3D *w2o, bool ro)
 Shape Constructor. More...
 
virtual bool Intersect (const Ray &ray, float *tHit, float *rayEpsilon, DifferentialGeometry *dg) const
 Intersect returns geometric information about a single ray­shape intersection corresponding to the first intersection, if any, in the [mint, maxt] parametric range along the ray. More...
 
virtual bool IntersectP (const Ray &ray) const
 IntersectP is a predicate function that determines whether or not an intersection occurs, without returning any details about the intersection itself. More...
 
virtual void GetShadingGeometry (const Transform3D &obj2world, const DifferentialGeometry &dg, DifferentialGeometry *dgShading) const
 GetShadingGeometry. More...
 
float Area () const
 Area calculates the surface Area. More...
 
template<class O >
void Print (O &os) const
 Print assings Shape information to stream. More...
 

Static Public Member Functions

static TriangleMeshReadSTLB (std::string filename)
 Imports the triangle mesh from a Binary STL file. More...
 

Protected Attributes

size_t ntris
 ntris More...
 
size_t nverts
 nverts More...
 
size_t * vertexIndex
 vertexIndex More...
 
Point3Dp
 p More...
 
Normaln
 n More...
 
Vector3Ds
 s More...
 
float * uvs
 uvs More...
 

Friends

class Triangle
 

Additional Inherited Members

- Public Attributes inherited from Bial::Shape
const Transform3DObjectToWorld
 ObjectToWorld is the object's transformation matrix. More...
 
const Transform3DWorldToObject
 WorldToObject is the inverse object's transformation matrix. More...
 
const bool ReverseOrientation
 ReverseOrientation indicates whether their surface normal directions should be reversed from the default. More...
 
const bool TransformSwapsHandedness
 TransformSwapsHandedness stores the result of the Transform::SwapsHandedness() call for their object­to­world transformation. More...
 
const uint32_t shapeId
 shapeId is the Shape's unique id. More...
 
- Static Public Attributes inherited from Bial::Shape
static uint32_t nextShapeId
 nextShapeId is a static attribute that is incremented at each Shape Construction. More...
 

Detailed Description

Definition at line 135 of file DrawShape.hpp.

Constructor & Destructor Documentation

Bial::TriangleMesh::TriangleMesh ( const Transform3D o2w,
const Transform3D w2o,
bool  ro,
size_t  nt,
size_t  nv,
const size_t *  vi,
const Point3D P,
const Normal N = NULL,
const Vector3D S = NULL,
const float *  uv = NULL 
)

TriangleMesh Constructor.

Date
2015/Aug/21
Parameters
o2wObject to World transform matrix.
w2oWorld to Object transform matrix.
roindicates if the surface normal should be reversed.
ntis the number of triangles.
nvis the number of vertices.
viis a pointer to an array of vertex indices. For the ith triangle, its three vertex positions are P[vi[3*i]],P[vi[3*i+1]], and P[vi[3*i+2]];
pis an array of nv vertex positions.
nis an optional array of normal vectors, one per vertex in the mesh. If present, these are interpolated across triangle faces to compute shading differential geometry.
sis an optional array of tangent vectors, one per vertex in the mesh. These are also used to compute shading geometry.
uvis an optional array of parametric (u,v) values, one for each vetex.
atexis an optional Alpha Mask texture, which can be used to cut away part of the triangle's surface.
Bial::TriangleMesh::~TriangleMesh ( )

TriangleMesh Destructor.

Date
2015/Aug/21

Member Function Documentation

virtual bool Bial::TriangleMesh::CanIntersect ( ) const
virtual

CanIntersect indicates that a shape can compute ray intersections, so only shapes that are nonintersectable need to override this method.

Date
2015/Aug/21
Returns

Reimplemented from Bial::Shape.

void Bial::TriangleMesh::ExportSTLA ( std::string  filename) const

Exports the triange mesh to a ASCII STL file.

Date
2015/Aug/21
Parameters
filenameOutput stl file name.
void Bial::TriangleMesh::ExportSTLB ( std::string  filename) const

Exports the triange mesh to a Brinary STL file.

Date
2015/Aug/21
Parameters
filenameOutput stl file name.
Normal* Bial::TriangleMesh::getN ( ) const
size_t Bial::TriangleMesh::getNtris ( ) const
size_t Bial::TriangleMesh::getNverts ( ) const
Point3D* Bial::TriangleMesh::getP ( ) const
Vector3D* Bial::TriangleMesh::getS ( ) const
float* Bial::TriangleMesh::getUvs ( ) const
size_t* Bial::TriangleMesh::getVertexIndex ( ) const
virtual BBox Bial::TriangleMesh::ObjectBound ( ) const
virtual

ObjectBound is the shape bounding box.

Date
2015/Aug/21
Returns

Implements Bial::Shape.

template<class O >
void Bial::TriangleMesh::Print ( O &  os) const

Print assings Shape information to stream.

Date
2015/Aug/21
Parameters
osan output stream.

Definition at line 383 of file DrawShape.hpp.

static TriangleMesh* Bial::TriangleMesh::ReadSTLB ( std::string  filename)
static

Imports the triangle mesh from a Binary STL file.

Date
2015/Aug/21
Parameters
filenameInput stl file name.
virtual void Bial::TriangleMesh::Refine ( Vector< std::shared_ptr< Shape > > &  refined) const
virtual

Refine is a method that splits the shape into a group of new shapes, some of which may be intersectable and some of which may need further refinement.

Date
2015/Aug/21
Parameters
refined

Reimplemented from Bial::Shape.

virtual BBox Bial::TriangleMesh::WorldBound ( ) const
virtual

WorldBound is the Shape's Bounding box transformed by the ObjectToWorld transform matrix.

Date
2015/Aug/21
Returns

Reimplemented from Bial::Shape.

Friends And Related Function Documentation

friend class Triangle
friend

Definition at line 136 of file DrawShape.hpp.

Member Data Documentation

Normal* Bial::TriangleMesh::n
protected

n

Definition at line 157 of file DrawShape.hpp.

size_t Bial::TriangleMesh::ntris
protected

ntris

Definition at line 141 of file DrawShape.hpp.

size_t Bial::TriangleMesh::nverts
protected

nverts

Definition at line 145 of file DrawShape.hpp.

Point3D* Bial::TriangleMesh::p
protected

p

Definition at line 153 of file DrawShape.hpp.

Vector3D* Bial::TriangleMesh::s
protected

s

Definition at line 161 of file DrawShape.hpp.

float* Bial::TriangleMesh::uvs
protected

uvs

Definition at line 165 of file DrawShape.hpp.

size_t* Bial::TriangleMesh::vertexIndex
protected

vertexIndex

Definition at line 149 of file DrawShape.hpp.


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