| 35 | } |
| 36 | |
| 37 | bool mitk::Cone::IsInside(const Point3D &worldPoint) const |
| 38 | { |
| 39 | // transform point from world to object coordinates |
| 40 | ScalarType p[4]; |
| 41 | p[0] = worldPoint[0]; |
| 42 | p[1] = worldPoint[1]; |
| 43 | p[2] = worldPoint[2]; |
| 44 | p[3] = 1; |
| 45 | |
| 46 | GetGeometry()->GetVtkTransform()->GetInverse()->TransformPoint(p, p); |
| 47 | |
| 48 | p[1] += 1; // translate point, so that it fits to the formula below, which describes a cone that has its cone vertex |
| 49 | // at the origin |
| 50 | return (sqrt(p[0] * p[0] + p[2] * p[2]) <= p[1] * 0.5) && (p[1] <= 2); // formula to calculate if a given point is |
| 51 | // inside a cone that has its cone vertex at |
| 52 | // the origin, is aligned on the second axis, |
| 53 | // has a radius of one an a height of two |
| 54 | } |
| 55 | |
| 56 | mitk::ScalarType mitk::Cone::GetVolume() |
| 57 | { |