Add distance2 for point
This commit is contained in:
parent
2ef2554316
commit
6d879a96de
12
point.cpp
12
point.cpp
@ -29,9 +29,15 @@ using namespace util;
|
||||
|
||||
double
|
||||
point::distance (const point &other) const {
|
||||
return sqrt ((x - other.x) * (x - other.x) +
|
||||
(y - other.y) * (y - other.y) +
|
||||
(z - other.z) * (z - other.z));
|
||||
return sqrt (distance2 (other));
|
||||
}
|
||||
|
||||
|
||||
double
|
||||
point::distance2 (const point &other) const {
|
||||
return (x - other.x) * (x - other.x) +
|
||||
(y - other.y) * (y - other.y) +
|
||||
(z - other.z) * (z - other.z);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user