Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions

mitk::PlaneGeometry Class Reference
[Geometry Classes]

Describes a two-dimensional, rectangular plane. More...

#include <mitkPlaneGeometry.h>

Inheritance diagram for mitk::PlaneGeometry:
Inheritance graph
[legend]
Collaboration diagram for mitk::PlaneGeometry:
Collaboration graph
[legend]

List of all members.

Public Types

enum  PlaneOrientation { Transversal, Sagittal, Frontal }
typedef PlaneGeometry Self
typedef Geometry2D Superclass
typedef itk::SmartPointer< SelfPointer
typedef itk::SmartPointer
< const Self
ConstPointer

Public Member Functions

virtual const char * GetClassName () const
 Method for creation through the object factory.
virtual void IndexToWorld (const Point2D &pt_units, Point2D &pt_mm) const
virtual void WorldToIndex (const Point2D &pt_mm, Point2D &pt_units) const
virtual void IndexToWorld (const Point2D &atPt2d_units, const Vector2D &vec_units, Vector2D &vec_mm) const
virtual void WorldToIndex (const Point2D &atPt2d_mm, const Vector2D &vec_mm, Vector2D &vec_units) const
virtual void Initialize ()
 Initialize the Geometry3D.
virtual void InitializeStandardPlane (const Geometry3D *geometry3D, PlaneOrientation planeorientation=Transversal, ScalarType zPosition=0, bool frontside=true, bool rotated=false)
 Initialize a plane with orientation planeorientation (default: transversal) with respect to geometry3D (default: identity). Spacing also taken from geometry3D.
virtual void InitializeStandardPlane (const Geometry3D *geometry3D, bool top, PlaneOrientation planeorientation=Transversal, bool frontside=true, bool rotated=false)
 Initialize a plane with orientation planeorientation (default: transversal) with respect to geometry3D (default: identity). Spacing also taken from geometry3D.
virtual void InitializeStandardPlane (ScalarType width, ScalarType height, const AffineTransform3D *transform=NULL, PlaneOrientation planeorientation=Transversal, ScalarType zPosition=0, bool frontside=true, bool rotated=false)
 Initialize a plane with orientation planeorientation (default: transversal) with respect to transform (default: identity) given width and height in units.
virtual void InitializeStandardPlane (ScalarType width, ScalarType height, const Vector3D &spacing, PlaneOrientation planeorientation=Transversal, ScalarType zPosition=0, bool frontside=true, bool rotated=false)
 Initialize plane with orientation planeorientation (default: transversal) given width, height and spacing.
virtual void InitializeStandardPlane (ScalarType width, ScalarType height, const Vector3D &rightVector, const Vector3D &downVector, const Vector3D *spacing=NULL)
 Initialize plane by width and height in pixels, right-/down-vector (itk) to describe orientation in world-space (vectors will be normalized) and spacing (default: 1.0 mm in all directions).
virtual void InitializeStandardPlane (ScalarType width, ScalarType height, const VnlVector &rightVector, const VnlVector &downVector, const Vector3D *spacing=NULL)
 Initialize plane by width and height in pixels, right-/down-vector (vnl) to describe orientation in world-space (vectors will be normalized) and spacing (default: 1.0 mm in all directions).
virtual void InitializeStandardPlane (const Vector3D &rightVector, const Vector3D &downVector, const Vector3D *spacing=NULL)
 Initialize plane by right-/down-vector (itk) and spacing (default: 1.0 mm in all directions).
virtual void InitializeStandardPlane (const VnlVector &rightVector, const VnlVector &downVector, const Vector3D *spacing=NULL)
 Initialize plane by right-/down-vector (vnl) and spacing (default: 1.0 mm in all directions).
virtual void InitializePlane (const Point3D &origin, const Vector3D &normal)
 Initialize plane by origin and normal (size is 1.0 mm in all directions, direction of right-/down-vector valid but undefined).
void SetMatrixByVectors (const VnlVector &rightVector, const VnlVector &downVector, ScalarType thickness=1.0)
 Initialize plane by right-/down-vector.
Vector3D GetNormal () const
 Normal of the plane.
VnlVector GetNormalVnl () const
 Normal of the plane as VnlVector.
virtual ScalarType SignedDistance (const Point3D &pt3d_mm) const
 Signed distance of the point from the geometry (bounding-box not considered)
virtual bool IsAbove (const Point3D &pt3d_mm) const
 Test if the point is above the geometry (bounding-box not considered)
ScalarType DistanceFromPlane (const Point3D &pt3d_mm) const
 Distance of the point from the plane (bounding-box not considered)
ScalarType SignedDistanceFromPlane (const Point3D &pt3d_mm) const
 Signed distance of the point from the plane (bounding-box not considered)
ScalarType DistanceFromPlane (const PlaneGeometry *plane) const
 Distance of the plane from another plane (bounding-box not considered)
ScalarType SignedDistanceFromPlane (const PlaneGeometry *plane) const
 Signed distance of the plane from another plane (bounding-box not considered)
bool IntersectionLine (const PlaneGeometry *plane, Line3D &crossline) const
 Calculate the intersecting line of two planes.
unsigned int IntersectWithPlane2D (const PlaneGeometry *plane, Point2D &lineFrom, Point2D &lineTo) const
 Calculate two points where another plane intersects the border of this plane.
double Angle (const PlaneGeometry *plane) const
 Calculate the angle between two planes.
double Angle (const Line3D &line) const
 Calculate the angle between the plane and a line.
bool IntersectionPoint (const Line3D &line, Point3D &intersectionPoint) const
 Calculate intersection point between the plane and a line.
bool IntersectionPointParam (const Line3D &line, double &t) const
 Calculate line parameter of intersection point between the plane and a line.
bool IsParallel (const PlaneGeometry *plane) const
 Returns whether the plane is parallel to another plane.
bool IsOnPlane (const Point3D &point) const
 Returns whether the point is on the plane (bounding-box not considered)
bool IsOnPlane (const Line3D &line) const
 Returns whether the line is on the plane (bounding-box not considered)
bool IsOnPlane (const PlaneGeometry *plane) const
 Returns whether the plane is on the plane (bounding-box not considered)
Point3D ProjectPointOntoPlane (const Point3D &pt) const
 Returns the lot from the point to the plane.
virtual void SetIndexToWorldTransform (AffineTransform3D *transform)
virtual void SetBounds (const BoundingBox::BoundsArrayType &bounds)
AffineGeometryFrame3D::Pointer Clone () const
 clones the geometry
virtual void ExecuteOperation (Operation *operation)

Static Public Member Functions

static Pointer New ()
static void EnsurePerpendicularNormal (AffineTransform3D *transform)
 Change transform so that the third column of the transform-martix is perpendicular to the first two columns.

Protected Member Functions

 PlaneGeometry ()
virtual ~PlaneGeometry ()
virtual void InitializeGeometry (Self *newGeometry) const
virtual void PrintSelf (std::ostream &os, itk::Indent indent) const

Detailed Description

Describes a two-dimensional, rectangular plane.

Definition at line 39 of file mitkPlaneGeometry.h.


Member Typedef Documentation

typedef itk::SmartPointer<const Self> mitk::PlaneGeometry::ConstPointer

Reimplemented from mitk::Geometry2D.

Definition at line 42 of file mitkPlaneGeometry.h.

typedef itk::SmartPointer<Self> mitk::PlaneGeometry::Pointer

Reimplemented from mitk::Geometry2D.

Definition at line 42 of file mitkPlaneGeometry.h.

Reimplemented from mitk::Geometry2D.

Definition at line 42 of file mitkPlaneGeometry.h.

Reimplemented from mitk::Geometry2D.

Definition at line 42 of file mitkPlaneGeometry.h.


Member Enumeration Documentation

Enumerator:
Transversal 
Sagittal 
Frontal 

Definition at line 47 of file mitkPlaneGeometry.h.


Constructor & Destructor Documentation

mitk::PlaneGeometry::PlaneGeometry (  ) [protected]

Definition at line 25 of file mitkPlaneGeometry.cpp.

{
mitk::PlaneGeometry::~PlaneGeometry (  ) [protected, virtual]

Definition at line 31 of file mitkPlaneGeometry.cpp.

{

Member Function Documentation

double mitk::PlaneGeometry::Angle ( const PlaneGeometry plane ) const

Calculate the angle between two planes.

Returns:
angle in radiants

Definition at line 576 of file mitkPlaneGeometry.cpp.

Referenced by IsOnPlane().

double mitk::PlaneGeometry::Angle ( const Line3D line ) const

Calculate the angle between the plane and a line.

Returns:
angle in radiants

Definition at line 582 of file mitkPlaneGeometry.cpp.

References mitk::Geometry3D::GetMatrixColumn().

{
  return angle(plane->GetMatrixColumn(2), GetMatrixColumn(2));
}
AffineGeometryFrame3D::Pointer mitk::PlaneGeometry::Clone (  ) const [virtual]

clones the geometry

Overwrite in all sub-classes. Normally looks like:

  //##  Self::Pointer newGeometry = Self::New();
  //##  newGeometry->Initialize();
  //##  InitializeGeometry(newGeometry);
  //##  return newGeometry.GetPointer();
  //## 
See also:
InitializeGeometry

Reimplemented from mitk::Geometry2D.

Definition at line 674 of file mitkPlaneGeometry.cpp.

References GetNormal(), GetNormalVnl(), and SignedDistanceFromPlane().

Referenced by mitk::SlicedGeometry3D::GetGeometry2D(), mitk::PlanesPerpendicularToLinesFilter::SetPlane(), and mitk::AbstractTransformGeometry::SetPlane().

{
  ScalarType len = this->GetNormalVnl().two_norm();
  return pt - this->GetNormal() * this->SignedDistanceFromPlane( pt ) / len;
}


AffineGeometryFrame3D::Pointer
ScalarType mitk::PlaneGeometry::DistanceFromPlane ( const Point3D &  pt3d_mm ) const

Distance of the point from the plane (bounding-box not considered)

Definition at line 499 of file mitkPlaneGeometry.cpp.

References itk::AffineGeometryFrame< TScalarType, NDimensions >::m_IndexToWorldTransform.

Referenced by mitk::PlanarFigureMapper2D::Paint(), and mitk::SlicesRotator::RotateToPoint().

{
  return m_IndexToWorldTransform
    ->GetMatrix().GetVnlMatrix().get_column(2);
}
ScalarType mitk::PlaneGeometry::DistanceFromPlane ( const PlaneGeometry plane ) const [inline]

Distance of the plane from another plane (bounding-box not considered)

Result is 0 if planes are not parallel.

Definition at line 243 of file mitkPlaneGeometry.h.

  {
    return fabs(SignedDistanceFromPlane(plane));
  }
void mitk::PlaneGeometry::EnsurePerpendicularNormal ( mitk::AffineTransform3D transform ) [static]

Change transform so that the third column of the transform-martix is perpendicular to the first two columns.

Definition at line 44 of file mitkPlaneGeometry.cpp.

References mitk::Geometry3D::Initialize().

{
  Superclass::Initialize();
}


void
PlaneGeometry::EnsurePerpendicularNormal(mitk::AffineTransform3D *transform)
{
  //ensure row(2) of transform to be perpendicular to plane, keep length.
  VnlVector normal = vnl_cross_3d(
    transform->GetMatrix().GetVnlMatrix().get_column(0),
    transform->GetMatrix().GetVnlMatrix().get_column(1) );

  normal.normalize();
  ScalarType len = transform->GetMatrix()
    .GetVnlMatrix().get_column(2).two_norm();
void mitk::PlaneGeometry::ExecuteOperation ( Operation operation ) [virtual]

Implements operation to re-orient the plane

Reimplemented from mitk::Geometry3D.

Definition at line 684 of file mitkPlaneGeometry.cpp.

{
  vtkTransform *transform = vtkTransform::New();
  transform->SetMatrix( m_VtkMatrix );

  switch ( operation->GetOperationType() )
  {
  case OpORIENT:
    {
      mitk::PlaneOperation *planeOp = dynamic_cast< mitk::PlaneOperation * >( operation );
      if ( planeOp == NULL )
      {
        return;
      }

      Point3D center = planeOp->GetPoint();

      Vector3D orientationVector = planeOp->GetNormal();
      Vector3D defaultVector;
      FillVector3D( defaultVector, 0.0, 0.0, 1.0 );

      Vector3D rotationAxis = itk::CrossProduct( orientationVector, defaultVector );
      //vtkFloatingPointType rotationAngle = acos( orientationVector[2] / orientationVector.GetNorm() );

      vtkFloatingPointType rotationAngle = atan2( (double) rotationAxis.GetNorm(), (double) (orientationVector * defaultVector) );
      rotationAngle *= 180.0 / vnl_math::pi;

      transform->PostMultiply();
      transform->Identity();
      transform->Translate( center[0], center[1], center[2] );
      transform->RotateWXYZ( rotationAngle, rotationAxis[0], rotationAxis[1], rotationAxis[2] );
      transform->Translate( -center[0], -center[1], -center[2] );
      break;
    }


  default:
    Superclass::ExecuteOperation( operation );
    transform->Delete();
    return;
virtual const char* mitk::PlaneGeometry::GetClassName (  ) const [virtual]

Method for creation through the object factory.

Reimplemented from mitk::Geometry2D.

Vector3D mitk::PlaneGeometry::GetNormal (  ) const
VnlVector mitk::PlaneGeometry::GetNormalVnl (  ) const

Normal of the plane as VnlVector.

Definition at line 491 of file mitkPlaneGeometry.cpp.

Referenced by Clone().

void mitk::PlaneGeometry::IndexToWorld ( const Point2D &  atPt2d_units,
const Vector2D &  vec_units,
Vector2D &  vec_mm 
) const [virtual]

Definition at line 101 of file mitkPlaneGeometry.cpp.

References mitk::Geometry2D::m_ScaleFactorMMPerUnitX, and mitk::Geometry2D::m_ScaleFactorMMPerUnitY.

{
  pt_units[0]=pt_mm[0]*(1.0/m_ScaleFactorMMPerUnitX);
  pt_units[1]=pt_mm[1]*(1.0/m_ScaleFactorMMPerUnitY);
}

void mitk::PlaneGeometry::IndexToWorld ( const Point2D &  pt_units,
Point2D &  pt_mm 
) const [virtual]

Definition at line 87 of file mitkPlaneGeometry.cpp.

Referenced by mappingTests2D().

void mitk::PlaneGeometry::Initialize (  ) [virtual]

Initialize the Geometry3D.

Reimplemented from mitk::Geometry3D.

Definition at line 37 of file mitkPlaneGeometry.cpp.

{
}
void mitk::PlaneGeometry::InitializeGeometry ( Self newGeometry ) const [protected, virtual]

Reimplemented from mitk::Geometry2D.

Definition at line 733 of file mitkPlaneGeometry.cpp.

void mitk::PlaneGeometry::InitializePlane ( const Point3D &  origin,
const Vector3D &  normal 
) [virtual]

Initialize plane by origin and normal (size is 1.0 mm in all directions, direction of right-/down-vector valid but undefined).

Definition at line 437 of file mitkPlaneGeometry.cpp.

{
  VnlVector rightVectorVnl(3), downVectorVnl;

  if( Equal( normal[1], 0.0f ) == false )
  {
    FillVector3D( rightVectorVnl, 1.0f, -normal[0]/normal[1], 0.0f ); 
    rightVectorVnl.normalize();
  }
  else
  {
    FillVector3D( rightVectorVnl, 0.0f, 1.0f, 0.0f );
  }
void mitk::PlaneGeometry::InitializeStandardPlane ( const Geometry3D geometry3D,
PlaneOrientation  planeorientation = Transversal,
ScalarType  zPosition = 0,
bool  frontside = true,
bool  rotated = false 
) [virtual]

Initialize a plane with orientation planeorientation (default: transversal) with respect to geometry3D (default: identity). Spacing also taken from geometry3D.

Warning:
A former version of this method created a geometry with unit spacing. For unit spacing use
   // for in-plane unit spacing:
   thisgeometry->SetSizeInUnits(thisgeometry->GetExtentInMM(0),
     thisgeometry->GetExtentInMM(1));
   // additionally, for unit spacing in normal direction (former version
   // did not do this):
   thisgeometry->SetExtentInMM(2, 1.0);

Definition at line 288 of file mitkPlaneGeometry.cpp.

Referenced by InitializeStandardPlane().

{
  this->SetReferenceGeometry( const_cast< Geometry3D * >( geometry3D ) );

  ScalarType width, height;

  const BoundingBox::BoundsArrayType& boundsarray = 
    geometry3D->GetBoundingBox()->GetBounds();

  Vector3D  originVector; 
  FillVector3D(originVector,  boundsarray[0], boundsarray[2], boundsarray[4]);
  if(geometry3D->GetImageGeometry())
  {
    FillVector3D( originVector,
      originVector[0] - 0.5, 
      originVector[1] - 0.5, 
      originVector[2] - 0.5 );
  }
  switch(planeorientation)
  {
    case Transversal:
      width  = geometry3D->GetExtent(0);
      height = geometry3D->GetExtent(1);
      break;
    case Frontal:
      width  = geometry3D->GetExtent(0);
      height = geometry3D->GetExtent(2);
      break;
    case Sagittal:
      width  = geometry3D->GetExtent(1);
      height = geometry3D->GetExtent(2);
      break;
    default:
      itkExceptionMacro("unknown PlaneOrientation");
  }

  InitializeStandardPlane( width, height, 
    geometry3D->GetIndexToWorldTransform(),
    planeorientation, zPosition, frontside, rotated );

  ScalarType bounds[6]= { 0, width, 0, height, 0, 1 };
  this->SetBounds( bounds );

void mitk::PlaneGeometry::InitializeStandardPlane ( const Geometry3D geometry3D,
bool  top,
PlaneOrientation  planeorientation = Transversal,
bool  frontside = true,
bool  rotated = false 
) [virtual]

Initialize a plane with orientation planeorientation (default: transversal) with respect to geometry3D (default: identity). Spacing also taken from geometry3D.

Parameters:
topif true, create plane at top, otherwise at bottom (for PlaneOrientation Transversal, for other plane locations respectively)

Definition at line 343 of file mitkPlaneGeometry.cpp.

{
  ScalarType zPosition;

  switch(planeorientation)
  {
    case Transversal:
      zPosition = (top ? 0.5 : geometry3D->GetExtent(2)-1+0.5);
      break;
    case Frontal:
      zPosition = (top ? 0.5 : geometry3D->GetExtent(1)-1+0.5);
      break;
    case Sagittal:
      zPosition = (top ? 0.5 : geometry3D->GetExtent(0)-1+0.5);
      break;
virtual void mitk::PlaneGeometry::InitializeStandardPlane ( ScalarType  width,
ScalarType  height,
const AffineTransform3D transform = NULL,
PlaneOrientation  planeorientation = Transversal,
ScalarType  zPosition = 0,
bool  frontside = true,
bool  rotated = false 
) [virtual]

Initialize a plane with orientation planeorientation (default: transversal) with respect to transform (default: identity) given width and height in units.

virtual void mitk::PlaneGeometry::InitializeStandardPlane ( ScalarType  width,
ScalarType  height,
const Vector3D &  spacing,
PlaneOrientation  planeorientation = Transversal,
ScalarType  zPosition = 0,
bool  frontside = true,
bool  rotated = false 
) [virtual]

Initialize plane with orientation planeorientation (default: transversal) given width, height and spacing.

virtual void mitk::PlaneGeometry::InitializeStandardPlane ( ScalarType  width,
ScalarType  height,
const Vector3D &  rightVector,
const Vector3D &  downVector,
const Vector3D *  spacing = NULL 
) [virtual]

Initialize plane by width and height in pixels, right-/down-vector (itk) to describe orientation in world-space (vectors will be normalized) and spacing (default: 1.0 mm in all directions).

The vectors are normalized and multiplied by the respective spacing before they are set in the matrix.

virtual void mitk::PlaneGeometry::InitializeStandardPlane ( ScalarType  width,
ScalarType  height,
const VnlVector &  rightVector,
const VnlVector &  downVector,
const Vector3D *  spacing = NULL 
) [virtual]

Initialize plane by width and height in pixels, right-/down-vector (vnl) to describe orientation in world-space (vectors will be normalized) and spacing (default: 1.0 mm in all directions).

The vectors are normalized and multiplied by the respective spacing before they are set in the matrix.

void mitk::PlaneGeometry::InitializeStandardPlane ( const Vector3D &  rightVector,
const Vector3D &  downVector,
const Vector3D *  spacing = NULL 
) [virtual]

Initialize plane by right-/down-vector (itk) and spacing (default: 1.0 mm in all directions).

The length of the right-/-down-vector is used as width/height in units, respectively. Then, the vectors are normalized and multiplied by the respective spacing before they are set in the matrix.

Definition at line 369 of file mitkPlaneGeometry.cpp.

void mitk::PlaneGeometry::InitializeStandardPlane ( const VnlVector &  rightVector,
const VnlVector &  downVector,
const Vector3D *  spacing = NULL 
) [virtual]

Initialize plane by right-/down-vector (vnl) and spacing (default: 1.0 mm in all directions).

The length of the right-/-down-vector is used as width/height in units, respectively. Then, the vectors are normalized and multiplied by the respective spacing before they are set in the matrix.

Definition at line 378 of file mitkPlaneGeometry.cpp.

References InitializeStandardPlane().

{
  InitializeStandardPlane( rightVector.Get_vnl_vector(), 
    downVector.Get_vnl_vector(), spacing );
}


void
PlaneGeometry::InitializeStandardPlane( const VnlVector& rightVector, 
bool mitk::PlaneGeometry::IntersectionLine ( const PlaneGeometry plane,
Line3D crossline 
) const

Calculate the intersecting line of two planes.

Returns:
true planes are intersecting
false planes do not intersect

Definition at line 520 of file mitkPlaneGeometry.cpp.

References SignedDistanceFromPlane().

Referenced by QmitkBoundingObjectWidget::CreateBoundingObject(), mitk::SlicesRotator::ExecuteAction(), QmitkStdMultiWidget::GetCrossPosition(), mitk::Geometry2DDataMapper2D::Paint(), and mitk::SlicesRotator::RotateToPoint().

{
  return SignedDistanceFromPlane(pt3d_mm) > 0;
}


bool
PlaneGeometry::IntersectionLine( 
  const PlaneGeometry* plane, Line3D& crossline ) const
{
  Vector3D normal = this->GetNormal();
  normal.Normalize();

  Vector3D planeNormal = plane->GetNormal();
  planeNormal.Normalize();

  Vector3D direction = itk::CrossProduct( normal, planeNormal );

  if ( direction.GetSquaredNorm() < eps )
    return false; 

  crossline.SetDirection( direction );

  double N1dN2 = normal * planeNormal;
  double determinant = 1.0 - N1dN2 * N1dN2;

  Vector3D origin = this->GetOrigin().GetVectorFromOrigin();
  Vector3D planeOrigin = plane->GetOrigin().GetVectorFromOrigin();

  double d1 = normal * origin;
  double d2 = planeNormal * planeOrigin;

  double c1 = ( d1 - d2 * N1dN2 ) / determinant;
bool mitk::PlaneGeometry::IntersectionPoint ( const Line3D line,
Point3D &  intersectionPoint 
) const

Calculate intersection point between the plane and a line.

Parameters:
intersectionPointintersection point
Returns:
true if unique intersection exists, i.e., if line is not on or parallel to the plane

Definition at line 589 of file mitkPlaneGeometry.cpp.

References mitk::Line< TCoordRep, NPointDimension >::GetDirection(), and mitk::Geometry3D::GetMatrixColumn().

Referenced by mitk::PlaneCutFilter::_computeIntersection(), QmitkBoundingObjectWidget::CreateBoundingObject(), mitk::SlicesRotator::ExecuteAction(), QmitkStdMultiWidget::GetCrossPosition(), and mitk::SlicesRotator::RotateToPoint().

{
  return vnl_math::pi_over_2
    - angle( line.GetDirection().Get_vnl_vector(), GetMatrixColumn(2) );
}


bool PlaneGeometry::IntersectionPoint( 
  const Line3D &line, Point3D &intersectionPoint ) const
{
  Vector3D planeNormal = this->GetNormal();
  planeNormal.Normalize();

  Vector3D lineDirection = line.GetDirection();
  lineDirection.Normalize();

  double t = planeNormal * lineDirection;
  if ( fabs( t ) < eps )
  {
    return false;
  }

bool mitk::PlaneGeometry::IntersectionPointParam ( const Line3D line,
double &  t 
) const

Calculate line parameter of intersection point between the plane and a line.

Parameters:
tparameter of line: intersection point is line.GetPoint()+t*line.GetDirection()
Returns:
true if unique intersection exists, i.e., if line is not on or parallel to the plane

Definition at line 614 of file mitkPlaneGeometry.cpp.

{
  Vector3D planeNormal = this->GetNormal();
  planeNormal.Normalize();

  Vector3D lineDirection = line.GetDirection();
  lineDirection.Normalize();

  t = planeNormal * lineDirection;

  if ( fabs( t ) < eps )
  {
    return false;
unsigned int mitk::PlaneGeometry::IntersectWithPlane2D ( const PlaneGeometry plane,
Point2D &  lineFrom,
Point2D &  lineTo 
) const

Calculate two points where another plane intersects the border of this plane.

Returns:
number of intersection points (0..2). First interection point (if existing) is returned in lineFrom, second in lineTo.

Definition at line 556 of file mitkPlaneGeometry.cpp.

{
  Line3D crossline;
  if ( this->IntersectionLine( plane, crossline ) == false )
    return 0;

  Point2D  point2; 
  Vector2D direction2; 

  this->Map( crossline.GetPoint(), point2 );
bool mitk::PlaneGeometry::IsAbove ( const Point3D &  pt3d_mm ) const [virtual]

Test if the point is above the geometry (bounding-box not considered)

Reimplemented from mitk::Geometry2D.

Definition at line 513 of file mitkPlaneGeometry.cpp.

References SignedDistanceFromPlane().

Referenced by mitk::PlaneCutFilter::_computeIntersection().

{
  return SignedDistanceFromPlane(pt3d_mm);
}
bool mitk::PlaneGeometry::IsOnPlane ( const Point3D &  point ) const

Returns whether the point is on the plane (bounding-box not considered)

Definition at line 644 of file mitkPlaneGeometry.cpp.

References Angle().

{
  return ( (Angle(plane) < 10.0 * mitk::sqrteps ) || ( Angle(plane) > ( vnl_math::pi - 10.0 * sqrteps ) ) ) ;
} 
bool mitk::PlaneGeometry::IsOnPlane ( const Line3D line ) const

Returns whether the line is on the plane (bounding-box not considered)

Definition at line 651 of file mitkPlaneGeometry.cpp.

References mitk::Geometry2D::Distance().

{
  return Distance(point) < eps;
}

bool mitk::PlaneGeometry::IsOnPlane ( const PlaneGeometry plane ) const

Returns whether the plane is on the plane (bounding-box not considered)

Returns:
true iff the normal vector of the planes point to the same or the exactly oposit direction and the distance of the planes is < eps

Definition at line 659 of file mitkPlaneGeometry.cpp.

References mitk::Geometry2D::Distance(), mitk::Line< TCoordRep, NPointDimension >::GetPoint(), and mitk::Line< TCoordRep, NPointDimension >::GetPoint2().

{
  return ( (Distance( line.GetPoint() ) < eps)
    && (Distance( line.GetPoint2() ) < eps) );
}
bool mitk::PlaneGeometry::IsParallel ( const PlaneGeometry plane ) const

Returns whether the plane is parallel to another plane.

Returns:
true iff the normal vectors both point to the same or exactly oposit direction

Definition at line 637 of file mitkPlaneGeometry.cpp.

Referenced by mitk::PlanarFigureMapper2D::Paint(), and ProjectPointOntoPlane().

static Pointer mitk::PlaneGeometry::New (  ) [static]
void mitk::PlaneGeometry::PrintSelf ( std::ostream &  os,
itk::Indent  indent 
) const [protected, virtual]

Reimplemented from mitk::Geometry2D.

Definition at line 739 of file mitkPlaneGeometry.cpp.

References mitk::Geometry2D::InitializeGeometry().

Point3D mitk::PlaneGeometry::ProjectPointOntoPlane ( const Point3D &  pt ) const

Returns the lot from the point to the plane.

Definition at line 666 of file mitkPlaneGeometry.cpp.

References mitk::Geometry2D::Distance(), mitk::Geometry3D::GetOrigin(), and IsParallel().

{
  return ( IsParallel( plane ) && (Distance( plane->GetOrigin() ) < eps) );
}

void mitk::PlaneGeometry::SetBounds ( const BoundingBox::BoundsArrayType &  bounds ) [virtual]

Definition at line 73 of file mitkPlaneGeometry.cpp.

{
  //currently the unit rectangle must be starting at the origin [0,0]
  assert(bounds[0]==0);
void mitk::PlaneGeometry::SetIndexToWorldTransform ( mitk::AffineTransform3D transform ) [virtual]

Reimplemented from mitk::Geometry2D.

Definition at line 64 of file mitkPlaneGeometry.cpp.

void mitk::PlaneGeometry::SetMatrixByVectors ( const VnlVector &  rightVector,
const VnlVector &  downVector,
ScalarType  thickness = 1.0 
)

Initialize plane by right-/down-vector.

Warning:
The vectors are set into the matrix as they are, without normalization!

Definition at line 461 of file mitkPlaneGeometry.cpp.

{
  VnlVector normal = vnl_cross_3d(rightVector, downVector);
  normal.normalize();
  normal *= thickness;

  AffineTransform3D::Pointer transform = AffineTransform3D::New();
  Matrix3D matrix;
ScalarType mitk::PlaneGeometry::SignedDistance ( const Point3D &  pt3d_mm ) const [virtual]

Signed distance of the point from the geometry (bounding-box not considered)

Reimplemented from mitk::Geometry2D.

Definition at line 506 of file mitkPlaneGeometry.cpp.

{
  return fabs(SignedDistance( pt3d_mm ));
}
ScalarType mitk::PlaneGeometry::SignedDistanceFromPlane ( const Point3D &  pt3d_mm ) const [inline]

Signed distance of the point from the plane (bounding-box not considered)

> 0 : point is in the direction of the direction vector.

Definition at line 226 of file mitkPlaneGeometry.h.

Referenced by Clone(), IntersectionLine(), IsAbove(), and mitk::SlicedGeometry3D::ReinitializePlanes().

  {
    ScalarType len = GetNormalVnl().two_norm();

    if( len == 0 )
      return 0;

    return (pt3d_mm-GetOrigin())*GetNormal() / len;
  }
ScalarType mitk::PlaneGeometry::SignedDistanceFromPlane ( const PlaneGeometry plane ) const [inline]

Signed distance of the plane from another plane (bounding-box not considered)

Result is 0 if planes are not parallel.

Definition at line 255 of file mitkPlaneGeometry.h.

References mitk::Geometry3D::GetOrigin().

  {
    if(IsParallel(plane))
    {
      return SignedDistance(plane->GetOrigin());
    }
    return 0;
  }
void mitk::PlaneGeometry::WorldToIndex ( const Point2D &  atPt2d_mm,
const Vector2D &  vec_mm,
Vector2D &  vec_units 
) const [virtual]

Definition at line 110 of file mitkPlaneGeometry.cpp.

References mitk::Geometry2D::m_ScaleFactorMMPerUnitX, and mitk::Geometry2D::m_ScaleFactorMMPerUnitY.

{
  vec_mm[0] = m_ScaleFactorMMPerUnitX * vec_units[0];
  vec_mm[1] = m_ScaleFactorMMPerUnitY * vec_units[1];
}


void mitk::PlaneGeometry::WorldToIndex ( const Point2D &  pt_mm,
Point2D &  pt_units 
) const [virtual]

Definition at line 94 of file mitkPlaneGeometry.cpp.

References mitk::Geometry2D::m_ScaleFactorMMPerUnitX, and mitk::Geometry2D::m_ScaleFactorMMPerUnitY.

Referenced by mappingTests2D().

{
  pt_mm[0]=m_ScaleFactorMMPerUnitX*pt_units[0];
  pt_mm[1]=m_ScaleFactorMMPerUnitY*pt_units[1];
}

The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines