/// <summary> /// Invalidates the cached <see cref="ImagePlaneHelper"/>, forcing it to be recalculated the next time it is accessed. /// </summary> protected void InvalidateImagePlaneHelper() { lock (_syncLock) { _imagePlaneHelper = null; } }
/// <summary> /// Gets whether or not this image plane intersects with the specified other image plane. /// </summary> /// <param name="intersectionPointPatient1">Returns one end point of the line segment of intersection between the two planes, if it exists.</param> /// <param name="intersectionPointPatient2">Returns the other end point of the line segment of intersection between the two planes, if it exists.</param> /// <param name="other">The other <see cref="ImagePlaneHelper"/> with which to intersect.</param> /// <returns>True if an intersection between the planes exists; False otherwise.</returns> public bool IntersectsWith(ImagePlaneHelper other, out Vector3D intersectionPointPatient1, out Vector3D intersectionPointPatient2) { Platform.CheckForNullReference(other, "other"); intersectionPointPatient1 = intersectionPointPatient2 = null; // Bounding line segments of this (reference) image plane var lineSegmentsImagePlaneBounds = new[, ] { { ImageTopLeftPatient, ImageTopRightPatient }, { ImageTopLeftPatient, ImageBottomLeftPatient }, { ImageBottomRightPatient, ImageTopRightPatient }, { ImageBottomRightPatient, ImageBottomLeftPatient } }; var planeIntersectionPoints = new List <Vector3D>(); for (var i = 0; i < 4; ++i) { // Intersect the bounding line segments of the reference plane of the target plane var intersectionPoint = Vector3D.GetLinePlaneIntersection(other.ImageNormalPatient, other.ImageCenterPatient, lineSegmentsImagePlaneBounds[i, 0], lineSegmentsImagePlaneBounds[i, 1], true); if (intersectionPoint != null) { planeIntersectionPoints.Add(intersectionPoint); } } if (planeIntersectionPoints.Count < 2) { return(false); } intersectionPointPatient1 = planeIntersectionPoints[0]; intersectionPointPatient2 = planeIntersectionPoints.Find(point => !planeIntersectionPoints[0].Equals(point)); return(intersectionPointPatient1 != null && intersectionPointPatient2 != null); }
/// <summary> /// Gets whether or not this image plane intersects with the specified other image plane. /// </summary> /// <param name="intersectionPointPatient1">Returns one end point of the line segment of intersection between the two planes, if it exists.</param> /// <param name="intersectionPointPatient2">Returns the other end point of the line segment of intersection between the two planes, if it exists.</param> /// <param name="other">The other <see cref="ImagePlaneHelper"/> with which to intersect.</param> /// <returns>True if an intersection between the planes exists; False otherwise.</returns> public bool IntersectsWith(ImagePlaneHelper other, out Vector3D intersectionPointPatient1, out Vector3D intersectionPointPatient2) { Platform.CheckForNullReference(other, "other"); intersectionPointPatient1 = intersectionPointPatient2 = null; // Bounding line segments of this (reference) image plane var lineSegmentsImagePlaneBounds = new[,] { {ImageTopLeftPatient, ImageTopRightPatient}, {ImageTopLeftPatient, ImageBottomLeftPatient}, {ImageBottomRightPatient, ImageTopRightPatient}, {ImageBottomRightPatient, ImageBottomLeftPatient} }; var planeIntersectionPoints = new List<Vector3D>(); for (var i = 0; i < 4; ++i) { // Intersect the bounding line segments of the reference plane of the target plane var intersectionPoint = Vector3D.GetLinePlaneIntersection(other.ImageNormalPatient, other.ImageCenterPatient, lineSegmentsImagePlaneBounds[i, 0], lineSegmentsImagePlaneBounds[i, 1], true); if (intersectionPoint != null) planeIntersectionPoints.Add(intersectionPoint); } if (planeIntersectionPoints.Count < 2) return false; intersectionPointPatient1 = planeIntersectionPoints[0]; intersectionPointPatient2 = planeIntersectionPoints.Find(point => !planeIntersectionPoints[0].Equals(point)); return intersectionPointPatient1 != null && intersectionPointPatient2 != null; }
/// <summary> /// Gets whether or not this image plane intersects with the specified other image plane. /// </summary> /// <param name="other">The other <see cref="ImagePlaneHelper"/> with which to intersect.</param> /// <returns>True if an intersection between the planes exists; False otherwise.</returns> public bool IntersectsWith(ImagePlaneHelper other) { Vector3D p1, p2; return IntersectsWith(other, out p1, out p2); }
/// <summary> /// Gets the angle between the normals of this image plane and the specified other image plane. /// </summary> /// <param name="other">The other <see cref="ImagePlaneHelper"/>.</param> /// <returns>The angle between the normals of the planes, in radians.</returns> public float GetAngleBetween(ImagePlaneHelper other) { Platform.CheckForNullReference(other, "other"); return ImageNormalPatient.GetAngleBetween(other.ImageNormalPatient); }
/// <summary> /// Gets whether or not this image plane is orthogonal to the specified other image plane. /// </summary> /// <param name="other">The other <see cref="ImagePlaneHelper"/>.</param> /// <param name="angleToleranceRadians">The angle of tolerance, in radians, for the planes to be considered orthogonal.</param> /// <returns>True if the planes are mutually orthogonal; False otherwise.</returns> public bool IsOrthogonalTo(ImagePlaneHelper other, float angleToleranceRadians) { Platform.CheckForNullReference(other, "other"); return ImageNormalPatient.IsOrthogonalTo(other.ImageNormalPatient, angleToleranceRadians); }
/// <summary> /// Gets whether or not this image plane is orthogonal to the specified other image plane. /// </summary> /// <param name="other">The other <see cref="ImagePlaneHelper"/>.</param> /// <returns>True if the planes are mutually orthogonal; False otherwise.</returns> public bool IsOrthogonalTo(ImagePlaneHelper other) { return IsOrthogonalTo(other, _defaultToleranceRadians); }
/// <summary> /// Gets whether or not this image plane is parallel to the specified other image plane. /// </summary> /// <param name="other">The other <see cref="ImagePlaneHelper"/>.</param> /// <returns>True if the planes are mutually parallel; False otherwise.</returns> public bool IsParallelTo(ImagePlaneHelper other) { return IsParallelTo(other, _defaultToleranceRadians); }
/// <summary> /// Gets whether or not this image plane intersects with the specified other image plane. /// </summary> /// <param name="other">The other <see cref="ImagePlaneHelper"/> with which to intersect.</param> /// <returns>True if an intersection between the planes exists; False otherwise.</returns> public bool IntersectsWith(ImagePlaneHelper other) { Vector3D p1, p2; return(IntersectsWith(other, out p1, out p2)); }
/// <summary> /// Gets the angle between the normals of this image plane and the specified other image plane. /// </summary> /// <param name="other">The other <see cref="ImagePlaneHelper"/>.</param> /// <returns>The angle between the normals of the planes, in radians.</returns> public float GetAngleBetween(ImagePlaneHelper other) { Platform.CheckForNullReference(other, "other"); return(ImageNormalPatient.GetAngleBetween(other.ImageNormalPatient)); }
/// <summary> /// Gets whether or not this image plane is orthogonal to the specified other image plane. /// </summary> /// <param name="other">The other <see cref="ImagePlaneHelper"/>.</param> /// <param name="angleToleranceRadians">The angle of tolerance, in radians, for the planes to be considered orthogonal.</param> /// <returns>True if the planes are mutually orthogonal; False otherwise.</returns> public bool IsOrthogonalTo(ImagePlaneHelper other, float angleToleranceRadians) { Platform.CheckForNullReference(other, "other"); return(ImageNormalPatient.IsOrthogonalTo(other.ImageNormalPatient, angleToleranceRadians)); }
/// <summary> /// Gets whether or not this image plane is orthogonal to the specified other image plane. /// </summary> /// <param name="other">The other <see cref="ImagePlaneHelper"/>.</param> /// <returns>True if the planes are mutually orthogonal; False otherwise.</returns> public bool IsOrthogonalTo(ImagePlaneHelper other) { return(IsOrthogonalTo(other, _defaultToleranceRadians)); }
/// <summary> /// Gets whether or not this image plane is parallel to the specified other image plane. /// </summary> /// <param name="other">The other <see cref="ImagePlaneHelper"/>.</param> /// <returns>True if the planes are mutually parallel; False otherwise.</returns> public bool IsParallelTo(ImagePlaneHelper other) { return(IsParallelTo(other, _defaultToleranceRadians)); }