Visual Computing Library
devel
|
List of Core algorithms. More...
Modules | |
Core Bounding Box Algorithms | |
List of overloaded boundingBox functions that take in input an object (or a Range of objects) and return its/their bounding box. | |
Core Box Algorithms | |
List of utility functions for boxes having different dimensions. | |
Core Create Algorithms | |
List core algorithms for creating generic objects. | |
Core Distance Algorithms | |
List of distance algorithms. | |
Core Intersection Algorithms | |
List of intersection algorithms. | |
Polygon Core Algorithms | |
List of Core Polygon algorithms. | |
Functions | |
template<Point3Concept PointType> | |
bool | vcl::arePointsCoplanar (const PointType &p0, const PointType &p1, const PointType &p2, const PointType &p3) |
Checks if 4 points are coplanar. | |
template<FaceConcept FaceType, Point3Concept PointType> | |
bool | vcl::facePointVisibility (const FaceType &face, const PointType &point) |
Checks if a point is visible from a face, i.e., if the point is in the half-space defined by the face. | |
template<FaceConcept FaceType, Point3Concept PointType> | |
auto | vcl::halfSpaceDeterminant (const FaceType &face, const PointType &point) |
Compute the determinant of the half-space defined by the triangle and the point. | |
template<Point3Concept PointType> | |
auto | vcl::halfSpaceDeterminant (const PointType &p0, const PointType &p1, const PointType &p2, const PointType &p) |
Compute the determinant of the half-space defined by the triangle (p1, p2, p3) and the point p. | |
template<Triangle3Concept TriangleType, Point3Concept PointType> | |
auto | vcl::halfSpaceDeterminant (const TriangleType &triangle, const PointType &point) |
Compute the determinant of the half-space defined by the triangle and the point. | |
int | vcl::poissonRandomNumber (double lambda, std::mt19937 &gen) |
algorithm poisson random number (Knuth): init: Let L ← e^−λ, k ← 0 and p ← 1. do: k ← k + 1. Generate uniform random number u in [0,1] and let p ← p × u. while p > L. return k − 1. | |
template<Point3Concept PointType> | |
PointType | vcl::randomTriangleBarycentricCoordinate (std::mt19937 &gen) |
Generate the barycentric coords of a random point over a triangle, with a uniform distribution over the triangle. It uses the parallelogram folding trick. | |
template<Matrix33Or44Concept MatrixType> | |
MatrixType | vcl::removeScalingFromMatrix (const MatrixType &matrix) |
Returns a matrix with the scaling factors removed. | |
template<Matrix33Or44Concept MatrixType> | |
void | vcl::removeScalingFromMatrixInPlace (MatrixType &matrix) |
Removes the scaling factors from the matrix in place. | |
template<MatrixConcept MatrixType, Point3Concept PointType, typename ScalarType > | |
MatrixType | vcl::rotationMatrix (const PointType &axis, const ScalarType &angleRad) |
Given an 3D axis and an angle expressed in radiants, returns a transform matrix that represents the rotation matrix of the given axis/angle. | |
template<MatrixConcept MatrixType, Point3Concept PointType> | |
MatrixType | vcl::rotationMatrix (const PointType &fromVector, const PointType &toVector) |
Given two 3D vectors, returns a transform matrix that represents the rotation matrix from the first vector to the second vector. | |
template<MatrixConcept MatrixType, Point3Concept PointType, typename ScalarType > | |
MatrixType | vcl::rotationMatrixDeg (const PointType &axis, const ScalarType &angleDeg) |
Given an 3D axis and an angle expressed in degrees, fills the given matrix with a transform matrix that represents the rotation matrix of the given axis/angle. | |
template<MatrixConcept MatrixType, Point3Concept PointType> | |
void | vcl::setTransformMatrixRotation (MatrixType &matrix, const PointType &fromVector, const PointType &toVector) |
Given two 3D vectors, fills the given matrix with a transform matrix that represents the rotation matrix from the first vector to the second vector. | |
template<MatrixConcept MatrixType, Point3Concept PointType, typename ScalarType > | |
void | vcl::setTransformMatrixRotation (MatrixType &matrix, PointType axis, const ScalarType &angleRad) |
Given an 3D axis and an angle expressed in radiants, fills the given matrix with a transform matrix that represents the rotation matrix of the given axis/angle. | |
template<MatrixConcept MatrixType, Point3Concept PointType, typename ScalarType > | |
void | vcl::setTransformMatrixRotationDeg (MatrixType &matrix, PointType axis, const ScalarType &angleDeg) |
Given an 3D axis and an angle expressed in degrees, fills the given matrix with a transform matrix that represents the rotation matrix of the given axis/angle. | |
template<Point3Concept PointType> | |
std::vector< PointType > | vcl::sphericalFibonacciPointSet (uint n) |
Returns a vector of n points distributed in a unit sphere. | |
template<Point3Concept PointType> | |
auto | vcl::trianglePointVisibility (const PointType &p0, const PointType &p1, const PointType &p2, const PointType &p) |
Checks if a point is visible from a triangle, i.e., if the point is in the half-space defined by the triangle. | |
template<Triangle3Concept TriangleType, Point3Concept PointType> | |
bool | vcl::trianglePointVisibility (const TriangleType &triangle, const PointType &point) |
Checks if a point is visible from a triangle, i.e., if the point is in the half-space defined by the triangle. | |
List of Core algorithms.
In this module, you can find the core algorithms of VCLib, that generally involve simple geometric primitives, like points, vectors, and matrices.
You can access these algorithms by including #include <vclib/algorithms/core.h>
bool vcl::arePointsCoplanar | ( | const PointType & | p0, |
const PointType & | p1, | ||
const PointType & | p2, | ||
const PointType & | p3 | ||
) |
Checks if 4 points are coplanar.
PointType | The type of the points. |
[in] | p0 | First point to test. |
[in] | p1 | Second point to test. |
[in] | p2 | Third point to test. |
[in] | p3 | Fourth point to test. |
bool vcl::facePointVisibility | ( | const FaceType & | face, |
const PointType & | point | ||
) |
Checks if a point is visible from a face, i.e., if the point is in the half-space defined by the face.
FaceType | The type of the face. |
PointType | The type of the point. |
[in] | face | The input face. |
[in] | point | The point to test. |
auto vcl::halfSpaceDeterminant | ( | const FaceType & | face, |
const PointType & | point | ||
) |
Compute the determinant of the half-space defined by the triangle and the point.
FaceType | The type of the face that defines the half-space. |
PointType | The type of the point to test. |
[in] | face | The face that defines the half-space. |
[in] | point | The point to test. |
auto vcl::halfSpaceDeterminant | ( | const PointType & | p0, |
const PointType & | p1, | ||
const PointType & | p2, | ||
const PointType & | p | ||
) |
Compute the determinant of the half-space defined by the triangle (p1, p2, p3) and the point p.
The triangle is defined by the points p1, p2, and p3, ordered in a counter-clockwise manner.
PointType | The type of the points. |
[in] | p0 | The first point of the triangle. |
[in] | p1 | The second point of the triangle. |
[in] | p2 | The third point of the triangle. |
[in] | p | The point to test. |
auto vcl::halfSpaceDeterminant | ( | const TriangleType & | triangle, |
const PointType & | point | ||
) |
Compute the determinant of the half-space defined by the triangle and the point.
TriangleType | The type of the triangle that defines the half-space. |
PointType | The type of the point to test. |
[in] | triangle | The triangle that defines the half-space. |
[in] | p | The point to test. |
algorithm poisson random number (Knuth): init: Let L ← e^−λ, k ← 0 and p ← 1. do: k ← k + 1. Generate uniform random number u in [0,1] and let p ← p × u. while p > L. return k − 1.
lambda | |
gen |
PointType vcl::randomTriangleBarycentricCoordinate | ( | std::mt19937 & | gen | ) |
Generate the barycentric coords of a random point over a triangle, with a uniform distribution over the triangle. It uses the parallelogram folding trick.
gen |
MatrixType vcl::removeScalingFromMatrix | ( | const MatrixType & | matrix | ) |
Returns a matrix with the scaling factors removed.
The input matrix is expected to be a 3x3 or 4x4 matrix, and the function removes the scaling factors from the first three rows (or columns) of the matrix. The scaling factors are computed as the Euclidean norm of the first three rows of the matrix. The resulting matrix will have the same orientation as the input matrix, but without scaling.
[in] | matrix | The input matrix from which the scaling factors will be removed. |
void vcl::removeScalingFromMatrixInPlace | ( | MatrixType & | matrix | ) |
Removes the scaling factors from the matrix in place.
The input matrix is expected to be a 3x3 or 4x4 matrix, and the function removes the scaling factors from the first three rows (or columns) of the matrix. The scaling factors are computed as the Euclidean norm of the first three rows of the matrix. The resulting matrix will have the same orientation as the input matrix, but without scaling.
[in/out] | matrix: The input matrix from which the scaling factors will be removed. |
MatrixType vcl::rotationMatrix | ( | const PointType & | axis, |
const ScalarType & | angleRad | ||
) |
Given an 3D axis and an angle expressed in radiants, returns a transform matrix that represents the rotation matrix of the given axis/angle.
The MatrixType must be at least a 3x3 matrix having the setIdentity() member function. If the matrix is a higher than 3x3 (e.g. 4x4), only the 3x3 submatrix will be set, leaving the identity values in the other cells of the matrix.
axis | |
angleRad |
MatrixType vcl::rotationMatrix | ( | const PointType & | fromVector, |
const PointType & | toVector | ||
) |
Given two 3D vectors, returns a transform matrix that represents the rotation matrix from the first vector to the second vector.
The MatrixType must be at least a 3x3 matrix having the setIdentity() member function. If the matrix is a higher than 3x3 (e.g. 4x4), only the 3x3 submatrix will be set, leaving the identity values in the other cells of the matrix.
fromVector | |
toVector |
MatrixType vcl::rotationMatrixDeg | ( | const PointType & | axis, |
const ScalarType & | angleDeg | ||
) |
Given an 3D axis and an angle expressed in degrees, fills the given matrix with a transform matrix that represents the rotation matrix of the given axis/angle.
The MatrixType must be at least a 3x3 matrix having the setIdentity() member function. If the matrix is a higher than 3x3 (e.g. 4x4), only the 3x3 submatrix will be set, leaving the identity values in the other cells of the matrix.
axis | |
angleDeg |
void vcl::setTransformMatrixRotation | ( | MatrixType & | matrix, |
const PointType & | fromVector, | ||
const PointType & | toVector | ||
) |
Given two 3D vectors, fills the given matrix with a transform matrix that represents the rotation matrix from the first vector to the second vector.
The given matrix must be at least a 3x3 matrix. If the matrix is a higher than 3x3 (e.g. 4x4), only the 3x3 submatrix will be set, leaving unchanged the other values.
matrix | |
fromVector | |
toVector |
void vcl::setTransformMatrixRotation | ( | MatrixType & | matrix, |
PointType | axis, | ||
const ScalarType & | angleRad | ||
) |
Given an 3D axis and an angle expressed in radiants, fills the given matrix with a transform matrix that represents the rotation matrix of the given axis/angle.
The given matrix must be at least a 3x3 matrix. If the matrix is a higher than 3x3 (e.g. 4x4), only the 3x3 submatrix will be set, leaving unchanged the other values.
matrix | |
axis | |
angleRad |
void vcl::setTransformMatrixRotationDeg | ( | MatrixType & | matrix, |
PointType | axis, | ||
const ScalarType & | angleDeg | ||
) |
Given an 3D axis and an angle expressed in degrees, fills the given matrix with a transform matrix that represents the rotation matrix of the given axis/angle.
The given matrix must be at least a 3x3 matrix. If the matrix is a higher than 3x3 (e.g. 4x4), only the 3x3 submatrix will be set, leaving unchanged the other values.
matrix | |
axis | |
angleDeg |
std::vector< PointType > vcl::sphericalFibonacciPointSet | ( | uint | n | ) |
Returns a vector of n
points distributed in a unit sphere.
This function returns a vector of n
points that are uniformly distributed on a unit sphere, using the Spherical Fibonacci Point Sets algorithm described in the paper "Spherical Fibonacci Mapping" by Benjamin Keinert, Matthias Innmann, Michael Sanger, and Marc Stamminger (TOG 2015).
PointType | The type of the point to generate. This type must satisfy the Point3Concept concept. |
[in] | n | The number of points to generate. |
n
points distributed in a unit sphere. auto vcl::trianglePointVisibility | ( | const PointType & | p0, |
const PointType & | p1, | ||
const PointType & | p2, | ||
const PointType & | p | ||
) |
Checks if a point is visible from a triangle, i.e., if the point is in the half-space defined by the triangle.
PointType | The type of the points. |
[in] | p0 | The first point of the triangle. |
[in] | p1 | The second point of the triangle. |
[in] | p2 | The third point of the triangle. |
[in] | p | The point to test. |
bool vcl::trianglePointVisibility | ( | const TriangleType & | triangle, |
const PointType & | point | ||
) |
Checks if a point is visible from a triangle, i.e., if the point is in the half-space defined by the triangle.
TriangleType | The type of the triangle. |
PointType | The type of the point. |
[in] | triangle | The input triangle. |
[in] | point | The point to test. |