Choreonoid  1.1
マクロ定義 | 関数
DistFuncs.cpp ファイル
#include "DistFuncs.h"

マクロ定義

#define EPS   1e-8
 

関数

std::ostream & operator<< (std::ostream &ost, const Point &p)
 
float SegSegDist (const Point &u0, const Point &u, const Point &v0, const Point &v, Point &cp0, Point &cp1)
 compute the minimum distance and the closest points between two line segments [詳解]
 
float PointPlaneDist (const Point &P, const Point &pointOnPlane, const Point &n, Point &cp)
 compute signed distance between a point and a plane [詳解]
 
float PointSegDist (const Point &P, const Point &u0, const Point &u1)
 compute distance between a point and a line segment [詳解]
 
bool PointFaceAppTest (const Point &P, const Point **vertices, const Point *edges, const Point &n)
 check whether a point is in Voroni region of a face [詳解]
 
float TriTriDist (const Point &U0, const Point &U1, const Point &U2, const Point &V0, const Point &V1, const Point &V2, Point &cp0, Point &cp1)
 compute the minimum distance and the closest points between two triangles [詳解]
 
float SegSegDist (const Point &u0, const Point &u1, const Point &v0, const Point &v1)
 compute distance between line segments [詳解]
 

マクロ定義詳解

#define EPS   1e-8

関数詳解

std::ostream& operator<< ( std::ostream &  ost,
const Point &  p 
)
bool PointFaceAppTest ( const Point &  P,
const Point **  vertices,
const Point *  edges,
const Point &  n 
)
inline

check whether a point is in Voroni region of a face

引数
pa point to be tested
verticesvertices of the triangle
edgesedges of the triangle
nnormal vector of the triangle
戻り値
true if the point is in the Voronoi region, false otherwise
float PointPlaneDist ( const Point &  P,
const Point &  pointOnPlane,
const Point &  n,
Point &  cp 
)
inline

compute signed distance between a point and a plane

引数
Pa point
pointOnPolanea point on the plane
nnormal vector of the plane
cpthe closest point on the plane from P
float PointSegDist ( const Point &  P,
const Point &  u0,
const Point &  u1 
)

compute distance between a point and a line segment

引数
Pthe point
u0one of end points of the line segment
u1the other end point of the line segment
戻り値
distance between the point and the line segment
float SegSegDist ( const Point &  u0,
const Point &  u,
const Point &  v0,
const Point &  v,
Point &  cp0,
Point &  cp1 
)
inline

compute the minimum distance and the closest points between two line segments

This function is implemented referring the following webpage http://www.softsurfer.com/Archive/algorithm_0106/algorithm_0106.htm

引数
u0start point of the first line segment
uvector from u0 to the other end point of the first line segment
v0start point of the second line segment
vvector from v0 the other end point of the second line segment
cp0the closest point on the first line segment
cp1the closest point on the second line segment
戻り値
the minimum distance
float SegSegDist ( const Point &  u0,
const Point &  u1,
const Point &  v0,
const Point &  v1 
)

compute distance between line segments

u0 one of end points of the first line segment u1 the other end point of the first line segment v0 one of end points of the second line segment v1 the other end point of the second line segment

戻り値
distance between line segments
float TriTriDist ( const Point &  U0,
const Point &  U1,
const Point &  U2,
const Point &  V0,
const Point &  V1,
const Point &  V2,
Point &  cp0,
Point &  cp1 
)

compute the minimum distance and the closest points between two triangles

引数
U0the first vertex of the first triangle
U1the second vertex of the first triangle
U2the third vertex of the first triangle
V0the first vertex of the second triangle
V1the second vertex of the second triangle
V2the third vertex of the second triangle
cp0the closest point on the first triangle
cp1the closest point on the second triangle
戻り値
the minimum distance