zsig 1.0.0

zsig::SignatureMeshT< T > Class Template Reference

Signature Mesh class. More...

#include <signaturet.hh>

List of all members.

Public Types

typedef vec< 3, T > vec3
 Vector or point (simply "vec") type.
typedef vec< 3, unsigned > uvec3
 Unsigned integer vec3 type.
typedef SignatureMeshT< T > mesh_type
 This class type.
typedef std::vector< unsigned > index_list
 Index list type.
typedef vec3 bbox_type [2]
 Bounding box type (min, max)
typedef vec3 sigplane_type [4]
 Signature plane type with Origin Position and LCF (P, X, Y, Z)

Public Member Functions

 SignatureMeshT ()
 Default constructor.
 SignatureMeshT (const mesh_type &_m)
 ~SignatureMeshT ()
 Destructor.
void clear (void)
 Clear this mesh.
mesh_typeoperator= (const mesh_type &_m)
 Assign operator.
void read_off (std::istream &_in)
 Read an OFF (Object File Format) to this mesh.
void read_off (const char *fn)
void write_off (std::ostream &_out) const
 Write an OFF (Object File Format) with this mesh.
void write_off (const char *fn) const
void write_ply (std::ostream &_out, const uvec3 *_colors) const
 Write a PLY (Polygon File Format) with this mesh.
void write_ply (const char *fn, const uvec3 *_colors) const
void build_all (void)
 Build all auxiliary information regarding this mesh.
void build_grid (T &_msd)
 Build 3D regular grid (with faces) for neighborhood searching.
void build_grid (void)
void build_fnormals (void)
 Build face normals (not normalized)
void build_neighborhood (void)
 Build neighborhood (faces around vertices)
void build_bbox (void)
 Build mesh bounding box.
void compute_neighborhood (const unsigned &_i, std::set< unsigned > &_nb, const bool &_v=false) const
 Compute neighborhood of faces (or vertices) for a given vertex.
void compute_sigplane (const unsigned &_i, sigplane_type &_sp) const
 Compute signature plane of a given vertex.
void compute_normal (const unsigned &_i, vec3 &_n) const
 Compute normal at a given vertex.
void set_vertices (const unsigned &_nv, const vec3 *_va)
 Set vertices of this mesh.
void set_faces (const unsigned &_nf, const uvec3 *_fa)
 Set faces of this mesh.
void set_grid (const unsigned &_gd, const index_list *_gfa, const T &_msd)
 Set grid of this mesh.
void set_fnormals (const unsigned &_nf, const vec3 *_fna)
 Set face normals of this mesh.
void set_neighborhood (const std::vector< index_list > &_nfv)
 Set neighborhodd faces-per-vertex of this mesh.
void set_bbox (const bbox_type &_bb, const vec3 &_diag)
 Set bounding box of this mesh.
unsigned size_of_vertices (void) const
 Get the number of vertices of this mesh.
unsigned size_of_faces (void) const
 Get the number of faces of this mesh.
unsigned grid_dimension (void) const
 Get the grid dimension of this mesh.
vec3vertices (void)
 Get the vertices of this mesh.
const vec3vertices (void) const
uvec3faces (void)
 Get the faces of this mesh.
const uvec3faces (void) const
index_listgrid (void)
 Get the grid of this mesh.
const index_listgrid (void) const
T & maximum_search_distance (void)
 Get the maximum search distance of this mesh.
const T & maximum_search_distance (void) const
vec3fnormals (void)
 Get the face normals of this mesh.
const vec3fnormals (void) const
std::vector< index_list > & neighborhood (void)
 Get the neighborhood of faces around each vertex.
const std::vector< index_list > & neighborhood (void) const
bbox_typebounding_box (void)
 Get the mesh's bounding box.
const bbox_typebounding_box (void) const
vec3diagonal (void)
 Get the mesh's diagonal vector.
const vec3diagonal (void) const
diagonal_distance (void) const
 Get diagonal distance inside mesh's bounding box.

Protected Member Functions

void convert_to_grid (const vec3 &_p, uvec3 &_g) const
 Convert to grid position.

Related Functions

(Note that these are not member functions.)
template<unsigned R, unsigned C, class T >
void compute_signature (SignatureT< R, C, T > &_sig, const SignatureMeshT< T > &_m, const unsigned &_i)
 Compute heightmap signature of a given vertex.
template<unsigned R, unsigned C, class T >
void compute_sig (std::vector< SignatureT< R, C, T > > &_sig, const SignatureMeshT< T > &_m)
 Compute Heightmap Signature for vertices.

Detailed Description

template<class T>
class zsig::SignatureMeshT< T >

Signature Mesh class.

This is a simple mesh class to support vertex signatures (see SignatureT class for more details) based on the tangent plane defined for a mesh vertex.

See also:
SignatureT
Template Parameters:
TMesh coordinate values type
Examples:

app_compute_signature.cc, app_paint_signature.cc, and example_mesh.cc.

Definition at line 171 of file signaturet.hh.


Member Typedef Documentation

template<class T>
typedef vec< 3, T > zsig::SignatureMeshT< T >::vec3

Vector or point (simply "vec") type.

Definition at line 175 of file signaturet.hh.

template<class T>
typedef vec< 3, unsigned > zsig::SignatureMeshT< T >::uvec3

Unsigned integer vec3 type.

Definition at line 176 of file signaturet.hh.

template<class T>
typedef SignatureMeshT< T > zsig::SignatureMeshT< T >::mesh_type

This class type.

Definition at line 177 of file signaturet.hh.

template<class T>
typedef std::vector< unsigned > zsig::SignatureMeshT< T >::index_list

Index list type.

Definition at line 178 of file signaturet.hh.

template<class T>
typedef vec3 zsig::SignatureMeshT< T >::bbox_type[2]

Bounding box type (min, max)

Definition at line 179 of file signaturet.hh.

template<class T>
typedef vec3 zsig::SignatureMeshT< T >::sigplane_type[4]

Signature plane type with Origin Position and LCF (P, X, Y, Z)

Definition at line 180 of file signaturet.hh.


Constructor & Destructor Documentation

template<class T>
zsig::SignatureMeshT< T >::SignatureMeshT ( ) [inline]

Default constructor.

Definition at line 183 of file signaturet.hh.

template<class T>
zsig::SignatureMeshT< T >::SignatureMeshT ( const mesh_type _m) [inline]

Copy Constructor

Parameters:
[in]_mCopy this mesh

Definition at line 188 of file signaturet.hh.

template<class T>
zsig::SignatureMeshT< T >::~SignatureMeshT ( ) [inline]

Destructor.

Definition at line 191 of file signaturet.hh.

References zsig::SignatureMeshT< T >::clear().


Member Function Documentation

template<class T>
void zsig::SignatureMeshT< T >::clear ( void  ) [inline]

Clear this mesh.

Examples:
example_mesh.cc.

Definition at line 194 of file signaturet.hh.

References zsig::vec< D, T >::clear().

template<class T>
void zsig::SignatureMeshT< T >::read_off ( std::istream &  _in) [inline]

Read an OFF (Object File Format) to this mesh.

Parameters:
[in,out]_inThe input stream to read the mesh from

Definition at line 227 of file signaturet.hh.

References zsig::SignatureMeshT< T >::clear().

template<class T>
void zsig::SignatureMeshT< T >::read_off ( const char *  fn) [inline]

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters:
[in]fnFile name to be read

Definition at line 244 of file signaturet.hh.

References zsig::SignatureMeshT< T >::read_off().

template<class T>
void zsig::SignatureMeshT< T >::write_off ( std::ostream &  _out) const [inline]

Write an OFF (Object File Format) with this mesh.

Parameters:
[in,out]_outThe output stream to write the mesh to

Definition at line 253 of file signaturet.hh.

template<class T>
void zsig::SignatureMeshT< T >::write_off ( const char *  fn) const [inline]

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters:
[in]fnFile name to be written

Definition at line 264 of file signaturet.hh.

References zsig::SignatureMeshT< T >::write_off().

template<class T>
void zsig::SignatureMeshT< T >::write_ply ( std::ostream &  _out,
const uvec3 _colors 
) const [inline]

Write a PLY (Polygon File Format) with this mesh.

Parameters:
[in,out]_outThe output stream to write the mesh to
[in]_colorsVertex colors to output together with the mesh

Definition at line 274 of file signaturet.hh.

template<class T>
void zsig::SignatureMeshT< T >::write_ply ( const char *  fn,
const uvec3 _colors 
) const [inline]

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters:
[in]fnFile name to be written
[in]_colorsVertex colors to output together with the mesh

Definition at line 292 of file signaturet.hh.

References zsig::SignatureMeshT< T >::write_ply().

template<class T>
void zsig::SignatureMeshT< T >::build_all ( void  ) [inline]

Build all auxiliary information regarding this mesh.

This method invokes all build methods of the mesh in order to set up all the pre-computation steps. It uses the default argument value for all build functions (when required).

Definition at line 310 of file signaturet.hh.

References zsig::SignatureMeshT< T >::build_bbox(), zsig::SignatureMeshT< T >::build_fnormals(), zsig::SignatureMeshT< T >::build_grid(), and zsig::SignatureMeshT< T >::build_neighborhood().

template<class T>
void zsig::SignatureMeshT< T >::build_grid ( T &  _msd) [inline]

Build 3D regular grid (with faces) for neighborhood searching.

Parameters:
[in,out]_msdMaximum search distance (using grid) for neighbors (default returns 2.5% of the diagonal bounding box)

Definition at line 320 of file signaturet.hh.

References zsig::SignatureMeshT< T >::convert_to_grid().

template<class T>
void zsig::SignatureMeshT< T >::build_grid ( void  ) [inline]

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

This method depends on building mesh's bounding box (see build_bbox) to compute the diagonal distance and use it as the missing maximum search distance parameter (2.5 % of the diagonal bounding box).

Definition at line 344 of file signaturet.hh.

References zsig::SignatureMeshT< T >::diagonal_distance().

template<class T>
void zsig::SignatureMeshT< T >::build_fnormals ( void  ) [inline]

Build face normals (not normalized)

Definition at line 350 of file signaturet.hh.

template<class T>
void zsig::SignatureMeshT< T >::build_neighborhood ( void  ) [inline]

Build neighborhood (faces around vertices)

Definition at line 364 of file signaturet.hh.

template<class T>
void zsig::SignatureMeshT< T >::build_bbox ( void  ) [inline]

Build mesh bounding box.

Definition at line 375 of file signaturet.hh.

References zsig::vec< D, T >::clear().

template<class T>
void zsig::SignatureMeshT< T >::compute_neighborhood ( const unsigned &  _i,
std::set< unsigned > &  _nb,
const bool &  _v = false 
) const [inline]

Compute neighborhood of faces (or vertices) for a given vertex.

To work properly, this method needs building the mesh's regular grid for neighborhood searching (see build_grid).

Parameters:
[in]_iIndex of the vertex to compute neighborhood
[out]_nbNeighborhood of faces (or vertices) to consider around vertex _i
[in]_vReturn vertices neighborhood (default: false returns faces)

Definition at line 402 of file signaturet.hh.

References zsig::SignatureMeshT< T >::convert_to_grid().

template<class T>
void zsig::SignatureMeshT< T >::compute_sigplane ( const unsigned &  _i,
sigplane_type _sp 
) const [inline]

Compute signature plane of a given vertex.

This method depends on the compute_normal method, which depends on the build_fnormals method.

Parameters:
[in]_iIndex of the vertex to compute signature plane
[out]_spSignature plane of vertex _i

Definition at line 439 of file signaturet.hh.

References zsig::SignatureMeshT< T >::compute_normal().

template<class T>
void zsig::SignatureMeshT< T >::compute_normal ( const unsigned &  _i,
vec3 _n 
) const [inline]

Compute normal at a given vertex.

To work properly, this method needs building the mesh's face normals (see build_fnormals).

Parameters:
[in]_iIndex of vertex to compute normal at
[out]_nNormal at vertex _i

Definition at line 466 of file signaturet.hh.

References zsig::vec< D, T >::clear().

template<class T>
void zsig::SignatureMeshT< T >::set_vertices ( const unsigned &  _nv,
const vec3 _va 
) [inline]

Set vertices of this mesh.

Parameters:
[in]_nvNumber of vertices to set
[in]_vaVertices array to set

Definition at line 482 of file signaturet.hh.

template<class T>
void zsig::SignatureMeshT< T >::set_faces ( const unsigned &  _nf,
const uvec3 _fa 
) [inline]

Set faces of this mesh.

Parameters:
[in]_nfNumber of faces to set
[in]_faFaces array to set

Definition at line 495 of file signaturet.hh.

template<class T>
void zsig::SignatureMeshT< T >::set_grid ( const unsigned &  _gd,
const index_list _gfa,
const T &  _msd 
) [inline]

Set grid of this mesh.

Parameters:
[in]_gdGrid dimension to set
[in]_gfaGrid faces array to set
[in]_msdMaximum search distance to set

Definition at line 509 of file signaturet.hh.

template<class T>
void zsig::SignatureMeshT< T >::set_fnormals ( const unsigned &  _nf,
const vec3 _fna 
) [inline]

Set face normals of this mesh.

Parameters:
[in]_nfNumber of faces to set
[in]_fnaFace normals array to set

Definition at line 525 of file signaturet.hh.

template<class T>
void zsig::SignatureMeshT< T >::set_neighborhood ( const std::vector< index_list > &  _nfv) [inline]

Set neighborhodd faces-per-vertex of this mesh.

Parameters:
[in]_nfvNeighborhood faces-per-vertex to set

Definition at line 536 of file signaturet.hh.

template<class T>
void zsig::SignatureMeshT< T >::set_bbox ( const bbox_type _bb,
const vec3 _diag 
) [inline]

Set bounding box of this mesh.

Parameters:
[in]_bbBounding box to set
[in]_diagDiagonal vector to set

Definition at line 544 of file signaturet.hh.

template<class T>
unsigned zsig::SignatureMeshT< T >::size_of_vertices ( void  ) const [inline]

Get the number of vertices of this mesh.

Returns:
Number of vertices

Definition at line 558 of file signaturet.hh.

template<class T>
unsigned zsig::SignatureMeshT< T >::size_of_faces ( void  ) const [inline]

Get the number of faces of this mesh.

Returns:
Number of faces

Definition at line 563 of file signaturet.hh.

template<class T>
unsigned zsig::SignatureMeshT< T >::grid_dimension ( void  ) const [inline]

Get the grid dimension of this mesh.

Returns:
Grid dimension

Definition at line 568 of file signaturet.hh.

template<class T>
vec3* zsig::SignatureMeshT< T >::vertices ( void  ) [inline]

Get the vertices of this mesh.

Returns:
Vertices of this mesh

Definition at line 573 of file signaturet.hh.

template<class T>
const vec3 * zsig::SignatureMeshT< T >::vertices ( void  ) const [inline]

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Returns:
Constant vertices of this mesh

Definition at line 578 of file signaturet.hh.

template<class T>
uvec3* zsig::SignatureMeshT< T >::faces ( void  ) [inline]

Get the faces of this mesh.

Returns:
Faces of this mesh

Definition at line 583 of file signaturet.hh.

template<class T>
const uvec3 * zsig::SignatureMeshT< T >::faces ( void  ) const [inline]

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Returns:
Constant faces of this mesh

Definition at line 588 of file signaturet.hh.

template<class T>
index_list* zsig::SignatureMeshT< T >::grid ( void  ) [inline]

Get the grid of this mesh.

Returns:
Grid of this mesh

Definition at line 593 of file signaturet.hh.

template<class T>
const index_list * zsig::SignatureMeshT< T >::grid ( void  ) const [inline]

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Returns:
Constant grid of this mesh

Definition at line 598 of file signaturet.hh.

template<class T>
T& zsig::SignatureMeshT< T >::maximum_search_distance ( void  ) [inline]

Get the maximum search distance of this mesh.

Returns:
Maximum search distance of this mesh

Definition at line 603 of file signaturet.hh.

template<class T>
const T & zsig::SignatureMeshT< T >::maximum_search_distance ( void  ) const [inline]

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Returns:
Constant maximum search distance of this mesh

Definition at line 608 of file signaturet.hh.

template<class T>
vec3* zsig::SignatureMeshT< T >::fnormals ( void  ) [inline]

Get the face normals of this mesh.

Returns:
Face normals of this mesh

Definition at line 613 of file signaturet.hh.

template<class T>
const vec3 * zsig::SignatureMeshT< T >::fnormals ( void  ) const [inline]

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Returns:
Constant face normals of this mesh

Definition at line 618 of file signaturet.hh.

template<class T>
std::vector< index_list >& zsig::SignatureMeshT< T >::neighborhood ( void  ) [inline]

Get the neighborhood of faces around each vertex.

Returns:
Neighborhood of faces around each vertex

Definition at line 623 of file signaturet.hh.

template<class T>
const std::vector< index_list > & zsig::SignatureMeshT< T >::neighborhood ( void  ) const [inline]

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Returns:
Constant neighborhood of faces around each vertex

Definition at line 628 of file signaturet.hh.

template<class T>
bbox_type& zsig::SignatureMeshT< T >::bounding_box ( void  ) [inline]

Get the mesh's bounding box.

Returns:
Mesh's bounding box

Definition at line 633 of file signaturet.hh.

template<class T>
const bbox_type & zsig::SignatureMeshT< T >::bounding_box ( void  ) const [inline]

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Returns:
Constant mesh's bounding box

Definition at line 638 of file signaturet.hh.

template<class T>
vec3& zsig::SignatureMeshT< T >::diagonal ( void  ) [inline]

Get the mesh's diagonal vector.

Returns:
Mesh's diagonal vector

Definition at line 643 of file signaturet.hh.

template<class T>
const vec3 & zsig::SignatureMeshT< T >::diagonal ( void  ) const [inline]

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Returns:
Constant mesh's diagonal vector

Definition at line 648 of file signaturet.hh.

template<class T>
T zsig::SignatureMeshT< T >::diagonal_distance ( void  ) const [inline]

Get diagonal distance inside mesh's bounding box.

Returns:
Diagonal distance

Definition at line 653 of file signaturet.hh.

References zsig::vec< D, T >::length().

template<class T>
void zsig::SignatureMeshT< T >::convert_to_grid ( const vec3 _p,
uvec3 _g 
) const [inline, protected]

Convert to grid position.

Parameters:
[in]_pPosition in space to convert
[out]_gConverted grid position

Definition at line 663 of file signaturet.hh.


Friends And Related Function Documentation

template<unsigned R, unsigned C, class T >
void compute_signature ( SignatureT< R, C, T > &  _sig,
const SignatureMeshT< T > &  _m,
const unsigned &  _i 
) [related]

Compute heightmap signature of a given vertex.

This function computes a vertex signature given the meshed surface. The signature is a heightmap image representing the surface neighborhood of the vertex.

See also:
SignatureT
SignatureMeshT
Parameters:
_sigSignature to return
_mMesh surface to compute heightmap signature of
_iIndex of the vertex in the mesh to compute the signature of
Template Parameters:
RSignature row dimension
CSignature column dimension
TSignature value type

Definition at line 710 of file signaturet.hh.

References zsig::SignatureT< R, C, T >::clear(), zsig::SignatureMeshT< T >::compute_neighborhood(), zsig::SignatureMeshT< T >::compute_sigplane(), zsig::SignatureMeshT< T >::faces(), zsig::SignatureMeshT< T >::fnormals(), zsig::SignatureMeshT< T >::maximum_search_distance(), zsig::vec< D, T >::sqrl(), and zsig::SignatureMeshT< T >::vertices().

template<unsigned R, unsigned C, class T >
void compute_sig ( std::vector< SignatureT< R, C, T > > &  _sig,
const SignatureMeshT< T > &  _m 
) [related]

Compute Heightmap Signature for vertices.

Given a mesh _m, compute the heightmap-based signatures for all mesh vertices. The output is a vector of heightmap signatures _sig.

See also:
SignatureT
SignatureMeshT
Parameters:
[out]_sigHeightmap-based vertex signatures
[in]_mMesh to compute signatures of vertices
Template Parameters:
RSignature row dimension
CSignature column dimension
TSignature value type

Definition at line 143 of file zsig.hh.

References zsig::SignatureMeshT< T >::size_of_vertices().


The documentation for this class was generated from the following files:
 All Classes Files Functions Variables Typedefs Friends