|
Visual Computing Library
devel
|
List of functions that compute point samplings. More...

Functions | |
| template<FaceMeshConcept MeshType> | |
| auto | vcl::allFacesPointSampling (const MeshType &m, bool onlySelected=false) |
| Returns a PointSampler object that contains all the faces contained in the given mesh. | |
| template<FaceMeshConcept MeshType> | |
| auto | vcl::allFacesPointSampling (const MeshType &m, std::vector< uint > &birthFaces, bool onlySelected=false) |
| Returns a PointSampler object that contains all the faces contained in the given mesh. | |
| template<MeshConcept MeshType> | |
| auto | vcl::allVerticesPointSampling (const MeshType &m, bool onlySelected=false) |
| Returns a PointSampler object that contains all the vertices contained in the given mesh. | |
| template<MeshConcept MeshType> | |
| auto | vcl::allVerticesPointSampling (const MeshType &m, std::vector< uint > &birthVertices, bool onlySelected=false) |
| Returns a PointSampler object that contains all the vertices contained in the given mesh. | |
| template<FaceMeshConcept MeshType> | |
| auto | vcl::faceAreaWeightedPointSampling (const MeshType &m, uint nSamples, std::optional< uint > seed=std::nullopt) |
| 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<FaceMeshConcept MeshType> | |
| auto | vcl::faceQualityWeightedPointSampling (const MeshType &m, uint nSamples, std::optional< uint > seed=std::nullopt) |
| 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<FaceMeshConcept MeshType> | |
| auto | vcl::faceUniformPointSampling (const MeshType &m, uint nSamples, bool onlySelected=false, std::optional< uint > seed=std::nullopt) |
| Returns a PointSampler 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<FaceMeshConcept MeshType> | |
| auto | vcl::faceUniformPointSampling (const MeshType &m, uint nSamples, std::vector< uint > &birthFaces, bool onlySelected=false, std::optional< uint > seed=std::nullopt) |
| Returns a PointSampler 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<FaceMeshConcept MeshType, typename ScalarType > | |
| auto | vcl::faceWeightedPointSampling (const MeshType &m, const std::vector< ScalarType > &weights, uint nSamples, std::optional< uint > seed=std::nullopt) |
| Returns a PointSampler 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<FaceMeshConcept MeshType, typename ScalarType > | |
| auto | vcl::faceWeightedPointSampling (const MeshType &m, const std::vector< ScalarType > &weights, uint nSamples, std::vector< uint > &birthFaces, std::optional< uint > seed=std::nullopt) |
| Returns a PointSampler 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<FaceMeshConcept MeshType> | |
| auto | vcl::montecarloPointSampling (const MeshType &m, uint nSamples, std::optional< uint > seed=std::nullopt) |
| 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<FaceMeshConcept MeshType> | |
| auto | vcl::montecarloPointSampling (const MeshType &m, uint nSamples, std::vector< uint > &birthFaces, std::optional< uint > seed=std::nullopt) |
| 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<FaceMeshConcept MeshType> | |
| auto | vcl::montecarloPoissonPointSampling (const MeshType &m, uint nSamples, std::optional< uint > seed=std::nullopt) |
| This function compute montecarlo distribution with an approximate number of samples exploiting the poisson distribution approximation of the binomial distribution. | |
| template<FaceMeshConcept MeshType> | |
| auto | vcl::vertexAreaWeightedPointSampling (const MeshType &m, uint nSamples, std::optional< uint > seed=std::nullopt) |
| 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<MeshConcept MeshType> | |
| auto | vcl::vertexQualityWeightedPointSampling (const MeshType &m, uint nSamples, std::optional< uint > seed=std::nullopt) |
| 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<MeshConcept MeshType> | |
| auto | vcl::vertexUniformPointSampling (const MeshType &m, uint nSamples, bool onlySelected=false, std::optional< uint > seed=std::nullopt) |
| Returns a PointSampler 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<MeshConcept MeshType> | |
| auto | vcl::vertexUniformPointSampling (const MeshType &m, uint nSamples, std::vector< uint > &birthVertices, bool onlySelected=false, std::optional< uint > seed=std::nullopt) |
| Returns a PointSampler 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<MeshConcept MeshType, typename ScalarType > | |
| auto | vcl::vertexWeightedPointSampling (const MeshType &m, const std::vector< ScalarType > &weights, uint nSamples, std::optional< uint > seed=std::nullopt) |
| 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<MeshConcept MeshType, typename ScalarType > | |
| auto | vcl::vertexWeightedPointSampling (const MeshType &m, const std::vector< ScalarType > &weights, uint nSamples, std::vector< uint > &birthVertices, std::optional< uint > seed=std::nullopt) |
| 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. | |
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>
| auto vcl::allFacesPointSampling | ( | const MeshType & | m, |
| bool | onlySelected = false |
||
| ) |
Returns a PointSampler object that contains all the faces contained in the given mesh.
This function creates a PointSampler 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 sampled point on each face is the face barycenter.
| 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 |
| auto vcl::allFacesPointSampling | ( | const MeshType & | m, |
| std::vector< uint > & | birthFaces, | ||
| bool | onlySelected = false |
||
| ) |
Returns a PointSampler object that contains all the faces contained in the given mesh.
This function creates a PointSampler 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 sampled point on each face is the face barycenter.
| 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 |
| auto vcl::allVerticesPointSampling | ( | const MeshType & | m, |
| bool | onlySelected = false |
||
| ) |
Returns a PointSampler object that contains all the vertices contained in the given mesh.
This function creates a PointSampler object that contains all the vertices in the given MeshType object m. If onlySelected is true, only the selected vertices are sampled.
| 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 |
| auto vcl::allVerticesPointSampling | ( | const MeshType & | m, |
| std::vector< uint > & | birthVertices, | ||
| bool | onlySelected = false |
||
| ) |
Returns a PointSampler object that contains all the vertices contained in the given mesh.
This function creates a PointSampler 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.
| 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 |
| auto vcl::faceAreaWeightedPointSampling | ( | const MeshType & | m, |
| uint | nSamples, | ||
| std::optional< uint > | seed = std::nullopt |
||
| ) |
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 | ||
| [in] | seed | optional value of seed, to get deterministic results. If not provided, a random seed is used. |
| auto vcl::faceQualityWeightedPointSampling | ( | const MeshType & | m, |
| uint | nSamples, | ||
| std::optional< uint > | seed = std::nullopt |
||
| ) |
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 | ||
| [in] | seed | optional value of seed, to get deterministic results. If not provided, a random seed is used. |
| auto vcl::faceUniformPointSampling | ( | const MeshType & | m, |
| uint | nSamples, | ||
| bool | onlySelected = false, |
||
| std::optional< uint > | seed = std::nullopt |
||
| ) |
Returns a PointSampler 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 sampled point on each face is the face barycenter.
| 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] | seed | optional value of seed, to get deterministic results. If not provided, a random seed is used. |
| auto vcl::faceUniformPointSampling | ( | const MeshType & | m, |
| uint | nSamples, | ||
| std::vector< uint > & | birthFaces, | ||
| bool | onlySelected = false, |
||
| std::optional< uint > | seed = std::nullopt |
||
| ) |
Returns a PointSampler 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 sampled point on each face is the face barycenter.
| 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] | seed | optional value of seed, to get deterministic results. If not provided, a random seed is used. |
| auto vcl::faceWeightedPointSampling | ( | const MeshType & | m, |
| const std::vector< ScalarType > & | weights, | ||
| uint | nSamples, | ||
| std::optional< uint > | seed = std::nullopt |
||
| ) |
Returns a PointSampler 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 sampled point on each face is the face barycenter.
| 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] | seed | optional value of seed, to get deterministic results. If not provided, a random seed is used. |
| auto vcl::faceWeightedPointSampling | ( | const MeshType & | m, |
| const std::vector< ScalarType > & | weights, | ||
| uint | nSamples, | ||
| std::vector< uint > & | birthFaces, | ||
| std::optional< uint > | seed = std::nullopt |
||
| ) |
Returns a PointSampler 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 sampled point on each face is the face barycenter.
| 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] | seed | optional value of seed, to get deterministic results. If not provided, a random seed is used. |
| auto vcl::montecarloPointSampling | ( | const MeshType & | m, |
| uint | nSamples, | ||
| std::optional< uint > | seed = std::nullopt |
||
| ) |
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.
| MeshType | A type that satisfies the FaceMeshConcept |
| [in] | m | The mesh to sample from. |
| [in] | nSamples | The number of samples to take. |
| [in] | seed | optional value of seed, to get deterministic results. If not provided, a random seed is used. |
| auto vcl::montecarloPointSampling | ( | const MeshType & | m, |
| uint | nSamples, | ||
| std::vector< uint > & | birthFaces, | ||
| std::optional< uint > | seed = std::nullopt |
||
| ) |
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.
| 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] | seed | optional value of seed, to get deterministic results. If not provided, a random seed is used. |
| auto vcl::montecarloPoissonPointSampling | ( | const MeshType & | m, |
| uint | nSamples, | ||
| std::optional< uint > | seed = std::nullopt |
||
| ) |
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 | ||
| [in] | seed | optional value of seed, to get deterministic results. If not provided, a random seed is used. |
| auto vcl::vertexAreaWeightedPointSampling | ( | const MeshType & | m, |
| uint | nSamples, | ||
| std::optional< uint > | seed = std::nullopt |
||
| ) |
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 | ||
| [in] | seed | optional value of seed, to get deterministic results. If not provided, a random seed is used. |
| auto vcl::vertexQualityWeightedPointSampling | ( | const MeshType & | m, |
| uint | nSamples, | ||
| std::optional< uint > | seed = std::nullopt |
||
| ) |
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 | ||
| [in] | seed | optional value of seed, to get deterministic results. If not provided, a random seed is used. |
| auto vcl::vertexUniformPointSampling | ( | const MeshType & | m, |
| uint | nSamples, | ||
| bool | onlySelected = false, |
||
| std::optional< uint > | seed = std::nullopt |
||
| ) |
Returns a PointSampler 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.
| 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] | seed | optional value of seed, to get deterministic results. If not provided, a random seed is used. |
| auto vcl::vertexUniformPointSampling | ( | const MeshType & | m, |
| uint | nSamples, | ||
| std::vector< uint > & | birthVertices, | ||
| bool | onlySelected = false, |
||
| std::optional< uint > | seed = std::nullopt |
||
| ) |
Returns a PointSampler 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.
| 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] | seed | optional value of seed, to get deterministic results. If not provided, a random seed is used. |
| auto vcl::vertexWeightedPointSampling | ( | const MeshType & | m, |
| const std::vector< ScalarType > & | weights, | ||
| uint | nSamples, | ||
| std::optional< uint > | seed = std::nullopt |
||
| ) |
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.
| 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] | seed | optional value of seed, to get deterministic results. If not provided, a random seed is used. |
| auto vcl::vertexWeightedPointSampling | ( | const MeshType & | m, |
| const std::vector< ScalarType > & | weights, | ||
| uint | nSamples, | ||
| std::vector< uint > & | birthVertices, | ||
| std::optional< uint > | seed = std::nullopt |
||
| ) |
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.
| 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] | seed | optional value of seed, to get deterministic results. If not provided, a random seed is used. |