Namespaces | Classes | Functions

OpenTissue::mesh Namespace Reference

Namespaces

namespace  detail

Classes

class  CoordinateIterator
class  VolumeIntegrator
class  DefaultVertexTraits
class  DefaultHalfEdgeTraits
class  DefaultEdgeTraits
class  DefaultFaceTraits

Functions

template<typename mesh_type >
bool default_read (std::string const &filename, mesh_type &mesh)
template<typename mesh_type >
bool default_write (std::string const &filename, mesh_type const &mesh)
template<typename mesh_type >
bool obj_read (std::string const &filename, mesh_type &mesh, bool keep_shared_vertices=true)
template<typename mesh_type >
bool obj_write (std::string const &filename, mesh_type const &mesh)
template<typename mesh_type >
bool tetgen_write (std::string const &filename, mesh_type const &mesh)
template<typename mesh_type >
bool vrml_write (std::string const &filename, mesh_type const &mesh)
template<typename mesh_type >
bool add2mesh (mesh_type const &A, mesh_type &C)
template<typename mesh_type >
void clear_face_tags (mesh_type &mesh, int tag_value=0)
template<typename mesh_type >
void clear_halfedge_tags (mesh_type &mesh, int tag_value=0)
template<typename mesh_type >
void clear_vertex_tags (mesh_type &mesh, int tag_value=0)
template<typename mesh_type >
void compute_aabb (mesh_type const &mesh, typename mesh_type::math_types::vector3_type &min_coord, typename mesh_type::math_types::vector3_type &max_coord)
template<typename mesh_type >
void compute_angle_weighted_vertex_normals (mesh_type &mesh)
template<typename face_type , typename vector3_type >
void compute_face_center (face_type const &f, vector3_type &center)
template<typename face_type , typename vector3_type >
void compute_face_maximum_coord (face_type const &f, vector3_type &max_coord)
template<typename face_type , typename vector3_type >
void compute_face_minimum_coord (face_type const &f, vector3_type &min_coord)
template<typename face_type , typename plane_type >
void compute_face_plane (face_type const &f, plane_type &plane)
template<typename mesh_type >
void compute_mean_vertex_normals (mesh_type &mesh)
template<typename mesh_type >
void compute_mesh_center (mesh_type const &mesh, typename mesh_type::math_types::vector3_type &center)
template<typename mesh_type , typename vector3_type >
void compute_mesh_maximum_coord (mesh_type const &mesh, vector3_type &max_coord)
template<typename mesh_type , typename vector3_type >
void compute_mesh_mean (mesh_type const &mesh, vector3_type &mean)
template<typename mesh_type , typename vector3_type >
void compute_mesh_minimum_coord (mesh_type const &mesh, vector3_type &min_coord)
template<typename mesh_type >
void compute_minmax_face_area (mesh_type const &mesh, double &min_area, double &max_area)
template<typename mesh_type , typename vector3_type , typename matrix3x3_type >
void compute_surface_covariance (mesh_type const &mesh, vector3_type &mu, matrix3x3_type &cov)
template<typename mesh_type_in , typename mesh_type_out >
bool convert (mesh_type_in const &in, mesh_type_out &out)
template<typename mesh_type , typename vector3_iterator >
void convex_hull (vector3_iterator begin, vector3_iterator end, mesh_type &mesh, bool print_summary=false)
template<typename mesh_type , typename vector3_type >
void translate (mesh_type &mesh, vector3_type const &translation)
template<typename mesh_type , typename matrix3x3_type >
void rotate (mesh_type &mesh, matrix3x3_type const &R)
template<typename mesh_type , typename real_type >
void uniform_scale (mesh_type &mesh, real_type const &s)
template<typename mesh_type , typename real_type >
void scale (mesh_type &mesh, real_type const &sx, real_type const &sy, real_type const &sz)
template<typename mesh_type , typename vector3_type >
void scale (mesh_type &mesh, vector3_type const &s)
template<typename mesh_type , typename vector3_type , typename real_type >
void twist (mesh_type &mesh, vector3_type const &direction, real_type const &pitch)
template<typename mesh_type , typename vector3_type , typename real_type >
void bend (mesh_type &mesh, vector3_type const &axis, vector3_type const &direction, real_type const &radius)
template<typename mesh_type , typename vector3_type , typename real_type >
void spherical_bend (mesh_type &mesh, vector3_type const &normal, real_type const &radius)
template<typename mesh_type >
bool flip (mesh_type const &mesh, mesh_type &flipped)
template<typename grid_type , typename mesh_type >
void isosurface (grid_type const &phi, typename grid_type::value_type const &isolevel, mesh_type &mesh)
template<typename mesh_type >
void make (mesh_type const &A, mesh_type const &B, mesh_type &C)
template<typename mesh_type >
mesh_type make (mesh_type const &A, mesh_type const &B)
template<typename real_type , typename mesh_type >
bool make_box (real_type const &length, real_type const &height, real_type const &depth, mesh_type &mesh)
template<typename mesh_type , typename real_type >
bool make_cylinder (real_type const &radius, real_type const &height, unsigned int slices, mesh_type &mesh)
template<typename mesh_type , typename real_type >
bool make_disk (real_type const &radius1, real_type const &radius2, unsigned int slices, unsigned int segments, mesh_type &mesh)
template<typename mesh_type , typename real_type >
bool make_plane (real_type dx, real_type dy, unsigned int X, unsigned int Y, mesh_type &mesh)
template<typename mesh_type , typename real_type >
bool make_sphere (real_type const &radius, unsigned int slices, unsigned int segments, mesh_type &mesh)
template<typename mesh_type >
void make_unit (mesh_type &mesh)
template<typename mesh_type , typename plane_type >
void plane_clipper (mesh_type const &mesh, plane_type plane, mesh_type &above, mesh_type &below, double const &tolerance=10e-6)
template<typename mesh_type , typename vector3_iterator , typename real_type >
bool profile_sweep (vector3_iterator profile_begin, vector3_iterator profile_end, real_type sweep_angle, unsigned int slices, mesh_type &mesh)
template<typename mesh_type >
void remove_redundant_vertices (mesh_type &input, mesh_type &output, double tolerance=10e-7)
template<typename grid_type , typename mesh_type >
void smooth_isosurface (grid_type const &phi, typename grid_type::value_type const &isolevel, mesh_type &mesh, size_t sub_sample=1u, bool smoothing=true)

Function Documentation

template<typename mesh_type >
bool OpenTissue::mesh::add2mesh ( mesh_type const &  A,
mesh_type C 
)

Add Mesh to Another Mesh.

Parameters:
A A reference to the input mesh.
C Upon return the geometry of mesh A will have been added to this mesh.
Returns:
If operation is succesful then the return value is true otherwise it is false.
template<typename mesh_type , typename vector3_type , typename real_type >
void OpenTissue::mesh::bend ( mesh_type mesh,
vector3_type const &  axis,
vector3_type const &  direction,
real_type const &  radius 
)
template<typename mesh_type >
void OpenTissue::mesh::clear_face_tags ( mesh_type mesh,
int  tag_value = 0 
)
template<typename mesh_type >
void OpenTissue::mesh::clear_halfedge_tags ( mesh_type mesh,
int  tag_value = 0 
)
template<typename mesh_type >
void OpenTissue::mesh::clear_vertex_tags ( mesh_type mesh,
int  tag_value = 0 
)
template<typename mesh_type >
void OpenTissue::mesh::compute_aabb ( mesh_type const &  mesh,
typename mesh_type::math_types::vector3_type min_coord,
typename mesh_type::math_types::vector3_type max_coord 
) [inline]

Compute min max AABB Corners of Mesh.

Example usage:

typedef ... vector3_type; typedef ... mesh_type;

mesh_type mesh; ...

vector3_type min_coord; vector3_type max_coord; OpenTissue::mesh::compute_aabb( mesh, min_coord , max_coord );

Parameters:
mesh A refence to a mesh.
min_coord Upon return this argument holds the minimum coordinates of the mesh.
max_coord Upon return this argument holds the maximum coordinates of the mesh.
template<typename mesh_type >
void OpenTissue::mesh::compute_angle_weighted_vertex_normals ( mesh_type mesh  ) 
template<typename face_type , typename vector3_type >
void OpenTissue::mesh::compute_face_center ( face_type const &  f,
vector3_type center 
)
template<typename face_type , typename vector3_type >
void OpenTissue::mesh::compute_face_maximum_coord ( face_type const &  f,
vector3_type max_coord 
)
template<typename face_type , typename vector3_type >
void OpenTissue::mesh::compute_face_minimum_coord ( face_type const &  f,
vector3_type min_coord 
)
template<typename face_type , typename plane_type >
void OpenTissue::mesh::compute_face_plane ( face_type const &  f,
plane_type &  plane 
)
template<typename mesh_type >
void OpenTissue::mesh::compute_mean_vertex_normals ( mesh_type mesh  ) 
template<typename mesh_type >
void OpenTissue::mesh::compute_mesh_center ( mesh_type const &  mesh,
typename mesh_type::math_types::vector3_type center 
)
template<typename mesh_type , typename vector3_type >
void OpenTissue::mesh::compute_mesh_maximum_coord ( mesh_type const &  mesh,
vector3_type max_coord 
)
template<typename mesh_type , typename vector3_type >
void OpenTissue::mesh::compute_mesh_mean ( mesh_type const &  mesh,
vector3_type mean 
)
template<typename mesh_type , typename vector3_type >
void OpenTissue::mesh::compute_mesh_minimum_coord ( mesh_type const &  mesh,
vector3_type min_coord 
)
template<typename mesh_type >
void OpenTissue::mesh::compute_minmax_face_area ( mesh_type const &  mesh,
double &  min_area,
double &  max_area 
)

Computes the maximum and minimum face area.

Parameters:
mesh The mesh that should be subdivided.
min_area Upon return holds the maximum area.
max_area Upon return holds the minimum area.
template<typename mesh_type , typename vector3_type , typename matrix3x3_type >
void OpenTissue::mesh::compute_surface_covariance ( mesh_type const &  mesh,
vector3_type mu,
matrix3x3_type &  cov 
)

Covaraince of Surface.

Parameters:
mesh 
mu 
C 
template<typename mesh_type_in , typename mesh_type_out >
bool OpenTissue::mesh::convert ( mesh_type_in const &  in,
mesh_type_out &  out 
)

Mesh conversion. This function converts a mesh of one type into a mesh of another type.

Example usage:

typedef OpenTissue::polymesh::PolyMesh<...> mesh_type1; typedef OpenTissue::TriMesh <...> mesh_type2; typedef OpenTissue::polymesh::PolyMesh<...> mesh_type3; mesh_type1 A; mesh_type2 B; mesh_type3 C;

convert(A,B); convert(B,A); convert(B,C); convert(A,C); ...

Topology is converted from one mesh representation to the ohter. Also vertex and face traits are assigned to each other. Function do not have any knowledge of halfedge and edge traits.

Parameters:
in Reference to input mesh.
out Reference to output mesh.
Returns:
The value true if succesful otherwise false.
template<typename mesh_type , typename vector3_iterator >
void OpenTissue::mesh::convex_hull ( vector3_iterator  begin,
vector3_iterator  end,
mesh_type mesh,
bool  print_summary = false 
)
template<typename mesh_type >
bool OpenTissue::mesh::default_read ( std::string const &  filename,
mesh_type mesh 
)

Read default opentissue mesh (.msh) file.

Parameters:
filename 
mesh 
Returns:
template<typename mesh_type >
bool OpenTissue::mesh::default_write ( std::string const &  filename,
mesh_type const &  mesh 
)

Write default opentissue mesh (.msh) file.

Parameters:
filename 
mesh 
Returns:
template<typename mesh_type >
bool OpenTissue::mesh::flip ( mesh_type const &  mesh,
mesh_type flipped 
)

Mesh Flip. This function flips a mesh.

Example usage:

typedef OpenTissue::polymesh::PolyMesh<...> mesh_type; mesh_type A,B;

mesh::flip(A,B);

Vertex and face traits are assigned to each other. Function do not have any knowledge of halfedge and edge traits.

Parameters:
in Reference to input mesh.
out Reference to output mesh.
Returns:
The value true if succesful otherwise false.
template<typename grid_type , typename mesh_type >
void OpenTissue::mesh::isosurface ( grid_type const &  phi,
typename grid_type::value_type const &  isolevel,
mesh_type mesh 
)

Extract Iso Surface.

Parameters:
phi 
isolevel 
mesh 
template<typename mesh_type >
void OpenTissue::mesh::make ( mesh_type const &  A,
mesh_type const &  B,
mesh_type C 
) [inline]

Mesh Make. This function creates a new mesh from two other meshes.

Example usage:

typedef OpenTissue::polymesh::PolyMesh<...> mesh_type; mesh_type A,B,C;

mesh::make(A,B,C);

Parameters:
A Reference to first input mesh.
B Reference to other input mesh.
C Reference to other input mesh.
template<typename mesh_type >
mesh_type OpenTissue::mesh::make ( mesh_type const &  A,
mesh_type const &  B 
) [inline]

Mesh Make. This function creates a new mesh from two other meshes.

Example usage:

typedef OpenTissue::polymesh::PolyMesh<...> mesh_type; mesh_type A,B,C;

C = mesh::make(A,B);

Parameters:
A Reference to first input mesh.
B Reference to other input mesh.
Returns:
The resulting mesh.
template<typename real_type , typename mesh_type >
bool OpenTissue::mesh::make_box ( real_type const &  length,
real_type const &  height,
real_type const &  depth,
mesh_type mesh 
)

Box Generation. The method generates an axed aligned box with origo at its center.

Parameters:
length The size of the x-side of the box.
height The size of the y-side of the box.
depth The size of the z-side of the box.
Returns:
If succesful a mesh representating a box otherwise null.
template<typename mesh_type , typename real_type >
bool OpenTissue::mesh::make_cylinder ( real_type const &  radius,
real_type const &  height,
unsigned int  slices,
mesh_type mesh 
)

Cylinder Generation. This method generates a cylinder aligned with the z-axe and with origo at the center of the cylinder.

Parameters:
radius The size of the radius of the cylinder.
height The total height of the cylinder.
slices The number of slices used to represent the cylinder.
Returns:
If succesful a mesh representating a cylinder otherwise null.
template<typename mesh_type , typename real_type >
bool OpenTissue::mesh::make_disk ( real_type const &  radius1,
real_type const &  radius2,
unsigned int  slices,
unsigned int  segments,
mesh_type mesh 
)

Disk Generation.

Parameters:
radius1 Specifies the circular size of the disk (maximum radius would be the sum of the two radie).
radius2 Specifies the curveness (flatness) of the disk.
slices The number of radial slices.
segments The number of slabs used along the z-axe.
Returns:
If succesful a mesh representating a sphere otherwise null.
template<typename mesh_type , typename real_type >
bool OpenTissue::mesh::make_plane ( real_type  dx,
real_type  dy,
unsigned int  X,
unsigned int  Y,
mesh_type mesh 
)

Make Plane

Returns:
If succesful the return value is true otherwise it is false;
template<typename mesh_type , typename real_type >
bool OpenTissue::mesh::make_sphere ( real_type const &  radius,
unsigned int  slices,
unsigned int  segments,
mesh_type mesh 
)

Sphere Generation.

Parameters:
radius The size of the radius of the sphere.
slices The number of radial slices.
segments The number of slabs used along the z-axe.
Returns:
If succesful a mesh representating a sphere otherwise null.
template<typename mesh_type >
void OpenTissue::mesh::make_unit ( mesh_type mesh  ) 

Center mesh around origin and rescale mesh so it is contained inside an unit AABB centered at the origin.

Note that the rescaling preserves the aspect ratio of the mesh.

template<typename mesh_type >
bool OpenTissue::mesh::obj_read ( std::string const &  filename,
mesh_type mesh,
bool  keep_shared_vertices = true 
)

Read OBJ mesh (.obj) file.

This implementation contains modifications suggested by Jrgen Havsberg Seland and Emanuel Greisen to support multiple texture coords and normals to be shared by the same vertex.

Parameters:
filename 
mesh 
Returns:
template<typename mesh_type >
bool OpenTissue::mesh::obj_write ( std::string const &  filename,
mesh_type const &  mesh 
)

Write OBJ mesh (.obj) file.

Parameters:
filename 
mesh 
Returns:
template<typename mesh_type , typename plane_type >
void OpenTissue::mesh::plane_clipper ( mesh_type const &  mesh,
plane_type  plane,
mesh_type above,
mesh_type below,
double const &  tolerance = 10e-6 
)

Mesh Plane Clipper Function.

Only works on meshes with convex faces!!!

Parameters:
mesh A reference to the mesh that should be cut by a plane.
plane A reference to the cutting plane.
above A reference to a mesh, which upon return contains the half of the mesh that was lying above the cutting plane.
below A reference to a mesh, which upon return contains the half of the mesh that was lying below the cutting plane.
tolerance A threshold value used for to handle problems with numerical precision (nonnegative value).
template<typename mesh_type , typename vector3_iterator , typename real_type >
bool OpenTissue::mesh::profile_sweep ( vector3_iterator  profile_begin,
vector3_iterator  profile_end,
real_type  sweep_angle,
unsigned int  slices,
mesh_type mesh 
)

The profile sweeps out a mesh by an incremental rotation of the specified number of slices around the z-axe.

Parameters:
profile_begin 
profile_end 
sweep_angle 
slices 
mesh 
Returns:
If succesful the return value is true otherwise it is false;
template<typename mesh_type >
void OpenTissue::mesh::remove_redundant_vertices ( mesh_type input,
mesh_type output,
double  tolerance = 10e-7 
)

Quadratic Time Brute force removeal of redundant vertices.

This function searches the input mesh for vertices with sufficiently similar coordinates and collapses these into a single vertex in the output mesh.

Parameters:
input 
output 
template<typename mesh_type , typename matrix3x3_type >
void OpenTissue::mesh::rotate ( mesh_type mesh,
matrix3x3_type const &  R 
)
template<typename mesh_type , typename real_type >
void OpenTissue::mesh::scale ( mesh_type mesh,
real_type const &  sx,
real_type const &  sy,
real_type const &  sz 
)
template<typename mesh_type , typename vector3_type >
void OpenTissue::mesh::scale ( mesh_type mesh,
vector3_type const &  s 
)
template<typename grid_type , typename mesh_type >
void OpenTissue::mesh::smooth_isosurface ( grid_type const &  phi,
typename grid_type::value_type const &  isolevel,
mesh_type mesh,
size_t  sub_sample = 1u,
bool  smoothing = true 
)

Extract Iso Surface.

Parameters:
phi 
isolevel 
mesh 
sub_sample 
smoothing 

which vertices in the cube make up each edge?

template<typename mesh_type , typename vector3_type , typename real_type >
void OpenTissue::mesh::spherical_bend ( mesh_type mesh,
vector3_type const &  normal,
real_type const &  radius 
)
template<typename mesh_type >
bool OpenTissue::mesh::tetgen_write ( std::string const &  filename,
mesh_type const &  mesh 
)

Write TetGen polygon (.poly) file.

Parameters:
filename 
mesh 
Returns:
template<typename mesh_type , typename vector3_type >
void OpenTissue::mesh::translate ( mesh_type mesh,
vector3_type const &  translation 
)
template<typename mesh_type , typename vector3_type , typename real_type >
void OpenTissue::mesh::twist ( mesh_type mesh,
vector3_type const &  direction,
real_type const &  pitch 
)
template<typename mesh_type , typename real_type >
void OpenTissue::mesh::uniform_scale ( mesh_type mesh,
real_type const &  s 
)
template<typename mesh_type >
bool OpenTissue::mesh::vrml_write ( std::string const &  filename,
mesh_type const &  mesh 
)

Write VRML mesh (.vrml) file.

Parameters:
filename 
mesh 
Returns: