Skip to content

DiGi.Geometry.Planar.Classes

github-actions[bot] edited this page Aug 21, 2026 · 4 revisions

DiGi.Geometry.Planar.Classes Namespace

Classes

BooleanOperationResult2D Class

Represents the abstract base class for a 2D boolean operation result.

public abstract class BooleanOperationResult2D : DiGi.Core.Classes.SerializableObject, DiGi.Geometry.Planar.Interfaces.IBooleanOperationResult2D, DiGi.Core.Interfaces.ISerializableResult, DiGi.Core.Interfaces.IResult, DiGi.Core.Interfaces.IObject, DiGi.Core.Interfaces.ISerializableObject, DiGi.Core.Interfaces.ICloneableObject<DiGi.Core.Interfaces.ISerializableObject>, DiGi.Core.Interfaces.ICloneableObject

Inheritance System.ObjectDiGi.Core.Classes.ObjectDiGi.Core.Classes.SerializableObject → BooleanOperationResult2D

Derived
DifferenceResult2D
IntersectionResult2D
UnionResult2D

Implements IBooleanOperationResult2D, DiGi.Core.Interfaces.ISerializableResult, DiGi.Core.Interfaces.IResult, DiGi.Core.Interfaces.IObject, DiGi.Core.Interfaces.ISerializableObject, DiGi.Core.Interfaces.ICloneableObject<DiGi.Core.Interfaces.ISerializableObject>, DiGi.Core.Interfaces.ICloneableObject

Constructors

BooleanOperationResult2D() Constructor

Initializes a new instance of the BooleanOperationResult2D class.

protected BooleanOperationResult2D();

BooleanOperationResult2D(BooleanOperationResult2D) Constructor

Initializes a new instance of the BooleanOperationResult2D class using another instance.

protected BooleanOperationResult2D(DiGi.Geometry.Planar.Classes.BooleanOperationResult2D? booleanOperationResult2D);

Parameters

booleanOperationResult2D BooleanOperationResult2D

The instance to copy from.

BooleanOperationResult2D(IEnumerable<IGeometry2D>) Constructor

Initializes a new instance of the BooleanOperationResult2D class with the specified geometries.

protected BooleanOperationResult2D(System.Collections.Generic.IEnumerable<DiGi.Geometry.Planar.Interfaces.IGeometry2D>? geometry2Ds);

Parameters

geometry2Ds System.Collections.Generic.IEnumerable<DiGi.Geometry.Planar.Interfaces.IGeometry2D>

The geometries to store in the result.

BooleanOperationResult2D(List<IGeometry2D>, bool) Constructor

Initializes a new instance of the BooleanOperationResult2D class from a prebuilt list of geometries.

protected BooleanOperationResult2D(System.Collections.Generic.List<DiGi.Geometry.Planar.Interfaces.IGeometry2D>? geometry2Ds, bool clone);

Parameters

geometry2Ds System.Collections.Generic.List<DiGi.Geometry.Planar.Interfaces.IGeometry2D>

The list of geometries to store in the result.

clone System.Boolean

When true, each geometry is cloned defensively; when false, the supplied list is adopted directly without cloning. Use false only when the caller owns freshly created geometries that are not shared.

BooleanOperationResult2D(JsonObject) Constructor

Initializes a new instance of the BooleanOperationResult2D class using the specified System.Text.Json.Nodes.JsonObject.

protected BooleanOperationResult2D(System.Text.Json.Nodes.JsonObject? jsonObject);

Parameters

jsonObject System.Text.Json.Nodes.JsonObject

The System.Text.Json.Nodes.JsonObject used to initialize the instance.

Properties

BooleanOperationResult2D.BooleanOpertaionType Property

Gets the type of the boolean operation.

public abstract DiGi.Geometry.Core.Enums.BooleanOpertaionType BooleanOpertaionType { get; }

Implements BooleanOpertaionType

Property Value

BooleanOpertaionType

BooleanOperationResult2D.Count Property

Gets the total number of DiGi.Geometry.Planar.Interfaces.IGeometry2D elements.

public int Count { get; }

Implements Count

Property Value

System.Int32

BooleanOperationResult2D.this[int] Property

Gets the 2D geometry at the specified index.

public DiGi.Geometry.Planar.Interfaces.IGeometry2D? this[int index] { get; }

Parameters

index System.Int32

The zero-based index of the geometry to retrieve.

Implements this[int]

Property Value

DiGi.Geometry.Planar.Interfaces.IGeometry2D

Methods

BooleanOperationResult2D.Any() Method

Determines whether there are any 2D geometries present.

public bool Any();

Implements Any()

Returns

System.Boolean
true if any geometries are present; otherwise, false.

BooleanOperationResult2D.Contains<T>() Method

Determines whether the collection contains any object of the specified type T.

public bool Contains<T>()
    where T : DiGi.Geometry.Planar.Interfaces.IGeometry2D;

Type parameters

T

The type of geometry to search for.

Implements Contains<T>()

Returns

System.Boolean
true if an object of type T is present; otherwise, false.

BooleanOperationResult2D.GetGeometry2Ds<T>() Method

Retrieves a list of 2D geometries of the specified type T.

public System.Collections.Generic.List<T>? GetGeometry2Ds<T>()
    where T : DiGi.Geometry.Planar.Interfaces.IGeometry2D;

Type parameters

T

The type of geometry to retrieve, which must implement the DiGi.Geometry.Planar.Interfaces.IGeometry2D interface.

Implements GetGeometry2Ds<T>()

Returns

System.Collections.Generic.List<T>
A list of matching geometries, or null if no geometries are present.

BoundingBox2D Class

Represents an axis-aligned bounding box in 2D space.

public class BoundingBox2D : DiGi.Geometry.Planar.Classes.Geometry2D, DiGi.Geometry.Core.Interfaces.IBoundingBox<DiGi.Geometry.Planar.Classes.Point2D>, DiGi.Geometry.Core.Interfaces.IBoundingBox, DiGi.Geometry.Core.Interfaces.IGeometry, DiGi.Core.Interfaces.ISerializableObject, DiGi.Core.Interfaces.ICloneableObject<DiGi.Core.Interfaces.ISerializableObject>, DiGi.Core.Interfaces.ICloneableObject, DiGi.Core.Interfaces.IObject

Inheritance System.ObjectDiGi.Core.Classes.ObjectDiGi.Core.Classes.SerializableObjectGeometry2D → BoundingBox2D

Implements DiGi.Geometry.Core.Interfaces.IBoundingBox<Point2D>, DiGi.Geometry.Core.Interfaces.IBoundingBox, DiGi.Geometry.Core.Interfaces.IGeometry, DiGi.Core.Interfaces.ISerializableObject, DiGi.Core.Interfaces.ICloneableObject<DiGi.Core.Interfaces.ISerializableObject>, DiGi.Core.Interfaces.ICloneableObject, DiGi.Core.Interfaces.IObject

Constructors

BoundingBox2D(Range<double>, Range<double>) Constructor

Initializes a new instance of the BoundingBox2D class defined by X and Y ranges.

public BoundingBox2D(DiGi.Core.Classes.Range<double>? x, DiGi.Core.Classes.Range<double>? y);

Parameters

x DiGi.Core.Classes.Range<System.Double>

The range of the X axis.

y DiGi.Core.Classes.Range<System.Double>

The range of the Y axis.

BoundingBox2D(BoundingBox2D) Constructor

Initializes a new instance of the BoundingBox2D class by cloning an existing bounding box.

public BoundingBox2D(DiGi.Geometry.Planar.Classes.BoundingBox2D boundingBox2D);

Parameters

boundingBox2D BoundingBox2D

The source bounding box to clone.

BoundingBox2D(Point2D, Point2D) Constructor

Initializes a new instance of the BoundingBox2D class defined by two points as opposite corners.

public BoundingBox2D(DiGi.Geometry.Planar.Classes.Point2D? point2D_1, DiGi.Geometry.Planar.Classes.Point2D? point2D_2);

Parameters

point2D_1 Point2D

The first corner point.

point2D_2 Point2D

The second corner point.

BoundingBox2D(double, double, double, double) Constructor

Initializes a new instance of the BoundingBox2D class defined by its origin and size.

public BoundingBox2D(double x, double y, double width, double height);

Parameters

x System.Double

The X coordinate of the origin.

y System.Double

The Y coordinate of the origin.

width System.Double

The width of the bounding box.

height System.Double

The height of the bounding box.

BoundingBox2D(double, double, double, double, bool) Constructor

Initializes a new instance of the BoundingBox2D class directly from corner coordinates, without intermediate allocations.

internal BoundingBox2D(double x_1, double y_1, double x_2, double y_2, bool sorted);

Parameters

x_1 System.Double

The X coordinate of the first corner.

y_1 System.Double

The Y coordinate of the first corner.

x_2 System.Double

The X coordinate of the second corner.

y_2 System.Double

The Y coordinate of the second corner.

sorted System.Boolean

When true, the caller guarantees the first corner is the minimum and the second the maximum; when false, the coordinates are normalized.

BoundingBox2D(IEnumerable<BoundingBox2D>) Constructor

Initializes a new instance of the BoundingBox2D class that encompasses all given bounding boxes.

public BoundingBox2D(System.Collections.Generic.IEnumerable<DiGi.Geometry.Planar.Classes.BoundingBox2D?>? boundingBox2Ds);

Parameters

boundingBox2Ds System.Collections.Generic.IEnumerable<BoundingBox2D>

The collection of bounding boxes to encompass.

BoundingBox2D(IEnumerable<Point2D>) Constructor

Initializes a new instance of the BoundingBox2D class that encompasses all given points.

public BoundingBox2D(System.Collections.Generic.IEnumerable<DiGi.Geometry.Planar.Classes.Point2D>? point2Ds);

Parameters

point2Ds System.Collections.Generic.IEnumerable<Point2D>

The collection of points to encompass.

BoundingBox2D(IEnumerable<Point2D>, double) Constructor

Initializes a new instance of the BoundingBox2D class that encompasses all given points with an added offset.

public BoundingBox2D(System.Collections.Generic.IEnumerable<DiGi.Geometry.Planar.Classes.Point2D>? point2Ds, double offset);

Parameters

point2Ds System.Collections.Generic.IEnumerable<Point2D>

The collection of points to encompass.

offset System.Double

The distance to expand the bounding box in all directions.

BoundingBox2D(JsonObject) Constructor

Initializes a new instance of the BoundingBox2D class from a JSON object.

public BoundingBox2D(System.Text.Json.Nodes.JsonObject? jsonObject);

Parameters

jsonObject System.Text.Json.Nodes.JsonObject

The JSON object containing bounding box data.

Properties

BoundingBox2D.BottomLeft Property

Gets the bottom-left corner of the bounding box.

public DiGi.Geometry.Planar.Classes.Point2D? BottomLeft { get; }

Property Value

Point2D

BoundingBox2D.BottomRight Property

Gets the bottom-right corner of the bounding box.

public DiGi.Geometry.Planar.Classes.Point2D? BottomRight { get; }

Property Value

Point2D

BoundingBox2D.Height Property

Gets the height of the bounding box.

public double Height { get; }

Property Value

System.Double

BoundingBox2D.Max Property

Gets or sets the maximum corner (top-right) of the bounding box.

public DiGi.Geometry.Planar.Classes.Point2D Max { get; set; }

Implements Max

Property Value

Point2D

BoundingBox2D.Min Property

Gets the minimum corner (bottom-left) of the bounding box.

public DiGi.Geometry.Planar.Classes.Point2D Min { get; set; }

Implements Min

Property Value

Point2D

BoundingBox2D.TopLeft Property

Gets the top-left corner of the bounding box.

public DiGi.Geometry.Planar.Classes.Point2D? TopLeft { get; }

Property Value

Point2D

BoundingBox2D.TopRight Property

Gets the top-right corner of the bounding box.

public DiGi.Geometry.Planar.Classes.Point2D? TopRight { get; }

Property Value

Point2D

BoundingBox2D.Width Property

Gets the width of the bounding box.

public double Width { get; }

Property Value

System.Double

Methods

BoundingBox2D.Add(BoundingBox2D) Method

Adds another bounding box to this one, expanding it to encompass the new area.

public bool Add(DiGi.Geometry.Planar.Classes.BoundingBox2D? boundingBox2D);

Parameters

boundingBox2D BoundingBox2D

The bounding box to add.

Returns

System.Boolean
True if the bounding box was successfully added.

BoundingBox2D.Add(Point2D) Method

Adds a point to this bounding box, expanding it to encompass the point.

public bool Add(DiGi.Geometry.Planar.Classes.Point2D? point2D);

Parameters

point2D Point2D

The point to add.

Returns

System.Boolean
True if the point was successfully added.

BoundingBox2D.Clone() Method

Creates a clone of the current bounding box.

public override DiGi.Core.Interfaces.ISerializableObject? Clone();

Implements Clone()

Returns

DiGi.Core.Interfaces.ISerializableObject
A cloned instance of the bounding box.

BoundingBox2D.ClosestPoint(Point2D) Method

Finds the point on the bounding box closest to the given point.

public DiGi.Geometry.Planar.Classes.Point2D? ClosestPoint(DiGi.Geometry.Planar.Classes.Point2D? point2D);

Parameters

point2D Point2D

The target point.

Returns

Point2D
The closest point on the bounding box boundary.

BoundingBox2D.Distance(Point2D) Method

Calculates the distance from a point to the bounding box boundary.

public double Distance(DiGi.Geometry.Planar.Classes.Point2D? point2D);

Parameters

point2D Point2D

The target point.

Returns

System.Double
The shortest distance to the boundary.

BoundingBox2D.GetArea() Method

Calculates the area of the bounding box.

public double GetArea();

Returns

System.Double
The area of the bounding box.

BoundingBox2D.GetCentroid() Method

Gets the centroid of the bounding box.

public DiGi.Geometry.Planar.Classes.Point2D? GetCentroid();

Returns

Point2D
The center point of the bounding box.

BoundingBox2D.GetDiagonals() Method

Gets the diagonals of the bounding box.

public DiGi.Geometry.Planar.Classes.Segment2D[]? GetDiagonals();

Returns

Segment2D[]
An array containing the two diagonal segments.

BoundingBox2D.GetLength() Method

Calculates the perimeter length of the bounding box.

public double GetLength();

Returns

System.Double
The total length of the boundary.

BoundingBox2D.GetPoint(Corner) Method

Gets the point corresponding to a specific corner of the bounding box.

public DiGi.Geometry.Planar.Classes.Point2D? GetPoint(DiGi.Geometry.Core.Enums.Corner corner);

Parameters

corner Corner

The corner to retrieve.

Returns

Point2D
The point at the specified corner.

BoundingBox2D.GetPoints() Method

Gets the four corner points of the bounding box.

public System.Collections.Generic.List<DiGi.Geometry.Planar.Classes.Point2D>? GetPoints();

Returns

System.Collections.Generic.List<Point2D>
A list containing the bottom-left, top-left, top-right, and bottom-right corners.

BoundingBox2D.GetSegments() Method

Gets the four segments forming the boundary of the bounding box.

public System.Collections.Generic.List<DiGi.Geometry.Planar.Classes.Segment2D>? GetSegments();

Returns

System.Collections.Generic.List<Segment2D>
A list of segments that define the perimeter.

BoundingBox2D.InRange(BoundingBox2D, double) Method

Checks if another bounding box is within or intersects this bounding box.

public bool InRange(DiGi.Geometry.Planar.Classes.BoundingBox2D? boundingBox2D, double tolerance=1E-06);

Parameters

boundingBox2D BoundingBox2D

The bounding box to check.

tolerance System.Double

The distance tolerance for the check.

Returns

System.Boolean
True if the bounding box is on or inside this bounding box.

BoundingBox2D.InRange(Line2D, double) Method

Checks if a line is within or intersects the bounding box.

public bool InRange(DiGi.Geometry.Planar.Classes.Line2D? line2D, double tolerance=1E-06);

Parameters

line2D Line2D

The line to check.

tolerance System.Double

The distance tolerance for the check.

Returns

System.Boolean
True if the line is in range of the bounding box.

BoundingBox2D.InRange(Point2D, double) Method

Checks if a point is within or on the boundary of this bounding box.

public bool InRange(DiGi.Geometry.Planar.Classes.Point2D? point2D, double tolerance=1E-06);

Parameters

point2D Point2D

The point to check.

tolerance System.Double

The distance tolerance for the check.

Returns

System.Boolean
True if the point is on or inside the bounding box.

BoundingBox2D.InRange(Segment2D, double) Method

Checks if a segment is within or intersects the bounding box.

public bool InRange(DiGi.Geometry.Planar.Classes.Segment2D? segment2D, double tolerance=1E-06);

Parameters

segment2D Segment2D

The segment to check.

tolerance System.Double

The distance tolerance for the check.

Returns

System.Boolean
True if the segment is in range of the bounding box.

BoundingBox2D.InRange(ISegmentable2D, double) Method

Checks if a segmentable geometry is within or intersects the bounding box.

public bool InRange(DiGi.Geometry.Planar.Interfaces.ISegmentable2D? segmentable2D, double tolerance=1E-06);

Parameters

segmentable2D ISegmentable2D

The geometry to check.

tolerance System.Double

The distance tolerance for the check.

Returns

System.Boolean
True if any part of the geometry is in range of the bounding box.

BoundingBox2D.InRange_Old(Segment2D, double) Method

Legacy method to check if a segment is within or intersects the bounding box.

public bool InRange_Old(DiGi.Geometry.Planar.Classes.Segment2D? segment2D, double tolerance=1E-06);

Parameters

segment2D Segment2D

The segment to check.

tolerance System.Double

The distance tolerance for the check.

Returns

System.Boolean
True if the segment is in range of the bounding box.

BoundingBox2D.Inside(BoundingBox2D, double) Method

Checks if boundingBox2D is inside this BoundingBox2D

public bool Inside(DiGi.Geometry.Planar.Classes.BoundingBox2D? boundingBox2D, double tolerance=1E-06);

Parameters

boundingBox2D BoundingBox2D

BoundingBox2D

tolerance System.Double

Tolerance

Returns

System.Boolean
True if given boundingBox2D is inside this BoundingBox2D with given tolerance

BoundingBox2D.Inside(Point2D, double) Method

Checks if a point is strictly inside the bounding box boundaries.

public bool Inside(DiGi.Geometry.Planar.Classes.Point2D? point2D, double tolerance=1E-06);

Parameters

point2D Point2D

The point to check.

tolerance System.Double

The distance tolerance for the check.

Returns

System.Boolean
True if the point is strictly inside.

BoundingBox2D.Inside(ISegmentable2D, double) Method

Checks if a segmentable geometry is strictly inside the bounding box boundaries.

public bool Inside(DiGi.Geometry.Planar.Interfaces.ISegmentable2D? segmentable2D, double tolerance=1E-06);

Parameters

segmentable2D ISegmentable2D

The geometry to check.

tolerance System.Double

The distance tolerance for the check.

Returns

System.Boolean
True if all points of the geometry are strictly inside.

BoundingBox2D.Inside(IEnumerable<Point2D>, double) Method

Checks if a collection of points are all strictly inside the bounding box boundaries.

public bool Inside(System.Collections.Generic.IEnumerable<DiGi.Geometry.Planar.Classes.Point2D>? point2Ds, double tolerance=1E-06);

Parameters

point2Ds System.Collections.Generic.IEnumerable<Point2D>

The collection of points to check.

tolerance System.Double

The distance tolerance for the check.

Returns

System.Boolean
True if all points are strictly inside.

BoundingBox2D.Move(Vector2D) Method

Moves the bounding box by the specified vector.

public override bool Move(DiGi.Geometry.Planar.Classes.Vector2D? vector2D);

Parameters

vector2D Vector2D

The translation vector.

Returns

System.Boolean
True if the move was successful.

BoundingBox2D.Offset(double) Method

Offsets the bounding box boundaries by a specified distance in all directions.

public void Offset(double value);

Parameters

value System.Double

The offset value.

BoundingBox2D.On(Point2D, double) Method

Checks if a point lies on the boundary of the bounding box.

public bool On(DiGi.Geometry.Planar.Classes.Point2D? point2D, double tolerance=1E-06);

Parameters

point2D Point2D

The point to check.

tolerance System.Double

The distance tolerance for the check.

Returns

System.Boolean
True if the point is on the boundary.

BoundingBox2D.Transform(ITransform2D) Method

Transforms the bounding box using the specified transformation.

public override bool Transform(DiGi.Geometry.Planar.Interfaces.ITransform2D? transform);

Parameters

transform DiGi.Geometry.Planar.Interfaces.ITransform2D

The transformation to apply.

Returns

System.Boolean
True if the transformation was successful.

Operators

BoundingBox2D.implicit operator Polygon2D(BoundingBox2D) Operator

Implicitly converts a BoundingBox2D to a Polygon2D.

public static DiGi.Geometry.Planar.Classes.Polygon2D? implicit operator DiGi.Geometry.Planar.Classes.Polygon2D?(DiGi.Geometry.Planar.Classes.BoundingBox2D boundingBox2D);

Parameters

boundingBox2D BoundingBox2D

The bounding box to convert.

Returns

Polygon2D
A Polygon2D representation of the bounding box.

Circle2D Class

Represents a 2D circle defined by its center and radius.

public class Circle2D : DiGi.Geometry.Planar.Classes.Geometry2D, DiGi.Geometry.Planar.Interfaces.IEllipse2D, DiGi.Geometry.Planar.Interfaces.IClosedCurve2D, DiGi.Geometry.Core.Interfaces.IClosedCurve, DiGi.Geometry.Core.Interfaces.ICurve, DiGi.Geometry.Core.Interfaces.IGeometry, DiGi.Core.Interfaces.ISerializableObject, DiGi.Core.Interfaces.ICloneableObject<DiGi.Core.Interfaces.ISerializableObject>, DiGi.Core.Interfaces.ICloneableObject, DiGi.Core.Interfaces.IObject, DiGi.Geometry.Planar.Interfaces.IGeometry2D, DiGi.Geometry.Planar.Interfaces.IMovable2D, DiGi.Geometry.Core.Interfaces.IMovable<DiGi.Geometry.Planar.Classes.Vector2D>, DiGi.Geometry.Core.Interfaces.IMovable, DiGi.Geometry.Planar.Interfaces.ITransformable2D, DiGi.Geometry.Core.Interfaces.ITransformable<DiGi.Geometry.Planar.Interfaces.ITransform2D>, DiGi.Geometry.Core.Interfaces.ITransformable, DiGi.Geometry.Planar.Interfaces.ICurve2D, DiGi.Geometry.Planar.Interfaces.ICollectable2D, DiGi.Geometry.Core.Interfaces.ICollectable, DiGi.Geometry.Planar.Interfaces.IBoundable2D, DiGi.Geometry.Core.Interfaces.IBoundable

Inheritance System.ObjectDiGi.Core.Classes.ObjectDiGi.Core.Classes.SerializableObjectGeometry2D → Circle2D

Implements IEllipse2D, IClosedCurve2D, DiGi.Geometry.Core.Interfaces.IClosedCurve, DiGi.Geometry.Core.Interfaces.ICurve, DiGi.Geometry.Core.Interfaces.IGeometry, DiGi.Core.Interfaces.ISerializableObject, DiGi.Core.Interfaces.ICloneableObject<DiGi.Core.Interfaces.ISerializableObject>, DiGi.Core.Interfaces.ICloneableObject, DiGi.Core.Interfaces.IObject, DiGi.Geometry.Planar.Interfaces.IGeometry2D, DiGi.Geometry.Planar.Interfaces.IMovable2D, DiGi.Geometry.Core.Interfaces.IMovable<Vector2D>, DiGi.Geometry.Core.Interfaces.IMovable, DiGi.Geometry.Planar.Interfaces.ITransformable2D, DiGi.Geometry.Core.Interfaces.ITransformable<DiGi.Geometry.Planar.Interfaces.ITransform2D>, DiGi.Geometry.Core.Interfaces.ITransformable, DiGi.Geometry.Planar.Interfaces.ICurve2D, DiGi.Geometry.Planar.Interfaces.ICollectable2D, DiGi.Geometry.Core.Interfaces.ICollectable, IBoundable2D, DiGi.Geometry.Core.Interfaces.IBoundable

Constructors

Circle2D() Constructor

Initializes a new instance of the Circle2D class.

public Circle2D();

Circle2D(Circle2D) Constructor

Initializes a new instance of the Circle2D class by cloning an existing circle.

public Circle2D(DiGi.Geometry.Planar.Classes.Circle2D? circle2D);

Parameters

circle2D Circle2D

The source circle to clone.

Circle2D(Point2D, double) Constructor

Initializes a new instance of the Circle2D class with a specified center and radius.

public Circle2D(DiGi.Geometry.Planar.Classes.Point2D? center, double radius);

Parameters

center Point2D

The center point of the circle.

radius System.Double

The radius of the circle.

Circle2D(JsonObject) Constructor

Initializes a new instance of the Circle2D class from a JSON object.

public Circle2D(System.Text.Json.Nodes.JsonObject? jsonObject);

Parameters

jsonObject System.Text.Json.Nodes.JsonObject

The JSON object containing circle data.

Properties

Circle2D.Center Property

Gets or sets the center point of the circle.

public DiGi.Geometry.Planar.Classes.Point2D? Center { get; set; }

Implements Center

Property Value

Point2D

Circle2D.Diameter Property

Gets or sets the diameter of the circle.

public double Diameter { get; set; }

Property Value

System.Double

Circle2D.Length Property

Gets the circumference (length) of the circle.

public double Length { get; }

Property Value

System.Double

Circle2D.Radius Property

Gets or sets the radius of the circle.

public double Radius { get; set; }

Property Value

System.Double

Methods

Circle2D.Clone() Method

Creates a clone of the current circle.

public override DiGi.Core.Interfaces.ISerializableObject? Clone();

Implements Clone()

Returns

DiGi.Core.Interfaces.ISerializableObject
A cloned instance of the circle.

Circle2D.GetArea() Method

Calculates the area of the circle.

public double GetArea();

Implements GetArea()

Returns

System.Double
The area of the circle.

Circle2D.GetBoundingBox() Method

Gets the axis-aligned bounding box of the circle.

public DiGi.Geometry.Planar.Classes.BoundingBox2D? GetBoundingBox();

Implements GetBoundingBox()

Returns

BoundingBox2D
The bounding box encompassing the circle.

Circle2D.GetInternalPoint(double) Method

Gets a point guaranteed to be inside the circle.

public DiGi.Geometry.Planar.Classes.Point2D? GetInternalPoint(double tolerance=1E-06);

Parameters

tolerance System.Double

The distance tolerance.

Implements GetInternalPoint(double)

Returns

Point2D
An internal point of the circle.

Circle2D.GetPerimeter() Method

Gets the perimeter (circumference) of the circle.

public double GetPerimeter();

Implements GetPerimeter()

Returns

System.Double
The length of the boundary.

Circle2D.InRange(BoundingBox2D, double) Method

Checks if an axis-aligned bounding box is within or intersects the circle.

public bool InRange(DiGi.Geometry.Planar.Classes.BoundingBox2D? boundingBox2D, double tolerance=1E-06);

Parameters

boundingBox2D BoundingBox2D

The bounding box to check.

tolerance System.Double

The distance tolerance for the check.

Returns

System.Boolean
True if the bounding box is in range of the circle.

Circle2D.InRange(Point2D, double) Method

Checks if a point is within or on the boundary of the circle.

public bool InRange(DiGi.Geometry.Planar.Classes.Point2D? point2D, double tolerance=1E-06);

Parameters

point2D Point2D

The point to check.

tolerance System.Double

The distance tolerance for the check.

Implements InRange(Point2D, double)

Returns

System.Boolean
True if the point is in range of the circle.

Circle2D.InRange(ISegmentable2D, double) Method

Checks if a segmentable geometry is within or intersects the circle.

public bool InRange(DiGi.Geometry.Planar.Interfaces.ISegmentable2D? segmentable2D, double tolerance=1E-06);

Parameters

segmentable2D ISegmentable2D

The geometry to check.

tolerance System.Double

The distance tolerance for the check.

Returns

System.Boolean
True if any part of the geometry is in range of the circle.

Circle2D.Inside(Point2D, double) Method

Checks if a point is strictly inside the circle boundaries.

public bool Inside(DiGi.Geometry.Planar.Classes.Point2D? point2D, double tolerance=1E-06);

Parameters

point2D Point2D

The point to check.

tolerance System.Double

The distance tolerance for the check.

Implements Inside(Point2D, double)

Returns

System.Boolean
True if the point is strictly inside.

Circle2D.Inside(ISegmentable2D, double) Method

Checks if a segmentable geometry is strictly inside the circle boundaries.

public bool Inside(DiGi.Geometry.Planar.Interfaces.ISegmentable2D? segmentable2D, double tolerance=1E-06);

Parameters

segmentable2D ISegmentable2D

The geometry to check.

tolerance System.Double

The distance tolerance for the check.

Returns

System.Boolean
True if all points of the geometry are strictly inside.

Circle2D.Move(Vector2D) Method

Moves the circle by the specified vector.

public override bool Move(DiGi.Geometry.Planar.Classes.Vector2D? vector2D);

Parameters

vector2D Vector2D

The translation vector.

Returns

System.Boolean
True if the move was successful.

Circle2D.On(Point2D, double) Method

Checks if a point lies on the boundary of the circle.

public bool On(DiGi.Geometry.Planar.Classes.Point2D? point2D, double tolerance=1E-06);

Parameters

point2D Point2D

The point to check.

tolerance System.Double

The distance tolerance for the check.

Returns

System.Boolean
True if the point is on the boundary.

Circle2D.Transform(ITransform2D) Method

Transforms the circle using the specified transformation.

public override bool Transform(DiGi.Geometry.Planar.Interfaces.ITransform2D? transform);

Parameters

transform DiGi.Geometry.Planar.Interfaces.ITransform2D

The transformation to apply.

Returns

System.Boolean
True if the transformation was successful.

ConvexHullComparer Class

internal class ConvexHullComparer : System.Collections.Generic.IComparer<DiGi.Geometry.Planar.Classes.Point2D>

Inheritance System.Object → ConvexHullComparer

Implements System.Collections.Generic.IComparer<Point2D>

Methods

ConvexHullComparer.Compare(Point2D, Point2D) Method

Compares two points for the purpose of calculating a convex hull.

public int Compare(DiGi.Geometry.Planar.Classes.Point2D point2D_1, DiGi.Geometry.Planar.Classes.Point2D point2D_2);

Parameters

point2D_1 Point2D

The first point to compare.

point2D_2 Point2D

The second point to compare.

Returns

System.Int32
A value indicating the relative order of the two points.

Coordinate2D Class

Base class for 2D coordinates providing basic transformation and movement functionality.

public abstract class Coordinate2D : DiGi.Geometry.Core.Classes.Coordinate, DiGi.Geometry.Planar.Interfaces.ICollectable2D, DiGi.Geometry.Core.Interfaces.ICollectable, DiGi.Geometry.Core.Interfaces.IGeometry, DiGi.Core.Interfaces.ISerializableObject, DiGi.Core.Interfaces.ICloneableObject<DiGi.Core.Interfaces.ISerializableObject>, DiGi.Core.Interfaces.ICloneableObject, DiGi.Core.Interfaces.IObject, DiGi.Geometry.Planar.Interfaces.IGeometry2D, DiGi.Geometry.Planar.Interfaces.IMovable2D, DiGi.Geometry.Core.Interfaces.IMovable<DiGi.Geometry.Planar.Classes.Vector2D>, DiGi.Geometry.Core.Interfaces.IMovable, DiGi.Geometry.Planar.Interfaces.ITransformable2D, DiGi.Geometry.Core.Interfaces.ITransformable<DiGi.Geometry.Planar.Interfaces.ITransform2D>, DiGi.Geometry.Core.Interfaces.ITransformable

Inheritance System.ObjectDiGi.Core.Classes.ObjectDiGi.Core.Classes.SerializableObjectCoordinate → Coordinate2D

Derived
Point2D
Vector2D

Implements DiGi.Geometry.Planar.Interfaces.ICollectable2D, DiGi.Geometry.Core.Interfaces.ICollectable, DiGi.Geometry.Core.Interfaces.IGeometry, DiGi.Core.Interfaces.ISerializableObject, DiGi.Core.Interfaces.ICloneableObject<DiGi.Core.Interfaces.ISerializableObject>, DiGi.Core.Interfaces.ICloneableObject, DiGi.Core.Interfaces.IObject, DiGi.Geometry.Planar.Interfaces.IGeometry2D, DiGi.Geometry.Planar.Interfaces.IMovable2D, DiGi.Geometry.Core.Interfaces.IMovable<Vector2D>, DiGi.Geometry.Core.Interfaces.IMovable, DiGi.Geometry.Planar.Interfaces.ITransformable2D, DiGi.Geometry.Core.Interfaces.ITransformable<DiGi.Geometry.Planar.Interfaces.ITransform2D>, DiGi.Geometry.Core.Interfaces.ITransformable

Constructors

Coordinate2D() Constructor

Initializes a new instance of the Coordinate2D class.

public Coordinate2D();

Coordinate2D(Coordinate2D) Constructor

Initializes a new instance of the Coordinate2D class by cloning an existing coordinate.

public Coordinate2D(DiGi.Geometry.Planar.Classes.Coordinate2D? coordinate2D);

Parameters

coordinate2D Coordinate2D

The source coordinate to clone.

Coordinate2D(double, double) Constructor

Initializes a new instance of the Coordinate2D class with specified X and Y coordinates.

public Coordinate2D(double x, double y);

Parameters

x System.Double

The X coordinate.

y System.Double

The Y coordinate.

Coordinate2D(double[]) Constructor

Initializes a new instance of the Coordinate2D class from an array of values.

public Coordinate2D(double[]? values);

Parameters

values System.Double[]

The coordinate values.

Coordinate2D(int) Constructor

Initializes a new instance of the Coordinate2D class with the specified internal values array length.

protected Coordinate2D(int length);

Parameters

length System.Int32

The length of the values array.

Coordinate2D(JsonObject) Constructor

Initializes a new instance of the Coordinate2D class from a JSON object.

public Coordinate2D(System.Text.Json.Nodes.JsonObject? jsonObject);

Parameters

jsonObject System.Text.Json.Nodes.JsonObject

The JSON object containing coordinate data.

Properties

Coordinate2D.X Property

Gets or sets the X coordinate.

public double X { get; set; }

Property Value

System.Double

Coordinate2D.Y Property

Gets or sets the Y coordinate.

public double Y { get; set; }

Property Value

System.Double

Methods

Coordinate2D.Move(Vector2D) Method

Moves the coordinate by the specified vector.

public bool Move(DiGi.Geometry.Planar.Classes.Vector2D? vector2D);

Parameters

vector2D Vector2D

The translation vector.

Returns

System.Boolean
True if the move was successful.

Coordinate2D.Transform(ITransform2D) Method

Transforms the coordinate using the specified transformation.

public bool Transform(DiGi.Geometry.Planar.Interfaces.ITransform2D? transform);

Parameters

transform DiGi.Geometry.Planar.Interfaces.ITransform2D

The transformation to apply.

Returns

System.Boolean
True if the transformation was successful.

CoordinateSystem2D Class

Represents a two-dimensional coordinate system defined by an origin Point2D and basis vectors Vector2D.

public class CoordinateSystem2D : DiGi.Core.Classes.SerializableObject, DiGi.Geometry.Planar.Interfaces.IMovable2D, DiGi.Geometry.Core.Interfaces.IMovable<DiGi.Geometry.Planar.Classes.Vector2D>, DiGi.Geometry.Core.Interfaces.IMovable, DiGi.Geometry.Core.Interfaces.IGeometry, DiGi.Core.Interfaces.ISerializableObject, DiGi.Core.Interfaces.ICloneableObject<DiGi.Core.Interfaces.ISerializableObject>, DiGi.Core.Interfaces.ICloneableObject, DiGi.Core.Interfaces.IObject, DiGi.Geometry.Planar.Interfaces.ITransformable2D, DiGi.Geometry.Core.Interfaces.ITransformable<DiGi.Geometry.Planar.Interfaces.ITransform2D>, DiGi.Geometry.Core.Interfaces.ITransformable

Inheritance System.ObjectDiGi.Core.Classes.ObjectDiGi.Core.Classes.SerializableObject → CoordinateSystem2D

Implements DiGi.Geometry.Planar.Interfaces.IMovable2D, DiGi.Geometry.Core.Interfaces.IMovable<Vector2D>, DiGi.Geometry.Core.Interfaces.IMovable, DiGi.Geometry.Core.Interfaces.IGeometry, DiGi.Core.Interfaces.ISerializableObject, DiGi.Core.Interfaces.ICloneableObject<DiGi.Core.Interfaces.ISerializableObject>, DiGi.Core.Interfaces.ICloneableObject, DiGi.Core.Interfaces.IObject, DiGi.Geometry.Planar.Interfaces.ITransformable2D, DiGi.Geometry.Core.Interfaces.ITransformable<DiGi.Geometry.Planar.Interfaces.ITransform2D>, DiGi.Geometry.Core.Interfaces.ITransformable

Constructors

CoordinateSystem2D() Constructor

Initializes a new instance of the CoordinateSystem2D class with default origin and world axes.

public CoordinateSystem2D();

CoordinateSystem2D(CoordinateSystem2D) Constructor

Initializes a new instance of the CoordinateSystem2D class by cloning an existing coordinate system.

public CoordinateSystem2D(DiGi.Geometry.Planar.Classes.CoordinateSystem2D? coordinateSystem2D);

Parameters

coordinateSystem2D CoordinateSystem2D

The source coordinate system to clone.

CoordinateSystem2D(Point2D) Constructor

Initializes a new instance of the CoordinateSystem2D class with a specified origin and world axes.

public CoordinateSystem2D(DiGi.Geometry.Planar.Classes.Point2D? origin);

Parameters

origin Point2D

The origin point of the coordinate system.

CoordinateSystem2D(JsonObject) Constructor

Initializes a new instance of the CoordinateSystem2D class from a JSON object.

public CoordinateSystem2D(System.Text.Json.Nodes.JsonObject? jsonObject);

Parameters

jsonObject System.Text.Json.Nodes.JsonObject

The JSON object containing coordinate system data.

Properties

CoordinateSystem2D.AxisX Property

Gets the X-axis vector of the coordinate system.

public DiGi.Geometry.Planar.Classes.Vector2D? AxisX { get; }

Property Value

Vector2D

CoordinateSystem2D.AxisY Property

Gets the Y-axis vector of the coordinate system.

public DiGi.Geometry.Planar.Classes.Vector2D? AxisY { get; }

Property Value

Vector2D

CoordinateSystem2D.Origin Property

Gets the origin point of the coordinate system.

public DiGi.Geometry.Planar.Classes.Point2D? Origin { get; }

Property Value

Point2D

Methods

CoordinateSystem2D.Clone() Method

Creates a clone of the current coordinate system.

public override DiGi.Core.Interfaces.ISerializableObject? Clone();

Implements Clone()

Returns

DiGi.Core.Interfaces.ISerializableObject
A cloned instance of the coordinate system.

CoordinateSystem2D.GetAxis(PlanarAxis) Method

Gets the vector corresponding to the specified axis.

public DiGi.Geometry.Planar.Classes.Vector2D? GetAxis(DiGi.Geometry.Planar.Enums.PlanarAxis axis);

Parameters

axis PlanarAxis

The axis to retrieve.

Returns

Vector2D
The vector of the requested axis.

CoordinateSystem2D.Move(Vector2D) Method

Moves the coordinate system origin by the specified vector.

public bool Move(DiGi.Geometry.Planar.Classes.Vector2D? vector2D);

Parameters

vector2D Vector2D

The translation vector.

Returns

System.Boolean
True if the move was successful.

CoordinateSystem2D.Transform(ITransform2D) Method

Transforms the coordinate system using the specified transformation.

public bool Transform(DiGi.Geometry.Planar.Interfaces.ITransform2D? transform);

Parameters

transform DiGi.Geometry.Planar.Interfaces.ITransform2D

The transformation to apply.

Returns

System.Boolean
True if the transformation was successful.

DifferenceResult2D Class

Represents the result of a 2D difference operation.

public class DifferenceResult2D : DiGi.Geometry.Planar.Classes.BooleanOperationResult2D, DiGi.Geometry.Planar.Interfaces.IDifferenceResult2D, DiGi.Geometry.Planar.Interfaces.IBooleanOperationResult2D, DiGi.Core.Interfaces.ISerializableResult, DiGi.Core.Interfaces.IResult, DiGi.Core.Interfaces.IObject, DiGi.Core.Interfaces.ISerializableObject, DiGi.Core.Interfaces.ICloneableObject<DiGi.Core.Interfaces.ISerializableObject>, DiGi.Core.Interfaces.ICloneableObject

Inheritance System.ObjectDiGi.Core.Classes.ObjectDiGi.Core.Classes.SerializableObjectBooleanOperationResult2D → DifferenceResult2D

Implements IDifferenceResult2D, IBooleanOperationResult2D, DiGi.Core.Interfaces.ISerializableResult, DiGi.Core.Interfaces.IResult, DiGi.Core.Interfaces.IObject, DiGi.Core.Interfaces.ISerializableObject, DiGi.Core.Interfaces.ICloneableObject<DiGi.Core.Interfaces.ISerializableObject>, DiGi.Core.Interfaces.ICloneableObject

Constructors

DifferenceResult2D() Constructor

Initializes a new instance of the DifferenceResult2D class.

public DifferenceResult2D();

DifferenceResult2D(DifferenceResult2D) Constructor

Initializes a new instance of the DifferenceResult2D class using another DifferenceResult2D instance.

public DifferenceResult2D(DiGi.Geometry.Planar.Classes.DifferenceResult2D? differenceResult2D);

Parameters

differenceResult2D DifferenceResult2D

The DifferenceResult2D instance to copy from.

DifferenceResult2D(IGeometry2D) Constructor

Initializes a new instance of the DifferenceResult2D class with the specified DiGi.Geometry.Planar.Interfaces.IGeometry2D.

public DifferenceResult2D(DiGi.Geometry.Planar.Interfaces.IGeometry2D? geometry2D);

Parameters

geometry2D DiGi.Geometry.Planar.Interfaces.IGeometry2D

The DiGi.Geometry.Planar.Interfaces.IGeometry2D to initialize the result with. This value can be null.

DifferenceResult2D(IEnumerable<IGeometry2D>) Constructor

Initializes a new instance of the DifferenceResult2D class.

public DifferenceResult2D(System.Collections.Generic.IEnumerable<DiGi.Geometry.Planar.Interfaces.IGeometry2D>? geometry2Ds);

Parameters

geometry2Ds System.Collections.Generic.IEnumerable<DiGi.Geometry.Planar.Interfaces.IGeometry2D>

An optional collection of DiGi.Geometry.Planar.Interfaces.IGeometry2D objects to be cloned and stored in the result.

DifferenceResult2D(List<IGeometry2D>, bool) Constructor

Initializes a new instance of the DifferenceResult2D class from a prebuilt list of geometries.

internal DifferenceResult2D(System.Collections.Generic.List<DiGi.Geometry.Planar.Interfaces.IGeometry2D>? geometry2Ds, bool clone);

Parameters

geometry2Ds System.Collections.Generic.List<DiGi.Geometry.Planar.Interfaces.IGeometry2D>

The list of geometries resulting from the difference.

clone System.Boolean

When true, each geometry is cloned defensively; when false, the supplied list is adopted directly without cloning. Use false only when the caller owns freshly created geometries that are not shared.

DifferenceResult2D(JsonObject) Constructor

Initializes a new instance of the DifferenceResult2D class using the specified System.Text.Json.Nodes.JsonObject.

public DifferenceResult2D(System.Text.Json.Nodes.JsonObject? jsonObject);

Parameters

jsonObject System.Text.Json.Nodes.JsonObject

The System.Text.Json.Nodes.JsonObject used to initialize the instance.

Properties

DifferenceResult2D.BooleanOpertaionType Property

Gets the type of the boolean operation, which is Difference.

public override DiGi.Geometry.Core.Enums.BooleanOpertaionType BooleanOpertaionType { get; }

Implements BooleanOpertaionType

Property Value

BooleanOpertaionType

Methods

DifferenceResult2D.Clone() Method

Creates a copy of the current DifferenceResult2D instance.

public override DiGi.Core.Interfaces.ISerializableObject? Clone();

Implements Clone()

Returns

DiGi.Core.Interfaces.ISerializableObject
A new DiGi.Core.Interfaces.ISerializableObject instance that is a clone of the current object.

DouglasPeuckerUpdater Class

Provides functionality to update a 2D geometry using the Douglas-Peucker simplification algorithm.

public class DouglasPeuckerUpdater : DiGi.Geometry.Core.Classes.GeometryUpdater<DiGi.Geometry.Planar.Interfaces.IGeometry2D>

Inheritance System.ObjectDiGi.Geometry.Core.Classes.GeometryUpdater<DiGi.Geometry.Planar.Interfaces.IGeometry2D> → DouglasPeuckerUpdater

Constructors

DouglasPeuckerUpdater() Constructor

Initializes a new instance of the DouglasPeuckerUpdater class.

public DouglasPeuckerUpdater();

DouglasPeuckerUpdater(double) Constructor

Initializes a new instance of the DouglasPeuckerUpdater class with a specified tolerance.

public DouglasPeuckerUpdater(double tolerance);

Parameters

tolerance System.Double

The System.Double value representing the distance tolerance used for simplifying geometries.

Methods

DouglasPeuckerUpdater.Update() Method

Updates the current value by simplifying its underlying geometry using the Douglas-Peucker simplification algorithm.

public override bool Update();

Implements Update()

Returns

System.Boolean
A System.Boolean indicating whether the update was successful. Returns false if the value is null or cannot be simplified; otherwise, returns true.

Ellipse2D Class

Represents a 2D ellipse defined by its center, semi-axes lengths, and the direction of the major axis.

public class Ellipse2D : DiGi.Geometry.Planar.Classes.Geometry2D, DiGi.Geometry.Planar.Interfaces.IEllipse2D, DiGi.Geometry.Planar.Interfaces.IClosedCurve2D, DiGi.Geometry.Core.Interfaces.IClosedCurve, DiGi.Geometry.Core.Interfaces.ICurve, DiGi.Geometry.Core.Interfaces.IGeometry, DiGi.Core.Interfaces.ISerializableObject, DiGi.Core.Interfaces.ICloneableObject<DiGi.Core.Interfaces.ISerializableObject>, DiGi.Core.Interfaces.ICloneableObject, DiGi.Core.Interfaces.IObject, DiGi.Geometry.Planar.Interfaces.IGeometry2D, DiGi.Geometry.Planar.Interfaces.IMovable2D, DiGi.Geometry.Core.Interfaces.IMovable<DiGi.Geometry.Planar.Classes.Vector2D>, DiGi.Geometry.Core.Interfaces.IMovable, DiGi.Geometry.Planar.Interfaces.ITransformable2D, DiGi.Geometry.Core.Interfaces.ITransformable<DiGi.Geometry.Planar.Interfaces.ITransform2D>, DiGi.Geometry.Core.Interfaces.ITransformable, DiGi.Geometry.Planar.Interfaces.ICurve2D, DiGi.Geometry.Planar.Interfaces.ICollectable2D, DiGi.Geometry.Core.Interfaces.ICollectable, DiGi.Geometry.Planar.Interfaces.IBoundable2D, DiGi.Geometry.Core.Interfaces.IBoundable

Inheritance System.ObjectDiGi.Core.Classes.ObjectDiGi.Core.Classes.SerializableObjectGeometry2D → Ellipse2D

Implements IEllipse2D, IClosedCurve2D, DiGi.Geometry.Core.Interfaces.IClosedCurve, DiGi.Geometry.Core.Interfaces.ICurve, DiGi.Geometry.Core.Interfaces.IGeometry, DiGi.Core.Interfaces.ISerializableObject, DiGi.Core.Interfaces.ICloneableObject<DiGi.Core.Interfaces.ISerializableObject>, DiGi.Core.Interfaces.ICloneableObject, DiGi.Core.Interfaces.IObject, DiGi.Geometry.Planar.Interfaces.IGeometry2D, DiGi.Geometry.Planar.Interfaces.IMovable2D, DiGi.Geometry.Core.Interfaces.IMovable<Vector2D>, DiGi.Geometry.Core.Interfaces.IMovable, DiGi.Geometry.Planar.Interfaces.ITransformable2D, DiGi.Geometry.Core.Interfaces.ITransformable<DiGi.Geometry.Planar.Interfaces.ITransform2D>, DiGi.Geometry.Core.Interfaces.ITransformable, DiGi.Geometry.Planar.Interfaces.ICurve2D, DiGi.Geometry.Planar.Interfaces.ICollectable2D, DiGi.Geometry.Core.Interfaces.ICollectable, IBoundable2D, DiGi.Geometry.Core.Interfaces.IBoundable

Constructors

Ellipse2D(Ellipse2D) Constructor

Initializes a new instance of the Ellipse2D class by cloning an existing ellipse.

public Ellipse2D(DiGi.Geometry.Planar.Classes.Ellipse2D? ellipse2D);

Parameters

ellipse2D Ellipse2D

The source ellipse to clone.

Ellipse2D(Point2D, double, double) Constructor

Initializes a new instance of the Ellipse2D class with center and semi-axes lengths.

public Ellipse2D(DiGi.Geometry.Planar.Classes.Point2D? center, double a, double b);

Parameters

center Point2D

The center point of the ellipse.

a System.Double

The length of the semi-major axis.

b System.Double

The length of the semi-minor axis.

Ellipse2D(Point2D, double, double, Vector2D) Constructor

Initializes a new instance of the Ellipse2D class with center, semi-axes lengths and major axis direction.

public Ellipse2D(DiGi.Geometry.Planar.Classes.Point2D? center, double a, double b, DiGi.Geometry.Planar.Classes.Vector2D? directionA);

Parameters

center Point2D

The center point of the ellipse.

a System.Double

The length of the semi-major axis.

b System.Double

The length of the semi-minor axis.

directionA Vector2D

The direction vector of the major axis.

Ellipse2D(JsonObject) Constructor

Initializes a new instance of the Ellipse2D class from a JSON object.

public Ellipse2D(System.Text.Json.Nodes.JsonObject? jsonObject);

Parameters

jsonObject System.Text.Json.Nodes.JsonObject

The JSON object containing ellipse data.

Properties

Ellipse2D.A Property

Gets or sets the length of the semi-major axis.

public double A { get; set; }

Property Value

System.Double

Ellipse2D.B Property

Gets or sets the length of the semi-minor axis.

public double B { get; set; }

Property Value

System.Double

Ellipse2D.C Property

Gets the linear eccentricity of the ellipse.

public double C { get; }

Property Value

System.Double

Ellipse2D.Center Property

Gets or sets the center point of the ellipse.

public DiGi.Geometry.Planar.Classes.Point2D? Center { get; set; }

Implements Center

Property Value

Point2D

Ellipse2D.DirectionA Property

Gets or sets the direction vector of the major axis.

public DiGi.Geometry.Planar.Classes.Vector2D? DirectionA { get; set; }

Property Value

Vector2D

Ellipse2D.DirectionB Property

Gets the direction vector of the minor axis.

public DiGi.Geometry.Planar.Classes.Vector2D? DirectionB { get; }

Property Value

Vector2D

Methods

Ellipse2D.Clone() Method

Creates a clone of the current ellipse.

public override DiGi.Core.Interfaces.ISerializableObject? Clone();

Implements Clone()

Returns

DiGi.Core.Interfaces.ISerializableObject
A cloned instance of the ellipse.

Ellipse2D.Distance(Point2D) Method

Calculates the shortest distance from a point to the ellipse boundary.

public double Distance(DiGi.Geometry.Planar.Classes.Point2D? point2D);

Parameters

point2D Point2D

The target point.

Returns

System.Double
The minimum distance to the boundary.

Ellipse2D.Equals(object) Method

Determines whether the specified object is equal to the current ellipse.

public override bool Equals(object? obj);

Parameters

obj System.Object

The object to compare with the current ellipse.

Returns

System.Boolean
True if the objects are equal; otherwise, false.

Ellipse2D.GetArea() Method

Calculates the area of the ellipse.

public double GetArea();

Implements GetArea()

Returns

System.Double
The area of the ellipse.

Ellipse2D.GetBoundingBox() Method

Gets the axis-aligned bounding box of the ellipse.

public DiGi.Geometry.Planar.Classes.BoundingBox2D? GetBoundingBox();

Implements GetBoundingBox()

Returns

BoundingBox2D
The bounding box encompassing the ellipse.

Ellipse2D.GetFocalLength() Method

Calculates the distance between the two foci of the ellipse.

public double GetFocalLength();

Returns

System.Double
The distance between the foci (2C), or NaN if it cannot be determined.

Ellipse2D.GetFocalPoints() Method

Gets the focal points of the ellipse.

public DiGi.Geometry.Planar.Classes.Point2D[]? GetFocalPoints();

Returns

Point2D[]
An array containing the two foci.

Ellipse2D.GetHashCode() Method

Gets the hash code for this ellipse.

public override int GetHashCode();

Returns

System.Int32
A 32-bit signed integer hash code.

Ellipse2D.GetInternalPoint(double) Method

Gets a point guaranteed to be inside the ellipse.

public DiGi.Geometry.Planar.Classes.Point2D? GetInternalPoint(double tolerance=1E-06);

Parameters

tolerance System.Double

The distance tolerance.

Implements GetInternalPoint(double)

Returns

Point2D
An internal point of the ellipse.

Ellipse2D.GetPerimeter() Method

Calculates the approximate perimeter of the ellipse using Ramanujan's formula.

public double GetPerimeter();

Implements GetPerimeter()

Returns

System.Double
The circumference of the ellipse.

Ellipse2D.GetPoint(Vector2D) Method

Gets the point on the ellipse boundary in a given direction from the center.

public DiGi.Geometry.Planar.Classes.Point2D? GetPoint(DiGi.Geometry.Planar.Classes.Vector2D? vector2D);

Parameters

vector2D Vector2D

The direction vector.

Returns

Point2D
The corresponding point on the ellipse boundary.

Ellipse2D.InRange(Point2D, double) Method

Checks if a point is within or on the boundary of the ellipse.

public bool InRange(DiGi.Geometry.Planar.Classes.Point2D? point2D, double tolerance=1E-06);

Parameters

point2D Point2D

The point to check.

tolerance System.Double

The distance tolerance for the check.

Implements InRange(Point2D, double)

Returns

System.Boolean
True if the point is in range of the ellipse.

Ellipse2D.Inside(Point2D, double) Method

Checks if a point is strictly inside the ellipse boundaries.

public bool Inside(DiGi.Geometry.Planar.Classes.Point2D? point2D, double tolerance=1E-06);

Parameters

point2D Point2D

The point to check.

tolerance System.Double

The distance tolerance for the check.

Implements Inside(Point2D, double)

Returns

System.Boolean
True if the point is strictly inside.

Ellipse2D.Inverse() Method

Inverts the direction of the major axis.

public void Inverse();

Ellipse2D.Move(Vector2D) Method

Moves the ellipse by the specified vector.

public override bool Move(DiGi.Geometry.Planar.Classes.Vector2D? vector2D);

Parameters

vector2D Vector2D

The translation vector.

Returns

System.Boolean
True if the move was successful.

Ellipse2D.On(Point2D, double) Method

Checks if a point lies on the boundary of the ellipse.

public bool On(DiGi.Geometry.Planar.Classes.Point2D? point2D, double tolerance=1E-06);

Parameters

point2D Point2D

The point to check.

tolerance System.Double

The distance tolerance for the check.

Returns

System.Boolean
True if the point is on the boundary.

Ellipse2D.Project(Point2D) Method

Projects a point onto the ellipse boundary along the ray from the centre through the point (a fast radial approximation, not the closest boundary point). Use the tolerance overload for the true nearest point.

public DiGi.Geometry.Planar.Classes.Point2D? Project(DiGi.Geometry.Planar.Classes.Point2D? point2D);

Parameters

point2D Point2D

The target point.

Returns

Point2D
The boundary point along the centre-to-point direction.

Ellipse2D.Project(Point2D, double) Method

Projects a point onto the ellipse boundary, returning the closest boundary point via Newton iteration on the parametric angle.

public DiGi.Geometry.Planar.Classes.Point2D? Project(DiGi.Geometry.Planar.Classes.Point2D? point2D, double tolerance);

Parameters

point2D Point2D

The target point.

tolerance System.Double

The angular convergence tolerance, in radians.

Returns

Point2D
The closest point on the ellipse boundary, or null if it cannot be determined.

Ellipse2D.Transform(ITransform2D) Method

Transforms the ellipse using the specified transformation.

public override bool Transform(DiGi.Geometry.Planar.Interfaces.ITransform2D? transform);

Parameters

transform DiGi.Geometry.Planar.Interfaces.ITransform2D

The transformation to apply.

Returns

System.Boolean
True if the transformation was successful.

Operators

Ellipse2D.operator ==(Ellipse2D, Ellipse2D) Operator

Determines whether two ellipses are equal.

public static bool operator ==(DiGi.Geometry.Planar.Classes.Ellipse2D? ellipse2D_1, DiGi.Geometry.Planar.Classes.Ellipse2D? ellipse2D_2);

Parameters

ellipse2D_1 Ellipse2D

The first ellipse.

ellipse2D_2 Ellipse2D

The second ellipse.

Returns

System.Boolean
True if the ellipses are equal; otherwise, false.

Ellipse2D.explicit operator Ellipse2D(Circle2D) Operator

Converts a Circle2D to an Ellipse2D.

public static DiGi.Geometry.Planar.Classes.Ellipse2D? explicit operator DiGi.Geometry.Planar.Classes.Ellipse2D?(DiGi.Geometry.Planar.Classes.Circle2D? circle2D);

Parameters

circle2D Circle2D

The source circle.

Returns

Ellipse2D
An ellipse equivalent to the circle.

Ellipse2D.operator !=(Ellipse2D, Ellipse2D) Operator

Determines whether two ellipses are not equal.

public static bool operator !=(DiGi.Geometry.Planar.Classes.Ellipse2D? ellipse2D_1, DiGi.Geometry.Planar.Classes.Ellipse2D? ellipse2D_2);

Parameters

ellipse2D_1 Ellipse2D

The first ellipse.

ellipse2D_2 Ellipse2D

The second ellipse.

Returns

System.Boolean
True if the ellipses are not equal; otherwise, false.

Geometry2D Class

Represents a base class for all two-dimensional geometric objects.

public abstract class Geometry2D : DiGi.Core.Classes.SerializableObject, DiGi.Geometry.Planar.Interfaces.ICollectable2D, DiGi.Geometry.Core.Interfaces.ICollectable, DiGi.Geometry.Core.Interfaces.IGeometry, DiGi.Core.Interfaces.ISerializableObject, DiGi.Core.Interfaces.ICloneableObject<DiGi.Core.Interfaces.ISerializableObject>, DiGi.Core.Interfaces.ICloneableObject, DiGi.Core.Interfaces.IObject, DiGi.Geometry.Planar.Interfaces.IGeometry2D, DiGi.Geometry.Planar.Interfaces.IMovable2D, DiGi.Geometry.Core.Interfaces.IMovable<DiGi.Geometry.Planar.Classes.Vector2D>, DiGi.Geometry.Core.Interfaces.IMovable, DiGi.Geometry.Planar.Interfaces.ITransformable2D, DiGi.Geometry.Core.Interfaces.ITransformable<DiGi.Geometry.Planar.Interfaces.ITransform2D>, DiGi.Geometry.Core.Interfaces.ITransformable

Inheritance System.ObjectDiGi.Core.Classes.ObjectDiGi.Core.Classes.SerializableObject → Geometry2D

Derived
BoundingBox2D
Circle2D
Ellipse2D
Grid2D
Line2D
PolygonalFace2D
Ray2D
Rectangle2D
Segment2D
Segmentable2D

Implements DiGi.Geometry.Planar.Interfaces.ICollectable2D, DiGi.Geometry.Core.Interfaces.ICollectable, DiGi.Geometry.Core.Interfaces.IGeometry, DiGi.Core.Interfaces.ISerializableObject, DiGi.Core.Interfaces.ICloneableObject<DiGi.Core.Interfaces.ISerializableObject>, DiGi.Core.Interfaces.ICloneableObject, DiGi.Core.Interfaces.IObject, DiGi.Geometry.Planar.Interfaces.IGeometry2D, DiGi.Geometry.Planar.Interfaces.IMovable2D, DiGi.Geometry.Core.Interfaces.IMovable<Vector2D>, DiGi.Geometry.Core.Interfaces.IMovable, DiGi.Geometry.Planar.Interfaces.ITransformable2D, DiGi.Geometry.Core.Interfaces.ITransformable<DiGi.Geometry.Planar.Interfaces.ITransform2D>, DiGi.Geometry.Core.Interfaces.ITransformable

Constructors

Geometry2D() Constructor

Initializes a new instance of the Geometry2D class.

public Geometry2D();

Geometry2D(Geometry2D) Constructor

Initializes a new instance of the Geometry2D class by cloning an existing geometry.

public Geometry2D(DiGi.Geometry.Planar.Classes.Geometry2D? geometry2D);

Parameters

geometry2D Geometry2D

The source geometry to clone.

Geometry2D(JsonObject) Constructor

Initializes a new instance of the Geometry2D class from a JSON object.

public Geometry2D(System.Text.Json.Nodes.JsonObject? jsonObject);

Parameters

jsonObject System.Text.Json.Nodes.JsonObject

The JSON object containing geometry data.

Methods

Geometry2D.Move(Vector2D) Method

Moves the geometry by the specified vector.

public abstract bool Move(DiGi.Geometry.Planar.Classes.Vector2D? vector2D);

Parameters

vector2D Vector2D

The translation vector.

Returns

System.Boolean
True if the move was successful.

Geometry2D.Transform(ITransform2D) Method

Transforms the geometry using the specified transformation.

public abstract bool Transform(DiGi.Geometry.Planar.Interfaces.ITransform2D? transform);

Parameters

transform DiGi.Geometry.Planar.Interfaces.ITransform2D

The transformation to apply.

Returns

System.Boolean
True if the transformation was successful.

GeometryCollection2D Class

Represents a collection of two-dimensional geometry objects that implement the DiGi.Geometry.Planar.Interfaces.ICollectable2D interface.

public class GeometryCollection2D : DiGi.Geometry.Core.Classes.GeometryCollection<DiGi.Geometry.Planar.Interfaces.ICollectable2D>, DiGi.Geometry.Planar.Interfaces.IGeometryCollection2D, DiGi.Geometry.Planar.Interfaces.ICollectable2D, DiGi.Geometry.Core.Interfaces.ICollectable, DiGi.Geometry.Core.Interfaces.IGeometry, DiGi.Core.Interfaces.ISerializableObject, DiGi.Core.Interfaces.ICloneableObject<DiGi.Core.Interfaces.ISerializableObject>, DiGi.Core.Interfaces.ICloneableObject, DiGi.Core.Interfaces.IObject, DiGi.Geometry.Planar.Interfaces.IGeometry2D, DiGi.Geometry.Planar.Interfaces.IMovable2D, DiGi.Geometry.Core.Interfaces.IMovable<DiGi.Geometry.Planar.Classes.Vector2D>, DiGi.Geometry.Core.Interfaces.IMovable, DiGi.Geometry.Planar.Interfaces.ITransformable2D, DiGi.Geometry.Core.Interfaces.ITransformable<DiGi.Geometry.Planar.Interfaces.ITransform2D>, DiGi.Geometry.Core.Interfaces.ITransformable, DiGi.Geometry.Core.Interfaces.IGeometryCollection<DiGi.Geometry.Planar.Interfaces.ICollectable2D>, DiGi.Geometry.Core.Interfaces.IGeometryCollection, System.Collections.Generic.ICollection<DiGi.Geometry.Planar.Interfaces.ICollectable2D>, System.Collections.Generic.IEnumerable<DiGi.Geometry.Planar.Interfaces.ICollectable2D>, System.Collections.IEnumerable

Inheritance System.ObjectDiGi.Core.Classes.ObjectDiGi.Core.Classes.SerializableObjectDiGi.Core.Classes.SerializableObjectCollection<DiGi.Geometry.Planar.Interfaces.ICollectable2D>DiGi.Geometry.Core.Classes.GeometryCollection<DiGi.Geometry.Planar.Interfaces.ICollectable2D> → GeometryCollection2D

Implements DiGi.Geometry.Planar.Interfaces.IGeometryCollection2D, DiGi.Geometry.Planar.Interfaces.ICollectable2D, DiGi.Geometry.Core.Interfaces.ICollectable, DiGi.Geometry.Core.Interfaces.IGeometry, DiGi.Core.Interfaces.ISerializableObject, DiGi.Core.Interfaces.ICloneableObject<DiGi.Core.Interfaces.ISerializableObject>, DiGi.Core.Interfaces.ICloneableObject, DiGi.Core.Interfaces.IObject, DiGi.Geometry.Planar.Interfaces.IGeometry2D, DiGi.Geometry.Planar.Interfaces.IMovable2D, DiGi.Geometry.Core.Interfaces.IMovable<Vector2D>, DiGi.Geometry.Core.Interfaces.IMovable, DiGi.Geometry.Planar.Interfaces.ITransformable2D, DiGi.Geometry.Core.Interfaces.ITransformable<DiGi.Geometry.Planar.Interfaces.ITransform2D>, DiGi.Geometry.Core.Interfaces.ITransformable, DiGi.Geometry.Core.Interfaces.IGeometryCollection<DiGi.Geometry.Planar.Interfaces.ICollectable2D>, DiGi.Geometry.Core.Interfaces.IGeometryCollection, System.Collections.Generic.ICollection<DiGi.Geometry.Planar.Interfaces.ICollectable2D>, System.Collections.Generic.IEnumerable<DiGi.Geometry.Planar.Interfaces.ICollectable2D>, System.Collections.IEnumerable

Constructors

GeometryCollection2D() Constructor

Initializes a new instance of the GeometryCollection2D class.

public GeometryCollection2D();

GeometryCollection2D(IEnumerable<ICollectable2D>) Constructor

Initializes a new instance of the GeometryCollection2D class from a collection of geometries.

public GeometryCollection2D(System.Collections.Generic.IEnumerable<DiGi.Geometry.Planar.Interfaces.ICollectable2D> collectable2Ds);

Parameters

collectable2Ds System.Collections.Generic.IEnumerable<DiGi.Geometry.Planar.Interfaces.ICollectable2D>

The collection of geometries.

GeometryCollection2D(JsonObject) Constructor

Initializes a new instance of the GeometryCollection2D class from a JSON object.

public GeometryCollection2D(System.Text.Json.Nodes.JsonObject jsonObject);

Parameters

jsonObject System.Text.Json.Nodes.JsonObject

The JSON object containing collection data.

Methods

GeometryCollection2D.Move(Vector2D) Method

Moves all geometries in the collection by the specified vector.

public bool Move(DiGi.Geometry.Planar.Classes.Vector2D vector2D);

Parameters

vector2D Vector2D

The translation vector.

Returns

System.Boolean
True if the move was successful.

GeometryCollection2D.Transform(ITransform2D) Method

Transforms all geometries in the collection using the specified transformation.

public bool Transform(DiGi.Geometry.Planar.Interfaces.ITransform2D transform);

Parameters

transform DiGi.Geometry.Planar.Interfaces.ITransform2D

The transformation to apply.

Returns

System.Boolean
True if the transformation was successful.

Grid2D Class

Represents a two-dimensional grid geometry defined by its total width, total height, and the number of cells along each axis.

public class Grid2D : DiGi.Geometry.Planar.Classes.Geometry2D

Inheritance System.ObjectDiGi.Core.Classes.ObjectDiGi.Core.Classes.SerializableObjectGeometry2D → Grid2D

Constructors

Grid2D(Grid2D) Constructor

Initializes a new instance of the Grid2D class by cloning an existing grid.

public Grid2D(DiGi.Geometry.Planar.Classes.Grid2D grid2D);

Parameters

grid2D Grid2D

The source grid to clone.

Grid2D(Point2D, double, double, Vector2D, int, int) Constructor

Initializes a new instance of the Grid2D class.

public Grid2D(DiGi.Geometry.Planar.Classes.Point2D? origin, double width, double height, DiGi.Geometry.Planar.Classes.Vector2D? heightDirection, int widthCount, int heightCount);

Parameters

origin Point2D

The origin point of the grid.

width System.Double

The total width of the grid.

height System.Double

The total height of the grid.

heightDirection Vector2D

The direction of the height axis.

widthCount System.Int32

The number of cells in the width direction.

heightCount System.Int32

The number of cells in the height direction.

Grid2D(Rectangle2D, int, int) Constructor

Initializes a new instance of the Grid2D class.

public Grid2D(DiGi.Geometry.Planar.Classes.Rectangle2D? rectangle2D, int widthCount, int heightCount);

Parameters

rectangle2D Rectangle2D

The bounding rectangle of the grid.

widthCount System.Int32

The number of cells in the width direction.

heightCount System.Int32

The number of cells in the height direction.

Grid2D(JsonObject) Constructor

Initializes a new instance of the Grid2D class from a JSON object.

public Grid2D(System.Text.Json.Nodes.JsonObject jsonObject);

Parameters

jsonObject System.Text.Json.Nodes.JsonObject

The JSON object containing grid data.

Properties

Grid2D.HeightCount Property

Gets the number of cells in the height direction.

public int HeightCount { get; }

Property Value

System.Int32

Grid2D.HeightFactor Property

Gets the height of a single cell in the grid.

public double HeightFactor { get; }

Property Value

System.Double

Grid2D.Rectangle2D Property

Gets the bounding rectangle of the grid.

public DiGi.Geometry.Planar.Classes.Rectangle2D? Rectangle2D { get; }

Property Value

Rectangle2D

Grid2D.this[int, int] Property

Gets the rectangle at the specified grid indices.

public DiGi.Geometry.Planar.Classes.Rectangle2D? this[int index_width, int index_height] { get; }

Parameters

index_width System.Int32

The index along the width axis.

index_height System.Int32

The index along the height axis.

Property Value

Rectangle2D

Grid2D.WidthCount Property

Gets the number of cells in the width direction.

public int WidthCount { get; }

Property Value

System.Int32

Grid2D.WidthFactor Property

Gets the width of a single cell in the grid.

public double WidthFactor { get; }

Property Value

System.Double

Methods

Grid2D.GetRectangle(int, int) Method

Gets the rectangle at the specified grid indices.

public DiGi.Geometry.Planar.Classes.Rectangle2D? GetRectangle(int index_width, int index_height);

Parameters

index_width System.Int32

The index along the width axis.

index_height System.Int32

The index along the height axis.

Returns

Rectangle2D
The Rectangle2D at the specified position, or null if it cannot be determined.

Grid2D.GetRectangles() Method

Gets all rectangles in the grid.

public System.Collections.Generic.List<DiGi.Geometry.Planar.Classes.Rectangle2D>? GetRectangles();

Returns

System.Collections.Generic.List<Rectangle2D>
A list of all cell rectangles, or null if the grid is invalid.

Grid2D.Move(Vector2D) Method

Moves the grid by the specified vector.

public override bool Move(DiGi.Geometry.Planar.Classes.Vector2D? vector2D);

Parameters

vector2D Vector2D

The movement vector.

Returns

System.Boolean
True if the move was successful; otherwise, false.

Grid2D.Transform(ITransform2D) Method

Transforms the grid using the specified transformation.

public override bool Transform(DiGi.Geometry.Planar.Interfaces.ITransform2D? transform);

Parameters

transform DiGi.Geometry.Planar.Interfaces.ITransform2D

The transformation to apply.

Returns

System.Boolean
True if the transformation was successful.

IntersectionResult2D Class

Represents the result of a 2D intersection operation.

public class IntersectionResult2D : DiGi.Geometry.Planar.Classes.BooleanOperationResult2D, DiGi.Geometry.Planar.Interfaces.IIntersectionResult2D, DiGi.Geometry.Core.Interfaces.IIntersectionResult, DiGi.Geometry.Core.Interfaces.IBooleanOperationResult, DiGi.Core.Interfaces.ISerializableResult, DiGi.Core.Interfaces.IResult, DiGi.Core.Interfaces.IObject, DiGi.Core.Interfaces.ISerializableObject, DiGi.Core.Interfaces.ICloneableObject<DiGi.Core.Interfaces.ISerializableObject>, DiGi.Core.Interfaces.ICloneableObject

Inheritance System.ObjectDiGi.Core.Classes.ObjectDiGi.Core.Classes.SerializableObjectBooleanOperationResult2D → IntersectionResult2D

Implements IIntersectionResult2D, DiGi.Geometry.Core.Interfaces.IIntersectionResult, IBooleanOperationResult, DiGi.Core.Interfaces.ISerializableResult, DiGi.Core.Interfaces.IResult, DiGi.Core.Interfaces.IObject, DiGi.Core.Interfaces.ISerializableObject, DiGi.Core.Interfaces.ICloneableObject<DiGi.Core.Interfaces.ISerializableObject>, DiGi.Core.Interfaces.ICloneableObject

Constructors

IntersectionResult2D() Constructor

Initializes a new instance of the IntersectionResult2D class.

public IntersectionResult2D();

IntersectionResult2D(IntersectionResult2D) Constructor

Initializes a new instance of the IntersectionResult2D class using another IntersectionResult2D instance.

public IntersectionResult2D(DiGi.Geometry.Planar.Classes.IntersectionResult2D? intersectionResult2D);

Parameters

intersectionResult2D IntersectionResult2D

The IntersectionResult2D instance to copy from.

IntersectionResult2D(IGeometry2D) Constructor

Initializes a new instance of the IntersectionResult2D class with the specified DiGi.Geometry.Planar.Interfaces.IGeometry2D.

public IntersectionResult2D(DiGi.Geometry.Planar.Interfaces.IGeometry2D? geometry2D);

Parameters

geometry2D DiGi.Geometry.Planar.Interfaces.IGeometry2D

The DiGi.Geometry.Planar.Interfaces.IGeometry2D to initialize the result with. This value can be null.

IntersectionResult2D(IEnumerable<IGeometry2D>) Constructor

Initializes a new instance of the IntersectionResult2D class.

public IntersectionResult2D(System.Collections.Generic.IEnumerable<DiGi.Geometry.Planar.Interfaces.IGeometry2D>? geometry2Ds);

Parameters

geometry2Ds System.Collections.Generic.IEnumerable<DiGi.Geometry.Planar.Interfaces.IGeometry2D>

An optional collection of DiGi.Geometry.Planar.Interfaces.IGeometry2D objects to be cloned and stored in the result.

IntersectionResult2D(List<IGeometry2D>, bool) Constructor

Initializes a new instance of the IntersectionResult2D class from a prebuilt list of geometries.

internal IntersectionResult2D(System.Collections.Generic.List<DiGi.Geometry.Planar.Interfaces.IGeometry2D>? geometry2Ds, bool clone);

Parameters

geometry2Ds System.Collections.Generic.List<DiGi.Geometry.Planar.Interfaces.IGeometry2D>

The list of geometries resulting from the intersection.

clone System.Boolean

When true, each geometry is cloned defensively; when false, the supplied list is adopted directly without cloning. Use false only when the caller owns freshly created geometries that are not shared.

IntersectionResult2D(JsonObject) Constructor

Initializes a new instance of the IntersectionResult2D class using the specified System.Text.Json.Nodes.JsonObject.

public IntersectionResult2D(System.Text.Json.Nodes.JsonObject? jsonObject);

Parameters

jsonObject System.Text.Json.Nodes.JsonObject

The System.Text.Json.Nodes.JsonObject used to initialize the instance.

Properties

IntersectionResult2D.BooleanOpertaionType Property

Gets the type of the boolean operation, which is Intersection.

public override DiGi.Geometry.Core.Enums.BooleanOpertaionType BooleanOpertaionType { get; }

Implements BooleanOpertaionType

Property Value

BooleanOpertaionType

Methods

IntersectionResult2D.Clone() Method

Creates a copy of the current IntersectionResult2D instance.

public override DiGi.Core.Interfaces.ISerializableObject? Clone();

Implements Clone()

Returns

DiGi.Core.Interfaces.ISerializableObject
A new DiGi.Core.Interfaces.ISerializableObject instance that is a clone of the current object.

Line2D Class

Represents an infinite line in 2D space defined by an origin point and a direction vector.

public class Line2D : DiGi.Geometry.Planar.Classes.Geometry2D, DiGi.Geometry.Planar.Interfaces.ILinear2D, DiGi.Geometry.Planar.Interfaces.IMovable2D, DiGi.Geometry.Core.Interfaces.IMovable<DiGi.Geometry.Planar.Classes.Vector2D>, DiGi.Geometry.Core.Interfaces.IMovable, DiGi.Geometry.Core.Interfaces.IGeometry, DiGi.Core.Interfaces.ISerializableObject, DiGi.Core.Interfaces.ICloneableObject<DiGi.Core.Interfaces.ISerializableObject>, DiGi.Core.Interfaces.ICloneableObject, DiGi.Core.Interfaces.IObject, DiGi.Geometry.Core.Interfaces.ICurve, DiGi.Geometry.Planar.Interfaces.ITransformable2D, DiGi.Geometry.Core.Interfaces.ITransformable<DiGi.Geometry.Planar.Interfaces.ITransform2D>, DiGi.Geometry.Core.Interfaces.ITransformable, DiGi.Geometry.Planar.Interfaces.IGeometry2D

Inheritance System.ObjectDiGi.Core.Classes.ObjectDiGi.Core.Classes.SerializableObjectGeometry2D → Line2D

Implements ILinear2D, DiGi.Geometry.Planar.Interfaces.IMovable2D, DiGi.Geometry.Core.Interfaces.IMovable<Vector2D>, DiGi.Geometry.Core.Interfaces.IMovable, DiGi.Geometry.Core.Interfaces.IGeometry, DiGi.Core.Interfaces.ISerializableObject, DiGi.Core.Interfaces.ICloneableObject<DiGi.Core.Interfaces.ISerializableObject>, DiGi.Core.Interfaces.ICloneableObject, DiGi.Core.Interfaces.IObject, DiGi.Geometry.Core.Interfaces.ICurve, DiGi.Geometry.Planar.Interfaces.ITransformable2D, DiGi.Geometry.Core.Interfaces.ITransformable<DiGi.Geometry.Planar.Interfaces.ITransform2D>, DiGi.Geometry.Core.Interfaces.ITransformable, DiGi.Geometry.Planar.Interfaces.IGeometry2D

Constructors

Line2D(Line2D) Constructor

Initializes a new instance of the Line2D class by cloning an existing line.

public Line2D(DiGi.Geometry.Planar.Classes.Line2D? line2D);

Parameters

line2D Line2D

The source line to clone.

Line2D(Point2D, Vector2D) Constructor

Initializes a new instance of the Line2D class with a specified origin and direction.

public Line2D(DiGi.Geometry.Planar.Classes.Point2D? origin, DiGi.Geometry.Planar.Classes.Vector2D? direction);

Parameters

origin Point2D

The origin point of the line.

direction Vector2D

The direction vector of the line.

Properties

Line2D.Direction Property

Gets or sets the unit direction vector of the line.

public DiGi.Geometry.Planar.Classes.Vector2D? Direction { get; set; }

Implements Direction

Property Value

Vector2D

Line2D.Origin Property

Gets or sets the origin point of the line.

public DiGi.Geometry.Planar.Classes.Point2D? Origin { get; set; }

Property Value

Point2D

Methods

Line2D.Clone() Method

Creates a clone of the current line.

public override DiGi.Core.Interfaces.ISerializableObject? Clone();

Implements Clone()

Returns

DiGi.Core.Interfaces.ISerializableObject
A cloned instance of the line.

Line2D.ClosestPoint(Point2D) Method

Finds the point on the line closest to the given point.

public DiGi.Geometry.Planar.Classes.Point2D? ClosestPoint(DiGi.Geometry.Planar.Classes.Point2D? point2D);

Parameters

point2D Point2D

The target point.

Implements ClosestPoint(Point2D)

Returns

Point2D
The projected point on the line.

Line2D.Collinear(ILinear2D, double) Method

Checks if another linear geometry is collinear with this line.

public bool Collinear(DiGi.Geometry.Planar.Interfaces.ILinear2D? linear2D, double tolerance=1E-06);

Parameters

linear2D ILinear2D

The linear geometry to check.

tolerance System.Double

The distance tolerance for the check.

Implements Collinear(ILinear2D, double)

Returns

System.Boolean
True if they are collinear; otherwise, false.

Line2D.Distance(Point2D) Method

Calculates the shortest distance from a point to the line.

public double Distance(DiGi.Geometry.Planar.Classes.Point2D? point2D);

Parameters

point2D Point2D

The target point.

Implements Distance(Point2D)

Returns

System.Double
The perpendicular distance to the line.

Line2D.Equals(object) Method

Determines whether the specified object is equal to the current line.

public override bool Equals(object? obj);

Parameters

obj System.Object

The object to compare with the current line.

Returns

System.Boolean
True if the objects are equal; otherwise, false.

Line2D.GetHashCode() Method

Gets the hash code for this line.

public override int GetHashCode();

Returns

System.Int32
A 32-bit signed integer hash code.

Line2D.IntersectionPoint(Line2D, double) Method

Calculates the intersection point of two lines.

public DiGi.Geometry.Planar.Classes.Point2D? IntersectionPoint(DiGi.Geometry.Planar.Classes.Line2D? line2D, double tolerance=1E-06);

Parameters

line2D Line2D

The other line to intersect with.

tolerance System.Double

The distance tolerance for the check.

Returns

Point2D
The intersection point, or null if they are parallel or collinear.

Line2D.IntersectionPoint(Segment2D, double) Method

Calculates the intersection point of a line and a segment.

public DiGi.Geometry.Planar.Classes.Point2D? IntersectionPoint(DiGi.Geometry.Planar.Classes.Segment2D? segment2D, double tolerance=1E-06);

Parameters

segment2D Segment2D

The segment to intersect with.

tolerance System.Double

The distance tolerance for the check.

Returns

Point2D
The intersection point, or null if no intersection exists within the segment boundaries.

Line2D.Inverse() Method

Reverses the direction of the line.

public bool Inverse();

Returns

System.Boolean
True if the direction was successfully reversed.

Line2D.Move(Vector2D) Method

Moves the line by translating its origin point.

public override bool Move(DiGi.Geometry.Planar.Classes.Vector2D? vector2D);

Parameters

vector2D Vector2D

The translation vector.

Returns

System.Boolean
True if the move was successful.

Line2D.On(Point2D, double) Method

Checks if a point lies on the line within the specified tolerance.

public bool On(DiGi.Geometry.Planar.Classes.Point2D? point2D, double tolerance=1E-06);

Parameters

point2D Point2D

The point to check.

tolerance System.Double

The distance tolerance for the check.

Implements On(Point2D, double)

Returns

System.Boolean
True if the point is on the line; otherwise, false.

Line2D.On(double, double, double) Method

Checks if the point given by its coordinates lies on the line within the specified tolerance, without allocating.

internal bool On(double x, double y, double tolerance);

Parameters

x System.Double

The X coordinate of the point to check.

y System.Double

The Y coordinate of the point to check.

tolerance System.Double

The distance tolerance for the check.

Returns

System.Boolean
True if the point is on the line; otherwise, false.

Line2D.Project(Point2D) Method

Projects a point onto the line.

public DiGi.Geometry.Planar.Classes.Point2D? Project(DiGi.Geometry.Planar.Classes.Point2D? point2D);

Parameters

point2D Point2D

The target point.

Implements Project(Point2D)

Returns

Point2D
The projected point on the line.

Line2D.Transform(ITransform2D) Method

Transforms the line using the specified transformation.

public override bool Transform(DiGi.Geometry.Planar.Interfaces.ITransform2D? transform);

Parameters

transform DiGi.Geometry.Planar.Interfaces.ITransform2D

The transformation to apply.

Returns

System.Boolean
True if the transformation was successful.

Line2D.TryGetCoordinates(double, double, double, double) Method

Gets the origin and direction coordinates of the line without allocating intermediate objects.

internal bool TryGetCoordinates(out double x_Origin, out double y_Origin, out double x_Direction, out double y_Direction);

Parameters

x_Origin System.Double

When this method returns true, the X coordinate of the origin point.

y_Origin System.Double

When this method returns true, the Y coordinate of the origin point.

x_Direction System.Double

When this method returns true, the X component of the direction vector.

y_Direction System.Double

When this method returns true, the Y component of the direction vector.

Returns

System.Boolean
True if the line has a valid origin and direction; otherwise, false.

Operators

Line2D.operator ==(Line2D, Line2D) Operator

Determines whether two lines are equal.

public static bool operator ==(DiGi.Geometry.Planar.Classes.Line2D? line2D_1, DiGi.Geometry.Planar.Classes.Line2D? line2D_2);

Parameters

line2D_1 Line2D

The first line.

line2D_2 Line2D

The second line.

Returns

System.Boolean
True if the lines are equal; otherwise, false.

Line2D.explicit operator Line2D(Segment2D) Operator

Explicitly converts a segment to a line that extends infinitely in both directions along the segment's axis.

public static DiGi.Geometry.Planar.Classes.Line2D? explicit operator DiGi.Geometry.Planar.Classes.Line2D?(DiGi.Geometry.Planar.Classes.Segment2D? segment2D);

Parameters

segment2D Segment2D

The source segment.

Returns

Line2D
A Line2D representation of the infinite line containing the segment.

Line2D.operator !=(Line2D, Line2D) Operator

Determines whether two lines are not equal.

public static bool operator !=(DiGi.Geometry.Planar.Classes.Line2D? line2D_1, DiGi.Geometry.Planar.Classes.Line2D? line2D_2);

Parameters

line2D_1 Line2D

The first line.

line2D_2 Line2D

The second line.

Returns

System.Boolean
True if the lines are not equal; otherwise, false.

Mesh2D Class

Represents a two-dimensional mesh composed of Point2D elements, implementing 2D geometry, bounding, and collection interfaces.

public class Mesh2D : DiGi.Geometry.Core.Classes.Mesh<DiGi.Geometry.Planar.Classes.Point2D>, DiGi.Geometry.Planar.Interfaces.IGeometry2D, DiGi.Geometry.Core.Interfaces.IGeometry, DiGi.Core.Interfaces.ISerializableObject, DiGi.Core.Interfaces.ICloneableObject<DiGi.Core.Interfaces.ISerializableObject>, DiGi.Core.Interfaces.ICloneableObject, DiGi.Core.Interfaces.IObject, DiGi.Geometry.Planar.Interfaces.IMovable2D, DiGi.Geometry.Core.Interfaces.IMovable<DiGi.Geometry.Planar.Classes.Vector2D>, DiGi.Geometry.Core.Interfaces.IMovable, DiGi.Geometry.Planar.Interfaces.ITransformable2D, DiGi.Geometry.Core.Interfaces.ITransformable<DiGi.Geometry.Planar.Interfaces.ITransform2D>, DiGi.Geometry.Core.Interfaces.ITransformable, DiGi.Geometry.Planar.Interfaces.IBoundable2D, DiGi.Geometry.Core.Interfaces.IBoundable, DiGi.Geometry.Planar.Interfaces.ICollectable2D, DiGi.Geometry.Core.Interfaces.ICollectable

Inheritance System.ObjectDiGi.Core.Classes.ObjectDiGi.Core.Classes.SerializableObjectDiGi.Geometry.Core.Classes.Mesh<Point2D> → Mesh2D

Implements DiGi.Geometry.Planar.Interfaces.IGeometry2D, DiGi.Geometry.Core.Interfaces.IGeometry, DiGi.Core.Interfaces.ISerializableObject, DiGi.Core.Interfaces.ICloneableObject<DiGi.Core.Interfaces.ISerializableObject>, DiGi.Core.Interfaces.ICloneableObject, DiGi.Core.Interfaces.IObject, DiGi.Geometry.Planar.Interfaces.IMovable2D, DiGi.Geometry.Core.Interfaces.IMovable<Vector2D>, DiGi.Geometry.Core.Interfaces.IMovable, DiGi.Geometry.Planar.Interfaces.ITransformable2D, DiGi.Geometry.Core.Interfaces.ITransformable<DiGi.Geometry.Planar.Interfaces.ITransform2D>, DiGi.Geometry.Core.Interfaces.ITransformable, IBoundable2D, DiGi.Geometry.Core.Interfaces.IBoundable, DiGi.Geometry.Planar.Interfaces.ICollectable2D, DiGi.Geometry.Core.Interfaces.ICollectable

Constructors

Mesh2D(Mesh2D) Constructor

Initializes a new instance of the Mesh2D class by cloning an existing mesh.

public Mesh2D(DiGi.Geometry.Planar.Classes.Mesh2D? mesh2D);

Parameters

mesh2D Mesh2D

The source mesh to clone.

Mesh2D(IEnumerable<Point2D>, IEnumerable<int[]>) Constructor

Initializes a new instance of the Mesh2D class with specified points and indices.

public Mesh2D(System.Collections.Generic.IEnumerable<DiGi.Geometry.Planar.Classes.Point2D>? points, System.Collections.Generic.IEnumerable<int[]>? indexes);

Parameters

points System.Collections.Generic.IEnumerable<Point2D>

The collection of vertices.

indexes System.Collections.Generic.IEnumerable<System.Int32[]>

The index arrays defining triangles.

Mesh2D(List<Point2D>, List<int[]>, bool) Constructor

Initializes a new instance of the Mesh2D class from prebuilt lists.

internal Mesh2D(System.Collections.Generic.List<DiGi.Geometry.Planar.Classes.Point2D>? point2Ds, System.Collections.Generic.List<int[]>? indexes, bool clone);

Parameters

point2Ds System.Collections.Generic.List<Point2D>

The System.Collections.Generic.List<> containing the vertices of the mesh.

indexes System.Collections.Generic.List<System.Int32[]>

The System.Collections.Generic.List<> of int[] defining the triangle indices of the mesh.

clone System.Boolean

When true, the inputs are defensively copied and validated; when false, the supplied lists are adopted directly without cloning. Use false only when the caller owns freshly created, valid data that is not shared.

Mesh2D(JsonObject) Constructor

Initializes a new instance of the Mesh2D class from a JSON object.

public Mesh2D(System.Text.Json.Nodes.JsonObject? jsonObject);

Parameters

jsonObject System.Text.Json.Nodes.JsonObject

The JSON object containing mesh data.

Methods

Mesh2D.Clone() Method

Creates a clone of the current mesh.

public override DiGi.Core.Interfaces.ISerializableObject? Clone();

Implements Clone()

Returns

DiGi.Core.Interfaces.ISerializableObject
A cloned instance of the mesh.

Mesh2D.GetArea() Method

Calculates the total area of the mesh as the sum of the areas of its triangles.

Uses scalar coordinate arithmetic only, without allocating intermediate objects.

public double GetArea();

Returns

System.Double
A System.Double representing the total area, or System.Double.NaN if the points or indexes are unavailable.

Mesh2D.GetAuxiliarySegments() Method

Retrieves the auxiliary segments of the mesh.

public System.Collections.Generic.List<DiGi.Geometry.Planar.Classes.Segment2D>? GetAuxiliarySegments();

Returns

System.Collections.Generic.List<Segment2D>
A list of auxiliary segments, or null if the mesh is invalid.

Mesh2D.GetBoundaryEdges() Method

Retrieves the boundary edges of the mesh as polygons.

public System.Collections.Generic.List<DiGi.Geometry.Planar.Classes.Polygon2D>? GetBoundaryEdges();

Returns

System.Collections.Generic.List<Polygon2D>
A list of polygons forming the boundary, or null if the mesh is invalid.

Mesh2D.GetBoundaryEdges(List<Segment2D>) Method

Retrieves the boundary edges of the mesh as polygons and returns auxiliary segments via an out parameter.

public System.Collections.Generic.List<DiGi.Geometry.Planar.Classes.Polygon2D>? GetBoundaryEdges(out System.Collections.Generic.List<DiGi.Geometry.Planar.Classes.Segment2D>? auxiliarySegments);

Parameters

auxiliarySegments System.Collections.Generic.List<Segment2D>

The output list of auxiliary segments.

Returns

System.Collections.Generic.List<Polygon2D>
A list of polygons forming the boundary, or null if the mesh is invalid.

Mesh2D.GetBoundingBox() Method

Gets the axis-aligned bounding box of the mesh.

public DiGi.Geometry.Planar.Classes.BoundingBox2D? GetBoundingBox();

Implements GetBoundingBox()

Returns

BoundingBox2D
The bounding box encompassing all points in the mesh.

Mesh2D.GetSegments() Method

Retrieves all unique segments (edges) of the mesh.

public System.Collections.Generic.List<DiGi.Geometry.Planar.Classes.Segment2D>? GetSegments();

Returns

System.Collections.Generic.List<Segment2D>
A list of all edges in the mesh, or null if the mesh is invalid.

Mesh2D.GetTriangle(int) Method

Retrieves the triangle at the specified index.

public DiGi.Geometry.Planar.Classes.Triangle2D? GetTriangle(int index);

Parameters

index System.Int32

The zero-based index of the triangle.

Returns

Triangle2D
The Triangle2D at the specified index, or null if out of range.

Mesh2D.GetTriangles() Method

Retrieves all triangles in the mesh.

public System.Collections.Generic.List<DiGi.Geometry.Planar.Classes.Triangle2D>? GetTriangles();

Returns

System.Collections.Generic.List<Triangle2D>
A list of all Triangle2D objects in the mesh, or null if the mesh is invalid.

Mesh2D.Move(Vector2D) Method

Moves the mesh by translating all its vertices.

public bool Move(DiGi.Geometry.Planar.Classes.Vector2D? vector2D);

Parameters

vector2D Vector2D

The translation vector.

Returns

System.Boolean
True if the move was successful.

Mesh2D.Transform(ITransform2D) Method

Transforms the mesh by transforming all its vertices.

public bool Transform(DiGi.Geometry.Planar.Interfaces.ITransform2D transform);

Parameters

transform DiGi.Geometry.Planar.Interfaces.ITransform2D

The transformation to apply.

Returns

System.Boolean
True if the transformation was successful.

Point2D Class

Represents a point in 2D space defined by X and Y coordinates.

public class Point2D : DiGi.Geometry.Planar.Classes.Coordinate2D, DiGi.Geometry.Planar.Interfaces.IMovable2D, DiGi.Geometry.Core.Interfaces.IMovable<DiGi.Geometry.Planar.Classes.Vector2D>, DiGi.Geometry.Core.Interfaces.IMovable, DiGi.Geometry.Core.Interfaces.IGeometry, DiGi.Core.Interfaces.ISerializableObject, DiGi.Core.Interfaces.ICloneableObject<DiGi.Core.Interfaces.ISerializableObject>, DiGi.Core.Interfaces.ICloneableObject, DiGi.Core.Interfaces.IObject, DiGi.Geometry.Core.Interfaces.IPoint<DiGi.Geometry.Planar.Classes.Point2D>, DiGi.Geometry.Core.Interfaces.IPoint

Inheritance System.ObjectDiGi.Core.Classes.ObjectDiGi.Core.Classes.SerializableObjectCoordinateCoordinate2D → Point2D

Implements DiGi.Geometry.Planar.Interfaces.IMovable2D, DiGi.Geometry.Core.Interfaces.IMovable<Vector2D>, DiGi.Geometry.Core.Interfaces.IMovable, DiGi.Geometry.Core.Interfaces.IGeometry, DiGi.Core.Interfaces.ISerializableObject, DiGi.Core.Interfaces.ICloneableObject<DiGi.Core.Interfaces.ISerializableObject>, DiGi.Core.Interfaces.ICloneableObject, DiGi.Core.Interfaces.IObject, DiGi.Geometry.Core.Interfaces.IPoint<Point2D>, DiGi.Geometry.Core.Interfaces.IPoint

Constructors

Point2D(Point2D) Constructor

Initializes a new instance of the Point2D class by cloning an existing point.

public Point2D(DiGi.Geometry.Planar.Classes.Point2D? point2D);

Parameters

point2D Point2D

The source point to clone.

Point2D(double, double) Constructor

Initializes a new instance of the Point2D class with specified X and Y coordinates.

public Point2D(double x, double y);

Parameters

x System.Double

The X coordinate.

y System.Double

The Y coordinate.

Point2D(double[]) Constructor

Initializes a new instance of the Point2D class using an array of values.

public Point2D(double[]? values);

Parameters

values System.Double[]

The array containing coordinate values.

Point2D(JsonObject) Constructor

Initializes a new instance of the Point2D class from a JSON object.

public Point2D(System.Text.Json.Nodes.JsonObject? jsonObject);

Parameters

jsonObject System.Text.Json.Nodes.JsonObject

The JSON object containing point data.

Methods

Point2D.Clone() Method

Creates a clone of the current point.

public override DiGi.Core.Interfaces.ISerializableObject? Clone();

Implements Clone()

Returns

DiGi.Core.Interfaces.ISerializableObject
A cloned DiGi.Core.Interfaces.ISerializableObject.

Point2D.Distance(Point2D) Method

Calculates the distance between this point and another point.

public double Distance(DiGi.Geometry.Planar.Classes.Point2D? point2D);

Parameters

point2D Point2D

The other point.

Returns

System.Double
The distance result, or NaN if the input is null.

Point2D.Equals(object) Method

Determines whether the specified System.Object is equal to the current Point2D.

public override bool Equals(object? obj);

Parameters

obj System.Object

The System.Object to compare with the current instance.

Returns

System.Boolean
true if the specified System.Object is a Point2D with equal component values; otherwise, false.

Point2D.GetAbs() Method

Gets a new point with absolute values of the coordinates.

public DiGi.Geometry.Planar.Classes.Point2D? GetAbs();

Returns

Point2D
A new Point2D with absolute coordinate values.

Point2D.GetHashCode() Method

Returns a hash code for the current Point2D.

public override int GetHashCode();

Returns

System.Int32
An System.Int32 hash code.

Point2D.GetMoved(Vector2D) Method

Returns a new point moved by the specified vector.

public DiGi.Geometry.Planar.Classes.Point2D? GetMoved(DiGi.Geometry.Planar.Classes.Vector2D? vector3D);

Parameters

vector3D Vector2D

The movement vector.

Returns

Point2D
A new Point2D shifted by the vector, or null if input is null.

Point2D.InDistance(Point2D, double, double) Method

Checks if another point is within a specified distance from this point.

public bool InDistance(DiGi.Geometry.Planar.Classes.Point2D? point2D, double distance, double tolerance=1E-06);

Parameters

point2D Point2D

The other point to check.

distance System.Double

The maximum distance.

tolerance System.Double

The distance tolerance.

Returns

System.Boolean
True if the point is within the specified distance; otherwise, false.

Point2D.Mid(Point2D) Method

Calculates the midpoint between this point and another point.

public DiGi.Geometry.Planar.Classes.Point2D? Mid(DiGi.Geometry.Planar.Classes.Point2D? point2D);

Parameters

point2D Point2D

The other point.

Returns

Point2D
A new Point2D representing the midpoint, or null if input is null.

Operators

Point2D.operator +(Point2D, Vector2D) Operator

Adds a vector to a point to produce a new point.

public static DiGi.Geometry.Planar.Classes.Point2D? operator +(DiGi.Geometry.Planar.Classes.Point2D? point2D, DiGi.Geometry.Planar.Classes.Vector2D? vector2D);

Parameters

point2D Point2D

The origin point.

vector2D Vector2D

The translation vector.

Returns

Point2D
A new Point2D shifted by the vector, or null if either input is null.

Point2D.operator ==(Point2D, Point2D) Operator

Indicates whether two Point2D instances are equal.

public static bool operator ==(DiGi.Geometry.Planar.Classes.Point2D? point2D_1, DiGi.Geometry.Planar.Classes.Point2D? point2D_2);

Parameters

point2D_1 Point2D

The first Point2D to compare.

point2D_2 Point2D

The second Point2D to compare.

Returns

System.Boolean
true if the points are equal; otherwise, false.

Point2D.operator !=(Point2D, Point2D) Operator

Indicates whether two Point2D instances are not equal.

public static bool operator !=(DiGi.Geometry.Planar.Classes.Point2D? point2D_1, DiGi.Geometry.Planar.Classes.Point2D? point2D_2);

Parameters

point2D_1 Point2D

The first Point2D to compare.

point2D_2 Point2D

The second Point2D to compare.

Returns

System.Boolean
true if the points are not equal; otherwise, false.

Point2D.operator -(Point2D, Vector2D) Operator

Subtracts a vector from a point to produce a new point.

public static DiGi.Geometry.Planar.Classes.Point2D? operator -(DiGi.Geometry.Planar.Classes.Point2D? point2D, DiGi.Geometry.Planar.Classes.Vector2D? vector2D);

Parameters

point2D Point2D

The origin point.

vector2D Vector2D

The translation vector.

Returns

Point2D
A new Point2D shifted by the negative of the vector, or null if either input is null.

Polygon2D Class

Represents a 2D polygon defined by a collection of vertices.

public class Polygon2D : DiGi.Geometry.Planar.Classes.Segmentable2D, DiGi.Geometry.Planar.Interfaces.IPolygon2D, DiGi.Geometry.Planar.Interfaces.IPolygonal2D, DiGi.Geometry.Planar.Interfaces.IClosedCurve2D, DiGi.Geometry.Core.Interfaces.IClosedCurve, DiGi.Geometry.Core.Interfaces.ICurve, DiGi.Geometry.Core.Interfaces.IGeometry, DiGi.Core.Interfaces.ISerializableObject, DiGi.Core.Interfaces.ICloneableObject<DiGi.Core.Interfaces.ISerializableObject>, DiGi.Core.Interfaces.ICloneableObject, DiGi.Core.Interfaces.IObject, DiGi.Geometry.Planar.Interfaces.IGeometry2D, DiGi.Geometry.Planar.Interfaces.IMovable2D, DiGi.Geometry.Core.Interfaces.IMovable<DiGi.Geometry.Planar.Classes.Vector2D>, DiGi.Geometry.Core.Interfaces.IMovable, DiGi.Geometry.Planar.Interfaces.ITransformable2D, DiGi.Geometry.Core.Interfaces.ITransformable<DiGi.Geometry.Planar.Interfaces.ITransform2D>, DiGi.Geometry.Core.Interfaces.ITransformable, DiGi.Geometry.Planar.Interfaces.ICurve2D, DiGi.Geometry.Planar.Interfaces.ICollectable2D, DiGi.Geometry.Core.Interfaces.ICollectable, DiGi.Geometry.Planar.Interfaces.IBoundable2D, DiGi.Geometry.Core.Interfaces.IBoundable, DiGi.Geometry.Planar.Interfaces.ISegmentable2D, DiGi.Geometry.Core.Interfaces.ISegmentable<DiGi.Geometry.Planar.Classes.Point2D>, DiGi.Geometry.Core.Interfaces.ISegmentable, DiGi.Geometry.Core.Interfaces.IInvertible, DiGi.Geometry.Planar.Interfaces.IInvertible2D

Inheritance System.ObjectDiGi.Core.Classes.ObjectDiGi.Core.Classes.SerializableObjectGeometry2DSegmentable2D → Polygon2D

Derived
Triangle2D

Implements DiGi.Geometry.Planar.Interfaces.IPolygon2D, IPolygonal2D, IClosedCurve2D, DiGi.Geometry.Core.Interfaces.IClosedCurve, DiGi.Geometry.Core.Interfaces.ICurve, DiGi.Geometry.Core.Interfaces.IGeometry, DiGi.Core.Interfaces.ISerializableObject, DiGi.Core.Interfaces.ICloneableObject<DiGi.Core.Interfaces.ISerializableObject>, DiGi.Core.Interfaces.ICloneableObject, DiGi.Core.Interfaces.IObject, DiGi.Geometry.Planar.Interfaces.IGeometry2D, DiGi.Geometry.Planar.Interfaces.IMovable2D, DiGi.Geometry.Core.Interfaces.IMovable<Vector2D>, DiGi.Geometry.Core.Interfaces.IMovable, DiGi.Geometry.Planar.Interfaces.ITransformable2D, DiGi.Geometry.Core.Interfaces.ITransformable<DiGi.Geometry.Planar.Interfaces.ITransform2D>, DiGi.Geometry.Core.Interfaces.ITransformable, DiGi.Geometry.Planar.Interfaces.ICurve2D, DiGi.Geometry.Planar.Interfaces.ICollectable2D, DiGi.Geometry.Core.Interfaces.ICollectable, IBoundable2D, DiGi.Geometry.Core.Interfaces.IBoundable, ISegmentable2D, DiGi.Geometry.Core.Interfaces.ISegmentable<Point2D>, DiGi.Geometry.Core.Interfaces.ISegmentable, DiGi.Geometry.Core.Interfaces.IInvertible, DiGi.Geometry.Planar.Interfaces.IInvertible2D

Constructors

Polygon2D() Constructor

Initializes a new instance of the Polygon2D class.

public Polygon2D();

Polygon2D(Polygon2D) Constructor

Initializes a new instance of the Polygon2D class by cloning an existing polygon.

public Polygon2D(DiGi.Geometry.Planar.Classes.Polygon2D? polygon2D);

Parameters

polygon2D Polygon2D

The source polygon to clone.

Polygon2D(IPolygonal2D) Constructor

Initializes a new instance of the Polygon2D class from another polygonal geometry.

public Polygon2D(DiGi.Geometry.Planar.Interfaces.IPolygonal2D? polygonal2D);

Parameters

polygonal2D IPolygonal2D

The source polygonal geometry.

Polygon2D(IEnumerable<Point2D>) Constructor

Initializes a new instance of the Polygon2D class defined by a collection of points.

The points are stored as given. A polygon holds its ring open, because GetSegments() adds the closing segment itself, so a caller handing over a ring which repeats its first point as its last should build it through Polygon2D(this IEnumerable<Point2D>, double) instead - that is where the repeat is removed.

public Polygon2D(System.Collections.Generic.IEnumerable<DiGi.Geometry.Planar.Classes.Point2D>? point2Ds);

Parameters

point2Ds System.Collections.Generic.IEnumerable<Point2D>

The vertices of the polygon.

Polygon2D(List<Point2D>, bool) Constructor

Initializes a new instance of the Polygon2D class from a prebuilt list of points.

internal Polygon2D(System.Collections.Generic.List<DiGi.Geometry.Planar.Classes.Point2D>? point2Ds, bool clone);

Parameters

point2Ds System.Collections.Generic.List<Point2D>

The vertices of the polygon.

clone System.Boolean

When true, the points are defensively cloned; when false, the supplied list is adopted directly without cloning. Use false only when the caller owns freshly created points that are not shared.

Polygon2D(JsonObject) Constructor

Initializes a new instance of the Polygon2D class from a JSON object.

public Polygon2D(System.Text.Json.Nodes.JsonObject? jsonObject);

Parameters

jsonObject System.Text.Json.Nodes.JsonObject

The JSON object containing polygon data.

Methods

Polygon2D.Clone() Method

Creates a clone of the current polygon.

public override DiGi.Core.Interfaces.ISerializableObject? Clone();

Implements Clone()

Returns

DiGi.Core.Interfaces.ISerializableObject
A cloned instance of the polygon.

Polygon2D.GetArea() Method

Calculates the area of the polygon.

public virtual double GetArea();

Implements GetArea()

Returns

System.Double
The area of the polygon.

Polygon2D.GetCentroid() Method

Gets the centroid of the polygon.

public DiGi.Geometry.Planar.Classes.Point2D? GetCentroid();

Implements GetCentroid()

Returns

Point2D
The center point of the polygon, or null if it cannot be determined.

Polygon2D.GetInternalPoint(double) Method

Gets a point guaranteed to be inside the polygon boundaries.

public virtual DiGi.Geometry.Planar.Classes.Point2D? GetInternalPoint(double tolerance=1E-06);

Parameters

tolerance System.Double

The distance tolerance.

Implements GetInternalPoint(double)

Returns

Point2D
An internal point of the polygon, or null if it cannot be determined.

Polygon2D.GetPerimeter() Method

Gets the perimeter length of the polygon.

public double GetPerimeter();

Implements GetPerimeter()

Returns

System.Double
The total length of the boundary.

Polygon2D.GetSegments() Method

Gets the segments that form the boundary of the polygon.

public override System.Collections.Generic.List<DiGi.Geometry.Planar.Classes.Segment2D>? GetSegments();

Implements GetSegments()

Returns

System.Collections.Generic.List<Segment2D>
A list of boundary segments.

Polygon2D.InRange(BoundingBox2D, double) Method

Checks if a bounding box is within or intersects the polygon.

public bool InRange(DiGi.Geometry.Planar.Classes.BoundingBox2D? boundingBox2D, double tolerance=1E-06);

Parameters

boundingBox2D BoundingBox2D

The bounding box to check.

tolerance System.Double

The distance tolerance for the check.

Implements InRange(BoundingBox2D, double)

Returns

System.Boolean
True if they intersect or overlap; otherwise, false.

Polygon2D.InRange(Point2D, double) Method

Checks if a point is within or on the boundary of the polygon.

public bool InRange(DiGi.Geometry.Planar.Classes.Point2D? point2D, double tolerance=1E-06);

Parameters

point2D Point2D

The point to check.

tolerance System.Double

The distance tolerance for the check.

Implements InRange(Point2D, double)

Returns

System.Boolean
True if the point is in range; otherwise, false.

Polygon2D.InRange(ISegmentable2D, double) Method

Checks if a segmentable geometry is within or intersects the polygon boundaries.

public bool InRange(DiGi.Geometry.Planar.Interfaces.ISegmentable2D? segmentable2D, double tolerance=1E-06);

Parameters

segmentable2D ISegmentable2D

The geometry to check.

tolerance System.Double

The distance tolerance for the check.

Implements InRange(ISegmentable2D, double)

Returns

System.Boolean
True if any part of the geometry is in range; otherwise, false.

Polygon2D.Inside(Point2D, double) Method

Checks if a point is strictly inside the polygon boundaries.

public bool Inside(DiGi.Geometry.Planar.Classes.Point2D? point2D, double tolerance=1E-06);

Parameters

point2D Point2D

The point to check.

tolerance System.Double

The distance tolerance for the check.

Implements Inside(Point2D, double)

Returns

System.Boolean
True if the point is strictly inside; otherwise, false.

Polygon2D.Inside(ISegmentable2D, double) Method

Checks if a segmentable geometry is strictly inside the polygon boundaries.

public bool Inside(DiGi.Geometry.Planar.Interfaces.ISegmentable2D? segmentable2D, double tolerance=1E-06);

Parameters

segmentable2D ISegmentable2D

The geometry to check.

tolerance System.Double

The distance tolerance for the check.

Implements Inside(ISegmentable2D, double)

Returns

System.Boolean
True if all points of the geometry are strictly inside; otherwise, false.

Polygon2D.Triangulate(double) Method

Triangulates the polygon into a set of triangles.

public virtual System.Collections.Generic.List<DiGi.Geometry.Planar.Classes.Triangle2D>? Triangulate(double tolerance=1E-09);

Parameters

tolerance System.Double

The distance tolerance used during triangulation.

Implements Triangulate(double)

Returns

System.Collections.Generic.List<Triangle2D>
A list of Triangle2D objects representing the triangulated polygon, or null if it cannot be triangulated.

Polygonal2DNormalizationUpdater Class

Provides functionality to update and verify the normalization of a 2D polygonal geometry based on a specified orientation.

public class Polygonal2DNormalizationUpdater : DiGi.Geometry.Core.Classes.GeometryUpdater<DiGi.Geometry.Planar.Interfaces.IPolygonal2D>, DiGi.Geometry.Core.Interfaces.INormalizationUpdater<DiGi.Geometry.Planar.Interfaces.IPolygonal2D>, DiGi.Geometry.Core.Interfaces.IGeometryUpdater<DiGi.Geometry.Planar.Interfaces.IPolygonal2D>, DiGi.Geometry.Core.Interfaces.IGeometryUpdater, DiGi.Core.Interfaces.IUpdater, DiGi.Core.Interfaces.IEvaluator, DiGi.Core.Interfaces.IUpdater<DiGi.Geometry.Planar.Interfaces.IPolygonal2D>

Inheritance System.ObjectDiGi.Geometry.Core.Classes.GeometryUpdater<IPolygonal2D> → Polygonal2DNormalizationUpdater

Implements DiGi.Geometry.Core.Interfaces.INormalizationUpdater<IPolygonal2D>, DiGi.Geometry.Core.Interfaces.IGeometryUpdater<IPolygonal2D>, DiGi.Geometry.Core.Interfaces.IGeometryUpdater, DiGi.Core.Interfaces.IUpdater, DiGi.Core.Interfaces.IEvaluator, DiGi.Core.Interfaces.IUpdater<IPolygonal2D>

Constructors

Polygonal2DNormalizationUpdater(Orientation) Constructor

Initializes a new instance of the Polygonal2DNormalizationUpdater class.

public Polygonal2DNormalizationUpdater(DiGi.Geometry.Core.Enums.Orientation orientation);

Parameters

orientation Orientation

The Orientation that the polygonal 2D object should be normalized to.

Methods

Polygonal2DNormalizationUpdater.Normalized() Method

Determines whether the current value is normalized based on the specified orientation.

public bool Normalized();

Implements Normalized()

Returns

System.Boolean
A System.Boolean value indicating true if the value is normalized; otherwise, false.

Polygonal2DNormalizationUpdater.Update() Method

Updates the orientation of the value.

public override bool Update();

Implements Update()

Returns

System.Boolean
A System.Boolean indicating whether the update was successful; returns false if the value is null.

Polygonal2DSelfIntersectionSolver Class

Solves self-intersections for a 2D polygonal geometry.

public class Polygonal2DSelfIntersectionSolver : DiGi.Geometry.Core.Interfaces.IOneToOneGeometrySolver<DiGi.Geometry.Planar.Interfaces.IPolygonal2D, DiGi.Geometry.Planar.Interfaces.IPolygonal2D>, DiGi.Geometry.Core.Interfaces.IGeometrySolver, DiGi.Core.Interfaces.ISolver, DiGi.Core.Interfaces.IEvaluator, DiGi.Core.Interfaces.IOneToOneSolver<DiGi.Geometry.Planar.Interfaces.IPolygonal2D, DiGi.Geometry.Planar.Interfaces.IPolygonal2D>

Inheritance System.Object → Polygonal2DSelfIntersectionSolver

Implements DiGi.Geometry.Core.Interfaces.IOneToOneGeometrySolver<IPolygonal2D,IPolygonal2D>, DiGi.Geometry.Core.Interfaces.IGeometrySolver, DiGi.Core.Interfaces.ISolver, DiGi.Core.Interfaces.IEvaluator, DiGi.Core.Interfaces.IOneToOneSolver<IPolygonal2D,IPolygonal2D>

Constructors

Polygonal2DSelfIntersectionSolver(IPolygonal2D, double, double) Constructor

Initializes a new instance of the Polygonal2DSelfIntersectionSolver class.

public Polygonal2DSelfIntersectionSolver(DiGi.Geometry.Planar.Interfaces.IPolygonal2D input, double maxLength, double tolerance=1E-06);

Parameters

input IPolygonal2D

The IPolygonal2D input geometry to be analyzed for self-intersections.

maxLength System.Double

The maximum length as a System.Double.

tolerance System.Double

The distance tolerance as a System.Double.

Polygonal2DSelfIntersectionSolver(double, double) Constructor

Initializes a new instance of the Polygonal2DSelfIntersectionSolver class.

public Polygonal2DSelfIntersectionSolver(double maxLength, double tolerance=1E-06);

Parameters

maxLength System.Double

The maximum length as a System.Double.

tolerance System.Double

The tolerance value as a System.Double.

Properties

Polygonal2DSelfIntersectionSolver.Input Property

Gets or sets the input IPolygonal2D.

public DiGi.Geometry.Planar.Interfaces.IPolygonal2D? Input { set; }

Implements Input

Property Value

IPolygonal2D

Polygonal2DSelfIntersectionSolver.Output Property

Gets the resulting IPolygonal2D object produced by the solver.

public DiGi.Geometry.Planar.Interfaces.IPolygonal2D? Output { get; }

Implements Output

Property Value

IPolygonal2D
The IPolygonal2D instance, or null if no output has been generated or the solve operation failed.

Methods

Polygonal2DSelfIntersectionSolver.Solve() Method

Attempts to solve for self-intersecting polygons based on the input data, maximum length, and tolerance.

public bool Solve();

Implements Solve()

Returns

System.Boolean
A System.Boolean value indicating whether a solution was successfully found.

PolygonalFace2D Class

Represents a two-dimensional polygonal face defined by an external edge and a collection of internal edges.

public class PolygonalFace2D : DiGi.Geometry.Planar.Classes.Geometry2D, DiGi.Geometry.Planar.Interfaces.IPolygonalFace2D, DiGi.Geometry.Planar.Interfaces.IFace2D<DiGi.Geometry.Planar.Interfaces.IPolygonal2D>, DiGi.Geometry.Planar.Interfaces.IFace2D, DiGi.Geometry.Core.Interfaces.IFace, DiGi.Geometry.Core.Interfaces.ISurface, DiGi.Geometry.Core.Interfaces.IGeometry, DiGi.Core.Interfaces.ISerializableObject, DiGi.Core.Interfaces.ICloneableObject<DiGi.Core.Interfaces.ISerializableObject>, DiGi.Core.Interfaces.ICloneableObject, DiGi.Core.Interfaces.IObject, DiGi.Geometry.Planar.Interfaces.IGeometry2D, DiGi.Geometry.Planar.Interfaces.IMovable2D, DiGi.Geometry.Core.Interfaces.IMovable<DiGi.Geometry.Planar.Classes.Vector2D>, DiGi.Geometry.Core.Interfaces.IMovable, DiGi.Geometry.Planar.Interfaces.ITransformable2D, DiGi.Geometry.Core.Interfaces.ITransformable<DiGi.Geometry.Planar.Interfaces.ITransform2D>, DiGi.Geometry.Core.Interfaces.ITransformable, DiGi.Geometry.Planar.Interfaces.IBoundable2D, DiGi.Geometry.Core.Interfaces.IBoundable, DiGi.Geometry.Planar.Interfaces.ICollectable2D, DiGi.Geometry.Core.Interfaces.ICollectable, DiGi.Geometry.Planar.Interfaces.ISurface2D, DiGi.Geometry.Core.Interfaces.IFace<DiGi.Geometry.Planar.Interfaces.IPolygonal2D>, DiGi.Geometry.Planar.Interfaces.IInvertible2D, DiGi.Geometry.Core.Interfaces.IInvertible

Inheritance System.ObjectDiGi.Core.Classes.ObjectDiGi.Core.Classes.SerializableObjectGeometry2D → PolygonalFace2D

Implements IPolygonalFace2D, DiGi.Geometry.Planar.Interfaces.IFace2D<IPolygonal2D>, IFace2D, DiGi.Geometry.Core.Interfaces.IFace, DiGi.Geometry.Core.Interfaces.ISurface, DiGi.Geometry.Core.Interfaces.IGeometry, DiGi.Core.Interfaces.ISerializableObject, DiGi.Core.Interfaces.ICloneableObject<DiGi.Core.Interfaces.ISerializableObject>, DiGi.Core.Interfaces.ICloneableObject, DiGi.Core.Interfaces.IObject, DiGi.Geometry.Planar.Interfaces.IGeometry2D, DiGi.Geometry.Planar.Interfaces.IMovable2D, DiGi.Geometry.Core.Interfaces.IMovable<Vector2D>, DiGi.Geometry.Core.Interfaces.IMovable, DiGi.Geometry.Planar.Interfaces.ITransformable2D, DiGi.Geometry.Core.Interfaces.ITransformable<DiGi.Geometry.Planar.Interfaces.ITransform2D>, DiGi.Geometry.Core.Interfaces.ITransformable, IBoundable2D, DiGi.Geometry.Core.Interfaces.IBoundable, DiGi.Geometry.Planar.Interfaces.ICollectable2D, DiGi.Geometry.Core.Interfaces.ICollectable, DiGi.Geometry.Planar.Interfaces.ISurface2D, DiGi.Geometry.Core.Interfaces.IFace<IPolygonal2D>, DiGi.Geometry.Planar.Interfaces.IInvertible2D, DiGi.Geometry.Core.Interfaces.IInvertible

Constructors

PolygonalFace2D(PolygonalFace2D) Constructor

Initializes a new instance of the PolygonalFace2D class by cloning an existing polygonal face.

public PolygonalFace2D(DiGi.Geometry.Planar.Classes.PolygonalFace2D? polygonalFace2D);

Parameters

polygonalFace2D PolygonalFace2D

The source polygonal face to clone.

PolygonalFace2D(IPolygonal2D, IEnumerable<IPolygonal2D>) Constructor

Initializes a new instance of the PolygonalFace2D class with specified external and internal edges.

internal PolygonalFace2D(DiGi.Geometry.Planar.Interfaces.IPolygonal2D? externalEdge, System.Collections.Generic.IEnumerable<DiGi.Geometry.Planar.Interfaces.IPolygonal2D>? internalEdges=null);

Parameters

externalEdge IPolygonal2D

The outer boundary of the face.

internalEdges System.Collections.Generic.IEnumerable<IPolygonal2D>

The inner boundaries (holes) of the face.

PolygonalFace2D(IPolygonal2D, List<IPolygonal2D>, bool) Constructor

Initializes a new instance of the PolygonalFace2D class from prebuilt edges.

internal PolygonalFace2D(DiGi.Geometry.Planar.Interfaces.IPolygonal2D? externalEdge, System.Collections.Generic.List<DiGi.Geometry.Planar.Interfaces.IPolygonal2D>? internalEdges, bool clone);

Parameters

externalEdge IPolygonal2D

The outer boundary of the face.

internalEdges System.Collections.Generic.List<IPolygonal2D>

The inner boundaries (holes) of the face.

clone System.Boolean

When true, the edges are defensively cloned; when false, the supplied edges are adopted directly without cloning. Use false only when the caller owns freshly created edges that are not shared.

PolygonalFace2D(JsonObject) Constructor

Initializes a new instance of the PolygonalFace2D class from a JSON object.

public PolygonalFace2D(System.Text.Json.Nodes.JsonObject? jsonObject);

Parameters

jsonObject System.Text.Json.Nodes.JsonObject

The JSON object containing polygonal face data.

Properties

PolygonalFace2D.Edges Property

Gets all edges of the polygonal face, including both external and internal boundaries.

public System.Collections.Generic.List<DiGi.Geometry.Planar.Interfaces.IPolygonal2D>? Edges { get; }

Implements Edges

Property Value

System.Collections.Generic.List<IPolygonal2D>

PolygonalFace2D.ExternalEdge Property

Gets the external boundary of the polygonal face.

public DiGi.Geometry.Planar.Interfaces.IPolygonal2D? ExternalEdge { get; }

Implements ExternalEdge

Property Value

IPolygonal2D

PolygonalFace2D.InternalEdges Property

Gets the internal boundaries (holes) of the polygonal face.

public System.Collections.Generic.List<DiGi.Geometry.Planar.Interfaces.IPolygonal2D>? InternalEdges { get; }

Implements InternalEdges

Property Value

System.Collections.Generic.List<IPolygonal2D>

Methods

PolygonalFace2D.Clone() Method

Creates a clone of the current polygonal face.

public override DiGi.Core.Interfaces.ISerializableObject? Clone();

Implements Clone()

Returns

DiGi.Core.Interfaces.ISerializableObject
A cloned instance of the polygonal face.

PolygonalFace2D.ClosestPoint(Point2D, double) Method

Finds the point on the polygonal face closest to the given point.

public DiGi.Geometry.Planar.Classes.Point2D? ClosestPoint(DiGi.Geometry.Planar.Classes.Point2D? point2D, double tolerance=1E-06);

Parameters

point2D Point2D

The target point.

tolerance System.Double

The distance tolerance for the check.

Implements ClosestPoint(Point2D, double)

Returns

Point2D
The closest point on the face (including its interior), or null if it cannot be determined.

PolygonalFace2D.GetArea() Method

Calculates the area of the polygonal face (external area minus internal hole areas).

public double GetArea();

Implements GetArea()

Returns

System.Double
The net area of the face.

PolygonalFace2D.GetBoundingBox() Method

Gets the axis-aligned bounding box of the polygonal face.

public DiGi.Geometry.Planar.Classes.BoundingBox2D? GetBoundingBox();

Implements GetBoundingBox()

Returns

BoundingBox2D
The bounding box based on the external boundary.

PolygonalFace2D.GetInternalPoint(double) Method

Gets a point guaranteed to be inside the polygonal face (outside of any holes).

public DiGi.Geometry.Planar.Classes.Point2D? GetInternalPoint(double tolerance=1E-06);

Parameters

tolerance System.Double

The distance tolerance.

Implements GetInternalPoint(double)

Returns

Point2D
An internal point of the face, or null if it cannot be determined.

PolygonalFace2D.InRange(Point2D, double) Method

Checks if a point is within or on the boundary of the polygonal face.

public bool InRange(DiGi.Geometry.Planar.Classes.Point2D? point2D, double tolerance=1E-06);

Parameters

point2D Point2D

The point to check.

tolerance System.Double

The distance tolerance for the check.

Implements InRange(Point2D, double)

Returns

System.Boolean
True if the point is in range; otherwise, false.

PolygonalFace2D.Inside(Point2D, double) Method

Checks if a point is strictly inside the polygonal face (excluding boundaries and holes).

public bool Inside(DiGi.Geometry.Planar.Classes.Point2D? point2D, double tolerance=1E-06);

Parameters

point2D Point2D

The point to check.

tolerance System.Double

The distance tolerance for the check.

Implements Inside(Point2D, double)

Returns

System.Boolean
True if the point is strictly inside; otherwise, false.

PolygonalFace2D.Inverse() Method

Reverses the orientation of both external and internal boundaries.

public bool Inverse();

Implements Inverse()

Returns

System.Boolean
True if at least one boundary was successfully reversed.

PolygonalFace2D.Move(Vector2D) Method

Moves the polygonal face by translating its boundaries.

public override bool Move(DiGi.Geometry.Planar.Classes.Vector2D? vector2D);

Parameters

vector2D Vector2D

The translation vector.

Returns

System.Boolean
True if the move was successful.

PolygonalFace2D.OnEdge(Point2D, double) Method

Checks if a point lies on any of the edges (external or internal) of the face.

public bool OnEdge(DiGi.Geometry.Planar.Classes.Point2D? point2D, double tolerance=1E-06);

Parameters

point2D Point2D

The point to check.

tolerance System.Double

The distance tolerance for the check.

Implements OnEdge(Point2D, double)

Returns

System.Boolean
True if the point is on an edge; otherwise, false.

PolygonalFace2D.Orient(Nullable<Orientation>, Nullable<Orientation>) Method

Orients the external and internal boundaries of the face.

public bool Orient(System.Nullable<DiGi.Geometry.Core.Enums.Orientation> externalEdgeOrientation, System.Nullable<DiGi.Geometry.Core.Enums.Orientation> internalEdgeOrientation);

Parameters

externalEdgeOrientation System.Nullable<Orientation>

The desired orientation for the external boundary.

internalEdgeOrientation System.Nullable<Orientation>

The desired orientation for the internal boundaries.

Implements Orient(Nullable<Orientation>, Nullable<Orientation>)

Returns

System.Boolean
True if at least one boundary was successfully oriented.

PolygonalFace2D.Transform(ITransform2D) Method

Transforms the polygonal face by transforming its boundaries.

public override bool Transform(DiGi.Geometry.Planar.Interfaces.ITransform2D? transform);

Parameters

transform DiGi.Geometry.Planar.Interfaces.ITransform2D

The transformation to apply.

Returns

System.Boolean
True if the transformation was successful.

PolygonalFace2D.Triangulate(double) Method

Triangulates the polygonal face into a set of triangles.

public virtual System.Collections.Generic.List<DiGi.Geometry.Planar.Classes.Triangle2D>? Triangulate(double tolerance=1E-09);

Parameters

tolerance System.Double

The distance tolerance used during triangulation.

Implements Triangulate(double)

Returns

System.Collections.Generic.List<Triangle2D>
A list of Triangle2D objects representing the triangulated face, or null if it cannot be triangulated.

PolygonalFace2DInternalPointSolver Class

Provides a solver for calculating internal points within an IPolygonalFace2D.

public class PolygonalFace2DInternalPointSolver : DiGi.Geometry.Core.Classes.InternalPointSolver<DiGi.Geometry.Planar.Interfaces.IPolygonalFace2D, DiGi.Geometry.Planar.Classes.Point2D>

Inheritance System.ObjectDiGi.Geometry.Core.Classes.InternalPointSolver<IPolygonalFace2D,Point2D> → PolygonalFace2DInternalPointSolver

Constructors

PolygonalFace2DInternalPointSolver(double) Constructor

Initializes a new instance of the PolygonalFace2DInternalPointSolver class.

public PolygonalFace2DInternalPointSolver(double tolerance=1E-06);

Parameters

tolerance System.Double

The System.Double value representing the distance tolerance used for calculations.

PolygonalFace2DInternalPointSolver(int, double) Constructor

Initializes a new instance of the PolygonalFace2DInternalPointSolver class.

public PolygonalFace2DInternalPointSolver(int maxCount, double tolerance=1E-06);

Parameters

maxCount System.Int32

The maximum number of points to solve for as an System.Int32.

tolerance System.Double

The distance tolerance used in calculations as a System.Double.

Properties

PolygonalFace2DInternalPointSolver.Input Property

Gets or sets the IPolygonalFace2D used as the input for the operation.

public override DiGi.Geometry.Planar.Interfaces.IPolygonalFace2D? Input { set; }

Implements Input

Property Value

IPolygonalFace2D
The IPolygonalFace2D instance that serves as the input.

Methods

PolygonalFace2DInternalPointSolver.Solve() Method

Attempts to solve the current problem instance based on the polygonal face and existing outputs.

public override bool Solve();

Implements Solve()

Returns

System.Boolean
A System.Boolean value indicating whether the solution was successfully found; returns false if the polygonal face is null, the maximum output count has been reached, or the external edge area is below the specified tolerance.

PolygonalFace2DNormalizationUpdater Class

Updates the normalization of a 2D polygonal face based on specified edge orientations.

public class PolygonalFace2DNormalizationUpdater : DiGi.Geometry.Core.Classes.GeometryUpdater<DiGi.Geometry.Planar.Interfaces.IPolygonalFace2D>, DiGi.Geometry.Core.Interfaces.INormalizationUpdater<DiGi.Geometry.Planar.Interfaces.IPolygonalFace2D>, DiGi.Geometry.Core.Interfaces.IGeometryUpdater<DiGi.Geometry.Planar.Interfaces.IPolygonalFace2D>, DiGi.Geometry.Core.Interfaces.IGeometryUpdater, DiGi.Core.Interfaces.IUpdater, DiGi.Core.Interfaces.IEvaluator, DiGi.Core.Interfaces.IUpdater<DiGi.Geometry.Planar.Interfaces.IPolygonalFace2D>

Inheritance System.ObjectDiGi.Geometry.Core.Classes.GeometryUpdater<IPolygonalFace2D> → PolygonalFace2DNormalizationUpdater

Implements DiGi.Geometry.Core.Interfaces.INormalizationUpdater<IPolygonalFace2D>, DiGi.Geometry.Core.Interfaces.IGeometryUpdater<IPolygonalFace2D>, DiGi.Geometry.Core.Interfaces.IGeometryUpdater, DiGi.Core.Interfaces.IUpdater, DiGi.Core.Interfaces.IEvaluator, DiGi.Core.Interfaces.IUpdater<IPolygonalFace2D>

Constructors

PolygonalFace2DNormalizationUpdater(Orientation) Constructor

Initializes a new instance of the PolygonalFace2DNormalizationUpdater class using the specified Orientation for both external and internal edges.

public PolygonalFace2DNormalizationUpdater(DiGi.Geometry.Core.Enums.Orientation orientation);

Parameters

orientation Orientation

The Orientation to be used for normalization of both external and internal edges.

PolygonalFace2DNormalizationUpdater(Nullable<Orientation>, Nullable<Orientation>) Constructor

Initializes a new instance of the PolygonalFace2DNormalizationUpdater class with the specified orientations for external and internal edges.

public PolygonalFace2DNormalizationUpdater(System.Nullable<DiGi.Geometry.Core.Enums.Orientation> externalEdgeOrientation, System.Nullable<DiGi.Geometry.Core.Enums.Orientation> internalEdgeOrientation);

Parameters

externalEdgeOrientation System.Nullable<Orientation>

The optional Orientation used to validate the normalization of the external edge.

internalEdgeOrientation System.Nullable<Orientation>

The optional Orientation used to validate the normalization of internal edges.

Methods

PolygonalFace2DNormalizationUpdater.Normalized() Method

Determines whether the current value is normalized based on the external and internal edge orientations.

public bool Normalized();

Implements Normalized()

Returns

System.Boolean
A System.Boolean value indicating whether the value is normalized.

PolygonalFace2DNormalizationUpdater.Update() Method

Updates the orientation of the value based on the external and internal edge orientations.

public override bool Update();

Implements Update()

Returns

System.Boolean
A System.Boolean indicating whether the update was successful; returns false if the value is null.

Polyline2D Class

Represents a 2D polyline defined by a sequence of vertices.

public class Polyline2D : DiGi.Geometry.Planar.Classes.Segmentable2D

Inheritance System.ObjectDiGi.Core.Classes.ObjectDiGi.Core.Classes.SerializableObjectGeometry2DSegmentable2D → Polyline2D

Constructors

Polyline2D() Constructor

Initializes a new instance of the Polyline2D class.

public Polyline2D();

Polyline2D(Polyline2D) Constructor

Initializes a new instance of the Polyline2D class by cloning an existing polyline.

public Polyline2D(DiGi.Geometry.Planar.Classes.Polyline2D? polyline2D);

Parameters

polyline2D Polyline2D

The source polyline to clone.

Polyline2D(IEnumerable<Point2D>) Constructor

Initializes a new instance of the Polyline2D class defined by a collection of points.

public Polyline2D(System.Collections.Generic.IEnumerable<DiGi.Geometry.Planar.Classes.Point2D>? point2Ds);

Parameters

point2Ds System.Collections.Generic.IEnumerable<Point2D>

The vertices of the polyline.

Polyline2D(IEnumerable<Point2D>, bool) Constructor

Initializes a new instance of the Polyline2D class defined by vertices and whether it is closed.

public Polyline2D(System.Collections.Generic.IEnumerable<DiGi.Geometry.Planar.Classes.Point2D>? point2Ds, bool close);

Parameters

point2Ds System.Collections.Generic.IEnumerable<Point2D>

The vertices of the polyline.

close System.Boolean

True if the polyline should be closed by connecting the last point to the first.

Polyline2D(JsonObject) Constructor

Initializes a new instance of the Polyline2D class from a JSON object.

public Polyline2D(System.Text.Json.Nodes.JsonObject? jsonObject);

Parameters

jsonObject System.Text.Json.Nodes.JsonObject

The JSON object containing polyline data.

Methods

Polyline2D.Clone() Method

Creates a clone of the current polyline.

public override DiGi.Core.Interfaces.ISerializableObject? Clone();

Implements Clone()

Returns

DiGi.Core.Interfaces.ISerializableObject
A cloned instance of the polyline.

Polyline2D.Close() Method

Closes the polyline by adding a point at the end that matches the start point.

public void Close();

Polyline2D.GetSegments() Method

Gets the segments that form the polyline boundary.

public override System.Collections.Generic.List<DiGi.Geometry.Planar.Classes.Segment2D>? GetSegments();

Implements GetSegments()

Returns

System.Collections.Generic.List<Segment2D>
A list of line segments.

Polyline2D.IsClosed() Method

Checks if the polyline is closed (start point equals end point).

public bool IsClosed();

Returns

System.Boolean
True if it is closed; otherwise, false.

Polyline2D.Open() Method

Opens the polyline by removing the last point if it is closed.

public void Open();

Ray2D Class

Represents a ray in two-dimensional space, defined by an origin point and a direction vector.

public class Ray2D : DiGi.Geometry.Planar.Classes.Geometry2D, DiGi.Geometry.Planar.Interfaces.ILinear2D, DiGi.Geometry.Planar.Interfaces.IMovable2D, DiGi.Geometry.Core.Interfaces.IMovable<DiGi.Geometry.Planar.Classes.Vector2D>, DiGi.Geometry.Core.Interfaces.IMovable, DiGi.Geometry.Core.Interfaces.IGeometry, DiGi.Core.Interfaces.ISerializableObject, DiGi.Core.Interfaces.ICloneableObject<DiGi.Core.Interfaces.ISerializableObject>, DiGi.Core.Interfaces.ICloneableObject, DiGi.Core.Interfaces.IObject, DiGi.Geometry.Core.Interfaces.ICurve, DiGi.Geometry.Planar.Interfaces.ITransformable2D, DiGi.Geometry.Core.Interfaces.ITransformable<DiGi.Geometry.Planar.Interfaces.ITransform2D>, DiGi.Geometry.Core.Interfaces.ITransformable, DiGi.Geometry.Planar.Interfaces.IGeometry2D, DiGi.Geometry.Planar.Interfaces.IInvertible2D, DiGi.Geometry.Core.Interfaces.IInvertible

Inheritance System.ObjectDiGi.Core.Classes.ObjectDiGi.Core.Classes.SerializableObjectGeometry2D → Ray2D

Implements ILinear2D, DiGi.Geometry.Planar.Interfaces.IMovable2D, DiGi.Geometry.Core.Interfaces.IMovable<Vector2D>, DiGi.Geometry.Core.Interfaces.IMovable, DiGi.Geometry.Core.Interfaces.IGeometry, DiGi.Core.Interfaces.ISerializableObject, DiGi.Core.Interfaces.ICloneableObject<DiGi.Core.Interfaces.ISerializableObject>, DiGi.Core.Interfaces.ICloneableObject, DiGi.Core.Interfaces.IObject, DiGi.Geometry.Core.Interfaces.ICurve, DiGi.Geometry.Planar.Interfaces.ITransformable2D, DiGi.Geometry.Core.Interfaces.ITransformable<DiGi.Geometry.Planar.Interfaces.ITransform2D>, DiGi.Geometry.Core.Interfaces.ITransformable, DiGi.Geometry.Planar.Interfaces.IGeometry2D, DiGi.Geometry.Planar.Interfaces.IInvertible2D, DiGi.Geometry.Core.Interfaces.IInvertible

Constructors

Ray2D(Point2D, Vector2D) Constructor

Initializes a new instance of the Ray2D class with the specified origin and direction.

public Ray2D(DiGi.Geometry.Planar.Classes.Point2D? origin, DiGi.Geometry.Planar.Classes.Vector2D? direction);

Parameters

origin Point2D

The Point2D that represents the starting point of the ray.

direction Vector2D

The Vector2D that represents the direction of the ray.

Ray2D(Ray2D) Constructor

Initializes a new instance of the Ray2D class by copying the values from an existing Ray2D instance.

public Ray2D(DiGi.Geometry.Planar.Classes.Ray2D? ray2D);

Parameters

ray2D Ray2D

The Ray2D instance to copy from.

Properties

Ray2D.Direction Property

Gets or sets the Vector2D representing the direction.

public DiGi.Geometry.Planar.Classes.Vector2D? Direction { get; set; }

Implements Direction

Property Value

Vector2D
A nullable Vector2D that specifies the direction.

Ray2D.Origin Property

Gets or sets the origin Point2D.

public DiGi.Geometry.Planar.Classes.Point2D? Origin { get; set; }

Property Value

Point2D
The Point2D representing the origin, or null if it is not specified.

Methods

Ray2D.Clone() Method

Creates a copy of the current Ray2D instance.

public override DiGi.Core.Interfaces.ISerializableObject? Clone();

Implements Clone()

Returns

DiGi.Core.Interfaces.ISerializableObject
A new DiGi.Core.Interfaces.ISerializableObject that is a clone of the current instance.

Ray2D.ClosestPoint(Point2D) Method

Calculates the closest Point2D on the line to the specified Point2D.

public DiGi.Geometry.Planar.Classes.Point2D? ClosestPoint(DiGi.Geometry.Planar.Classes.Point2D? point2D);

Parameters

point2D Point2D

The Point2D for which the closest point is calculated.

Implements ClosestPoint(Point2D)

Returns

Point2D
The closest Point2D, or null if the origin or direction is not defined.

Ray2D.Collinear(ILinear2D, double) Method

Determines whether this linear 2D object is collinear with the specified ILinear2D object within a given tolerance.

public bool Collinear(DiGi.Geometry.Planar.Interfaces.ILinear2D? linear2D, double tolerance=1E-06);

Parameters

linear2D ILinear2D

The ILinear2D object to check for collinearity.

tolerance System.Double

The System.Double value representing the distance tolerance used to determine collinearity.

Implements Collinear(ILinear2D, double)

Returns

System.Boolean
A System.Boolean value indicating whether the two linear 2D objects are collinear.

Ray2D.Distance(Point2D) Method

Calculates the distance from a specified Point2D to the ray.

public double Distance(DiGi.Geometry.Planar.Classes.Point2D? point2D);

Parameters

point2D Point2D

The Point2D instance for which the distance is calculated.

Implements Distance(Point2D)

Returns

System.Double
The shortest distance as a System.Double, or System.Double.NaN if the provided Point2D is null, or if the ray's origin or direction are not defined.

Ray2D.Equals(object) Method

Determines whether the specified System.Object is equal to the current Ray2D.

public override bool Equals(object? obj);

Parameters

obj System.Object

The System.Object to compare with the current Ray2D.

Returns

System.Boolean
true if the specified System.Object is a Ray2D and has the same origin and direction as the current instance; otherwise, false.

Ray2D.GetHashCode() Method

Returns a hash code for the current object based on the origin and direction.

public override int GetHashCode();

Returns

System.Int32
An System.Int32 representing the hash code of the instance.

Ray2D.IntersectionPoint(Ray2D, double) Method

Calculates the intersection point between this ray and another specified Ray2D.

public DiGi.Geometry.Planar.Classes.Point2D? IntersectionPoint(DiGi.Geometry.Planar.Classes.Ray2D? ray2D, double tolerance=1E-06);

Parameters

ray2D Ray2D

The other Ray2D to intersect with.

tolerance System.Double

A System.Double value specifying the distance tolerance for the intersection calculation and verification.

Returns

Point2D
A Point2D representing the intersection point if it exists within the specified tolerance; otherwise, null.

Ray2D.IntersectionPoint(Segment2D, double) Method

Calculates the intersection point between this segment and another Segment2D.

public DiGi.Geometry.Planar.Classes.Point2D? IntersectionPoint(DiGi.Geometry.Planar.Classes.Segment2D? segment2D, double tolerance=1E-06);

Parameters

segment2D Segment2D

The Segment2D to check for an intersection.

tolerance System.Double

A System.Double value representing the distance tolerance used for the intersection calculation.

Returns

Point2D
A Point2D if an intersection point exists and lies on both segments; otherwise, null.

Ray2D.Inverse() Method

Inverts the current direction.

public bool Inverse();

Implements Inverse()

Returns

System.Boolean
A System.Boolean value indicating whether the inversion was successful.

Ray2D.Move(Vector2D) Method

Moves the object by the specified Vector2D.

public override bool Move(DiGi.Geometry.Planar.Classes.Vector2D? vector2D);

Parameters

vector2D Vector2D

The Vector2D that defines the movement offset.

Returns

System.Boolean
True if the move operation was successful; otherwise, false.

Ray2D.On(Point2D, double) Method

Determines whether the specified Point2D is on the object within a given tolerance.

public bool On(DiGi.Geometry.Planar.Classes.Point2D? point2D, double tolerance=1E-06);

Parameters

point2D Point2D

The Point2D to evaluate.

tolerance System.Double

The System.Double value representing the distance tolerance.

Implements On(Point2D, double)

Returns

System.Boolean
A System.Boolean value indicating whether the point is on the object within the specified tolerance.

Ray2D.Project(Point2D) Method

Projects the specified Point2D onto the ray, clamping points behind the origin to the origin.

public DiGi.Geometry.Planar.Classes.Point2D? Project(DiGi.Geometry.Planar.Classes.Point2D? point2D);

Parameters

point2D Point2D

The Point2D to project.

Implements Project(Point2D)

Returns

Point2D
The projected Point2D on the ray, or null if the input point or the ray is not properly defined.

Ray2D.Transform(ITransform2D) Method

Transforms the object's origin and direction using the provided 2D transformation.

public override bool Transform(DiGi.Geometry.Planar.Interfaces.ITransform2D? transform);

Parameters

transform DiGi.Geometry.Planar.Interfaces.ITransform2D

The DiGi.Geometry.Planar.Interfaces.ITransform2D instance used to perform the transformation.

Returns

System.Boolean
A System.Boolean value indicating whether the transformation was successfully applied; returns false if the DiGi.Geometry.Planar.Interfaces.ITransform2D transform, origin, or direction is null.

Operators

Ray2D.operator ==(Ray2D, Ray2D) Operator

Indicates whether the two specified Ray2D instances are equal.

public static bool operator ==(DiGi.Geometry.Planar.Classes.Ray2D? ray2D_1, DiGi.Geometry.Planar.Classes.Ray2D? ray2D_2);

Parameters

ray2D_1 Ray2D

The first Ray2D instance to compare.

ray2D_2 Ray2D

The second Ray2D instance to compare.

Returns

System.Boolean
true if the two rays are equal; otherwise, false.

Ray2D.explicit operator Ray2D(Segment2D) Operator

Explicitly converts a Segment2D instance to a Ray2D instance.

public static DiGi.Geometry.Planar.Classes.Ray2D? explicit operator DiGi.Geometry.Planar.Classes.Ray2D?(DiGi.Geometry.Planar.Classes.Segment2D? segment2D);

Parameters

segment2D Segment2D

The Segment2D instance to convert.

Returns

Ray2D
A Ray2D instance derived from the specified segment, or null if the input is null.

Ray2D.operator !=(Ray2D, Ray2D) Operator

Indicates whether the two specified Ray2D instances are not equal.

public static bool operator !=(DiGi.Geometry.Planar.Classes.Ray2D? ray2D_1, DiGi.Geometry.Planar.Classes.Ray2D? ray2D_2);

Parameters

ray2D_1 Ray2D

The first Ray2D instance to compare.

ray2D_2 Ray2D

The second Ray2D instance to compare.

Returns

System.Boolean
true if the two rays are not equal; otherwise, false.

Rectangle2D Class

Represents a two-dimensional rectangle defined by its width and height.

public class Rectangle2D : DiGi.Geometry.Planar.Classes.Geometry2D, DiGi.Geometry.Planar.Interfaces.IPolygonal2D, DiGi.Geometry.Planar.Interfaces.IClosedCurve2D, DiGi.Geometry.Core.Interfaces.IClosedCurve, DiGi.Geometry.Core.Interfaces.ICurve, DiGi.Geometry.Core.Interfaces.IGeometry, DiGi.Core.Interfaces.ISerializableObject, DiGi.Core.Interfaces.ICloneableObject<DiGi.Core.Interfaces.ISerializableObject>, DiGi.Core.Interfaces.ICloneableObject, DiGi.Core.Interfaces.IObject, DiGi.Geometry.Planar.Interfaces.IGeometry2D, DiGi.Geometry.Planar.Interfaces.IMovable2D, DiGi.Geometry.Core.Interfaces.IMovable<DiGi.Geometry.Planar.Classes.Vector2D>, DiGi.Geometry.Core.Interfaces.IMovable, DiGi.Geometry.Planar.Interfaces.ITransformable2D, DiGi.Geometry.Core.Interfaces.ITransformable<DiGi.Geometry.Planar.Interfaces.ITransform2D>, DiGi.Geometry.Core.Interfaces.ITransformable, DiGi.Geometry.Planar.Interfaces.ICurve2D, DiGi.Geometry.Planar.Interfaces.ICollectable2D, DiGi.Geometry.Core.Interfaces.ICollectable, DiGi.Geometry.Planar.Interfaces.IBoundable2D, DiGi.Geometry.Core.Interfaces.IBoundable, DiGi.Geometry.Planar.Interfaces.ISegmentable2D, DiGi.Geometry.Core.Interfaces.ISegmentable<DiGi.Geometry.Planar.Classes.Point2D>, DiGi.Geometry.Core.Interfaces.ISegmentable, DiGi.Geometry.Core.Interfaces.IInvertible, DiGi.Geometry.Planar.Interfaces.IInvertible2D

Inheritance System.ObjectDiGi.Core.Classes.ObjectDiGi.Core.Classes.SerializableObjectGeometry2D → Rectangle2D

Implements IPolygonal2D, IClosedCurve2D, DiGi.Geometry.Core.Interfaces.IClosedCurve, DiGi.Geometry.Core.Interfaces.ICurve, DiGi.Geometry.Core.Interfaces.IGeometry, DiGi.Core.Interfaces.ISerializableObject, DiGi.Core.Interfaces.ICloneableObject<DiGi.Core.Interfaces.ISerializableObject>, DiGi.Core.Interfaces.ICloneableObject, DiGi.Core.Interfaces.IObject, DiGi.Geometry.Planar.Interfaces.IGeometry2D, DiGi.Geometry.Planar.Interfaces.IMovable2D, DiGi.Geometry.Core.Interfaces.IMovable<Vector2D>, DiGi.Geometry.Core.Interfaces.IMovable, DiGi.Geometry.Planar.Interfaces.ITransformable2D, DiGi.Geometry.Core.Interfaces.ITransformable<DiGi.Geometry.Planar.Interfaces.ITransform2D>, DiGi.Geometry.Core.Interfaces.ITransformable, DiGi.Geometry.Planar.Interfaces.ICurve2D, DiGi.Geometry.Planar.Interfaces.ICollectable2D, DiGi.Geometry.Core.Interfaces.ICollectable, IBoundable2D, DiGi.Geometry.Core.Interfaces.IBoundable, ISegmentable2D, DiGi.Geometry.Core.Interfaces.ISegmentable<Point2D>, DiGi.Geometry.Core.Interfaces.ISegmentable, DiGi.Geometry.Core.Interfaces.IInvertible, DiGi.Geometry.Planar.Interfaces.IInvertible2D

Constructors

Rectangle2D(BoundingBox2D) Constructor

Initializes a new instance of the Rectangle2D class from a bounding box.

public Rectangle2D(DiGi.Geometry.Planar.Classes.BoundingBox2D? boundingBox2D);

Parameters

boundingBox2D BoundingBox2D

The source bounding box.

Rectangle2D(Point2D, double, double) Constructor

Initializes a new instance of the Rectangle2D class with specified origin, width, and height.

public Rectangle2D(DiGi.Geometry.Planar.Classes.Point2D? origin, double width, double height);

Parameters

origin Point2D

The origin point of the rectangle.

width System.Double

The width of the rectangle.

height System.Double

The height of the rectangle.

Rectangle2D(Point2D, double, double, Vector2D) Constructor

Initializes a new instance of the Rectangle2D class with specified origin, width, height, and height direction vector.

public Rectangle2D(DiGi.Geometry.Planar.Classes.Point2D? origin, double width, double height, DiGi.Geometry.Planar.Classes.Vector2D? heightDirection);

Parameters

origin Point2D

The origin point of the rectangle.

width System.Double

The width of the rectangle.

height System.Double

The height of the rectangle.

heightDirection Vector2D

The vector defining the direction of the height.

Rectangle2D(Rectangle2D) Constructor

Initializes a new instance of the Rectangle2D class by cloning an existing rectangle.

public Rectangle2D(DiGi.Geometry.Planar.Classes.Rectangle2D? rectangle2D);

Parameters

rectangle2D Rectangle2D

The source rectangle to clone.

Rectangle2D(double, double) Constructor

Initializes a new instance of the Rectangle2D class with specified width and height at the origin.

public Rectangle2D(double width, double height);

Parameters

width System.Double

The width of the rectangle.

height System.Double

The height of the rectangle.

Rectangle2D(JsonObject) Constructor

Initializes a new instance of the Rectangle2D class from a JSON object.

public Rectangle2D(System.Text.Json.Nodes.JsonObject? jsonObject);

Parameters

jsonObject System.Text.Json.Nodes.JsonObject

The JSON object containing rectangle data.

Properties

Rectangle2D.Height Property

Gets or sets the height of the rectangle.

public double Height { get; set; }

Property Value

System.Double

Rectangle2D.HeightDirection Property

Gets the unit vector defining the height direction of the rectangle.

public DiGi.Geometry.Planar.Classes.Vector2D? HeightDirection { get; }

Property Value

Vector2D

Rectangle2D.Length Property

Gets the perimeter of the rectangle.

public double Length { get; }

Implements Length

Property Value

System.Double

Rectangle2D.Origin Property

Gets or sets the origin point of the rectangle.

public DiGi.Geometry.Planar.Classes.Point2D? Origin { get; set; }

Property Value

Point2D

Rectangle2D.Width Property

Gets or sets the width of the rectangle.

public double Width { get; set; }

Property Value

System.Double

Rectangle2D.WidthDirection Property

Gets the unit vector defining the width direction of the rectangle.

public DiGi.Geometry.Planar.Classes.Vector2D? WidthDirection { get; }

Property Value

Vector2D

Methods

Rectangle2D.Clone() Method

Creates a clone of the current rectangle.

public override DiGi.Core.Interfaces.ISerializableObject? Clone();

Implements Clone()

Returns

DiGi.Core.Interfaces.ISerializableObject
A new DiGi.Core.Interfaces.ISerializableObject representing the cloned rectangle.

Rectangle2D.ClosestPoint(Point2D) Method

Calculates the closest point on the rectangle to the specified point.

public DiGi.Geometry.Planar.Classes.Point2D? ClosestPoint(DiGi.Geometry.Planar.Classes.Point2D? point2D);

Parameters

point2D Point2D

The target point.

Returns

Point2D
The closest point on the rectangle's boundary or interior, or null if input is invalid.

Rectangle2D.GetArea() Method

Calculates the area of the rectangle.

public double GetArea();

Implements GetArea()

Returns

System.Double
The area as a double.

Rectangle2D.GetBoundingBox() Method

Generates a bounding box that encloses the rectangle.

public DiGi.Geometry.Planar.Classes.BoundingBox2D? GetBoundingBox();

Implements GetBoundingBox()

Returns

BoundingBox2D
A new BoundingBox2D instance, or null if it cannot be created.

Rectangle2D.GetCentroid() Method

Calculates the centroid (center point) of the rectangle.

public DiGi.Geometry.Planar.Classes.Point2D? GetCentroid();

Implements GetCentroid()

Returns

Point2D
The centroid as a Point2D, or null if it cannot be calculated.

Rectangle2D.GetDiagonals() Method

Retrieves the diagonals of the rectangle as segments.

public DiGi.Geometry.Planar.Classes.Segment2D[]? GetDiagonals();

Returns

Segment2D[]
An array of two Segment2D representing the diagonals, or null if points cannot be retrieved.

Rectangle2D.GetInternalPoint(double) Method

Finds a point known to be inside the rectangle.

public DiGi.Geometry.Planar.Classes.Point2D? GetInternalPoint(double tolerance=1E-06);

Parameters

tolerance System.Double

The distance tolerance for internal checking.

Implements GetInternalPoint(double)

Returns

Point2D
A Point2D located within the rectangle, or null.

Rectangle2D.GetPerimeter() Method

Calculates the perimeter of the rectangle.

public double GetPerimeter();

Implements GetPerimeter()

Returns

System.Double
The total length of the boundary.

Rectangle2D.GetPoints() Method

Retrieves the four corner points of the rectangle.

public System.Collections.Generic.List<DiGi.Geometry.Planar.Classes.Point2D>? GetPoints();

Implements GetPoints()

Returns

System.Collections.Generic.List<Point2D>
A list of Point2D representing the corners, or null if the origin is not set.

Rectangle2D.GetSegments() Method

Retrieves the four boundary segments of the rectangle.

public System.Collections.Generic.List<DiGi.Geometry.Planar.Classes.Segment2D>? GetSegments();

Implements GetSegments()

Returns

System.Collections.Generic.List<Segment2D>
A list of Segment2D representing the sides, or null if points cannot be retrieved.

Rectangle2D.InRange(BoundingBox2D, double) Method

Checks if the specified bounding box is within range of the rectangle.

public bool InRange(DiGi.Geometry.Planar.Classes.BoundingBox2D? boundingBox2D, double tolerance=1E-06);

Parameters

boundingBox2D BoundingBox2D

The target bounding box.

tolerance System.Double

The distance tolerance for the range check.

Implements InRange(BoundingBox2D, double)

Returns

System.Boolean
True if the bounding box is in range, otherwise false.

Rectangle2D.InRange(Point2D, double) Method

Checks if the specified point is within range of the rectangle's boundary or interior.

public bool InRange(DiGi.Geometry.Planar.Classes.Point2D? point2D, double tolerance=1E-06);

Parameters

point2D Point2D

The target point.

tolerance System.Double

The distance tolerance for the range check.

Implements InRange(Point2D, double)

Returns

System.Boolean
True if the point is in range, otherwise false.

Rectangle2D.InRange(ISegmentable2D, double) Method

Checks if the specified segmentable object is within range of the rectangle's boundary or interior.

public bool InRange(DiGi.Geometry.Planar.Interfaces.ISegmentable2D? segmentable2D, double tolerance=1E-06);

Parameters

segmentable2D ISegmentable2D

The object to check.

tolerance System.Double

The distance tolerance for the range check.

Implements InRange(ISegmentable2D, double)

Returns

System.Boolean
True if the object is in range, otherwise false.

Rectangle2D.Inside(Point2D, double) Method

Checks if the specified point is strictly inside the rectangle.

public bool Inside(DiGi.Geometry.Planar.Classes.Point2D? point2D, double tolerance=1E-06);

Parameters

point2D Point2D

The target point.

tolerance System.Double

The distance tolerance for the inside check.

Implements Inside(Point2D, double)

Returns

System.Boolean
True if the point is inside, otherwise false.

Rectangle2D.Inside(ISegmentable2D, double) Method

Checks if the specified segmentable object is strictly inside the rectangle.

public bool Inside(DiGi.Geometry.Planar.Interfaces.ISegmentable2D? segmentable2D, double tolerance=1E-06);

Parameters

segmentable2D ISegmentable2D

The object to check.

tolerance System.Double

The distance tolerance for the inside check.

Implements Inside(ISegmentable2D, double)

Returns

System.Boolean
True if the object is inside, otherwise false.

Rectangle2D.Inverse() Method

Inverts the orientation of the rectangle by moving its origin to the opposite corner and reversing height direction.

public bool Inverse();

Implements Inverse()

Returns

System.Boolean
True if inversion was successful, otherwise false.

Rectangle2D.Move(Vector2D) Method

Moves the rectangle by the specified vector.

public override bool Move(DiGi.Geometry.Planar.Classes.Vector2D? vector2D);

Parameters

vector2D Vector2D

The translation vector.

Returns

System.Boolean
True if move was successful, otherwise false.

Rectangle2D.On(Point2D, double) Method

Checks if the specified point lies on the boundary of the rectangle.

public bool On(DiGi.Geometry.Planar.Classes.Point2D? point2D, double tolerance=1E-06);

Parameters

point2D Point2D

The target point.

tolerance System.Double

The distance tolerance for the check.

Returns

System.Boolean
True if the point is on the boundary, otherwise false.

Rectangle2D.Transform(ITransform2D) Method

Applies a 2D transformation to the rectangle.

public override bool Transform(DiGi.Geometry.Planar.Interfaces.ITransform2D? transform);

Parameters

transform DiGi.Geometry.Planar.Interfaces.ITransform2D

The transform to apply.

Returns

System.Boolean
True if transformation was successful, otherwise false.

Rectangle2D.Triangulate(double) Method

Splits the rectangle into two triangles.

public System.Collections.Generic.List<DiGi.Geometry.Planar.Classes.Triangle2D>? Triangulate(double tolerance=1E-09);

Parameters

tolerance System.Double

The distance tolerance for triangulation.

Implements Triangulate(double)

Returns

System.Collections.Generic.List<Triangle2D>
A list of two Triangle2D, or null if it cannot be triangulated.

Operators

Rectangle2D.explicit operator Polygon2D(Rectangle2D) Operator

Explicitly converts a Rectangle2D to a Polygon2D.

public static DiGi.Geometry.Planar.Classes.Polygon2D? explicit operator DiGi.Geometry.Planar.Classes.Polygon2D?(DiGi.Geometry.Planar.Classes.Rectangle2D? rectangle2D);

Parameters

rectangle2D Rectangle2D

The rectangle to convert.

Returns

Polygon2D
A new Polygon2D representing the rectangle, or null if conversion fails.

Rectangle2D.explicit operator Rectangle2D(BoundingBox2D) Operator

Explicitly converts a BoundingBox2D to a Rectangle2D.

public static DiGi.Geometry.Planar.Classes.Rectangle2D? explicit operator DiGi.Geometry.Planar.Classes.Rectangle2D?(DiGi.Geometry.Planar.Classes.BoundingBox2D? boundingBox2D);

Parameters

boundingBox2D BoundingBox2D

The bounding box to convert.

Returns

Rectangle2D
A new Rectangle2D instance, or null if the input is null.

Segment2D Class

Represents a two-dimensional line segment defined by a starting Point2D and a Vector2D.

public class Segment2D : DiGi.Geometry.Planar.Classes.Geometry2D, DiGi.Geometry.Planar.Interfaces.ISegmentable2D, DiGi.Geometry.Core.Interfaces.ISegmentable<DiGi.Geometry.Planar.Classes.Point2D>, DiGi.Geometry.Core.Interfaces.ISegmentable, DiGi.Geometry.Core.Interfaces.IGeometry, DiGi.Core.Interfaces.ISerializableObject, DiGi.Core.Interfaces.ICloneableObject<DiGi.Core.Interfaces.ISerializableObject>, DiGi.Core.Interfaces.ICloneableObject, DiGi.Core.Interfaces.IObject, DiGi.Geometry.Core.Interfaces.IInvertible, DiGi.Geometry.Core.Interfaces.ICurve, DiGi.Geometry.Core.Interfaces.IMovable, DiGi.Geometry.Planar.Interfaces.IMovable2D, DiGi.Geometry.Core.Interfaces.IMovable<DiGi.Geometry.Planar.Classes.Vector2D>, DiGi.Geometry.Planar.Interfaces.ICurve2D, DiGi.Geometry.Planar.Interfaces.IGeometry2D, DiGi.Geometry.Planar.Interfaces.ITransformable2D, DiGi.Geometry.Core.Interfaces.ITransformable<DiGi.Geometry.Planar.Interfaces.ITransform2D>, DiGi.Geometry.Core.Interfaces.ITransformable, DiGi.Geometry.Planar.Interfaces.ICollectable2D, DiGi.Geometry.Core.Interfaces.ICollectable, DiGi.Geometry.Planar.Interfaces.IBoundable2D, DiGi.Geometry.Core.Interfaces.IBoundable, DiGi.Geometry.Planar.Interfaces.IInvertible2D, DiGi.Geometry.Planar.Interfaces.ILinear2D, DiGi.Geometry.Core.Interfaces.ISegment<DiGi.Geometry.Planar.Classes.Point2D>, DiGi.Geometry.Core.Interfaces.ISegment

Inheritance System.ObjectDiGi.Core.Classes.ObjectDiGi.Core.Classes.SerializableObjectGeometry2D → Segment2D

Implements ISegmentable2D, DiGi.Geometry.Core.Interfaces.ISegmentable<Point2D>, DiGi.Geometry.Core.Interfaces.ISegmentable, DiGi.Geometry.Core.Interfaces.IGeometry, DiGi.Core.Interfaces.ISerializableObject, DiGi.Core.Interfaces.ICloneableObject<DiGi.Core.Interfaces.ISerializableObject>, DiGi.Core.Interfaces.ICloneableObject, DiGi.Core.Interfaces.IObject, DiGi.Geometry.Core.Interfaces.IInvertible, DiGi.Geometry.Core.Interfaces.ICurve, DiGi.Geometry.Core.Interfaces.IMovable, DiGi.Geometry.Planar.Interfaces.IMovable2D, DiGi.Geometry.Core.Interfaces.IMovable<Vector2D>, DiGi.Geometry.Planar.Interfaces.ICurve2D, DiGi.Geometry.Planar.Interfaces.IGeometry2D, DiGi.Geometry.Planar.Interfaces.ITransformable2D, DiGi.Geometry.Core.Interfaces.ITransformable<DiGi.Geometry.Planar.Interfaces.ITransform2D>, DiGi.Geometry.Core.Interfaces.ITransformable, DiGi.Geometry.Planar.Interfaces.ICollectable2D, DiGi.Geometry.Core.Interfaces.ICollectable, IBoundable2D, DiGi.Geometry.Core.Interfaces.IBoundable, DiGi.Geometry.Planar.Interfaces.IInvertible2D, ILinear2D, DiGi.Geometry.Core.Interfaces.ISegment<Point2D>, DiGi.Geometry.Core.Interfaces.ISegment

Constructors

Segment2D(Point2D, Point2D) Constructor

Initializes a new instance of the Segment2D class using start and end points.

public Segment2D(DiGi.Geometry.Planar.Classes.Point2D? start, DiGi.Geometry.Planar.Classes.Point2D? end);

Parameters

start Point2D

The start point of the segment.

end Point2D

The end point of the segment.

Segment2D(Point2D, Vector2D) Constructor

Initializes a new instance of the Segment2D class using a start point and a vector.

public Segment2D(DiGi.Geometry.Planar.Classes.Point2D? start, DiGi.Geometry.Planar.Classes.Vector2D? vector);

Parameters

start Point2D

The start point of the segment.

vector Vector2D

The vector defining the direction and length of the segment.

Segment2D(Segment2D) Constructor

Initializes a new instance of the Segment2D class by cloning an existing segment.

public Segment2D(DiGi.Geometry.Planar.Classes.Segment2D? segment2D);

Parameters

segment2D Segment2D

The source segment to clone.

Segment2D(double, double, double, double) Constructor

Initializes a new instance of the Segment2D class defined by start and end coordinates.

public Segment2D(double x_1, double y_1, double x_2, double y_2);

Parameters

x_1 System.Double

The X coordinate of the start point.

y_1 System.Double

The Y coordinate of the start point.

x_2 System.Double

The X coordinate of the end point.

y_2 System.Double

The Y coordinate of the end point.

Segment2D(JsonObject) Constructor

Initializes a new instance of the Segment2D class from a JSON object.

public Segment2D(System.Text.Json.Nodes.JsonObject? jsonObject);

Parameters

jsonObject System.Text.Json.Nodes.JsonObject

The JSON object containing segment data.

Properties

Segment2D.Direction Property

Gets or sets the unit direction vector of the segment.

public DiGi.Geometry.Planar.Classes.Vector2D? Direction { get; set; }

Implements Direction

Property Value

Vector2D

Segment2D.End Property

Gets or sets the end point of the segment.

public DiGi.Geometry.Planar.Classes.Point2D? End { get; set; }

Implements End

Property Value

Point2D

Segment2D.Length Property

Gets or sets the length of the segment.

public double Length { get; set; }

Implements Length

Property Value

System.Double

Segment2D.SquaredLength Property

Gets the squared length of the segment.

public double SquaredLength { get; }

Property Value

System.Double

Segment2D.Start Property

Gets or sets the start point of the segment.

public DiGi.Geometry.Planar.Classes.Point2D? Start { get; set; }

Implements Start

Property Value

Point2D

Segment2D.this[int] Property

Gets the point at the specified index of the segment.

public DiGi.Geometry.Planar.Classes.Point2D? this[int index] { get; }

Parameters

index System.Int32

The zero-based index of the point to retrieve (0 for the start point, 1 for the end point).

Property Value

Point2D

Segment2D.Vector Property

Gets or sets the vector defining the segment.

public DiGi.Geometry.Planar.Classes.Vector2D? Vector { get; set; }

Property Value

Vector2D

Methods

Segment2D.Clone() Method

Creates a clone of the current segment.

public override DiGi.Core.Interfaces.ISerializableObject? Clone();

Implements Clone()

Returns

DiGi.Core.Interfaces.ISerializableObject
A cloned DiGi.Core.Interfaces.ISerializableObject.

Segment2D.ClosestPoint(Point2D) Method

Finds the point on the segment closest to the specified point.

public DiGi.Geometry.Planar.Classes.Point2D? ClosestPoint(DiGi.Geometry.Planar.Classes.Point2D? point2D);

Parameters

point2D Point2D

The target point.

Implements ClosestPoint(Point2D)

Returns

Point2D
The closest Point2D on the segment, or null if input is null.

Segment2D.Collinear(ILinear2D, double) Method

Checks if the segment is collinear with another linear geometry.

public bool Collinear(DiGi.Geometry.Planar.Interfaces.ILinear2D? linear2D, double tolerance=1E-06);

Parameters

linear2D ILinear2D

The other linear geometry.

tolerance System.Double

The distance tolerance.

Implements Collinear(ILinear2D, double)

Returns

System.Boolean
True if they are collinear; otherwise, false.

Segment2D.Distance(Point2D) Method

Calculates the minimum distance from a point to the segment.

public double Distance(DiGi.Geometry.Planar.Classes.Point2D? point2D);

Parameters

point2D Point2D

The target point.

Implements Distance(Point2D)

Returns

System.Double
The distance result, or NaN if input is null.

Segment2D.Equals(object) Method

Determines whether the specified object is equal to the current segment.

public override bool Equals(object? obj);

Parameters

obj System.Object

The object to compare with.

Returns

System.Boolean
True if the objects are equal; otherwise, false.

Segment2D.GetBoundingBox() Method

Calculates the axis-aligned bounding box of the segment.

public DiGi.Geometry.Planar.Classes.BoundingBox2D? GetBoundingBox();

Implements GetBoundingBox()

Returns

BoundingBox2D
A new BoundingBox2D, or null if start or vector is null.

Segment2D.GetHashCode() Method

Gets the hash code for this segment based on its start point and vector coordinates.

public override int GetHashCode();

Returns

System.Int32
A 32-bit signed integer hash code.

Segment2D.GetPoints() Method

Returns a list containing the start and end points of the segment.

public System.Collections.Generic.List<DiGi.Geometry.Planar.Classes.Point2D>? GetPoints();

Implements GetPoints()

Returns

System.Collections.Generic.List<Point2D>
A list of two points, or null if endpoints are missing.

Segment2D.GetSegments() Method

Returns a list containing the current segment as its only element.

public System.Collections.Generic.List<DiGi.Geometry.Planar.Classes.Segment2D>? GetSegments();

Implements GetSegments()

Returns

System.Collections.Generic.List<Segment2D>
A list of one Segment2D.

Segment2D.IntersectionPoint(Segment2D, double) Method

Finds the intersection point between this segment and another.

public DiGi.Geometry.Planar.Classes.Point2D? IntersectionPoint(DiGi.Geometry.Planar.Classes.Segment2D? segment2D, double tolerance=1E-06);

Parameters

segment2D Segment2D

The other segment.

tolerance System.Double

The distance tolerance for detecting an intersection.

Returns

Point2D
The Point2D of intersection, or null if no intersection is found.

Segment2D.Inverse() Method

Inverts the direction of the segment by swapping start and end points.

public bool Inverse();

Implements Inverse()

Returns

System.Boolean
True if inversion was successful; otherwise, false.

Segment2D.Mid() Method

Calculates the midpoint of the segment.

public DiGi.Geometry.Planar.Classes.Point2D? Mid();

Returns

Point2D
The midpoint as a Point2D, or null if start or vector is missing.

Segment2D.Move(Vector2D) Method

Moves the segment by the specified translation vector.

public override bool Move(DiGi.Geometry.Planar.Classes.Vector2D? vector2D);

Parameters

vector2D Vector2D

The movement vector.

Returns

System.Boolean
True if move was successful; otherwise, false.

Segment2D.On(Point2D, double) Method

Checks if the specified point lies on the segment within a given tolerance.

public bool On(DiGi.Geometry.Planar.Classes.Point2D? point2D, double tolerance=1E-06);

Parameters

point2D Point2D

The target point.

tolerance System.Double

The distance tolerance for the check.

Implements On(Point2D, double)

Returns

System.Boolean
True if the point is on the segment; otherwise, false.

Segment2D.On(double, double, double) Method

Checks if the point given by its coordinates lies on the segment within a given tolerance, without allocating.

internal bool On(double x, double y, double tolerance);

Parameters

x System.Double

The X coordinate of the target point.

y System.Double

The Y coordinate of the target point.

tolerance System.Double

The distance tolerance for the check.

Returns

System.Boolean
True if the point is on the segment; otherwise, false.

Segment2D.Project(Point2D) Method

Projects a point onto the line containing the segment, without clamping to the segment boundaries.

public DiGi.Geometry.Planar.Classes.Point2D? Project(DiGi.Geometry.Planar.Classes.Point2D? point2D);

Parameters

point2D Point2D

The target point.

Implements Project(Point2D)

Returns

Point2D
The projected Point2D on the infinite line, or null if input is missing.

Segment2D.Transform(ITransform2D) Method

Applies a 2D transformation to the segment's endpoints and vector.

public override bool Transform(DiGi.Geometry.Planar.Interfaces.ITransform2D? transform);

Parameters

transform DiGi.Geometry.Planar.Interfaces.ITransform2D

The transform to apply.

Returns

System.Boolean
True if transformation was successful; otherwise, false.

Segment2D.TryGetCoordinates(double, double, double, double) Method

Gets the endpoint coordinates of the segment without allocating intermediate points.

internal bool TryGetCoordinates(out double x_Start, out double y_Start, out double x_End, out double y_End);

Parameters

x_Start System.Double

When this method returns true, the X coordinate of the start point.

y_Start System.Double

When this method returns true, the Y coordinate of the start point.

x_End System.Double

When this method returns true, the X coordinate of the end point.

y_End System.Double

When this method returns true, the Y coordinate of the end point.

Returns

System.Boolean
True if the segment has a valid start point and vector; otherwise, false.

Operators

Segment2D.operator ==(Segment2D, Segment2D) Operator

Checks if two segments are equal.

public static bool operator ==(DiGi.Geometry.Planar.Classes.Segment2D? segment2D_1, DiGi.Geometry.Planar.Classes.Segment2D? segment2D_2);

Parameters

segment2D_1 Segment2D

The first segment.

segment2D_2 Segment2D

The second segment.

Returns

System.Boolean
True if the segments have the same start point and vector; otherwise, false.

Segment2D.operator !=(Segment2D, Segment2D) Operator

Checks if two segments are not equal.

public static bool operator !=(DiGi.Geometry.Planar.Classes.Segment2D? segment2D_1, DiGi.Geometry.Planar.Classes.Segment2D? segment2D_2);

Parameters

segment2D_1 Segment2D

The first segment.

segment2D_2 Segment2D

The second segment.

Returns

System.Boolean
True if the segments are different; otherwise, false.

Segmentable2D Class

Base class for 2D geometries that can be represented as a collection of segments.

public abstract class Segmentable2D : DiGi.Geometry.Planar.Classes.Geometry2D, DiGi.Geometry.Planar.Interfaces.ISegmentable2D, DiGi.Geometry.Core.Interfaces.ISegmentable<DiGi.Geometry.Planar.Classes.Point2D>, DiGi.Geometry.Core.Interfaces.ISegmentable, DiGi.Geometry.Core.Interfaces.IGeometry, DiGi.Core.Interfaces.ISerializableObject, DiGi.Core.Interfaces.ICloneableObject<DiGi.Core.Interfaces.ISerializableObject>, DiGi.Core.Interfaces.ICloneableObject, DiGi.Core.Interfaces.IObject, DiGi.Geometry.Core.Interfaces.IInvertible, DiGi.Geometry.Core.Interfaces.ICurve, DiGi.Geometry.Core.Interfaces.IMovable, DiGi.Geometry.Planar.Interfaces.IMovable2D, DiGi.Geometry.Core.Interfaces.IMovable<DiGi.Geometry.Planar.Classes.Vector2D>, DiGi.Geometry.Planar.Interfaces.ICurve2D, DiGi.Geometry.Planar.Interfaces.IGeometry2D, DiGi.Geometry.Planar.Interfaces.ITransformable2D, DiGi.Geometry.Core.Interfaces.ITransformable<DiGi.Geometry.Planar.Interfaces.ITransform2D>, DiGi.Geometry.Core.Interfaces.ITransformable, DiGi.Geometry.Planar.Interfaces.ICollectable2D, DiGi.Geometry.Core.Interfaces.ICollectable, DiGi.Geometry.Planar.Interfaces.IBoundable2D, DiGi.Geometry.Core.Interfaces.IBoundable, DiGi.Geometry.Planar.Interfaces.IInvertible2D

Inheritance System.ObjectDiGi.Core.Classes.ObjectDiGi.Core.Classes.SerializableObjectGeometry2D → Segmentable2D

Derived
Polygon2D
Polyline2D

Implements ISegmentable2D, DiGi.Geometry.Core.Interfaces.ISegmentable<Point2D>, DiGi.Geometry.Core.Interfaces.ISegmentable, DiGi.Geometry.Core.Interfaces.IGeometry, DiGi.Core.Interfaces.ISerializableObject, DiGi.Core.Interfaces.ICloneableObject<DiGi.Core.Interfaces.ISerializableObject>, DiGi.Core.Interfaces.ICloneableObject, DiGi.Core.Interfaces.IObject, DiGi.Geometry.Core.Interfaces.IInvertible, DiGi.Geometry.Core.Interfaces.ICurve, DiGi.Geometry.Core.Interfaces.IMovable, DiGi.Geometry.Planar.Interfaces.IMovable2D, DiGi.Geometry.Core.Interfaces.IMovable<Vector2D>, DiGi.Geometry.Planar.Interfaces.ICurve2D, DiGi.Geometry.Planar.Interfaces.IGeometry2D, DiGi.Geometry.Planar.Interfaces.ITransformable2D, DiGi.Geometry.Core.Interfaces.ITransformable<DiGi.Geometry.Planar.Interfaces.ITransform2D>, DiGi.Geometry.Core.Interfaces.ITransformable, DiGi.Geometry.Planar.Interfaces.ICollectable2D, DiGi.Geometry.Core.Interfaces.ICollectable, IBoundable2D, DiGi.Geometry.Core.Interfaces.IBoundable, DiGi.Geometry.Planar.Interfaces.IInvertible2D

Constructors

Segmentable2D() Constructor

Initializes a new instance of the Segmentable2D class.

public Segmentable2D();

Segmentable2D(Segmentable2D) Constructor

Initializes a new instance of the Segmentable2D class by cloning an existing segmentable geometry.

public Segmentable2D(DiGi.Geometry.Planar.Classes.Segmentable2D? segmentable2D);

Parameters

segmentable2D Segmentable2D

The source geometry to clone.

Segmentable2D(IEnumerable<Point2D>) Constructor

Initializes a new instance of the Segmentable2D class defined by a collection of points.

public Segmentable2D(System.Collections.Generic.IEnumerable<DiGi.Geometry.Planar.Classes.Point2D>? point2Ds);

Parameters

point2Ds System.Collections.Generic.IEnumerable<Point2D>

The vertices of the geometry.

Segmentable2D(List<Point2D>, bool) Constructor

Initializes a new instance of the Segmentable2D class from a prebuilt list of points.

internal Segmentable2D(System.Collections.Generic.List<DiGi.Geometry.Planar.Classes.Point2D>? point2Ds, bool clone);

Parameters

point2Ds System.Collections.Generic.List<Point2D>

The vertices of the geometry.

clone System.Boolean

When true, the points are defensively cloned; when false, the supplied list is adopted directly without cloning. Use false only when the caller owns freshly created points that are not shared.

Segmentable2D(JsonObject) Constructor

Initializes a new instance of the Segmentable2D class from a JSON object.

public Segmentable2D(System.Text.Json.Nodes.JsonObject? jsonObject);

Parameters

jsonObject System.Text.Json.Nodes.JsonObject

The JSON object containing geometry data.

Properties

Segmentable2D.Length Property

Gets the total length of the segments that form the geometry.

public double Length { get; }

Implements Length

Property Value

System.Double

Methods

Segmentable2D.ClosestPoint(Point2D) Method

Gets the point on the geometry closest to the specified point.

public DiGi.Geometry.Planar.Classes.Point2D? ClosestPoint(DiGi.Geometry.Planar.Classes.Point2D? point2D);

Parameters

point2D Point2D

The target point.

Returns

Point2D
The closest point on the geometry, or null if it cannot be determined.

Segmentable2D.Distance(Point2D) Method

Calculates the shortest distance from the geometry to the specified point.

public double Distance(DiGi.Geometry.Planar.Classes.Point2D? point2D);

Parameters

point2D Point2D

The target point.

Returns

System.Double
The distance to the point, or NaN if it cannot be calculated.

Segmentable2D.GetBoundingBox() Method

Gets the bounding box of the geometry.

public DiGi.Geometry.Planar.Classes.BoundingBox2D? GetBoundingBox();

Implements GetBoundingBox()

Returns

BoundingBox2D
The bounding box, or null if it cannot be determined.

Segmentable2D.GetPoints() Method

Gets the collection of points that define the geometry.

public System.Collections.Generic.List<DiGi.Geometry.Planar.Classes.Point2D>? GetPoints();

Implements GetPoints()

Returns

System.Collections.Generic.List<Point2D>
A cloned list of vertices, or null if none exist.

Segmentable2D.GetPoints(bool) Method

Gets the collection of points that define the geometry.

public System.Collections.Generic.List<DiGi.Geometry.Planar.Classes.Point2D>? GetPoints(bool clone);

Parameters

clone System.Boolean

When true, the returned list contains cloned points; when false, the internal list is returned directly without cloning and must not be mutated by the caller.

Returns

System.Collections.Generic.List<Point2D>
The vertices of the geometry, or null if none exist.

Segmentable2D.GetSegments() Method

Gets the segments that form the geometry.

public abstract System.Collections.Generic.List<DiGi.Geometry.Planar.Classes.Segment2D>? GetSegments();

Implements GetSegments()

Returns

System.Collections.Generic.List<Segment2D>
A list of boundary segments, or null if none exist.

Segmentable2D.Inverse() Method

Reverses the order of the points defining the geometry.

public bool Inverse();

Implements Inverse()

Returns

System.Boolean
True if the reversal was successful; otherwise, false.

Segmentable2D.Move(Vector2D) Method

Moves the geometry by the specified vector.

public override bool Move(DiGi.Geometry.Planar.Classes.Vector2D? vector2D);

Parameters

vector2D Vector2D

The translation vector.

Returns

System.Boolean
True if the move was successful; otherwise, false.

Segmentable2D.On(Point2D, double) Method

Checks if the specified point lies on the geometry within a given tolerance.

public bool On(DiGi.Geometry.Planar.Classes.Point2D? point2D, double tolerance=1E-06);

Parameters

point2D Point2D

The point to check.

tolerance System.Double

The distance tolerance for the check.

Returns

System.Boolean
True if the point is on the geometry; otherwise, false.

Segmentable2D.Transform(ITransform2D) Method

Transforms the geometry using the specified transformation.

public override bool Transform(DiGi.Geometry.Planar.Interfaces.ITransform2D? transform);

Parameters

transform DiGi.Geometry.Planar.Interfaces.ITransform2D

The transformation to apply.

Returns

System.Boolean
True if the transformation was successful; otherwise, false.

SegmentableTraceResult2D Class

Represents a result of a trace operation in 2D space that can be segmented into a point, segment, or vector.

public class SegmentableTraceResult2D : DiGi.Core.Classes.SerializableObject

Inheritance System.ObjectDiGi.Core.Classes.ObjectDiGi.Core.Classes.SerializableObject → SegmentableTraceResult2D

Constructors

SegmentableTraceResult2D(SegmentableTraceResult2D) Constructor

Initializes a new instance of the SegmentableTraceResult2D class by copying the values from an existing SegmentableTraceResult2D instance.

public SegmentableTraceResult2D(DiGi.Geometry.Planar.Classes.SegmentableTraceResult2D? segmentableTraceResult2D);

Parameters

segmentableTraceResult2D SegmentableTraceResult2D

The SegmentableTraceResult2D instance to copy data from.

SegmentableTraceResult2D(JsonObject) Constructor

Initializes a new instance of the SegmentableTraceResult2D class using the specified System.Text.Json.Nodes.JsonObject.

public SegmentableTraceResult2D(System.Text.Json.Nodes.JsonObject? jsonObject);

Parameters

jsonObject System.Text.Json.Nodes.JsonObject

The System.Text.Json.Nodes.JsonObject used to initialize the current instance.

Properties

SegmentableTraceResult2D.Point2D Property

Hit Point

public DiGi.Geometry.Planar.Classes.Point2D? Point2D { get; }

Property Value

Point2D

SegmentableTraceResult2D.Segment2D Property

Hit Segment

public DiGi.Geometry.Planar.Classes.Segment2D? Segment2D { get; }

Property Value

Segment2D

SegmentableTraceResult2D.Vector2D Property

Hit direction

public DiGi.Geometry.Planar.Classes.Vector2D? Vector2D { get; }

Property Value

Vector2D

Methods

SegmentableTraceResult2D.Clone() Method

Creates a clone of the current object.

public override DiGi.Core.Interfaces.ISerializableObject? Clone();

Implements Clone()

Returns

DiGi.Core.Interfaces.ISerializableObject
A new DiGi.Core.Interfaces.ISerializableObject instance that is a copy of the current object, or null.

SnapperUpdater Class

Provides functionality to update geometry by snapping it based on a specified tolerance.

public class SnapperUpdater : DiGi.Geometry.Core.Interfaces.IGeometryUpdater<DiGi.Geometry.Planar.Interfaces.IGeometry2D>, DiGi.Geometry.Core.Interfaces.IGeometryUpdater, DiGi.Core.Interfaces.IUpdater, DiGi.Core.Interfaces.IEvaluator, DiGi.Core.Interfaces.IUpdater<DiGi.Geometry.Planar.Interfaces.IGeometry2D>

Inheritance System.Object → SnapperUpdater

Implements DiGi.Geometry.Core.Interfaces.IGeometryUpdater<DiGi.Geometry.Planar.Interfaces.IGeometry2D>, DiGi.Geometry.Core.Interfaces.IGeometryUpdater, DiGi.Core.Interfaces.IUpdater, DiGi.Core.Interfaces.IEvaluator, DiGi.Core.Interfaces.IUpdater<DiGi.Geometry.Planar.Interfaces.IGeometry2D>

Constructors

SnapperUpdater() Constructor

Initializes a new instance of the SnapperUpdater class.

public SnapperUpdater();

SnapperUpdater(double) Constructor

Initializes a new instance of the SnapperUpdater class.

public SnapperUpdater(double tolerance);

Parameters

tolerance System.Double

The System.Double tolerance value used for snapping operations.

Properties

SnapperUpdater.Value Property

Gets or sets the DiGi.Geometry.Planar.Interfaces.IGeometry2D value to be processed during the update operation.

public DiGi.Geometry.Planar.Interfaces.IGeometry2D? Value { get; set; }

Implements Value

Property Value

DiGi.Geometry.Planar.Interfaces.IGeometry2D
The DiGi.Geometry.Planar.Interfaces.IGeometry2D instance.

Methods

SnapperUpdater.Update() Method

Updates the current value by snapping the geometry to itself using a specified tolerance.

public bool Update();

Implements Update()

Returns

System.Boolean
A System.Boolean indicating whether the update operation was successful.

TopologyPreservingUpdater Class

Provides functionality to update an DiGi.Geometry.Planar.Interfaces.IGeometry2D while preserving its topological structure.

public class TopologyPreservingUpdater : DiGi.Geometry.Core.Interfaces.IGeometryUpdater<DiGi.Geometry.Planar.Interfaces.IGeometry2D>, DiGi.Geometry.Core.Interfaces.IGeometryUpdater, DiGi.Core.Interfaces.IUpdater, DiGi.Core.Interfaces.IEvaluator, DiGi.Core.Interfaces.IUpdater<DiGi.Geometry.Planar.Interfaces.IGeometry2D>

Inheritance System.Object → TopologyPreservingUpdater

Implements DiGi.Geometry.Core.Interfaces.IGeometryUpdater<DiGi.Geometry.Planar.Interfaces.IGeometry2D>, DiGi.Geometry.Core.Interfaces.IGeometryUpdater, DiGi.Core.Interfaces.IUpdater, DiGi.Core.Interfaces.IEvaluator, DiGi.Core.Interfaces.IUpdater<DiGi.Geometry.Planar.Interfaces.IGeometry2D>

Constructors

TopologyPreservingUpdater() Constructor

Initializes a new instance of the TopologyPreservingUpdater class.

public TopologyPreservingUpdater();

TopologyPreservingUpdater(double) Constructor

Initializes a new instance of the TopologyPreservingUpdater class with the specified tolerance.

public TopologyPreservingUpdater(double tolerance);

Parameters

tolerance System.Double

The System.Double value used as the tolerance for preserving topology during updates.

Properties

TopologyPreservingUpdater.Value Property

Gets or sets the DiGi.Geometry.Planar.Interfaces.IGeometry2D value.

public DiGi.Geometry.Planar.Interfaces.IGeometry2D? Value { get; set; }

Implements Value

Property Value

DiGi.Geometry.Planar.Interfaces.IGeometry2D

Methods

TopologyPreservingUpdater.Update() Method

Updates the current value by simplifying its geometry while preserving topology.

pu

Clone this wiki locally