GeometryExtensionMethods

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

Methods

ClosestPointToInterior

#Example
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.
public static bool ClosestPointToInterior(
this BrepFace
face,
Brep face.
point,
World point.
out double
u,
U parameter on surface closest to point.
out double
v
V parameter on surface closest to point.
)
True if projection was successful.

CreateSpanParameters

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

CreateSpanParameters

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

DetermineSide

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

EdgeFaceTable

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

EvaluateUvDirections

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

FindCocircularDomains

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

FindCollinearDomains

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

FindRadiusCrossing

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

GetAllDiscontinuities

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

GetSides

#Example
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
public static Rectangle3d[] GetSides(
this Box
box
)

PointOnInterior

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

PointOnInterior

#
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.
public static Point3d PointOnInterior(
boundaries,
precision
)

PointOnInterior

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

PointOnInterior

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

PointOnIsoInterior

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

RadiusAt

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

SampleSpans

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

SetAllVertices

#Example
public static void SetAllVertices(
vertices,
points
)

SetAllVertices

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

ToMeshSafe

#Example
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.
public static Mesh ToMeshSafe(
this Surface
surface,
Surface to mesh. May be null, in which case null is returned.
parameters
Meshing parameters.
)
The surface mesh, or null if meshing failed.

ToMeshSafe

#Example
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.
public static Mesh[] ToMeshSafe(
this Brep
brep,
Brep to mesh. May be null, in which case an empty array is returned.
parameters,
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
Convert a circle to a polyline.
public static Polyline ToPolyline(
this Circle
circle,
Circle to convert.
segments
Number of segments.
)