Skip to content
Snippets Groups Projects
Commit a7d60869 authored by Dmitri Naumov's avatar Dmitri Naumov
Browse files

[MaL] Inline sqrDist(double*,...).

This improves GeoLib::SearchNearestPoints() by factor >1.4.
parent 2db1faa1
No related branches found
No related tags found
No related merge requests found
...@@ -42,12 +42,6 @@ double calcProjPntToLineAndDists(const double p[3], const double a[3], ...@@ -42,12 +42,6 @@ double calcProjPntToLineAndDists(const double p[3], const double a[3],
return sqrt (sqrDist (p, proj_pnt)); return sqrt (sqrDist (p, proj_pnt));
} }
double sqrDist(const double* p0, const double* p1)
{
const double v[3] = {p1[0] - p0[0], p1[1] - p0[1], p1[2] - p0[2]};
return scalarProduct<double,3>(v,v);
}
double getAngle (const double p0[3], const double p1[3], const double p2[3]) double getAngle (const double p0[3], const double p1[3], const double p2[3])
{ {
const double v0[3] = {p0[0]-p1[0], p0[1]-p1[1], p0[2]-p1[2]}; const double v0[3] = {p0[0]-p1[0], p0[1]-p1[1], p0[2]-p1[2]};
......
...@@ -122,7 +122,12 @@ bool operator==(TemplatePoint<T,DIM> const& a, TemplatePoint<T,DIM> const& b) ...@@ -122,7 +122,12 @@ bool operator==(TemplatePoint<T,DIM> const& a, TemplatePoint<T,DIM> const& b)
} }
/** squared dist between double arrays p0 and p1 (size of arrays is 3) */ /** squared dist between double arrays p0 and p1 (size of arrays is 3) */
double sqrDist(const double* p0, const double* p1); inline
double sqrDist(const double* p0, const double* p1)
{
const double v[3] = {p1[0] - p0[0], p1[1] - p0[1], p1[2] - p0[2]};
return scalarProduct<double,3>(v,v);
}
/** Distance between points p0 and p1 in the maximum norm. */ /** Distance between points p0 and p1 in the maximum norm. */
template <typename T> template <typename T>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment