[IoId("00000000-ac6e-48bd-9ad0-ea8290204877")] public sealed class Region : IStorable
A two-dimensional bounded region with optional holes.

Constructors

Region

#
public Region(IReader reader)
Deserialization constructor.
reader (IReader)

Properties

InnerArea

#
public double InnerArea { get; }
Gets the combined area of all inner hole curves.

InnerCount

#
public int InnerCount { get; }
Gets the total number of holes in all regions.

InnerLength

#
public double InnerLength { get; }
Gets the combined length of all inner hole curves.

OuterArea

#
public double OuterArea { get; }
Gets the combined area of all outer boundary curves.

OuterCount

#
public int OuterCount { get; }
Gets the number of sub-regions.

OuterLength

#
public double OuterLength { get; }
Gets the combined length of all outer boundary curves.

Plane

#
public Plane Plane { get; }
Gets the plane within which this region is defined.

PlaneToWorld3

#
public Transform PlaneToWorld3 { get; }
Gets the transform from plane (u,v) coordinates to world (x,y,z) coordinates.

WorldToPlane2

#
public Transform WorldToPlane2 { get; }
Gets the transform from world (x,y,z) coordinates to plane (u,v) coordinates.

WorldToPlane3

#
public Transform WorldToPlane3 { get; }
Gets the transform from world (x,y,z) coordinates to plane (u,v,w) coordinates.

Methods

BooleanDifference

#
public Region BooleanDifference(Brep brep)
Use a solid brep to cut holes in this region.
brep (Brep)Brep, should be solid.
Modified region.

BooleanDifference

#
public static Region BooleanDifference(Region a, Region b)
Difference two regions. The difference happens in the plane of the first region.
a (Region)First (and primary) region.
b (Region)Secondary region.

BooleanIntersection

#
public Region BooleanIntersection(Brep brep)
Use a solid brep to limit this region.
brep (Brep)Brep, must be solid.
Modified region. If null, it means this region was entirely disjoint from the brep.

BooleanIntersection

#
public static Region BooleanIntersection(Region a, Region b)
Intersect two regions. The difference happens in the plane of the first region. As such, the order matters.
a (Region)First (and primary) region.
b (Region)Secondary region.

BooleanUnion

#
public static Region BooleanUnion(params Region[] regions)
Union two regions. The union happens in the plane of the first region, as such, the order matters.
regions (params Region[])

BoundingBox

#
public BoundingBox BoundingBox(Transform transform)
Gets the boundingbox of this region after applying a transform to it.
transform (Transform)

Contains

#
public RegionRelation Contains(Point2d point, double tolerance = 1E-06)
Determine the relation between this region and a point in plane (u,v) coordinates.
point (Point2d)Point to test.
tolerance (double = 1E-06)Tolerance to be used for coincidence testing.
Containment relation.

Contains

#
public RegionRelation Contains(Point3d point, double tolerance = 1E-06)
Determine the relation between this region and a point in world coordinates.
point (Point3d)Point to test.
tolerance (double = 1E-06)Tolerance to be used for coincidence testing.
Containment relation.

ContainsFast

#
public bool ContainsFast(Point2d point)
Perform much faster but also slightly less accurate point inclusion. The first time this method is called a spatial cache is constructed which speeds up the inclusion testing. So only use this method if you know you'll be using it a lot.
point (Point2d)

ContainsFast

#
public bool ContainsFast(Point3d point)
Perform much faster but also slightly less accurate point inclusion. The first time this method is called a spatial cache is constructed which speeds up the inclusion testing. So only use this method if you know you'll be using it a lot.
point (Point3d)

CreateFromBrep

#
public static Region CreateFromBrep(Brep face)
Convert a Brep with a single face into a region.
face (Brep)

CreateFromBrep

#
public static Region CreateFromBrep(Plane plane, Brep face)
Convert a Brep with a single face into a region.
plane (Plane)
face (Brep)

CreateFromBreps

#
public static Region CreateFromBreps(Plane plane, params Brep[] breps)
plane (Plane)
breps (params Brep[])

CreateFromCurves

#
public static Region CreateFromCurves(Curve outer, Curve[] inner = null)
Create a region from an outer boundary curve and a list of inner hole curves. If any of the inner curves fully contains the outer curvem, an empty region be created.
outer (Curve)Outer boundary curves.
inner (Curve[] = null)Zero or more holes.

CreateFromCurves

#
public static Region CreateFromCurves(Curve[] outer, Curve[] inner, bool continuousHoles = true)
Create a region from an unsorted and unstructed set of boundaries and holes.
outer (Curve[])One or more outer boundary curves.
inner (Curve[])One or more holes. Any hole whose set intersection with a boundary is not empty is considered part of that boundary.
continuousHoles (bool = true)If true, holes across regions are treated as continuous spaces.

CreateFromCurves

#
public static Region CreateFromCurves(Curve[] outer, Curve[][] inner)
Create a region from a set of outer boundary curves and lists of inner hole curves.
outer (Curve[])One or more outer boundary curves.
inner (Curve[][])For each boundary, zero or more holes. If the union of the holes fully contain their associated boundary, that particular boundary will go missing.

CreateFromCurves

#
public static Region CreateFromCurves(Plane plane, Curve outer, Curve[] inner = null)
Create a region from an outer boundary curve and a list of inner hole curves.
plane (Plane)Region plane.
outer (Curve)Outer boundary curves.
inner (Curve[] = null)Zero or more holes.

CreateFromCurves

#
public static Region CreateFromCurves(Plane plane, Curve[] outer, Curve[] inner, bool continuousHoles = true)
Create a region from an unsorted and unstructed set of boundaries and holes.
plane (Plane)Region plane.
outer (Curve[])One or more outer boundary curves.
inner (Curve[])One or more holes. Any hole whose set intersection with a boundary is not empty is considered part of that boundary.
continuousHoles (bool = true)If true, holes across regions are treated as continuous spaces.

CreateFromCurves

#
public static Region CreateFromCurves(Plane plane, Curve[] outer, Curve[][] inner)
Create a region from a set of outer boundary curves and lists of inner hole curves.
plane (Plane)Region plane.
outer (Curve[])One or more outer boundary curves.
inner (Curve[][])For each boundary, zero or more holes.

Empty

#
public static Region Empty(Plane plane)
Create an empty region.
plane (Plane)Plane of region.

Explode

#
public Region[] Explode()
Explode this region into multiple ones with only a single outer boundary each.

FitPlaneToCurves

#
public static Plane FitPlaneToCurves(params IEnumerable<Curve>[] curves)
Fit a single plane to the control points of a set of curves.
curves (params IEnumerable<Curve>[])
Explicit

IStorable.Store

#
void IStorable.Store(IWriter writer)
writer (IWriter)
Store

InnerBounds

#
public (Interval x, Interval y) InnerBounds(int outerIndex, int innerIndex)
Gets the bounds (in the 2D canonical plane) of the specified inner boundary.
outerIndex (int)
innerIndex (int)

InteriorPoints

#
public Point3d[] InteriorPoints(int densityHint)
A method for generating the point distribution on the interior of the region.
densityHint (int)Hint for the total number of points on the combined outer boundaries. 190 is a decent value to start with. Do note that after the points on the boundary are tesselated, triangles with naked edges are omitted from the result. So the density hint has very little to do with the actual number of returned points.
An array of points on the interior of the region, or null if something went wrong.

OuterBounds

#
public (Interval x, Interval y) OuterBounds(int index)
Gets the bounds (in the 2D canonical plane) of the specified outer boundary.
index (int)

RollingBall

#
public Region RollingBall(double radius, double tolerance = 1E-06, CancellationToken token = default(CancellationToken))
Computes the part of this region a disk of the given radius can reach while rolling around inside it: convex corners are rounded off and features narrower than the disk disappear. A negative radius rolls the disk around the outside instead and returns the region plus everything outside it the disk cannot get into: concave corners are rounded off and notches narrower than the disk fill up.
radius (double)
tolerance (double = 1E-06)
token (CancellationToken = null)

RollingBall

#
public Region RollingBall(double radius, double tolerance, out RegionLoop[] loops, CancellationToken token = default(CancellationToken))
Computes the part of this region a disk of the given radius can reach while rolling around inside it, and reports the boundary of the result as trimmed pieces of the original curves joined by true arcs.
radius (double)
tolerance (double)
loops (out RegionLoop[])
token (CancellationToken = null)

RollingBall

#
public Region RollingBall(double radius, double tolerance, Point3d start, CancellationToken token = default(CancellationToken))
Computes the part of this region a disk of the given radius can reach while rolling around inside it, starting out covering the given point; parts of the region the disk cannot roll to from there are left out.
radius (double)
tolerance (double)
start (Point3d)
token (CancellationToken = null)

RollingBall

#
public Region RollingBall(double radius, double tolerance, Point3d start, out RegionLoop[] loops, CancellationToken token = default(CancellationToken))
Computes the part of this region a disk of the given radius can reach while rolling around inside it, starting out covering the given point, and reports the boundary of the result as trimmed pieces of the original curves joined by true arcs.
radius (double)
tolerance (double)
start (Point3d)
loops (out RegionLoop[])
token (CancellationToken = null)

Slice

#
public void Slice(Line line, out Region left, out Region right)
Slice this region along a line.
line (Line)Slicing line.
left (out Region)Region to the left.
right (out Region)Regio to the right.

ToBrep

#
public Brep ToBrep(int index)
Create a planar brep representing the specified subregion.
index (int)

ToCurve

#
public Curve ToCurve(int outerIndex, int innerIndex)
Create a curve representing the specified inner boundary in 3D.
outerIndex (int)
innerIndex (int)

ToCurve

#
public Curve ToCurve(int outerIndex)
Create a curve representing the specified outer boundary in 3D.
outerIndex (int)

ToCurves

#
public Curve[] ToCurves(int outerIndex)
Gets an array of the outer boundary curve plus all associated hole curves for the given sub region.
outerIndex (int)

ToHatch

#
public Hatch ToHatch(int index, int patternIndex, double scale, double rotation)
Create a hatch out of the specified subregion.
index (int)
patternIndex (int)
scale (double)
rotation (double)

ToMesh

#
public Mesh ToMesh(double tolerance)
Create a mesh approximating this region.
tolerance (double)

ToString

#
public override string ToString()
Object.ToString

Transform

#
public Region Transform(Transform transform)
Transform this region.
transform (Transform)

WithoutHoles

#
public Region WithoutHoles()
Remove all holes from this region.

Convertors

OperationResultDescription
implicitCircleRegionConvert a circle into a region.
implicitRectangle3dRegionConvert a rectahgle into a region.