Visual Computing Library
|
List of functions that compute point samplings. More...
Functions | |
template<SamplerConcept SamplerType, MeshConcept MeshType> | |
SamplerType | vcl::allVerticesPointSampling (const MeshType &m, std::vector< uint > &birthVertices, bool onlySelected=false) |
Returns a Sampler object that contains all the vertices contained in the given mesh. | |
template<SamplerConcept SamplerType, MeshConcept MeshType> | |
SamplerType | vcl::allVerticesPointSampling (const MeshType &m, bool onlySelected=false) |
Returns a Sampler object that contains all the vertices contained in the given mesh. | |
template<SamplerConcept SamplerType, FaceMeshConcept MeshType> | |
SamplerType | vcl::allFacesPointSampling (const MeshType &m, std::vector< uint > &birthFaces, bool onlySelected=false) |
Returns a SamplerType object that contains all the faces contained in the given mesh. | |
template<SamplerConcept SamplerType, FaceMeshConcept MeshType> | |
SamplerType | vcl::allFacesPointSampling (const MeshType &m, bool onlySelected=false) |
Returns a SamplerType object that contains all the faces contained in the given mesh. | |
template<SamplerConcept SamplerType, MeshConcept MeshType> | |
SamplerType | vcl::vertexUniformPointSampling (const MeshType &m, uint nSamples, std::vector< uint > &birthVertices, bool onlySelected=false, bool deterministic=false) |
Returns a SamplerType object that contains the given number of samples taken from the vertices of the given mesh. Each vertex has the same probability of being chosen. If onlySelected is true, only the selected vertices are sampled. The indices of the sampled vertices in the mesh are stored in the birthVertices vector. | |
template<SamplerConcept SamplerType, MeshConcept MeshType> | |
SamplerType | vcl::vertexUniformPointSampling (const MeshType &m, uint nSamples, bool onlySelected=false, bool deterministic=false) |
Returns a SamplerType object that contains the given number of samples taken from the vertices of the given mesh. Each vertex has the same probability of being chosen. If onlySelected is true, only the selected vertices are sampled. | |
template<SamplerConcept SamplerType, FaceMeshConcept MeshType> | |
SamplerType | vcl::faceUniformPointSampling (const MeshType &m, uint nSamples, std::vector< uint > &birthFaces, bool onlySelected=false, bool deterministic=false) |
Returns a SamplerType object that contains the given number of samples taken from the faces of the given mesh. Each face has the same probability of being chosen. If onlySelected is true, only the selected faces are sampled. The indices of the sampled faces in the mesh are stored in the birthFaces vector. | |
template<SamplerConcept SamplerType, FaceMeshConcept MeshType> | |
SamplerType | vcl::faceUniformPointSampling (const MeshType &m, uint nSamples, bool onlySelected=false, bool deterministic=false) |
Returns a SamplerType object that contains the given number of samples taken from the faces of the given mesh. Each face has the same probability of being chosen. If onlySelected is true, only the selected faces are sampled. | |
template<SamplerConcept SamplerType, MeshConcept MeshType, typename ScalarType > | |
SamplerType | vcl::vertexWeightedPointSampling (const MeshType &m, const std::vector< ScalarType > &weights, uint nSamples, std::vector< uint > &birthVertices, bool deterministic=false) |
Samples the vertices in a weighted way, using the per vertex weights given as input. Each vertex has a probability of being chosen that is proportional to its weight. If onlySelected is true, only the selected vertices are sampled. The indices of the sampled vertices in the mesh are stored in the birthVertices vector. | |
template<SamplerConcept SamplerType, MeshConcept MeshType, typename ScalarType > | |
SamplerType | vcl::vertexWeightedPointSampling (const MeshType &m, const std::vector< ScalarType > &weights, uint nSamples, bool deterministic=false) |
Samples the vertices in a weighted way, using the per vertex weights given as input. Each vertex has a probability of being chosen that is proportional to its weight. If onlySelected is true, only the selected vertices are sampled. | |
template<SamplerConcept SamplerType, FaceMeshConcept MeshType, typename ScalarType > | |
SamplerType | vcl::faceWeightedPointSampling (const MeshType &m, const std::vector< ScalarType > &weights, uint nSamples, std::vector< uint > &birthFaces, bool deterministic=false) |
Returns a SamplerType object that contains the given number of samples taken from the faces of the given mesh. Each face has the same probability of being chosen. If onlySelected is true, only the selected faces are sampled. The indices of the sampled faces in the mesh are stored in the birthFaces vector. | |
template<SamplerConcept SamplerType, FaceMeshConcept MeshType, typename ScalarType > | |
SamplerType | vcl::faceWeightedPointSampling (const MeshType &m, const std::vector< ScalarType > &weights, uint nSamples, bool deterministic=false) |
Returns a SamplerType object that contains the given number of samples taken from the faces of the given mesh. Each face has the same probability of being chosen. If onlySelected is true, only the selected faces are sampled. | |
template<SamplerConcept SamplerType, MeshConcept MeshType> | |
SamplerType | vcl::vertexQualityWeightedPointSampling (const MeshType &m, uint nSamples, bool deterministic=false) |
Samples the vertices in a weighted way, using the per vertex Quality component. Each vertex has a probability of being chosen that is proportional to its quality value. | |
template<SamplerConcept SamplerType, FaceMeshConcept MeshType> | |
SamplerType | vcl::faceQualityWeightedPointSampling (const MeshType &m, uint nSamples, bool deterministic=false) |
Samples the faces in a weighted way, using the per face Quality component. Each face has a probability of being chosen that is proportional to its quality value. | |
template<SamplerConcept SamplerType, FaceMeshConcept MeshType> | |
SamplerType | vcl::vertexAreaWeightedPointSampling (const MeshType &m, uint nSamples, bool deterministic=false) |
Samples the vertices in a weighted way, using the area. Each vertex has a probability of being chosen that is proportional to the average area of its adjacent faces. | |
template<SamplerConcept SamplerType, FaceMeshConcept MeshType> | |
SamplerType | vcl::faceAreaWeightedPointSampling (const MeshType &m, uint nSamples, bool deterministic=false) |
Samples the faces in a weighted way, using the per face area. Each face has a probability of being chosen that is proportional to its area. | |
template<SamplerConcept SamplerType, FaceMeshConcept MeshType> | |
SamplerType | vcl::montecarloPointSampling (const MeshType &m, uint nSamples, std::vector< uint > &birthFaces, bool deterministic=false) |
Computes a montecarlo distribution with an exact number of samples. It works by generating a sequence of consecutive segments proportional to the face areas and actually shooting sample over this line. The indices of the sampled faces in the mesh are stored in the birthFaces vector. | |
template<SamplerConcept SamplerType, FaceMeshConcept MeshType> | |
SamplerType | vcl::montecarloPointSampling (const MeshType &m, uint nSamples, bool deterministic=false) |
Computes a montecarlo distribution with an exact number of samples. It works by generating a sequence of consecutive segments proportional to the face areas and actually shooting sample over this line. | |
template<SamplerConcept SamplerType, FaceMeshConcept MeshType> | |
SamplerType | vcl::montecarloPoissonPointSampling (const MeshType &m, uint nSamples, bool deterministic=false) |
This function compute montecarlo distribution with an approximate number of samples exploiting the poisson distribution approximation of the binomial distribution. | |
List of functions that compute point samplings.
These functions compute saplings using various simple and complex methods, and return objects that satisfy the vcl::SamplerConcept. A Sampler is an object that allows to store points that can be results of some geometric function (e.g. a point sample that is computed as the barycentric coordinate of a triangle).
You can access these algorithms by including #include <vclib/algorithms/point_sampling.h>
SamplerType vcl::allFacesPointSampling | ( | const MeshType & | m, |
bool | onlySelected = false |
||
) |
Returns a SamplerType object that contains all the faces contained in the given mesh.
This function creates a SamplerType object that contains sampled points on the faces of the given MeshType object m. If onlySelected is true, only the selected faces are sampled.
The specific sampling method is determined by the implementation of the SamplerType class. However, in general, the sampled point on each face is the face barycenter.
SamplerType | A type that satisfies the SamplerConcept |
MeshType | A type that satisfies the FaceMeshConcept |
[in] | m | A const reference to the Mesh object |
[in] | onlySelected | A bool that specifies whether to sample only selected faces |
SamplerType vcl::allFacesPointSampling | ( | const MeshType & | m, |
std::vector< uint > & | birthFaces, | ||
bool | onlySelected = false |
||
) |
Returns a SamplerType object that contains all the faces contained in the given mesh.
This function creates a SamplerType object that contains sampled points on the faces of the given MeshType object m. If onlySelected is true, only the selected faces are sampled. The indices of the sampled faces in the mesh are stored in the birthFaces vector.
The specific sampling method is determined by the implementation of the SamplerType class. However, in general, the sampled point on each face is the face barycenter.
SamplerType | A type that satisfies the SamplerConcept |
MeshType | A type that satisfies the FaceMeshConcept |
[in] | m | A const reference to the Mesh object |
[out] | birthFaces | A vector of uints that will contain the indices of the sampled faces in the mesh |
[in] | onlySelected | A bool that specifies whether to sample only selected faces |
SamplerType vcl::allVerticesPointSampling | ( | const MeshType & | m, |
bool | onlySelected = false |
||
) |
Returns a Sampler object that contains all the vertices contained in the given mesh.
This function creates a SamplerType object that contains all the vertices in the given MeshType object m. If onlySelected is true, only the selected vertices are sampled.
SamplerType | A type that satisfies the SamplerConcept |
MeshType | A type that satisfies the MeshConcept |
[in] | m | A const reference to the Mesh object |
[in] | onlySelected | A bool that specifies whether to sample only selected vertices |
SamplerType vcl::allVerticesPointSampling | ( | const MeshType & | m, |
std::vector< uint > & | birthVertices, | ||
bool | onlySelected = false |
||
) |
Returns a Sampler object that contains all the vertices contained in the given mesh.
This function creates a SamplerType object that contains all the vertices in the given MeshType object m. If onlySelected is true, only the selected vertices are sampled. The indices of the sampled vertices in the mesh are stored in the birthVertices vector.
SamplerType | A type that satisfies the SamplerConcept |
MeshType | A type that satisfies the MeshConcept |
[in] | m | A const reference to the Mesh object |
[out] | birthVertices | A vector of uints that will contain the indices of the sampled vertices in the mesh |
[in] | onlySelected | A bool that specifies whether to sample only selected vertices |
SamplerType vcl::faceAreaWeightedPointSampling | ( | const MeshType & | m, |
uint | nSamples, | ||
bool | deterministic = false |
||
) |
Samples the faces in a weighted way, using the per face area. Each face has a probability of being chosen that is proportional to its area.
m | |
nSamples | |
deterministic |
SamplerType vcl::faceQualityWeightedPointSampling | ( | const MeshType & | m, |
uint | nSamples, | ||
bool | deterministic = false |
||
) |
Samples the faces in a weighted way, using the per face Quality component. Each face has a probability of being chosen that is proportional to its quality value.
m | |
nSamples | |
deterministic |
SamplerType vcl::faceUniformPointSampling | ( | const MeshType & | m, |
uint | nSamples, | ||
bool | onlySelected = false , |
||
bool | deterministic = false |
||
) |
Returns a SamplerType object that contains the given number of samples taken from the faces of the given mesh. Each face has the same probability of being chosen. If onlySelected is true, only the selected faces are sampled.
The specific sampling method is determined by the implementation of the SamplerType class. However, in general, the sampled point on each face is the face barycenter.
SamplerType | A type that satisfies the SamplerConcept |
MeshType | A type that satisfies the FaceMeshConcept |
[in] | m | The mesh to sample from. |
[in] | nSamples | The number of samples to take. |
[in] | onlySelected | Whether to only sample from the selected faces. |
[in] | deterministic | Whether to use a deterministic random generator. |
SamplerType vcl::faceUniformPointSampling | ( | const MeshType & | m, |
uint | nSamples, | ||
std::vector< uint > & | birthFaces, | ||
bool | onlySelected = false , |
||
bool | deterministic = false |
||
) |
Returns a SamplerType object that contains the given number of samples taken from the faces of the given mesh. Each face has the same probability of being chosen. If onlySelected is true, only the selected faces are sampled. The indices of the sampled faces in the mesh are stored in the birthFaces vector.
The specific sampling method is determined by the implementation of the SamplerType class. However, in general, the sampled point on each face is the face barycenter.
SamplerType | A type that satisfies the SamplerConcept |
MeshType | A type that satisfies the FaceMeshConcept |
[in] | m | The mesh to sample from. |
[in] | nSamples | The number of samples to take. |
[out] | birthFaces | A vector of indices of the birth faces. |
[in] | onlySelected | Whether to only sample from the selected faces. |
[in] | deterministic | Whether to use a deterministic random generator. |
SamplerType vcl::faceWeightedPointSampling | ( | const MeshType & | m, |
const std::vector< ScalarType > & | weights, | ||
uint | nSamples, | ||
bool | deterministic = false |
||
) |
Returns a SamplerType object that contains the given number of samples taken from the faces of the given mesh. Each face has the same probability of being chosen. If onlySelected is true, only the selected faces are sampled.
The specific sampling method is determined by the implementation of the SamplerType class. However, in general, the sampled point on each face is the face barycenter.
SamplerType | A type that satisfies the SamplerConcept |
MeshType | A type that satisfies the FaceMeshConcept |
ScalarType | The scalar type used for the weights |
[in] | m | The mesh to sample from. |
[in] | weights | A vector of scalars having the i-th entry associated to the face having index i. Note: weights.size() == m.faceContainerSize(). |
[in] | nSamples | The number of samples to take. |
[in] | deterministic | Whether to use a deterministic random generator. |
SamplerType vcl::faceWeightedPointSampling | ( | const MeshType & | m, |
const std::vector< ScalarType > & | weights, | ||
uint | nSamples, | ||
std::vector< uint > & | birthFaces, | ||
bool | deterministic = false |
||
) |
Returns a SamplerType object that contains the given number of samples taken from the faces of the given mesh. Each face has the same probability of being chosen. If onlySelected is true, only the selected faces are sampled. The indices of the sampled faces in the mesh are stored in the birthFaces vector.
The specific sampling method is determined by the implementation of the SamplerType class. However, in general, the sampled point on each face is the face barycenter.
SamplerType | A type that satisfies the SamplerConcept |
MeshType | A type that satisfies the FaceMeshConcept |
ScalarType | The scalar type used for the weights |
[in] | m | The mesh to sample from. |
[in] | weights | A vector of scalars having the i-th entry associated to the face having index i. Note: weights.size() == m.faceContainerSize(). |
[in] | nSamples | The number of samples to take. |
[out] | birthFaces | A vector to store the indices of the faces that were sampled. |
[in] | deterministic | Whether to use a deterministic random generator. |
SamplerType vcl::montecarloPointSampling | ( | const MeshType & | m, |
uint | nSamples, | ||
bool | deterministic = false |
||
) |
Computes a montecarlo distribution with an exact number of samples. It works by generating a sequence of consecutive segments proportional to the face areas and actually shooting sample over this line.
SamplerType | A type that satisfies the SamplerConcept |
MeshType | A type that satisfies the FaceMeshConcept |
[in] | m | The mesh to sample from. |
[in] | nSamples | The number of samples to take. |
[in] | deterministic | Whether to use a deterministic random generator. |
SamplerType vcl::montecarloPointSampling | ( | const MeshType & | m, |
uint | nSamples, | ||
std::vector< uint > & | birthFaces, | ||
bool | deterministic = false |
||
) |
Computes a montecarlo distribution with an exact number of samples. It works by generating a sequence of consecutive segments proportional to the face areas and actually shooting sample over this line. The indices of the sampled faces in the mesh are stored in the birthFaces vector.
SamplerType | A type that satisfies the SamplerConcept |
MeshType | A type that satisfies the FaceMeshConcept |
[in] | m | The mesh to sample from. |
[in] | nSamples | The number of samples to take. |
[out] | birthFaces | A vector to store the indices of the faces that were sampled. |
[in] | deterministic | Whether to use a deterministic random generator. |
SamplerType vcl::montecarloPoissonPointSampling | ( | const MeshType & | m, |
uint | nSamples, | ||
bool | deterministic = false |
||
) |
This function compute montecarlo distribution with an approximate number of samples exploiting the poisson distribution approximation of the binomial distribution.
For a given triangle t of area a_t, in a Mesh of area A, if we take n_s sample over the mesh, the number of samples that falls in t follows the poisson distribution of P(lambda)
with lambda = n_s * (a_t/A)
.
To approximate the Binomial we use a Poisson distribution with parameter lambda = np
can be used as an approximation to B(n,p)
(it works if n is sufficiently large and p is sufficiently small).
m | |
nSamples | |
deterministic |
SamplerType vcl::vertexAreaWeightedPointSampling | ( | const MeshType & | m, |
uint | nSamples, | ||
bool | deterministic = false |
||
) |
Samples the vertices in a weighted way, using the area. Each vertex has a probability of being chosen that is proportional to the average area of its adjacent faces.
m | |
nSamples | |
deterministic |
SamplerType vcl::vertexQualityWeightedPointSampling | ( | const MeshType & | m, |
uint | nSamples, | ||
bool | deterministic = false |
||
) |
Samples the vertices in a weighted way, using the per vertex Quality component. Each vertex has a probability of being chosen that is proportional to its quality value.
m | |
nSamples | |
deterministic |
SamplerType vcl::vertexUniformPointSampling | ( | const MeshType & | m, |
uint | nSamples, | ||
bool | onlySelected = false , |
||
bool | deterministic = false |
||
) |
Returns a SamplerType object that contains the given number of samples taken from the vertices of the given mesh. Each vertex has the same probability of being chosen. If onlySelected is true, only the selected vertices are sampled.
SamplerType | A type that satisfies the SamplerConcept |
MeshType | A type that satisfies the MeshConcept |
[in] | m | The mesh to sample from. |
[in] | nSamples | The number of samples to take. |
[in] | onlySelected | Whether to only sample from the selected vertices. |
[in] | deterministic | Whether to use a deterministic random generator. |
SamplerType vcl::vertexUniformPointSampling | ( | const MeshType & | m, |
uint | nSamples, | ||
std::vector< uint > & | birthVertices, | ||
bool | onlySelected = false , |
||
bool | deterministic = false |
||
) |
Returns a SamplerType object that contains the given number of samples taken from the vertices of the given mesh. Each vertex has the same probability of being chosen. If onlySelected is true, only the selected vertices are sampled. The indices of the sampled vertices in the mesh are stored in the birthVertices vector.
SamplerType | A type that satisfies the SamplerConcept |
MeshType | A type that satisfies the MeshConcept |
[in] | m | The mesh to sample from. |
[in] | nSamples | The number of samples to take. |
[out] | birthVertices | A vector of indices of the birth vertices. |
[in] | onlySelected | Whether to only sample from the selected vertices. |
[in] | deterministic | Whether to use a deterministic random generator. |
SamplerType vcl::vertexWeightedPointSampling | ( | const MeshType & | m, |
const std::vector< ScalarType > & | weights, | ||
uint | nSamples, | ||
bool | deterministic = false |
||
) |
Samples the vertices in a weighted way, using the per vertex weights given as input. Each vertex has a probability of being chosen that is proportional to its weight. If onlySelected is true, only the selected vertices are sampled.
SamplerType | A type that satisfies the SamplerConcept |
MeshType | A type that satisfies the MeshConcept |
ScalarType | The scalar type used for the weights |
[in] | m | The input mesh to sample from. |
[in] | weights | A vector of scalars having the i-th entry associated to the vertex having index i. Note: weights.size() == m.vertexContainerSize(). |
[in] | nSamples | The number of vertices to sample. |
[in] | deterministic | If true, sets the random number generator to a deterministic mode. |
SamplerType vcl::vertexWeightedPointSampling | ( | const MeshType & | m, |
const std::vector< ScalarType > & | weights, | ||
uint | nSamples, | ||
std::vector< uint > & | birthVertices, | ||
bool | deterministic = false |
||
) |
Samples the vertices in a weighted way, using the per vertex weights given as input. Each vertex has a probability of being chosen that is proportional to its weight. If onlySelected is true, only the selected vertices are sampled. The indices of the sampled vertices in the mesh are stored in the birthVertices vector.
SamplerType | A type that satisfies the SamplerConcept |
MeshType | A type that satisfies the MeshConcept |
ScalarType | The scalar type used for the weights |
[in] | m | The input mesh to sample from. |
[in] | weights | A vector of scalars having the i-th entry associated to the vertex having index i. Note: weights.size() == m.vertexContainerSize(). |
[in] | nSamples | The number of vertices to sample. |
[out] | birthVertices | A vector to store the indices of the vertices that were sampled. |
[in] | deterministic | If true, sets the random number generator to a deterministic mode. |