zsig 1.0.0
|
Signature Mesh class. More...
#include <signaturet.hh>
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_type & | operator= (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. | |
vec3 * | vertices (void) |
Get the vertices of this mesh. | |
const vec3 * | vertices (void) const |
uvec3 * | faces (void) |
Get the faces of this mesh. | |
const uvec3 * | faces (void) const |
index_list * | grid (void) |
Get the grid of this mesh. | |
const index_list * | grid (void) const |
T & | maximum_search_distance (void) |
Get the maximum search distance of this mesh. | |
const T & | maximum_search_distance (void) const |
vec3 * | fnormals (void) |
Get the face normals of this mesh. | |
const vec3 * | fnormals (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_type & | bounding_box (void) |
Get the mesh's bounding box. | |
const bbox_type & | bounding_box (void) const |
vec3 & | diagonal (void) |
Get the mesh's diagonal vector. | |
const vec3 & | diagonal (void) const |
T | 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. |
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.
T | Mesh coordinate values type |
app_compute_signature.cc, app_paint_signature.cc, and example_mesh.cc.
Definition at line 171 of file signaturet.hh.
typedef vec< 3, T > zsig::SignatureMeshT< T >::vec3 |
Vector or point (simply "vec") type.
Definition at line 175 of file signaturet.hh.
typedef vec< 3, unsigned > zsig::SignatureMeshT< T >::uvec3 |
Unsigned integer vec3 type.
Definition at line 176 of file signaturet.hh.
typedef SignatureMeshT< T > zsig::SignatureMeshT< T >::mesh_type |
This class type.
Definition at line 177 of file signaturet.hh.
typedef std::vector< unsigned > zsig::SignatureMeshT< T >::index_list |
Index list type.
Definition at line 178 of file signaturet.hh.
typedef vec3 zsig::SignatureMeshT< T >::bbox_type[2] |
Bounding box type (min, max)
Definition at line 179 of file signaturet.hh.
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.
zsig::SignatureMeshT< T >::SignatureMeshT | ( | ) | [inline] |
Default constructor.
Definition at line 183 of file signaturet.hh.
zsig::SignatureMeshT< T >::SignatureMeshT | ( | const mesh_type & | _m | ) | [inline] |
zsig::SignatureMeshT< T >::~SignatureMeshT | ( | ) | [inline] |
Destructor.
Definition at line 191 of file signaturet.hh.
References zsig::SignatureMeshT< T >::clear().
void zsig::SignatureMeshT< T >::clear | ( | void | ) | [inline] |
Clear this mesh.
Definition at line 194 of file signaturet.hh.
References zsig::vec< D, T >::clear().
mesh_type& zsig::SignatureMeshT< T >::operator= | ( | const mesh_type & | _m | ) | [inline] |
Assign operator.
[in] | _m | Copy mesh |
Definition at line 210 of file signaturet.hh.
References zsig::SignatureMeshT< T >::bounding_box(), zsig::SignatureMeshT< T >::clear(), zsig::SignatureMeshT< T >::diagonal(), zsig::SignatureMeshT< T >::faces(), zsig::SignatureMeshT< T >::fnormals(), zsig::SignatureMeshT< T >::grid(), zsig::SignatureMeshT< T >::grid_dimension(), zsig::SignatureMeshT< T >::maximum_search_distance(), zsig::SignatureMeshT< T >::neighborhood(), zsig::SignatureMeshT< T >::set_bbox(), zsig::SignatureMeshT< T >::set_faces(), zsig::SignatureMeshT< T >::set_fnormals(), zsig::SignatureMeshT< T >::set_grid(), zsig::SignatureMeshT< T >::set_neighborhood(), zsig::SignatureMeshT< T >::set_vertices(), zsig::SignatureMeshT< T >::size_of_faces(), zsig::SignatureMeshT< T >::size_of_vertices(), and zsig::SignatureMeshT< T >::vertices().
void zsig::SignatureMeshT< T >::read_off | ( | std::istream & | _in | ) | [inline] |
Read an OFF (Object File Format) to this mesh.
[in,out] | _in | The input stream to read the mesh from |
Definition at line 227 of file signaturet.hh.
References zsig::SignatureMeshT< T >::clear().
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.
[in] | fn | File name to be read |
Definition at line 244 of file signaturet.hh.
References zsig::SignatureMeshT< T >::read_off().
void zsig::SignatureMeshT< T >::write_off | ( | std::ostream & | _out | ) | const [inline] |
Write an OFF (Object File Format) with this mesh.
[in,out] | _out | The output stream to write the mesh to |
Definition at line 253 of file signaturet.hh.
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.
[in] | fn | File name to be written |
Definition at line 264 of file signaturet.hh.
References zsig::SignatureMeshT< T >::write_off().
void zsig::SignatureMeshT< T >::write_ply | ( | std::ostream & | _out, |
const uvec3 * | _colors | ||
) | const [inline] |
Write a PLY (Polygon File Format) with this mesh.
[in,out] | _out | The output stream to write the mesh to |
[in] | _colors | Vertex colors to output together with the mesh |
Definition at line 274 of file signaturet.hh.
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.
[in] | fn | File name to be written |
[in] | _colors | Vertex colors to output together with the mesh |
Definition at line 292 of file signaturet.hh.
References zsig::SignatureMeshT< T >::write_ply().
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().
void zsig::SignatureMeshT< T >::build_grid | ( | T & | _msd | ) | [inline] |
Build 3D regular grid (with faces) for neighborhood searching.
[in,out] | _msd | Maximum 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().
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().
void zsig::SignatureMeshT< T >::build_fnormals | ( | void | ) | [inline] |
Build face normals (not normalized)
Definition at line 350 of file signaturet.hh.
void zsig::SignatureMeshT< T >::build_neighborhood | ( | void | ) | [inline] |
Build neighborhood (faces around vertices)
Definition at line 364 of file signaturet.hh.
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().
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).
[in] | _i | Index of the vertex to compute neighborhood |
[out] | _nb | Neighborhood of faces (or vertices) to consider around vertex _i |
[in] | _v | Return vertices neighborhood (default: false returns faces) |
Definition at line 402 of file signaturet.hh.
References zsig::SignatureMeshT< T >::convert_to_grid().
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.
[in] | _i | Index of the vertex to compute signature plane |
[out] | _sp | Signature plane of vertex _i |
Definition at line 439 of file signaturet.hh.
References zsig::SignatureMeshT< T >::compute_normal().
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).
[in] | _i | Index of vertex to compute normal at |
[out] | _n | Normal at vertex _i |
Definition at line 466 of file signaturet.hh.
References zsig::vec< D, T >::clear().
void zsig::SignatureMeshT< T >::set_vertices | ( | const unsigned & | _nv, |
const vec3 * | _va | ||
) | [inline] |
Set vertices of this mesh.
[in] | _nv | Number of vertices to set |
[in] | _va | Vertices array to set |
Definition at line 482 of file signaturet.hh.
void zsig::SignatureMeshT< T >::set_faces | ( | const unsigned & | _nf, |
const uvec3 * | _fa | ||
) | [inline] |
Set faces of this mesh.
[in] | _nf | Number of faces to set |
[in] | _fa | Faces array to set |
Definition at line 495 of file signaturet.hh.
void zsig::SignatureMeshT< T >::set_grid | ( | const unsigned & | _gd, |
const index_list * | _gfa, | ||
const T & | _msd | ||
) | [inline] |
Set grid of this mesh.
[in] | _gd | Grid dimension to set |
[in] | _gfa | Grid faces array to set |
[in] | _msd | Maximum search distance to set |
Definition at line 509 of file signaturet.hh.
void zsig::SignatureMeshT< T >::set_fnormals | ( | const unsigned & | _nf, |
const vec3 * | _fna | ||
) | [inline] |
Set face normals of this mesh.
[in] | _nf | Number of faces to set |
[in] | _fna | Face normals array to set |
Definition at line 525 of file signaturet.hh.
void zsig::SignatureMeshT< T >::set_neighborhood | ( | const std::vector< index_list > & | _nfv | ) | [inline] |
Set neighborhodd faces-per-vertex of this mesh.
[in] | _nfv | Neighborhood faces-per-vertex to set |
Definition at line 536 of file signaturet.hh.
void zsig::SignatureMeshT< T >::set_bbox | ( | const bbox_type & | _bb, |
const vec3 & | _diag | ||
) | [inline] |
Set bounding box of this mesh.
[in] | _bb | Bounding box to set |
[in] | _diag | Diagonal vector to set |
Definition at line 544 of file signaturet.hh.
unsigned zsig::SignatureMeshT< T >::size_of_vertices | ( | void | ) | const [inline] |
Get the number of vertices of this mesh.
Definition at line 558 of file signaturet.hh.
unsigned zsig::SignatureMeshT< T >::size_of_faces | ( | void | ) | const [inline] |
Get the number of faces of this mesh.
Definition at line 563 of file signaturet.hh.
unsigned zsig::SignatureMeshT< T >::grid_dimension | ( | void | ) | const [inline] |
Get the grid dimension of this mesh.
Definition at line 568 of file signaturet.hh.
vec3* zsig::SignatureMeshT< T >::vertices | ( | void | ) | [inline] |
Get the vertices of this mesh.
Definition at line 573 of file signaturet.hh.
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.
Definition at line 578 of file signaturet.hh.
uvec3* zsig::SignatureMeshT< T >::faces | ( | void | ) | [inline] |
Get the faces of this mesh.
Definition at line 583 of file signaturet.hh.
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.
Definition at line 588 of file signaturet.hh.
index_list* zsig::SignatureMeshT< T >::grid | ( | void | ) | [inline] |
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.
Definition at line 598 of file signaturet.hh.
T& zsig::SignatureMeshT< T >::maximum_search_distance | ( | void | ) | [inline] |
Get the maximum search distance of this mesh.
Definition at line 603 of file signaturet.hh.
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.
Definition at line 608 of file signaturet.hh.
vec3* zsig::SignatureMeshT< T >::fnormals | ( | void | ) | [inline] |
Get the face normals of this mesh.
Definition at line 613 of file signaturet.hh.
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.
Definition at line 618 of file signaturet.hh.
std::vector< index_list >& zsig::SignatureMeshT< T >::neighborhood | ( | void | ) | [inline] |
Get the neighborhood of faces around each vertex.
Definition at line 623 of file signaturet.hh.
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.
Definition at line 628 of file signaturet.hh.
bbox_type& zsig::SignatureMeshT< T >::bounding_box | ( | void | ) | [inline] |
Get the mesh's bounding box.
Definition at line 633 of file signaturet.hh.
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.
Definition at line 638 of file signaturet.hh.
vec3& zsig::SignatureMeshT< T >::diagonal | ( | void | ) | [inline] |
Get the mesh's diagonal vector.
Definition at line 643 of file signaturet.hh.
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.
Definition at line 648 of file signaturet.hh.
T zsig::SignatureMeshT< T >::diagonal_distance | ( | void | ) | const [inline] |
Get diagonal distance inside mesh's bounding box.
Definition at line 653 of file signaturet.hh.
References zsig::vec< D, T >::length().
void zsig::SignatureMeshT< T >::convert_to_grid | ( | const vec3 & | _p, |
uvec3 & | _g | ||
) | const [inline, protected] |
Convert to grid position.
[in] | _p | Position in space to convert |
[out] | _g | Converted grid position |
Definition at line 663 of file signaturet.hh.
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.
_sig | Signature to return |
_m | Mesh surface to compute heightmap signature of |
_i | Index of the vertex in the mesh to compute the signature of |
R | Signature row dimension |
C | Signature column dimension |
T | Signature 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().
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.
[out] | _sig | Heightmap-based vertex signatures |
[in] | _m | Mesh to compute signatures of vertices |
R | Signature row dimension |
C | Signature column dimension |
T | Signature value type |
Definition at line 143 of file zsig.hh.
References zsig::SignatureMeshT< T >::size_of_vertices().