Intersection

public static class Intersection
Provides static methods for the computation of intersections, projections, sections and similar.

Properties

MeshIntersectionsTolerancesCoefficient

#Since v7.0
public static double MeshIntersectionsTolerancesCoefficient { get; }

Offers a requested adjustment coefficient for mesh-mesh intersections tolerances. The value can be used to multiply the document absolute tolerance.

This is only a UI value; it is up to developer to honor (or not) this request, depending on application needs.

Remarks: Generally, document tolerances are around 0.001 for objects sized about 100 units. However, good mesh triangles for these objects are often a few orders of magnitude smaller than these values. This coefficient is provided to scale absolute document tolerances to values more suitable for good mesh intersections.

Methods

ArcArc

#Since v7.12
public static ArcArcIntersection ArcArc(Arc arcA, Arc arcB, out Point3d intersectionPoint1, out Point3d intersectionPoint2)
Intersects two arcs using exact calculations.
arcA (Arc)First arc to intersect.
arcB (Arc)Second arc to intersect.
intersectionPoint1 (out Point3d)First intersection point.
intersectionPoint2 (out Point3d)Second intersection point.
The intersection type.

BrepBrep

#Since v8.12
public static bool BrepBrep(Brep brepA, Brep brepB, double tolerance, bool joinCurves, out Curve[] intersectionCurves, out Point3d[] intersectionPoints)
Intersects two Breps.
brepA (Brep)First Brep for intersection.
brepB (Brep)Second Brep for intersection.
tolerance (double)Intersection tolerance.
joinCurves (bool)If true, join the resulting curves where possible.
intersectionCurves (out Curve[])The intersection curves will be returned here.
intersectionPoints (out Point3d[])The intersection points will be returned here.
true if the operation was success, false otherwise. Check the output arrays to determine how the input intersects.

BrepBrep

#Since v5.0
public static bool BrepBrep(Brep brepA, Brep brepB, double tolerance, out Curve[] intersectionCurves, out Point3d[] intersectionPoints)
Intersects two Breps.
brepA (Brep)First Brep for intersection.
brepB (Brep)Second Brep for intersection.
tolerance (double)Intersection tolerance.
intersectionCurves (out Curve[])The intersection curves will be returned here.
intersectionPoints (out Point3d[])The intersection points will be returned here.
true if the operation was success, false otherwise. Check the output arrays to determine how the input intersects.

BrepPlane

#Since v8.27
public static bool BrepPlane(Brep brep, Plane plane, double tolerance, bool joinCurves, out Curve[] intersectionCurves, out Point3d[] intersectionPoints)
Intersects a Brep with an (infinite) plane.
brep (Brep)Brep to intersect.
plane (Plane)Plane to intersect with.
tolerance (double)Tolerance to use for intersections.
joinCurves (bool)If true, join the resulting curves where possible.
intersectionCurves (out Curve[])The intersection curves will be returned here.
intersectionPoints (out Point3d[])The intersection points will be returned here.
true on success, false on failure.

BrepPlane

#Since v5.0
public static bool BrepPlane(Brep brep, Plane plane, double tolerance, out Curve[] intersectionCurves, out Point3d[] intersectionPoints)
Intersects a Brep with an (infinite) plane.
brep (Brep)Brep to intersect.
plane (Plane)Plane to intersect with.
tolerance (double)Tolerance to use for intersections.
intersectionCurves (out Curve[])The intersection curves will be returned here.
intersectionPoints (out Point3d[])The intersection points will be returned here.
true on success, false on failure.

BrepSurface

#Since v8.12
public static bool BrepSurface(Brep brep, Surface surface, double tolerance, bool joinCurves, out Curve[] intersectionCurves, out Point3d[] intersectionPoints)
Intersects a Brep and a Surface.
brep (Brep)A brep to be intersected.
surface (Surface)A surface to be intersected.
tolerance (double)A tolerance value.
joinCurves (bool)If true, join the resulting curves where possible.
intersectionCurves (out Curve[])The intersection curves array argument. This out reference is assigned during the call.
intersectionPoints (out Point3d[])The intersection points array argument. This out reference is assigned during the call.
true if the operation was success, false otherwise. Check the output arrays to determine how the input intersects.

BrepSurface

#Since v5.0
public static bool BrepSurface(Brep brep, Surface surface, double tolerance, out Curve[] intersectionCurves, out Point3d[] intersectionPoints)
Intersects a Brep and a Surface.
brep (Brep)A brep to be intersected.
surface (Surface)A surface to be intersected.
tolerance (double)A tolerance value.
intersectionCurves (out Curve[])The intersection curves array argument. This out reference is assigned during the call.
intersectionPoints (out Point3d[])The intersection points array argument. This out reference is assigned during the call.
true if the operation was success, false otherwise. Check the output arrays to determine how the input intersects.

CircleCircle

#Since v7.12
public static CircleCircleIntersection CircleCircle(Circle circleA, Circle circleB, out Point3d intersectionPoint1, out Point3d intersectionPoint2)
Intersects two circles using exact calculations.
circleA (Circle)First circle to intersect.
circleB (Circle)Second circle to intersect.
intersectionPoint1 (out Point3d)First intersection point.
intersectionPoint2 (out Point3d)Second intersection point.
The intersection type.

CurveBrep

#Since v6.0
public static bool CurveBrep(Curve curve, Brep brep, double tolerance, double angleTolerance, out double[] t)
Intersect a curve with a Brep. This function returns the intersection parameters on the curve.
curve (Curve)Curve.
brep (Brep)Brep.
tolerance (double)Absolute tolerance for intersections.
angleTolerance (double)Angle tolerance in radians.
t (out double[])Curve parameters at intersections.
True on success, false on failure.

CurveBrep

#Since v6.0
public static bool CurveBrep(Curve curve, Brep brep, double tolerance, out Curve[] overlapCurves, out Point3d[] intersectionPoints, out double[] curveParameters)
Intersects a curve with a Brep. This function returns the 3D points of intersection, curve parameters at the intersection locations, and 3D overlap curves. If an error occurs while processing overlap curves, this function will return false, but it will still provide partial results.
curve (Curve)Curve for intersection.
brep (Brep)Brep for intersection.
tolerance (double)Fitting and near miss tolerance.
overlapCurves (out Curve[])The overlap curves will be returned here.
intersectionPoints (out Point3d[])The intersection points will be returned here.
curveParameters (out double[])The intersection curve parameters will be returned here.
true on success, false on failure.

CurveBrep

#ExampleSince v5.0
public static bool CurveBrep(Curve curve, Brep brep, double tolerance, out Curve[] overlapCurves, out Point3d[] intersectionPoints)
Intersects a curve with a Brep. This function returns the 3D points of intersection and 3D overlap curves. If an error occurs while processing overlap curves, this function will return false, but it will still provide partial results.
curve (Curve)Curve for intersection.
brep (Brep)Brep for intersection.
tolerance (double)Fitting and near miss tolerance.
overlapCurves (out Curve[])The overlap curves will be returned here.
intersectionPoints (out Point3d[])The intersection points will be returned here.
true on success, false on failure.

CurveBrepFace

#Since v5.0
public static bool CurveBrepFace(Curve curve, BrepFace face, double tolerance, out Curve[] overlapCurves, out Point3d[] intersectionPoints)
Intersects a curve with a Brep face.
curve (Curve)A curve.
face (BrepFace)A brep face.
tolerance (double)Fitting and near miss tolerance.
overlapCurves (out Curve[])A overlap curves array argument. This out reference is assigned during the call.
intersectionPoints (out Point3d[])A points array argument. This out reference is assigned during the call.
true on success, false on failure.

CurveCurve

#ExampleSince v5.0
public static CurveIntersections CurveCurve(Curve curveA, Curve curveB, double tolerance, double overlapTolerance)
Finds the intersections between two curves.
curveA (Curve)First curve for intersection.
curveB (Curve)Second curve for intersection.
tolerance (double)Intersection tolerance. If the curves approach each other to within tolerance, an intersection is assumed.
overlapTolerance (double)The tolerance with which the curves are tested.
A collection of intersection events.

CurveCurveValidate

#Since v7.0
public static CurveIntersections CurveCurveValidate(Curve curveA, Curve curveB, double tolerance, double overlapTolerance, out int[] invalidIndices, out TextLog textLog)
Finds the intersections between two curves.
curveA (Curve)First curve for intersection.
curveB (Curve)Second curve for intersection.
tolerance (double)Intersection tolerance. If the curves approach each other to within tolerance, an intersection is assumed.
overlapTolerance (double)The tolerance with which the curves are tested.
invalidIndices (out int[])The indices in the resulting CurveIntersections collection that are invalid.
textLog (out TextLog)A text log that contains tails about the invalid intersection events.
A collection of intersection events.

CurveLine

#Since v6.0
public static CurveIntersections CurveLine(Curve curve, Line line, double tolerance, double overlapTolerance)
Intersects a curve and an infinite line.
curve (Curve)Curve for intersection.
line (Line)Infinite line to intersect.
tolerance (double)Intersection tolerance. If the curves approach each other to within tolerance, an intersection is assumed.
overlapTolerance (double)The tolerance with which the curves are tested.
A collection of intersection events.

CurvePlane

#Since v5.0
public static CurveIntersections CurvePlane(Curve curve, Plane plane, double tolerance)
Intersects a curve with an (infinite) plane.
curve (Curve)Curve to intersect.
plane (Plane)Plane to intersect with.
tolerance (double)Tolerance to use during intersection.
A list of intersection events or null if no intersections were recorded.

CurveSelf

#Since v5.0
public static CurveIntersections CurveSelf(Curve curve, double tolerance)
Finds the places where a curve intersects itself.
curve (Curve)Curve for self-intersections.
tolerance (double)Intersection tolerance. If the curve approaches itself to within tolerance, an intersection is assumed.
A collection of intersection events.

CurveSurface

#Since v5.0
public static CurveIntersections CurveSurface(Curve curve, Interval curveDomain, Surface surface, double tolerance, double overlapTolerance)
Intersects a sub-curve and a surface.
curve (Curve)Curve for intersection.
curveDomain (Interval)Domain of sub-curve to take into consideration for Intersections.
surface (Surface)Surface for intersection.
tolerance (double)Intersection tolerance. If the curve approaches the surface to within tolerance, an intersection is assumed.
overlapTolerance (double)The tolerance with which the curves are tested.
A collection of intersection events.

CurveSurface

#ExampleSince v5.0
public static CurveIntersections CurveSurface(Curve curve, Surface surface, double tolerance, double overlapTolerance)
Intersects a curve and a surface.
curve (Curve)Curve for intersection.
surface (Surface)Surface for intersection.
tolerance (double)Intersection tolerance. If the curve approaches the surface to within tolerance, an intersection is assumed.
overlapTolerance (double)The tolerance with which the curves are tested.
A collection of intersection events.

CurveSurfaceValidate

#Since v7.0
public static CurveIntersections CurveSurfaceValidate(Curve curve, Interval curveDomain, Surface surface, double tolerance, double overlapTolerance, out int[] invalidIndices, out TextLog textLog)
Intersects a sub-curve and a surface.
curve (Curve)Curve for intersection.
curveDomain (Interval)Domain of sub-curve to take into consideration for Intersections.
surface (Surface)Surface for intersection.
tolerance (double)Intersection tolerance. If the curve approaches the surface to within tolerance, an intersection is assumed.
overlapTolerance (double)The tolerance with which the curves are tested.
invalidIndices (out int[])The indices in the resulting CurveIntersections collection that are invalid.
textLog (out TextLog)A text log that contains tails about the invalid intersection events.
A collection of intersection events.

CurveSurfaceValidate

#Since v7.0
public static CurveIntersections CurveSurfaceValidate(Curve curve, Surface surface, double tolerance, double overlapTolerance, out int[] invalidIndices, out TextLog textLog)
Intersects a curve and a surface.
curve (Curve)Curve for intersection.
surface (Surface)Surface for intersection.
tolerance (double)Intersection tolerance. If the curve approaches the surface to within tolerance, an intersection is assumed.
overlapTolerance (double)The tolerance with which the curves are tested.
invalidIndices (out int[])The indices in the resulting CurveIntersections collection that are invalid.
textLog (out TextLog)A text log that contains tails about the invalid intersection events.
A collection of intersection events.

GeometryPlane

#Since v9.0
public static bool GeometryPlane(GeometryBase geometry, Plane plane, double tolerance, bool joinCurves, bool pointCloudAsPoints, bool includeHiddenObjects, RhinoDoc doc, Transform xform, PlaneIntersectionCache cache, CancellationToken cancel, out Curve[] intersectionCurves, out Point3d[] intersectionPoints)
Intersects geometry with an (infinite) plane.
Remarks: The curves and points are projected onto the plane. Curves that are not valid after the projection are not returned. For xform and for an InstanceReferenceGeometry, curves are fitted in the space of the geometry with tolerance divided by the largest scale factor of the transform, so they are within tolerance in world coordinates, also for non-uniform scale. Points are tested with their distance to the plane in world coordinates. With non-uniform scale, overlaps of curves with the plane are detected with the stricter curve tolerance, so a curve closer than tolerance to the plane can be missed as an overlap. When joinCurves is true, the open curves of each object are joined: they can be reversed, very short curves can be dropped, and joined curves are PolyCurve. Objects after a cancellation are not joined. For point clouds, the points within tolerance of the plane are returned in intersectionPoints when pointCloudAsPoints is true, all of them. Otherwise they are returned as one polyline in intersectionCurves, or in intersectionPoints when there is only one, and points closer together than tolerance are merged.
geometry (GeometryBase)GeometryBase object to intersect.
plane (Plane)Plane to intersect with.
tolerance (double)Tolerance to use for intersections.
joinCurves (bool)If true, join the resulting curves of each object where possible, for every geometry type. Curves of different objects, such as the objects of an instance definition, are never joined.
pointCloudAsPoints (bool)If true, every point of a PointCloud within tolerance of the plane is returned in intersectionPoints. If false, they are returned as one polyline in intersectionCurves, as the Contour command does.
includeHiddenObjects (bool)If false, the objects of an instance definition that are hidden or on a layer that is off are skipped, as the Contour command does. Nested instance references are entered whether they are visible or not, and their objects are tested one by one.
doc (RhinoDoc)The document that has the instance definition when geometry is, or contains, an InstanceReferenceGeometry. Can be null for other geometry.
xform (Transform)Maps geometry to the space of the plane and the results, as InstanceReferenceGeometry.Xform does. Avoids transforming a copy of the geometry. Must not be singular.
cache (PlaneIntersectionCache)Data computed from the geometry alone, kept between calls, or null. Reuse one cache for many planes through the same geometry.
cancel (CancellationToken)Checked between the objects of an instance definition, in point clouds and in mesh intersections. A single Brep intersection cannot be cancelled once it has started.
intersectionCurves (out Curve[])The intersection curves will be returned here.
intersectionPoints (out Point3d[])The intersection points will be returned here.
true if the intersection was computed, including when the plane misses the geometry. For an InstanceReferenceGeometry, true if it was computed for any object in the instance definition. false if the plane is not valid, tolerance is negative or not a number, the geometry type is not supported, the intersection failed or was cancelled, or xform or the transform of an InstanceReferenceGeometry is singular. Curves and points found before a failure or cancellation are still returned.

GeometryPlane

#Since v9.0
public static bool GeometryPlane(GeometryBase geometry, Plane plane, double tolerance, bool joinCurves, RhinoDoc doc, out Curve[] intersectionCurves, out Point3d[] intersectionPoints)
Intersects geometry with an (infinite) plane.
Remarks: The curves and points are projected onto the plane. Curves that are not valid after the projection are not returned. For an InstanceReferenceGeometry, curves are fitted inside the instance definition with tolerance divided by the largest scale factor of the transform, so they are within tolerance in world coordinates, also for non-uniform scale. Points are tested with their distance to the plane in world coordinates. With non-uniform scale, overlaps of curves with the plane are detected with the stricter curve tolerance, so a curve closer than tolerance to the plane can be missed as an overlap. When joinCurves is true, the open curves of each object are joined: they can be reversed, very short curves can be dropped, and joined curves are PolyCurve. For point clouds, the points within tolerance of the plane are returned as one polyline in intersectionCurves, or in intersectionPoints when there is only one. Points closer together than tolerance are merged. The objects of an instance definition that are not visible are skipped, as the Contour command does.
geometry (GeometryBase)GeometryBase object to intersect.
plane (Plane)Plane to intersect with.
tolerance (double)Tolerance to use for intersections.
joinCurves (bool)If true, join the resulting curves of each object where possible, for every geometry type. Curves of different objects, such as the objects of an instance definition, are never joined.
doc (RhinoDoc)The document that has the instance definition when geometry is an InstanceReferenceGeometry. Can be null for other geometry.
intersectionCurves (out Curve[])The intersection curves will be returned here.
intersectionPoints (out Point3d[])The intersection points will be returned here.
true if the intersection was computed, including when the plane misses the geometry. For an InstanceReferenceGeometry, true if it was computed for any object in the instance definition. false if the plane is not valid, tolerance is negative or not a number, the geometry type is not supported or the intersection failed. Curves and points found before a failure are still returned.

LineBox

#Since v5.0
public static bool LineBox(Line line, BoundingBox box, double tolerance, out Interval lineParameters)
Intersects an infinite line and an axis aligned bounding box.
line (Line)Line for intersection.
box (BoundingBox)BoundingBox to intersect.
tolerance (double)If tolerance > 0.0, then the intersection is performed against a box that has each side moved out by tolerance.
lineParameters (out Interval)The chord from line.PointAt(lineParameters.T0) to line.PointAt(lineParameters.T1) is the intersection.
true if the line intersects the box, false if no intersection occurs.

LineBox

#Since v5.0
public static bool LineBox(Line line, Box box, double tolerance, out Interval lineParameters)
Intersects an infinite line with a box volume.
line (Line)Line for intersection.
box (Box)Box to intersect.
tolerance (double)If tolerance > 0.0, then the intersection is performed against a box that has each side moved out by tolerance.
lineParameters (out Interval)The chord from line.PointAt(lineParameters.T0) to line.PointAt(lineParameters.T1) is the intersection.
true if the line intersects the box, false if no intersection occurs.

LineCircle

#ExampleSince v5.0
public static LineCircleIntersection LineCircle(Line line, Circle circle, out double t1, out Point3d point1, out double t2, out Point3d point2)
Intersects a line with a circle using exact calculations.
line (Line)Line for intersection.
circle (Circle)Circle for intersection.
t1 (out double)Parameter on line for first intersection.
point1 (out Point3d)Point on circle closest to first intersection.
t2 (out double)Parameter on line for second intersection.
point2 (out Point3d)Point on circle closest to second intersection.
If LineCircleIntersection.Single is returned, only t1 and point1 will have valid values. If LineCircleIntersection.Multiple is returned, t2 and point2 will also be filled out.

LineCylinder

#Since v5.0
public static LineCylinderIntersection LineCylinder(Line line, Cylinder cylinder, out Point3d intersectionPoint1, out Point3d intersectionPoint2)
Intersects a line with a cylinder using exact calculations.
line (Line)Line for intersection.
cylinder (Cylinder)Cylinder for intersection.
intersectionPoint1 (out Point3d)First intersection point.
intersectionPoint2 (out Point3d)Second intersection point.
If None is returned, the first point is the point on the line closest to the cylinder and the second point is the point on the cylinder closest to the line.

If LineCylinderIntersection.Single is returned, the first point is the point on the line and the second point is the same point on the cylinder.

LineLine

#Since v5.0
public static bool LineLine(Line lineA, Line lineB, out double a, out double b, double tolerance, bool finiteSegments)
Intersects two lines.
Remarks: If the lines are exactly parallel, meaning the system of equations used to find a and b has no numerical solution, then false is returned. If the lines are nearly parallel, which is often numerically true even if you think the lines look exactly parallel, then the closest points are found and true is returned. So, if you care about weeding out "parallel" lines, then you need to do something like the following:
bool rc = Intersect.LineLine(lineA, lineB, out a, out b, tolerance, segments);
if (rc)
{
  double angle_tol = RhinoMath.ToRadians(1.0); // or whatever
  double parallel_tol = Math.Cos(angle_tol);
  if ( Math.Abs(lineA.UnitTangent * lineB.UnitTangent) >= parallel_tol )
  {
    ... do whatever you think is appropriate
  }
}
Dim rc As Boolean = Intersect.LineLine(lineA, lineB, a, b, tolerance, segments)
If (rc) Then
  Dim angle_tol As Double = RhinoMath.ToRadians(1.0) 'or whatever
  Dim parallel_tolerance As Double = Math.Cos(angle_tol)
  If (Math.Abs(lineA.UnitTangent * lineB.UnitTangent) >= parallel_tolerance) Then
    ... do whatever you think is appropriate
  End If
End If
lineA (Line)First line for intersection.
lineB (Line)Second line for intersection.
a (out double)Parameter on lineA that is closest to LineB. The shortest distance between the lines is the chord from lineA.PointAt(a) to lineB.PointAt(b)
b (out double)Parameter on lineB that is closest to LineA. The shortest distance between the lines is the chord from lineA.PointAt(a) to lineB.PointAt(b)
tolerance (double)If tolerance > 0.0, then an intersection is reported only if the distance between the points is <= tolerance. If tolerance <= 0.0, then the closest point between the lines is reported.
finiteSegments (bool)If true, the input lines are treated as finite segments. If false, the input lines are treated as infinite lines.
true if a closest point can be calculated and the result passes the tolerance parameter test; otherwise false.

LineLine

#ExampleSince v5.0
public static bool LineLine(Line lineA, Line lineB, out double a, out double b)
Find the unique closest-points pair between two infinite lines, if it exists.
lineA (Line)First line.
lineB (Line)Second line.
a (out double)Parameter on lineA that is closest to lineB.
b (out double)Parameter on lineB that is closest to lineA. The shortest distance between the lines is the chord from lineA.PointAt(a) to lineB.PointAt(b)
true if points are found and false if the lines are numerically parallel. Numerically parallel means the 2x2 matrix:

+AoA -AoB

-AoB +BoB

is numerically singular, where A = (lineA.To - lineA.From) and B = (lineB.To-lineB.From).

LinePlane

#Since v5.0
public static bool LinePlane(Line line, Plane plane, out double lineParameter)
Intersects a line and a plane. This function only returns true if the intersection result is a single point (i.e. if the line is coincident with the plane then no intersection is assumed).
line (Line)Line for intersection.
plane (Plane)Plane to intersect.
lineParameter (out double)Parameter on line where intersection occurs. If the parameter is not within the {0, 1} Interval then the finite segment does not intersect the plane.
true on success, false on failure.

LineSphere

#Since v5.0
public static LineSphereIntersection LineSphere(Line line, Sphere sphere, out Point3d intersectionPoint1, out Point3d intersectionPoint2)
Intersects a line with a sphere using exact calculations.
line (Line)Line for intersection.
sphere (Sphere)Sphere for intersection.
intersectionPoint1 (out Point3d)First intersection point.
intersectionPoint2 (out Point3d)Second intersection point.
If LineSphereIntersection.None is returned, the first point is the point on the line closest to the sphere and the second point is the point on the sphere closest to the line. If LineSphereIntersection.Single is returned, the first point is the point on the line and the second point is the same point on the sphere.

MeshLine

#Since v5.0
public static Point3d[] MeshLine(Mesh mesh, Line line, out int[] faceIds)
Finds the intersections of a mesh and a line. The points are not necessarily sorted.
mesh (Mesh)A mesh to intersect
line (Line)The line to intersect with the mesh
faceIds (out int[])The indices of the intersecting faces. This out reference is assigned during the call. Empty if nothing is found.
An array of points: one for each face that was passed by the faceIds out reference. Empty if no items are found.

MeshLine

#Since v7.3
public static Point3d[] MeshLine(Mesh mesh, Line line)
Finds the intersections of a mesh and a line.
mesh (Mesh)A mesh to intersect
line (Line)The line to intersect with the mesh
An array of points: one for each face that was passed by the faceIds out reference. Empty if no items are found.

MeshLineSorted

#Since v5.0
public static Point3d[] MeshLineSorted(Mesh mesh, Line line, out int[] faceIds)
Finds the intersections of a mesh and a line. Points are sorted along the line.
mesh (Mesh)A mesh to intersect
line (Line)The line to intersect with the mesh
faceIds (out int[])The indices of the intersecting faces. This out reference is assigned during the call. Empty if nothing is found.
An array of points: one for each face that was passed by the faceIds out reference. Empty if no items are found.

MeshMesh

#Since v7.0
public static bool MeshMesh(IEnumerable<Mesh> meshes, double tolerance, out Polyline[] intersections, bool overlapsPolylines, out Polyline[] overlapsPolylinesResult, bool overlapsMesh, out Mesh overlapsMeshResult, TextLog textLog, CancellationToken cancel, IProgress<double> progress)
Intersects meshes. Overlaps and perforations are provided in the output list.

Tolerance can be specified.

We suggest to use the document tolerance multiplied by MeshIntersectionsTolerancesCoefficient.

meshes (IEnumerable<Mesh>)The mesh input list. This cannot be null. Null entries are tolerated.
tolerance (double)A tolerance value. If negative, the positive value will be used. WARNING! Good tolerance values are in the magnitude of 10^-7, or RhinoMath.SqrtEpsilon*10.
intersections (out Polyline[])Returns the intersections.
overlapsPolylines (bool)If true, overlaps are computed and returned.
overlapsPolylinesResult (out Polyline[])If requested, overlaps are returned here.
overlapsMesh (bool)If true, an overlaps mesh is computed and returned.
overlapsMeshResult (out Mesh)If requested, overlaps are returned here.
textLog (TextLog)A text log, or null.
cancel (CancellationToken)A cancellation token to stop the computation at a given point.
progress (IProgress<double>)A progress reporter to inform the user about progress, or null. The reported value is indicative.
True, if the operation succeeded, otherwise false.

MeshMeshAccurate

#Since v5.0
public static Polyline[] MeshMeshAccurate(Mesh meshA, Mesh meshB, double tolerance)
Intersects two meshes. Overlaps and near misses are handled. This is an old method kept for compatibility.

Tolerance can be specified.

We suggest to use the document tolerance multiplied by MeshIntersectionsTolerancesCoefficient.

meshA (Mesh)First mesh for intersection.
meshB (Mesh)Second mesh for intersection.
tolerance (double)A tolerance value. If negative, the positive value will be used. WARNING! Good tolerance values are in the magnitude of 10^-7, or RhinoMath.SqrtEpsilon*10.
An array of intersection and overlaps polylines.

MeshMeshFast

#Since v5.0
public static Line[] MeshMeshFast(Mesh meshA, Mesh meshB)
Fast intersection of two meshes, returned as loose line segments rather than assembled polylines.

Vertices are read in double precision when the mesh has them. Faces that cross or touch within tolerance produce segments; coplanar overlaps are ignored. Use MeshMesh(IEnumerable<Mesh>, double, Polyline[], bool, Polyline[], bool, Mesh, TextLog, CancellationToken, IProgress<double>) when overlaps or joined curves are needed, and MeshMeshPredicate(IEnumerable<Mesh>, IEnumerable<Mesh>, double, bool, TextLog, CancellationToken) when only the yes/no answer is needed.

meshA (Mesh)First mesh for intersection.
meshB (Mesh)Second mesh for intersection.
An array of intersection line segments, empty if no intersections were found.

MeshMeshPredicate

#Since v8.0
public static bool MeshMeshPredicate(IEnumerable<Mesh> meshes, double tolerance, out int[] pairs, TextLog textLog)
Determines which meshes intersect. No geometry is computed: each pair of meshes is tested only until its first crossing is found, with the fast intersector behind MeshMeshFast(Mesh, Mesh). Faces that cross or touch within tolerance count; coplanar overlap without a crossing does not.

The same as MeshMeshPredicate(IEnumerable<Mesh>, IEnumerable<Mesh>, double, bool, IntersectingMeshPair[], TextLog, CancellationToken) with fast = true.

meshes (IEnumerable<Mesh>)The mesh input list. This cannot be null. Null entries are tolerated.
tolerance (double)A tolerance value. If negative, the positive value will be used. WARNING! Good tolerance values are in the magnitude of 10^-7, or RhinoMath.SqrtEpsilon*10.
pairs (out int[])An array containing pairs of meshes that intersect.
textLog (TextLog)A text log, or null.
True, if meshes intersect, otherwise false. False is also returned on error, but textLog will start with Error: and contain the error.

MeshMeshPredicate

#Since v9.0
public static bool MeshMeshPredicate(IEnumerable<Mesh> meshesA, IEnumerable<Mesh> meshesB, double tolerance, bool fast, out IntersectingMeshPair[] intersectingPairs, TextLog textLog, CancellationToken cancel)
Determines which meshes intersect, and reports one intersecting face couple for each pair found. No geometry is computed: each pair of meshes is tested only until its first hit.
meshesA (IEnumerable<Mesh>)The first mesh list. This cannot be null. Null entries are skipped but keep their index.
meshesB (IEnumerable<Mesh>)A second mesh list, or null. When null, every pair within meshesA is tested once; otherwise every mesh of meshesA is tested against every mesh of meshesB. Null entries are skipped but keep their index.
tolerance (double)A tolerance value. If negative, the positive value will be used. WARNING! Good tolerance values are in the magnitude of 10^-7, or RhinoMath.SqrtEpsilon*10.
fast (bool)True uses the fast intersector behind MeshMeshFast(Mesh, Mesh): faces that cross or touch within tolerance count, coplanar overlap without a crossing does not. False uses the accurate intersector, which also reports coplanar overlap and costs about as much as MeshMeshFast(Mesh, Mesh).
intersectingPairs (out IntersectingMeshPair[])The pairs of meshes that intersect, each with the first intersecting faces found. IntersectingMeshPair.MeshIndexA indexes meshesA and IntersectingMeshPair.MeshIndexB indexes meshesB, or both index meshesA with MeshIndexA less than MeshIndexB. Empty when nothing intersects.
textLog (TextLog)A text log, or null.
cancel (CancellationToken)A cancellation token to stop the computation at a given point.
True if any pair intersects, otherwise false. False is also returned on error or cancellation.

MeshMeshPredicate

#Since v9.0
public static bool MeshMeshPredicate(IEnumerable<Mesh> meshesA, IEnumerable<Mesh> meshesB, double tolerance, bool fast, TextLog textLog, CancellationToken cancel)
Determines whether any of the meshes intersect. No geometry is computed, and the search stops at the first pair of meshes that intersect: this is the quickest answer when the intersecting pairs are not needed.
meshesA (IEnumerable<Mesh>)The first mesh list. This cannot be null. Null entries are skipped.
meshesB (IEnumerable<Mesh>)A second mesh list, or null. When null, every pair within meshesA is tested once; otherwise every mesh of meshesA is tested against every mesh of meshesB. Null entries are skipped.
tolerance (double)A tolerance value. If negative, the positive value will be used. WARNING! Good tolerance values are in the magnitude of 10^-7, or RhinoMath.SqrtEpsilon*10.
fast (bool)True uses the fast intersector behind MeshMeshFast(Mesh, Mesh): faces that cross or touch within tolerance count, coplanar overlap without a crossing does not. False uses the accurate intersector, which also reports coplanar overlap and costs about as much as MeshMeshFast(Mesh, Mesh).
textLog (TextLog)A text log, or null.
cancel (CancellationToken)A cancellation token to stop the computation at a given point.
True if any pair intersects, otherwise false. False is also returned on error or cancellation.

MeshMeshTwoSets

#Since v9.0
public static bool MeshMeshTwoSets(IEnumerable<Mesh> setA, IEnumerable<Mesh> setB, double tolerance, out Polyline[] intersections, bool overlapsPolylines, out Polyline[] overlapsPolylinesResult, bool overlapsMesh, out Mesh overlapsMeshResult, TextLog textLog, CancellationToken cancel, IProgress<double> progress)
Intersects two sets of meshes with each other. Overlaps and perforations are provided in the output list.

Only events between a mesh of the first set and a mesh of the second set are computed. Intersections among meshes of the same set, and self-intersections within a single mesh, are ignored.

Tolerance can be specified.

We suggest to use the document tolerance multiplied by MeshIntersectionsTolerancesCoefficient.

setA (IEnumerable<Mesh>)The first mesh input list. This cannot be null. Null entries are tolerated.
setB (IEnumerable<Mesh>)The second mesh input list. This cannot be null. Null entries are tolerated.
tolerance (double)A tolerance value. If negative, the positive value will be used. WARNING! Good tolerance values are in the magnitude of 10^-7, or RhinoMath.SqrtEpsilon*10.
intersections (out Polyline[])Returns the intersections.
overlapsPolylines (bool)If true, overlaps are computed and returned.
overlapsPolylinesResult (out Polyline[])If requested, overlaps are returned here.
overlapsMesh (bool)If true, an overlaps mesh is computed and returned.
overlapsMeshResult (out Mesh)If requested, overlaps are returned here.
textLog (TextLog)A text log, or null.
cancel (CancellationToken)A cancellation token to stop the computation at a given point.
progress (IProgress<double>)A progress reporter to inform the user about progress, or null. The reported value is indicative.
True, if the operation succeeded, otherwise false.

MeshPlane

#Since v5.0
public static Polyline[] MeshPlane(Mesh mesh, IEnumerable<Plane> planes)
Intersects a mesh with a collection of infinite planes.

RhinoMath.ZeroTolerance is used as fixed tolerance.

We suggest to use the document tolerance multiplied by MeshIntersectionsTolerancesCoefficient instaed.

mesh (Mesh)Mesh to intersect.
planes (IEnumerable<Plane>)Planes to intersect with.
An array of polylines describing the intersection loops, or null if no intersections could be found.

MeshPlane

#Since v9.0
public static Polyline[] MeshPlane(Mesh mesh, MeshIntersectionCache cache, IEnumerable<Plane> planes, double tolerance, bool overlaps)
Intersects a mesh with a collection of infinite planes.

Tolerance can be specified.

We suggest to use the document tolerance multiplied by MeshIntersectionsTolerancesCoefficient.

mesh (Mesh)Mesh to intersect.
cache (MeshIntersectionCache)Intersection cache for the mesh.
planes (IEnumerable<Plane>)Planes to intersect with.
tolerance (double)Intersection tolerance.
overlaps (bool)If true, overlaps are computed and will be part of the output.
An array of polylines describing the intersection loops, or null if no intersections could be found.

MeshPlane

#Since v8.0
public static Polyline[] MeshPlane(Mesh mesh, MeshIntersectionCache cache, IEnumerable<Plane> planes, double tolerance)
Intersects a mesh with a collection of infinite planes, providing both overlaps and perforations.

Tolerance can be specified.

We suggest to use the document tolerance multiplied by MeshIntersectionsTolerancesCoefficient.

mesh (Mesh)Mesh to intersect.
cache (MeshIntersectionCache)Intersection cache for the mesh.
planes (IEnumerable<Plane>)Planes to intersect with.
tolerance (double)Intersection tolerance.
An array of polylines describing the intersection loops, or null if no intersections could be found.

MeshPlane

#Since v8.0
public static Polyline[] MeshPlane(Mesh mesh, MeshIntersectionCache cache, Plane plane, double tolerance, bool overlaps)
Intersects a mesh with an infinite plane.

Tolerance can be specified.

We suggest to use the document tolerance multiplied by MeshIntersectionsTolerancesCoefficient.

mesh (Mesh)Mesh to intersect.
cache (MeshIntersectionCache)Intersection cache for mesh.
plane (Plane)Plane to intersect with.
tolerance (double)Intersection tolerance.
overlaps (bool)If true, overlaps are computed and will be part of the output.
An array of polylines describing the intersection loops, or null if no intersections could be found.

MeshPlane

#Since v8.0
public static Polyline[] MeshPlane(Mesh mesh, MeshIntersectionCache cache, Plane plane, double tolerance)
Intersects a mesh with an infinite plane.

Tolerance can be specified.

We suggest to use the document tolerance multiplied by MeshIntersectionsTolerancesCoefficient.

mesh (Mesh)Mesh to intersect.
cache (MeshIntersectionCache)Intersection cache for mesh.
plane (Plane)Plane to intersect with.
tolerance (double)Intersection tolerance.
An array of polylines describing the intersection loops, or null if no intersections could be found.

MeshPlane

#Since v5.0
public static Polyline[] MeshPlane(Mesh mesh, Plane plane)
Intersects a mesh with an infinite plane. RhinoMath.ZeroTolerance is used as fixed tolerance. We suggest to use the document tolerance multiplied by MeshIntersectionsTolerancesCoefficient instaed.
mesh (Mesh)Mesh to intersect.
plane (Plane)Plane to intersect with.
An array of polylines describing the intersection loops, or null if no intersections could be found.

MeshPolyline

#Since v5.0
public static Point3d[] MeshPolyline(Mesh mesh, PolylineCurve curve, out int[] faceIds)
Finds the intersection of a mesh and a polyline. Starting from version 7, points are always sorted along the polyline.
mesh (Mesh)A mesh to intersect.
curve (PolylineCurve)A polyline curves to intersect.
faceIds (out int[])The indices of the intersecting faces. This out reference is assigned during the call.
An array of points: one for each face that was passed by the faceIds out reference.

MeshPolylineSorted

#Since v5.0
public static Point3d[] MeshPolylineSorted(Mesh mesh, PolylineCurve curve, out int[] faceIds)
Finds the intersection of a mesh and a polyline. Points are guaranteed to be sorted along the polyline.
mesh (Mesh)A mesh to intersect.
curve (PolylineCurve)A polyline curves to intersect.
faceIds (out int[])The indices of the intersecting faces. This out reference is assigned during the call.
An array of points: one for each face that was passed by the faceIds out reference.

MeshRay

#Since v5.0
public static double MeshRay(Mesh mesh, Ray3d ray, out int[] meshFaceIndices)
Finds the first intersection of a ray with a mesh.
Remarks: The ray may intersect more than one face in cases where the ray hits the edge between two faces or the vertex corner shared by multiple faces, or more than one face is coplanar or happens to be intersecting at the same location as the ray.
mesh (Mesh)A mesh to intersect.
ray (Ray3d)A ray to be casted.
meshFaceIndices (out int[])faces on mesh that ray intersects.
>= 0.0 parameter along ray if successful. < 0.0 if no intersection found.

MeshRay

#Since v5.0
public static double MeshRay(Mesh mesh, Ray3d ray)
Finds the first intersection of a ray with a mesh.
mesh (Mesh)A mesh to intersect.
ray (Ray3d)A ray to be casted.
>= 0.0 parameter along ray if successful. < 0.0 if no intersection found.

MeshRays

#Since v9.0
public static double[] MeshRays(Mesh mesh, IEnumerable<Ray3d> rays, bool multithreaded)
Finds the first intersection of each one of a set of rays with a mesh.
mesh (Mesh)A mesh to intersect.
rays (IEnumerable<Ray3d>)The rays to cast.
multithreaded (bool)True to cast the rays on several threads.
One value for each ray, in the order of the rays: the parameter along that ray of its first intersection with the mesh, or a value smaller than 0.0 where that ray does not meet the mesh. Null when the mesh or the set of rays is null.

MeshRays

#Since v9.0
public static double[] MeshRays(Mesh mesh, IEnumerable<Ray3d> rays)
Finds the first intersection of each one of a set of rays with a mesh.
Remarks: The rays are cast on several threads, so this is much faster than one call of MeshRay(Mesh, Ray3d) per ray.
mesh (Mesh)A mesh to intersect.
rays (IEnumerable<Ray3d>)The rays to cast.
One value for each ray, in the order of the rays: the parameter along that ray of its first intersection with the mesh, or a value smaller than 0.0 where that ray does not meet the mesh. Null when the mesh or the set of rays is null.

PlaneBoundingBox

#Since v8.0
public static bool PlaneBoundingBox(Plane plane, BoundingBox boundingBox, out Polyline polyline)
Intersects a plane and a bounding box.
Remarks: Intersects the four bounding box infinite lines in the direction of the max coordinate with the plane. Point and single line intersections are ignored.
plane (Plane)The plane.
boundingBox (BoundingBox)The bounding box.
polyline (out Polyline)The output polyline if successful.
True if successful, false otherwise.

PlaneCircle

#Since v5.0
public static PlaneCircleIntersection PlaneCircle(Plane plane, Circle circle, out double firstCircleParameter, out double secondCircleParameter)
Intersects a plane with a circle using exact calculations.
plane (Plane)Plane to intersect.
circle (Circle)Circe to intersect.
firstCircleParameter (out double)First intersection parameter on circle if successful or RhinoMath.UnsetValue if not.
secondCircleParameter (out double)Second intersection parameter on circle if successful or RhinoMath.UnsetValue if not.
The type of intersection that occurred.

PlanePlane

#Since v5.0
public static bool PlanePlane(Plane planeA, Plane planeB, out Line intersectionLine)
Intersects two planes and return the intersection line. If the planes are parallel or coincident, no intersection is assumed.
planeA (Plane)First plane for intersection.
planeB (Plane)Second plane for intersection.
intersectionLine (out Line)If this function returns true, the intersectionLine parameter will return the line where the planes intersect.
true on success, false on failure.

PlanePlanePlane

#Since v5.0
public static bool PlanePlanePlane(Plane planeA, Plane planeB, Plane planeC, out Point3d intersectionPoint)
Intersects three planes to find the single point they all share.
planeA (Plane)First plane for intersection.
planeB (Plane)Second plane for intersection.
planeC (Plane)Third plane for intersection.
intersectionPoint (out Point3d)Point where all three planes converge.
true on success, false on failure. If at least two out of the three planes are parallel or coincident, failure is assumed.

PlaneSphere

#Since v5.0
public static PlaneSphereIntersection PlaneSphere(Plane plane, Sphere sphere, out Circle intersectionCircle)
Intersects a plane with a sphere using exact calculations.
plane (Plane)Plane to intersect.
sphere (Sphere)Sphere to intersect.
intersectionCircle (out Circle)Intersection result.
If PlaneSphereIntersection.None is returned, the intersectionCircle has a radius of zero and the center point is the point on the plane closest to the sphere.

ProjectPointsToBreps

#ExampleSince v5.0
public static Point3d[] ProjectPointsToBreps(IEnumerable<Brep> breps, IEnumerable<Point3d> points, Vector3d direction, double tolerance)
Projects points onto breps.
breps (IEnumerable<Brep>)The breps projection targets.
points (IEnumerable<Point3d>)The points to project.
direction (Vector3d)The direction to project.
tolerance (double)The tolerance used for intersections.
Array of projected points, or null in case of any error or invalid input.

ProjectPointsToBrepsEx

#Since v5.10
public static Point3d[] ProjectPointsToBrepsEx(IEnumerable<Brep> breps, IEnumerable<Point3d> points, Vector3d direction, double tolerance, out int[] indices)
Projects points onto breps.
breps (IEnumerable<Brep>)The breps projection targets.
points (IEnumerable<Point3d>)The points to project.
direction (Vector3d)The direction to project.
tolerance (double)The tolerance used for intersections.
indices (out int[])Return points[i] is a projection of points[indices[i]]
Array of projected points, or null in case of any error or invalid input.

ProjectPointsToMeshes

#Since v5.0
public static Point3d[] ProjectPointsToMeshes(IEnumerable<Mesh> meshes, IEnumerable<Point3d> points, Vector3d direction, double tolerance)
Projects points onto meshes.
meshes (IEnumerable<Mesh>)the meshes to project on to.
points (IEnumerable<Point3d>)the points to project.
direction (Vector3d)the direction to project.
tolerance (double)Projection tolerances used for culling close points and for line-mesh intersection.
Array of projected points, or null in case of any error or invalid input.

ProjectPointsToMeshesEx

#ExampleSince v5.10
public static Point3d[] ProjectPointsToMeshesEx(IEnumerable<Mesh> meshes, IEnumerable<Point3d> points, Vector3d direction, double tolerance, out int[] indices)
Projects points onto meshes.
meshes (IEnumerable<Mesh>)the meshes to project on to.
points (IEnumerable<Point3d>)the points to project.
direction (Vector3d)the direction to project.
tolerance (double)Projection tolerances used for culling close points and for line-mesh intersection.
indices (out int[])Return points[i] is a projection of points[indices[i]]
Array of projected points, or null in case of any error or invalid input.

RayShoot

#Since v5.0
public static Point3d[] RayShoot(Ray3d ray, IEnumerable<GeometryBase> geometry, int maxReflections)
Computes point intersections that occur when shooting a ray to a collection of surfaces and Breps.
ray (Ray3d)A ray used in intersection.
geometry (IEnumerable<GeometryBase>)Only Surface and Brep objects are currently supported. Trims are ignored on Breps.
maxReflections (int)The maximum number of reflections. This value should be any value between 1 and 1000, inclusive.
An array of points: one for each surface or Brep face that was hit, or an empty array on failure.
ArgumentNullExceptiongeometry is null.
ArgumentOutOfRangeExceptionmaxReflections is strictly outside the [1-1000] range.

RayShoot

#Since v9.0
public static RayShootEvent[] RayShoot(IEnumerable<GeometryBase> geometry, Ray3d ray, int maxReflections, bool honorTrims)
Computes point intersections that occur when shooting a ray to a collection of surfaces and Breps.
geometry (IEnumerable<GeometryBase>)The collection of surfaces and Breps to intersect.
ray (Ray3d)A ray used in intersection.
maxReflections (int)The maximum number of reflections. This value should be any value between 1 and 1000, inclusive.
honorTrims (bool)When true, hits that land outside a Brep face's trimming loops are skipped and the ray continues. When false, Breps are treated as their untrimmed surfaces, which is what Rhino 8 and earlier did.
An array of RayShootEvent structs if successful, or an empty array on failure.
ArgumentNullExceptiongeometry is null.
ArgumentOutOfRangeExceptionmaxReflections is strictly outside the [1-1000] range.

RayShoot

#Since v7.0
public static RayShootEvent[] RayShoot(IEnumerable<GeometryBase> geometry, Ray3d ray, int maxReflections)
Computes point intersections that occur when shooting a ray to a collection of surfaces and Breps.
geometry (IEnumerable<GeometryBase>)The collection of surfaces and Breps to intersect. Trims are ignored on Breps.
ray (Ray3d)>A ray used in intersection.
maxReflections (int)The maximum number of reflections. This value should be any value between 1 and 1000, inclusive.
An array of RayShootEvent structs if successful, or an empty array on failure.
ArgumentNullExceptiongeometry is null.
ArgumentOutOfRangeExceptionmaxReflections is strictly outside the [1-1000] range.

SphereSphere

#Since v5.0
public static SphereSphereIntersection SphereSphere(Sphere sphereA, Sphere sphereB, out Circle intersectionCircle)
Intersects two spheres using exact calculations.
sphereA (Sphere)First sphere to intersect.
sphereB (Sphere)Second sphere to intersect.
intersectionCircle (out Circle)If intersection is a point, then that point will be the center, radius 0.
The intersection type.

SurfaceSurface

#Since v5.0
public static bool SurfaceSurface(Surface surfaceA, Surface surfaceB, double tolerance, out Curve[] intersectionCurves, out Point3d[] intersectionPoints)
Intersects two Surfaces.
surfaceA (Surface)First Surface for intersection.
surfaceB (Surface)Second Surface for intersection.
tolerance (double)Intersection tolerance.
intersectionCurves (out Curve[])The intersection curves will be returned here.
intersectionPoints (out Point3d[])The intersection points will be returned here.
true on success, false on failure.