GeometryExtensionMethods

public static class GeometryExtensionMethods
Extension methods for several types in Rhino.Geometry.

Methods

ClosestPointToInterior

#Example
public static bool ClosestPointToInterior(this BrepFace face, Point3d point, out double u, out double v)
Perform poor-man's brep face closest point logic. It projects the point to the underlying surface then back onto the trimmed portion if need be.
face (BrepFace)Brep face.
point (Point3d)World point.
u (out double)U parameter on surface closest to point.
v (out double)V parameter on surface closest to point.
True if projection was successful.

CreateSpanParameters

#Example
public static double[] CreateSpanParameters(this Curve curve, double t0, double t1, int samplesPerSpan)
Create samples in curve parameter space using a fixed number of span-divisions.
curve (Curve)Curve to sample.
t0 (double)First parameter.
t1 (double)Last parameter.
samplesPerSpan (int)Number of samples per curve span.

CreateSpanParameters

#Example
public static double[] CreateSpanParameters(this Curve curve, int samplesPerSpan)
Create samples in curve parameter space using a fixed number of span-divisions.
curve (Curve)Curve to sample.
samplesPerSpan (int)Number of samples per curve span.

DetermineSide

#Example
public static int DetermineSide(this Curve curve, Plane plane, Point3d point)
Determine on which side of a curve a point falls.
curve (Curve)Curve.
plane (Plane)Plane in which the measurement happens.
point (Point3d)Point.
-1=indeterminable, 0=coincident, 1=left, 2=right

EdgeFaceTable

#
public static Dictionary<GeometryExtensionMethods.MeshEdge, int[]> EdgeFaceTable(Mesh mesh)
Create a lookup table for edges and their adjacent faces.
mesh (Mesh)

EvaluateUvDirections

#Example
public static void EvaluateUvDirections(this Surface surface, Point2d uv, out Vector3d u, out Vector3d v)
Evaluate the UV directions at a surface parameter.
surface (Surface)
uv (Point2d)
u (out Vector3d)
v (out Vector3d)

FindCocircularDomains

#Example
public static IEnumerable<Interval> FindCocircularDomains(this Curve curve, double absoluteTolerance, double angularTolarance)
Find all the circular subdomains of a curve.
curve (Curve)
absoluteTolerance (double)
angularTolarance (double)

FindCollinearDomains

#Example
public static IEnumerable<Interval> FindCollinearDomains(this Curve curve, double absoluteTolerance, double angularTolarance)
Find all the linear subdomains of a curve.
curve (Curve)
absoluteTolerance (double)
angularTolarance (double)

FindRadiusCrossing

#Example
public static double FindRadiusCrossing(this Curve curve, double radiusThreshold, double t0, double t1)
Find the parameter on the curve where the curvature radius crosses the given threshold.
curve (Curve)Curve to search.
radiusThreshold (double)Threshold to compare against.
t0 (double)Search start parameter.
t1 (double)Search end parameter.
Parameter in the [t0, t1] interval closest to t0 where the curvature radius equals the threshold, or double.NaN.

GetAllDiscontinuities

#Example
public static IEnumerable<double> GetAllDiscontinuities(this Curve curve, Continuity continuity)
Iterate over all discontinuities on a curve. The start and end of the curve domain are *always* included.
curve (Curve)
continuity (Continuity)

GetSides

#Example
public static Rectangle3d[] GetSides(this Box box)
Gets the 6 sides of a box as rectangles. Oriented such that the rectangle plane normal always points away from the box interior. The order of the faces is: bottom, left, front, right, back, top
box (Box)

PointOnInterior

#
public static Point2d PointOnInterior(Point2d[][] boundaries, double precision)
Find the most remote point inside a set of closed polylines.
boundaries (Point2d[][])
precision (double)

PointOnInterior

#
public static Point3d PointOnInterior(Polyline[] boundaries, double precision)
Find the most remote point inside a set of closed polylines. Only the X and Y coordinates of the polylines are taken into account. Polylines should all be closed.
boundaries (Polyline[])
precision (double)

PointOnInterior

#Example
public static Point3d PointOnInterior(this BrepFace face, double precision, out Point2d uv)
Return a point on the interior of a face.
face (BrepFace)
precision (double)
uv (out Point2d)

PointOnInterior

#Example
public static Point3d PointOnInterior(this BrepFace face, double precision)
Return a point on the interior of a face.
face (BrepFace)
precision (double)

PointOnIsoInterior

#Example
public static Point3d PointOnIsoInterior(this BrepFace face, out Point2d uv)
Return a point in the middle of the longest interior isocurve domain from a random sampling.
face (BrepFace)
uv (out Point2d)

RadiusAt

#Example
public static double RadiusAt(this Curve curve, double t)
Get the curvature radius at a parameter.
curve (Curve)
t (double)

SampleSpans

#Example
public static Point3d[] SampleSpans(this Curve curve, int density = 10)
Create an array of points sampled from each curve span.
curve (Curve)
density (int = 10)

SetAllVertices

#Example
public static void SetAllVertices(this MeshVertexList vertices, IEnumerable<Point3d> points)
vertices (MeshVertexList)
points (IEnumerable<Point3d>)

SetAllVertices

#Example
public static void SetAllVertices(this MeshVertexList vertices, Point3d[] points)
vertices (MeshVertexList)
points (Point3d[])
public static bool Split(this Curve curve, Plane plane, double tolerance, out Curve[] above, out Curve[] below)
Split a curve with a plane.
curve (Curve)
plane (Plane)
tolerance (double)
above (out Curve[])
below (out Curve[])
True if the curve was split, false if it ended up in its entirety into either the above or below output.

ToMeshSafe

#Example
public static Mesh ToMeshSafe(this Surface surface, MeshingParameters parameters)
Mesh a surface in a thread-safe manner. See ToMeshSafe(Brep, MeshingParameters, MeshType?) for why this is necessary; this method locks on surface so it cannot be meshed on two threads at once.
surface (Surface)Surface to mesh. May be null, in which case null is returned.
parameters (MeshingParameters)Meshing parameters.
The surface mesh, or null if meshing failed.

ToMeshSafe

#Example
public static Mesh[] ToMeshSafe(this Brep brep, MeshingParameters parameters, MeshType? meshType = null)
Mesh a brep in a thread-safe manner. Meshing a Rhino brep is not thread-safe on the native side. This method locks on brep - the same monitor the display pipeline uses - so at most one thread meshes a given instance at a time. If every face already carries a cached mesh it is reused rather than re-meshed.
brep (Brep)Brep to mesh. May be null, in which case an empty array is returned.
parameters (MeshingParameters)Meshing parameters.
meshType (MeshType? = null)Optional mesh type. When supplied, cached meshes of this type are reused and any freshly created meshes are stored back onto the brep faces for later reuse. When omitted, any available cached mesh is reused, but newly created meshes are not stored.
One mesh per brep face, or an empty array if meshing failed.

ToPolyline

#Example
public static Polyline ToPolyline(this Circle circle, int segments)
Convert a circle to a polyline.
circle (Circle)Circle to convert.
segments (int)Number of segments.