MCPcopy Create free account
hub / github.com/MITK/MITK / IntersectionLine

Method IntersectionLine

Modules/Core/src/DataManagement/mitkPlaneGeometry.cpp:592–625  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

590 }
591
592 bool PlaneGeometry::IntersectionLine(const PlaneGeometry* plane, Line3D& crossline) const
593 {
594 Vector3D normal = this->GetNormal();
595 normal.Normalize();
596
597 Vector3D planeNormal = plane->GetNormal();
598 planeNormal.Normalize();
599
600 Vector3D direction = itk::CrossProduct(normal, planeNormal);
601
602 if (direction.GetSquaredNorm() < eps)
603 return false;
604
605 crossline.SetDirection(direction);
606
607 double N1dN2 = normal * planeNormal;
608 double determinant = 1.0 - N1dN2 * N1dN2;
609
610 Vector3D origin = this->GetOrigin().GetVectorFromOrigin();
611 Vector3D planeOrigin = plane->GetOrigin().GetVectorFromOrigin();
612
613 double d1 = normal * origin;
614 double d2 = planeNormal * planeOrigin;
615
616 double c1 = (d1 - d2 * N1dN2) / determinant;
617 double c2 = (d2 - d1 * N1dN2) / determinant;
618
619 Vector3D p = normal * c1 + planeNormal * c2;
620 crossline.GetPoint()[0] = p.GetVnlVector()[0];
621 crossline.GetPoint()[1] = p.GetVnlVector()[1];
622 crossline.GetPoint()[2] = p.GetVnlVector()[2];
623
624 return true;
625 }
626
627 unsigned int PlaneGeometry::IntersectWithPlane2D(const PlaneGeometry *plane, Point2D &lineFrom, Point2D &lineTo) const
628 {

Callers 6

IntersectWithPlane2DMethod · 0.95
GetSelectedPositionMethod · 0.80
CreateBoundingObjectMethod · 0.80
CheckRotationPossibleMethod · 0.80
CheckSwivelPossibleMethod · 0.80
CreateVtkCrosshairMethod · 0.80

Calls 5

GetNormalMethod · 0.95
NormalizeMethod · 0.80
SetDirectionMethod · 0.80
GetOriginMethod · 0.45
GetPointMethod · 0.45

Tested by

no test coverage detected