I wrote a small test method, which shows a case when the method ProjectPointOntoPlane() gives a wrong result, which is attached to this text. I also attached a screenshot where you can see the wrong result.
Proposal for solving this bug:
The vtk method "vtkPlane::GeneralizedProjectPoint()" does also project a point onto a plane and works fine in my case. So you can use this method for a correct calculation of the projected point in the PlaneGeometry class.
#include <mitkPlaneGeometry.h>
static void projectPoint()
{
mitk::PlaneGeometry::Pointer myPlaneGeometry = mitk::PlaneGeometry::New(); mitk::Vector3D normal; normal[0] = 0; normal[1] = 0; normal[2] = 1; mitk::Point3D point; point[0] = -27.582859; point[1] = 50; point[2] = 200.27742; myPlaneGeometry->InitializePlane(point,normal); std::cout << std::endl << std::endl << "Our normal is: " << normal << std::endl; std::cout << "so ALL projected points should have exactly the same z- value!" << std::endl; mitk::Point3D myPoint1; myPoint1[0] = -27.582859; myPoint1[1] = 50.00; myPoint1[2] = 200.27742; mitk::Point3D myPoint2; myPoint2[0] = -26.58662; myPoint2[1] = 50.00; myPoint2[2] = 200.19026; std::cout << "Point1: " << myPoint1 << "=> "; std::cout << "Projected Point1: " << myPlaneGeometry->ProjectPointOntoPlane(myPoint1) << std::endl; std::cout << "Point2: " << myPoint2 << "=> "; std::cout << "Projected Point2: " << myPlaneGeometry->ProjectPointOntoPlane(myPoint2) << std::endl;
}