23#ifndef VCL_MESH_ELEM_ALGORITHMS_DISTANCE_H
24#define VCL_MESH_ELEM_ALGORITHMS_DISTANCE_H
26#include <vclib/mesh/elements.h>
28#include <vclib/algorithms/core.h>
29#include <vclib/space/core.h>
46template<VertexConcept VertexType, Po
int3Concept Po
intType>
47auto distance(
const VertexType& v,
const PointType&
p)
49 return v.position().dist(
p);
57template<Po
int3Concept Po
intType, VertexConcept VertexType>
58auto distance(
const PointType&
p,
const VertexType& v)
60 return v.position().dist(
p);
77template<VertexConcept VertexType1, VertexConcept VertexType2>
80 return v1.position().dist(v2.position());
106template<Po
int3Concept Po
intType, FaceConcept FaceType,
typename ScalarType>
116 f.vertex(0)->position(),
117 f.vertex(1)->position(),
118 f.vertex(2)->position());
123 if (f.vertexNumber() == 3) {
125 f.vertex(0)->position(),
126 f.vertex(1)->position(),
127 f.vertex(2)->position());
132 ScalarType minDist = maxDist;
140 f.vertex(
tris[
i])->position(),
141 f.vertex(
tris[
i + 1])->position(),
142 f.vertex(
tris[
i + 2])->position()),
147 if (std::abs(d) < minDist) {
148 minDist = std::abs(d);
179template<Po
int3Concept Po
intType, FaceConcept FaceType,
typename ScalarType>
196template<FaceConcept FaceType, Po
int3Concept Po
intType,
typename ScalarType>
227template<Po
int3Concept Po
intType, FaceConcept FaceType>
234 using ScalarType = PointType::ScalarType;
236 ScalarType maxDist = std::numeric_limits<ScalarType>::max();
259template<Po
int3Concept Po
intType, FaceConcept FaceType>
262 using ScalarType = PointType::ScalarType;
266 ScalarType maxDist = std::numeric_limits<ScalarType>::max();
275template<FaceConcept FaceType, Po
int3Concept Po
intType>
300template<VertexConcept VertexType, FaceConcept FaceType>
311template<FaceConcept FaceType, VertexConcept VertexType>
A class representing a box in N-dimensional space.
Definition box.h:46
PointT size() const
Computes the size of the box.
Definition box.h:267
The TriangleWrapper class is a wrapper around a N-Dimensional triangle.
Definition triangle_wrapper.h:54
auto 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.
Definition distance.h:203
auto distance(const PointType &point0, const PointType &point1)
Compute the distance between two Points of any dimension.
Definition distance.h:45
std::vector< uint > earCut(Iterator begin, Iterator end)
Triangulates a simple polygon with no holes using the ear-cutting algorithm.
Definition ear_cut.h:90