Visual Computing Library
|
List of distance algorithms. More...
Functions | |
template<VertexConcept VertexType, Point3Concept PointType> | |
auto | vcl::distance (const VertexType &v, const PointType &p) |
Computes the distance between a Vertex and a 3D point. | |
template<Point3Concept PointType, VertexConcept VertexType> | |
auto | vcl::distance (const PointType &p, const VertexType &v) |
Computes the distance between a Vertex and a 3D point. | |
template<VertexConcept VertexType1, VertexConcept VertexType2> | |
auto | vcl::distance (const VertexType1 &v1, const VertexType2 &v2) |
Computes the distance between two vertices. | |
template<Point3Concept PointType, FaceConcept FaceType, typename ScalarType > | |
auto | vcl::boundedDistance (const PointType &p, const FaceType &f, ScalarType maxDist, PointType &closest, bool signedDist=false) |
Compute the distance between a 3D point and a face. | |
template<Point3Concept PointType, FaceConcept FaceType, typename ScalarType > | |
auto | vcl::boundedDistance (const PointType &p, const FaceType &f, ScalarType maxDist, bool signedDist=false) |
Compute the distance between a 3D point and a face. | |
template<FaceConcept FaceType, Point3Concept PointType, typename ScalarType > | |
auto | vcl::boundedDistance (const FaceType &f, const PointType &p, ScalarType maxDist, bool signedDist=false) |
Compute the distance between a 3D point and a face. | |
template<Point3Concept PointType, FaceConcept FaceType> | |
auto | vcl::distance (const PointType &p, const FaceType &f, PointType &closest, bool signedDist=false) |
Compute the distance between a 3D point and a face. | |
template<Point3Concept PointType, FaceConcept FaceType> | |
auto | vcl::distance (const PointType &p, const FaceType &f, bool signedDist=false) |
Compute the distance between a 3D point and a face. | |
template<FaceConcept FaceType, Point3Concept PointType> | |
auto | vcl::distance (const FaceType &f, const PointType &p, bool signedDist=false) |
Compute the distance between a 3D point and a face. | |
template<VertexConcept VertexType, FaceConcept FaceType> | |
auto | vcl::distance (const VertexType &v, const FaceType &f, bool signedDist=false) |
Compute the distance between a vertex and a face. | |
template<FaceConcept FaceType, VertexConcept VertexType> | |
auto | vcl::distance (const FaceType &f, const VertexType &v, bool signedDist=false) |
Compute the distance between a vertex and a face. | |
template<typename Obj1 , typename Obj2 > | |
auto | vcl::distFunction () |
Return a proper dist function between a Obj1 object and an Obj2 object. | |
template<typename Obj1 , typename Obj2 , typename ScalarType = double> | |
auto | vcl::boundedDistFunction () |
Return a proper bounded distance function between a Obj1 object and an Obj2 object. | |
template<PointConcept PointType> | |
auto | vcl::distance (const PointType &point0, const PointType &point1) |
Compute the distance between two Points of any dimension. | |
template<Point3Concept PointType, PlaneConcept PlaneType> | |
auto | vcl::distance (const PointType &point, const PlaneType &plane, bool signedDist=false) |
Compute the distance between a point and a plane. | |
template<PlaneConcept PlaneType, Point3Concept PointType> | |
auto | vcl::distance (const PlaneType &plane, const PointType &point, bool signedDist=false) |
Compute the distance between a point and a plane. | |
template<PointConcept PointType, SegmentConcept SegmentType> requires (PointType::DIM == SegmentType::DIM) | |
auto | vcl::distance (const PointType &point, const SegmentType &segment, PointType &closestPoint) |
Compute the distance between a point and a segment. | |
template<PointConcept PointType, SegmentConcept SegmentType> requires (PointType::DIM == SegmentType::DIM) | |
auto | vcl::distance (const PointType &point, const SegmentType &segment) |
Compute the distance between a point and a segment. | |
template<SegmentConcept SegmentType, PointConcept PointType> requires (PointType::DIM == SegmentType::DIM) | |
auto | vcl::distance (const SegmentType &segment, const PointType &point) |
Compute the distance between a point and a segment. | |
template<Point3Concept PointType, Triangle3Concept TriangleType, typename ScalarType > | |
auto | vcl::boundedDistance (const PointType &p, const TriangleType &triangle, ScalarType maxDist, PointType &closest, bool signedDist=false) |
Compute the bounded distance between a 3D point and a 3D triangle. | |
template<Point3Concept PointType, Triangle3Concept TriangleType, typename ScalarType > | |
auto | vcl::boundedDistance (const PointType &p, const TriangleType &triangle, ScalarType maxDist, bool signedDist=false) |
Compute the distance between a 3D point and a 3D triangle. | |
template<Point3Concept PointType, Triangle3Concept TriangleType, typename ScalarType > | |
auto | vcl::distance (const PointType &p, const TriangleType &triangle, PointType &closest, bool signedDist=false) |
Compute the distance between a 3D point and a 3D triangle. | |
template<Point3Concept PointType, Triangle3Concept TriangleType, typename ScalarType > | |
auto | vcl::distance (const PointType &p, const TriangleType &triangle, bool signedDist=false) |
Compute the distance between a 3D point and a 3D triangle. | |
template<Triangle3Concept TriangleType, Point3Concept PointType, typename ScalarType > | |
auto | vcl::distance (const TriangleType &triangle, const PointType &p, bool signedDist=false) |
Compute the distance between a 3D point and a 3D triangle. | |
List of distance algorithms.
You can access these algorithms by including #include <vclib/algorithms/core/distance.h>
auto vcl::boundedDistance | ( | const FaceType & | f, |
const PointType & | p, | ||
ScalarType | maxDist, | ||
bool | signedDist = false |
||
) |
Compute the distance between a 3D point and a face.
If the face is a triangle, the function will use the bounded distance function between a point and a triangle. If the face is a polygon, the face is first triangulated using an earcut algorithm, and then for each triangle, the distance between the point and the triangle is computed.
PointType | The type of point. Must satisfy the Point3Concept. |
FaceType | The type of face. Must satisfy the FaceConcept. |
[in] | p | The point to calculate the distance from. |
[in] | f | The face to calculate the distance to. |
[in] | maxDist | The maximum distance to consider. If the distance is greater than this value, the function returns immediately. Default is std::numeric_limits<ScalarType>::max(). |
[in] | signedDist | Whether to calculate the signed distance. Default is false. |
auto vcl::boundedDistance | ( | const PointType & | p, |
const FaceType & | f, | ||
ScalarType | maxDist, | ||
bool | signedDist = false |
||
) |
Compute the distance between a 3D point and a face.
If the face is a triangle, the function will use the bounded distance function between a point and a triangle. If the face is a polygon, the face is first triangulated using an earcut algorithm, and then for each triangle, the distance between the point and the triangle is computed.
PointType | The type of point. Must satisfy the Point3Concept. |
FaceType | The type of face. Must satisfy the FaceConcept. |
[in] | p | The point to calculate the distance from. |
[in] | f | The face to calculate the distance to. |
[in] | maxDist | The maximum distance to consider. If the distance is greater than this value, the function returns immediately. Default is std::numeric_limits<ScalarType>::max(). |
[in] | signedDist | Whether to calculate the signed distance. Default is false. |
auto vcl::boundedDistance | ( | const PointType & | p, |
const FaceType & | f, | ||
ScalarType | maxDist, | ||
PointType & | closest, | ||
bool | signedDist = false |
||
) |
Compute the distance between a 3D point and a face.
If the face is a triangle, the function will use the bounded distance function between a point and a triangle. If the face is a polygon, the face is first triangulated using an earcut algorithm, and then for each triangle, the distance between the point and the triangle is computed.
PointType | The type of point. Must satisfy the Point3Concept. |
FaceType | The type of face. Must satisfy the FaceConcept. |
[in] | p | The point to calculate the distance from. |
[in] | f | The face to calculate the distance to. |
[in] | maxDist | The maximum distance to consider. If the distance is greater than this value, the function returns immediately. Default is std::numeric_limits<ScalarType>::max(). |
[out] | closest | The closest point on the triangle to the given point. |
[in] | signedDist | Whether to calculate the signed distance. Default is false. |
auto vcl::boundedDistance | ( | const PointType & | p, |
const TriangleType & | triangle, | ||
ScalarType | maxDist, | ||
bool | signedDist = false |
||
) |
Compute the distance between a 3D point and a 3D triangle.
PointType | The type of point. |
TriangleType | The type of triangle. |
[in] | p | The point to calculate the distance from. |
[in] | triangle | The triangle to calculate the distance to. |
[in] | maxDist | The maximum distance to consider. If the distance is greater than this value, the function returns immediately. Default is std::numeric_limits<ScalarType>::max(). |
[in] | signedDist | Whether to calculate the signed distance. Default is false. |
auto vcl::boundedDistance | ( | const PointType & | p, |
const TriangleType & | triangle, | ||
ScalarType | maxDist, | ||
PointType & | closest, | ||
bool | signedDist = false |
||
) |
Compute the bounded distance between a 3D point and a 3D triangle.
Compute the distance between a 3D point and a 3D triangle. The distance can be signed or unsigned, depending on the value of the signedDist parameter.
The actual distance is computed only if the absolute value of the distance is less than the maxDist parameter. If the distance is greater than maxDist, the function returns immediately, and the returned value is a value greater than maxDist.
PointType | The type of point. |
TriangleType | The type of triangle. |
[in] | p | The point to calculate the distance from. |
[in] | triangle | The triangle to calculate the distance to. |
[in] | maxDist | The (absolute) maximum distance to consider. If the absolute value of the distance is greater than this value, the function returns immediately. Default is std::numeric_limits<ScalarType>::max(). |
[out] | closest | The closest point on the triangle to the given point. |
[in] | signedDist | Whether to calculate the signed distance. Default is false. |
auto vcl::boundedDistFunction | ( | ) |
Return a proper bounded distance function between a Obj1 object and an Obj2 object.
The returned function is a lambda function that takes in input two const references of the desired types, a scalar that represents the bound, and returns a scalar that is the distance between the two objects if it is less than the bound. If the distance is greater than the bound, the distance was not computed totally and should be discarded.
This function is different w.r.t. the distFunction because the returned function here takes three arguments: the two objects on which compute the distance, and a scalar that represent the maximum distance that can be returned. This value is used by some distance functions for performance reasons: it allows to avoid several computation if a first distance does already exceed the maximum value.
If the bounded distance function is not defined, the standard distance function will be used, and the bound parameter will be ignored. If the distance function for your types is not defined, you can write your own vcl::boundedDistance (or vcl::distance) overload that defines a proper bounded distance function.
auto vcl::distance | ( | const FaceType & | f, |
const PointType & | p, | ||
bool | signedDist = false |
||
) |
Compute the distance between a 3D point and a face.
If the face is a triangle, the function will use the bounded distance function between a point and a triangle. If the face is a polygon, the face is first triangulated using an earcut algorithm, and then for each triangle, the distance between the point and the triangle is computed.
PointType | The type of point. Must satisfy the Point3Concept. |
FaceType | The type of face. Must satisfy the FaceConcept. |
[in] | p | The point to calculate the distance from. |
[in] | f | The face to calculate the distance to. |
[in] | signedDist | Whether to calculate the signed distance. Default is false. |
auto vcl::distance | ( | const FaceType & | f, |
const VertexType & | v, | ||
bool | signedDist = false |
||
) |
Compute the distance between a vertex and a face.
If the face is a triangle, the function will use the bounded distance function between a point and a triangle. If the face is a polygon, the face is first triangulated using an earcut algorithm, and then for each triangle, the distance between the point and the triangle is computed.
VertexType | The type of Vertex. Must satisfy the VertexConcept. |
FaceType | The type of face. Must satisfy the FaceConcept. |
[in] | v | The vertex to calculate the distance from. |
[in] | f | The face to calculate the distance to. |
[in] | signedDist | Whether to calculate the signed distance. Default is false. |
auto vcl::distance | ( | const PlaneType & | plane, |
const PointType & | point, | ||
bool | signedDist = false |
||
) |
Compute the distance between a point and a plane.
Compute the distance between a point and a plane. The distance can be signed or unsigned, depending on the value of the signedDist parameter.
PointType | The type of the input point. |
PlaneType | The type of the input plane. |
[in] | point | The input point. |
[in] | plane | The input plane. |
[in] | signedDist | If true, the distance is signed, otherwise it is unsigned. |
auto vcl::distance | ( | const PointType & | p, |
const FaceType & | f, | ||
bool | signedDist = false |
||
) |
Compute the distance between a 3D point and a face.
If the face is a triangle, the function will use the bounded distance function between a point and a triangle. If the face is a polygon, the face is first triangulated using an earcut algorithm, and then for each triangle, the distance between the point and the triangle is computed.
PointType | The type of point. Must satisfy the Point3Concept. |
FaceType | The type of face. Must satisfy the FaceConcept. |
[in] | p | The point to calculate the distance from. |
[in] | f | The face to calculate the distance to. |
[in] | signedDist | Whether to calculate the signed distance. Default is false. |
auto vcl::distance | ( | const PointType & | p, |
const FaceType & | f, | ||
PointType & | closest, | ||
bool | signedDist = false |
||
) |
Compute the distance between a 3D point and a face.
If the face is a triangle, the function will use the bounded distance function between a point and a triangle. If the face is a polygon, the face is first triangulated using an earcut algorithm, and then for each triangle, the distance between the point and the triangle is computed.
PointType | The type of point. Must satisfy the Point3Concept. |
FaceType | The type of face. Must satisfy the FaceConcept. |
[in] | p | The point to calculate the distance from. |
[in] | f | The face to calculate the distance to. |
[out] | closest | The closest point on the triangle to the given point. |
[in] | signedDist | Whether to calculate the signed distance. Default is false. |
auto vcl::distance | ( | const PointType & | p, |
const TriangleType & | triangle, | ||
bool | signedDist = false |
||
) |
Compute the distance between a 3D point and a 3D triangle.
PointType | The type of point. |
TriangleType | The type of triangle. |
[in] | p | The point to calculate the distance from. |
[in] | triangle | The triangle to calculate the distance to. |
[in] | signedDist | Whether to calculate the signed distance. Default is false. |
auto vcl::distance | ( | const PointType & | p, |
const TriangleType & | triangle, | ||
PointType & | closest, | ||
bool | signedDist = false |
||
) |
Compute the distance between a 3D point and a 3D triangle.
PointType | The type of point. |
TriangleType | The type of triangle. |
[in] | p | The point to calculate the distance from. |
[in] | triangle | The triangle to calculate the distance to. |
[out] | closest | The closest point on the triangle to the given point. |
[in] | signedDist | Whether to calculate the signed distance. Default is false. |
auto vcl::distance | ( | const PointType & | p, |
const VertexType & | v | ||
) |
Computes the distance between a Vertex and a 3D point.
VertexType | The type of vertex. Must satisfy the VertexConcept. |
PointType | The type of point. Must satisfy the Point3Concept. |
[in] | v | The vertex to calculate the distance from. |
[in] | p | The point to calculate the distance to. |
auto vcl::distance | ( | const PointType & | point, |
const PlaneType & | plane, | ||
bool | signedDist = false |
||
) |
Compute the distance between a point and a plane.
Compute the distance between a point and a plane. The distance can be signed or unsigned, depending on the value of the signedDist parameter.
PointType | The type of the input point. |
PlaneType | The type of the input plane. |
[in] | point | The input point. |
[in] | plane | The input plane. |
[in] | signedDist | If true, the distance is signed, otherwise it is unsigned. |
auto vcl::distance | ( | const PointType & | point, |
const SegmentType & | segment | ||
) |
Compute the distance between a point and a segment.
Compute the distance between a point and a segment of any dimension.
PointType | The type of the input point. |
SegmentType | The type of the input segment. |
[in] | point | The input point. |
[in] | segment | The input segment. |
auto vcl::distance | ( | const PointType & | point, |
const SegmentType & | segment, | ||
PointType & | closestPoint | ||
) |
Compute the distance between a point and a segment.
Compute the distance between a point and a segment of any dimension. The closest point on the segment is also computed, and stored in the closestPoint parameter.
PointType | The type of the input point. |
SegmentType | The type of the input segment. |
[in] | point | The input point. |
[in] | segment | The input segment. |
[out] | closestPoint | The closest point on the segment. |
auto vcl::distance | ( | const PointType & | point0, |
const PointType & | point1 | ||
) |
Compute the distance between two Points of any dimension.
PointType | The type of the input points. |
[in] | point0 | The first input point. |
[in] | point1 | The second input point. |
auto vcl::distance | ( | const SegmentType & | segment, |
const PointType & | point | ||
) |
Compute the distance between a point and a segment.
Compute the distance between a point and a segment of any dimension.
PointType | The type of the input point. |
SegmentType | The type of the input segment. |
[in] | point | The input point. |
[in] | segment | The input segment. |
auto vcl::distance | ( | const TriangleType & | triangle, |
const PointType & | p, | ||
bool | signedDist = false |
||
) |
Compute the distance between a 3D point and a 3D triangle.
PointType | The type of point. |
TriangleType | The type of triangle. |
[in] | p | The point to calculate the distance from. |
[in] | triangle | The triangle to calculate the distance to. |
[in] | signedDist | Whether to calculate the signed distance. Default is false. |
auto vcl::distance | ( | const VertexType & | v, |
const FaceType & | f, | ||
bool | signedDist = false |
||
) |
Compute the distance between a vertex and a face.
If the face is a triangle, the function will use the bounded distance function between a point and a triangle. If the face is a polygon, the face is first triangulated using an earcut algorithm, and then for each triangle, the distance between the point and the triangle is computed.
VertexType | The type of Vertex. Must satisfy the VertexConcept. |
FaceType | The type of face. Must satisfy the FaceConcept. |
[in] | v | The vertex to calculate the distance from. |
[in] | f | The face to calculate the distance to. |
[in] | signedDist | Whether to calculate the signed distance. Default is false. |
auto vcl::distance | ( | const VertexType & | v, |
const PointType & | p | ||
) |
Computes the distance between a Vertex and a 3D point.
VertexType | The type of vertex. Must satisfy the VertexConcept. |
PointType | The type of point. Must satisfy the Point3Concept. |
[in] | v | The vertex to calculate the distance from. |
[in] | p | The point to calculate the distance to. |
auto vcl::distance | ( | const VertexType1 & | v1, |
const VertexType2 & | v2 | ||
) |
Computes the distance between two vertices.
VertexType1 | The type of the first vertex. Must satisfy the VertexConcept. |
VertexType2 | The type of the second vertex. Must satisfy the VertexConcept. |
[in] | v1 | The first vertex. |
[in] | v2 | The second vertex. |
Return a proper dist function between a Obj1 object and an Obj2 object.
The returned function is a lambda function that takes in input two const references of the desired types and returns a scalar that is the distance between the two objects.
If the distance function for your types is not defined, you can write your own vcl::distance overload that defines a proper distance function.