VTK 的 Math 库,计算两个三维点之间的平方距离和欧几里得距离
#include <vtkMath.h>
int main(int, char* [])
{
// Create two points.
double p0[3] = { 0.0, 0.0, 0.0 };
double p1[3] = { 1.0, 1.0, 1.0 };
double squaredDistance = vtkMath::Distance2BetweenPoints(p0, p1);
double distance = std::sqrt(squaredDistance);
std::cout << "SquaredDistance = " << squaredDistance << std::endl;
std::cout << "Distance = " << distance << std::endl;
return 0;
}