-
Notifications
You must be signed in to change notification settings - Fork 0
DiGi.ComputeSharp.Planar.Classes
Represents a two-dimensional coordinate or vector in a planar system.
public readonly struct Coordinate2 : DiGi.ComputeSharp.Planar.Interfaces.IGeometry2, DiGi.ComputeSharp.Core.Interfaces.IGeometryImplements IGeometry2, IGeometry
Initializes a new instance of the Coordinate2 struct with NaN values.
public Coordinate2();Initializes a new instance of the Coordinate2 struct by copying an existing coordinate.
public Coordinate2(DiGi.ComputeSharp.Planar.Classes.Coordinate2 coordinate);coordinate Coordinate2
The source coordinate to copy.
Initializes a new instance of the Coordinate2 struct as a vector representing the difference between two points.
public Coordinate2(DiGi.ComputeSharp.Planar.Classes.Coordinate2 start, DiGi.ComputeSharp.Planar.Classes.Coordinate2 end);start Coordinate2
The starting point.
end Coordinate2
The ending point.
Initializes a new instance of the Coordinate2 struct with specified X and Y coordinates.
public Coordinate2(double x, double y);The X-coordinate.
The Y-coordinate.
The X-coordinate of the point or the X-component of the vector.
public readonly double X;The Y-coordinate of the point or the Y-component of the vector.
public readonly double Y;Performs vector addition of this coordinate and another coordinate.
public DiGi.ComputeSharp.Planar.Classes.Coordinate2 Add(DiGi.ComputeSharp.Planar.Classes.Coordinate2 coordinate);coordinate Coordinate2
The coordinate to add.
Coordinate2
A new Coordinate2 representing the sum.
Determines whether this coordinate is approximately equal to another coordinate within a specified tolerance.
public bool AlmostEquals(DiGi.ComputeSharp.Planar.Classes.Coordinate2 coordinate, double tolerance);coordinate Coordinate2
The coordinate to compare.
tolerance System.Double
The maximum allowed difference between coordinates.
System.Boolean
True if the coordinates are within the tolerance; otherwise, false.
Calculates the 2D cross product of this vector and another vector.
public double CrossProduct(DiGi.ComputeSharp.Planar.Classes.Coordinate2 vector);vector Coordinate2
The other vector.
System.Double
The scalar result of the 2D cross product.
Performs component-wise division of this coordinate by another coordinate.
public DiGi.ComputeSharp.Planar.Classes.Coordinate2 Divide(DiGi.ComputeSharp.Planar.Classes.Coordinate2 coordinate);coordinate Coordinate2
The divisor coordinate.
Coordinate2
A new Coordinate2 representing the result of the division.
Divides this coordinate by a scalar factor.
public DiGi.ComputeSharp.Planar.Classes.Coordinate2 Divide(double factor);factor System.Double
The divisor value.
Coordinate2
A new Coordinate2 representing the result of the division.
Calculates the dot product of this vector and another vector.
public double DotProduct(DiGi.ComputeSharp.Planar.Classes.Coordinate2 vector);vector Coordinate2
The other vector.
System.Double
The scalar result of the dot product.
Determines whether this coordinate is equal to another coordinate based on exact values.
public bool Equals(DiGi.ComputeSharp.Planar.Classes.Coordinate2 coordinate);coordinate Coordinate2
The coordinate to compare.
System.Boolean
True if the coordinates are identical or both are NaN; otherwise, false.
Determines whether this instance is equal to a specified object.
public override bool Equals(object? obj);obj System.Object
The object to compare with the current instance.
System.Boolean
True if the object is a Coordinate2 and has identical values; otherwise, false.
Calculates an approximate distance between this point and another point using a fast approximation formula.
public double GetApproximateDistance(DiGi.ComputeSharp.Planar.Classes.Coordinate2 point);point Coordinate2
The target point.
System.Double
An approximated Euclidean distance.
Calculates the approximate length of this vector from the origin (0,0).
public double GetApproximateLength();System.Double
An approximated magnitude of the vector.
Calculates the centroid (midpoint) between this coordinate and the origin.
public DiGi.ComputeSharp.Planar.Classes.Coordinate2 GetCentroid();Coordinate2
A new Coordinate2 representing the midpoint.
Calculates the centroid (midpoint) between this coordinate and another point.
public DiGi.ComputeSharp.Planar.Classes.Coordinate2 GetCentroid(DiGi.ComputeSharp.Planar.Classes.Coordinate2 point);point Coordinate2
The other point.
Coordinate2
A new Coordinate2 representing the midpoint.
Calculates the Euclidean distance between this coordinate and another point.
public double GetDistance(DiGi.ComputeSharp.Planar.Classes.Coordinate2 point, double tolerance);point Coordinate2
The target point.
tolerance System.Double
Tolerance used for the square root calculation.
System.Double
The distance between the two points.
Returns a hash code for the current coordinate.
public override int GetHashCode();System.Int32
An integer hash code representing the coordinate's value.
Returns a coordinate with inverted X and Y values.
public DiGi.ComputeSharp.Planar.Classes.Coordinate2 GetInversed();Coordinate2
A new Coordinate2 representing the inverse vector.
Calculates the magnitude (length) of this vector.
public double GetLength(double tolerance);tolerance System.Double
Tolerance used for the square root calculation.
System.Double
The length of the vector.
Translates this coordinate by a given vector.
public DiGi.ComputeSharp.Planar.Classes.Coordinate2 GetMoved(DiGi.ComputeSharp.Planar.Classes.Coordinate2 vector);vector Coordinate2
The translation vector.
Coordinate2
A new Coordinate2 representing the moved position.
Returns a unit vector in the same direction as this coordinate.
public DiGi.ComputeSharp.Planar.Classes.Coordinate2 GetNormalized(double tolerance);tolerance System.Double
Tolerance used for length calculation.
Coordinate2
A normalized Coordinate2 with a magnitude of 1.
Calculates the squared Euclidean distance between this coordinate and another.
public double GetSquaredDistance(DiGi.ComputeSharp.Planar.Classes.Coordinate2 coordinate);coordinate Coordinate2
The target coordinate.
System.Double
The squared distance value.
Calculates the squared length of the coordinate vector (X*X + Y*Y).
public double GetSquaredLength();System.Double
The sum of the squares of the X and Y components.
Checks if this point is within the range of the specified line's bounding box expanded by a tolerance.
public bool InRange(DiGi.ComputeSharp.Planar.Classes.Line2 line, double tolerance);line Line2
The line to check against.
tolerance System.Double
The distance used to expand the bounding box.
System.Boolean
True if the point is within the expanded bounding box; otherwise, false.
Checks if this point is within the bounding box of the specified triangle expanded by a tolerance.
public bool InRange(DiGi.ComputeSharp.Planar.Classes.Triangle2 triangle, double tolerance);triangle DiGi.ComputeSharp.Planar.Classes.Triangle2
The triangle to check against.
tolerance System.Double
The distance used to expand the bounding box.
System.Boolean
True if the point is within the expanded bounding box; otherwise, false.
Determines whether either the X or Y component of this coordinate is Not-a-Number (NaN).
public bool IsNaN();System.Boolean
True if X or Y is NaN; otherwise, false.
Performs a component-wise multiplication of this coordinate with another coordinate.
public DiGi.ComputeSharp.Planar.Classes.Coordinate2 Multiply(DiGi.ComputeSharp.Planar.Classes.Coordinate2 coordinate);coordinate Coordinate2
The coordinate to multiply by.
Coordinate2
A new Coordinate2 resulting from the component-wise multiplication.
Performs scalar multiplication of this coordinate by a specified factor.
public DiGi.ComputeSharp.Planar.Classes.Coordinate2 Multiply(double factor);factor System.Double
The scalar value to multiply by.
Coordinate2
A new Coordinate2 resulting from the scalar multiplication.
Projects the specified coordinate onto this vector.
public DiGi.ComputeSharp.Planar.Classes.Coordinate2 Project(DiGi.ComputeSharp.Planar.Classes.Coordinate2 coordinate);coordinate Coordinate2
The coordinate to project.
Coordinate2
A new Coordinate2 representing the projection of the given coordinate onto this vector.
Subtracts another coordinate from this coordinate.
public DiGi.ComputeSharp.Planar.Classes.Coordinate2 Substract(DiGi.ComputeSharp.Planar.Classes.Coordinate2 coordinate);coordinate Coordinate2
The coordinate to subtract.
Coordinate2
A new Coordinate2 representing the result of the subtraction.
Returns a string representation of the current coordinate.
public override string ToString();System.String
A formatted string containing the X and Y components.
Determines whether two Coordinate2 objects are equal.
public static bool operator ==(DiGi.ComputeSharp.Planar.Classes.Coordinate2 left, DiGi.ComputeSharp.Planar.Classes.Coordinate2 right);left Coordinate2
The first coordinate to compare.
right Coordinate2
The second coordinate to compare.
System.Boolean
True if the coordinates are equal; otherwise, false.
Determines whether two Coordinate2 objects are not equal.
public static bool operator !=(DiGi.ComputeSharp.Planar.Classes.Coordinate2 left, DiGi.ComputeSharp.Planar.Classes.Coordinate2 right);left Coordinate2
The first coordinate to compare.
right Coordinate2
The second coordinate to compare.
System.Boolean
True if the coordinates are not equal; otherwise, false.
Represents a 2D line segment or an infinite line in a planar coordinate system.
public readonly struct Line2 : DiGi.ComputeSharp.Planar.Interfaces.IGeometry2, DiGi.ComputeSharp.Core.Interfaces.IGeometryImplements IGeometry2, IGeometry
Initializes a new instance of the Line2 struct with default NaN values and unbounded flag.
public Line2();Initializes a new instance of the Line2 struct with specified boundedness and coordinate objects.
public Line2(DiGi.ComputeSharp.Core.Classes.Bool bounded, DiGi.ComputeSharp.Planar.Classes.Coordinate2 start, DiGi.ComputeSharp.Planar.Classes.Coordinate2 end);bounded Bool
Whether the line is bounded.
start Coordinate2
The starting coordinate.
end Coordinate2
The ending coordinate.
Initializes a new instance of the Line2 struct with specified boundedness and coordinates.
public Line2(DiGi.ComputeSharp.Core.Classes.Bool bounded, double x_1, double y_1, double x_2, double y_2);bounded Bool
Whether the line is bounded.
x_1 System.Double
The X coordinate of the first point.
y_1 System.Double
The Y coordinate of the first point.
x_2 System.Double
The X coordinate of the second point.
y_2 System.Double
The Y coordinate of the second point.
Initializes a new instance of the Line2 struct as a bounded line using start and end coordinates.
public Line2(DiGi.ComputeSharp.Planar.Classes.Coordinate2 start, DiGi.ComputeSharp.Planar.Classes.Coordinate2 end);start Coordinate2
The starting coordinate.
end Coordinate2
The ending coordinate.
Initializes a new instance of the Line2 struct as a bounded line using specific coordinates.
public Line2(double x_1, double y_1, double x_2, double y_2);x_1 System.Double
The X coordinate of the first point.
y_1 System.Double
The Y coordinate of the first point.
x_2 System.Double
The X coordinate of the second point.
y_2 System.Double
The Y coordinate of the second point.
Indicates whether the line is bounded (a segment) or unbounded (an infinite line).
public readonly Bool Bounded;The end coordinate of the line.
public readonly Coordinate2 End;The start coordinate of the line.
public readonly Coordinate2 Start;Calculates the approximate distance from a given point to the line.
public double GetApproximateDistance(DiGi.ComputeSharp.Planar.Classes.Coordinate2 point);point Coordinate2
The point to measure distance from.
System.Double
The approximate distance as a double.
Calculates the approximate length of the line.
public double GetApproximateLength();System.Double
The distance between start and end, or positive infinity if the line is unbounded.
Calculates the centroid of the line.
public DiGi.ComputeSharp.Planar.Classes.Coordinate2 GetCentroid();Coordinate2
The coordinate representing the center point of the line.
Finds the closest point on the line to a specified target point.
public DiGi.ComputeSharp.Planar.Classes.Coordinate2 GetClosestPoint(DiGi.ComputeSharp.Planar.Classes.Coordinate2 point);point Coordinate2
The target point.
Coordinate2
The coordinate on the line closest to the provided point.
Gets the normalized direction vector of the line.
public DiGi.ComputeSharp.Planar.Classes.Coordinate2 GetDirection(double tolerance);tolerance System.Double
The tolerance used for normalization.
Coordinate2
A normalized coordinate representing the direction.
Creates a new line that is the inverse of the current line (swapping start and end points).
public DiGi.ComputeSharp.Planar.Classes.Line2 GetInversed();Line2
A new Line2 instance with inverted coordinates.
Calculates the actual length of the line using a specified tolerance for the square root operation.
public double GetLength(double tolerance);tolerance System.Double
The precision tolerance.
System.Double
The length of the line as a double.
Gets the maximum coordinate (top-right corner) of the line's axis-aligned bounding box.
public DiGi.ComputeSharp.Planar.Classes.Coordinate2 GetMax();Coordinate2
The maximum X and Y coordinates as a Coordinate2.
Gets the minimum coordinate (bottom-left corner) of the line's axis-aligned bounding box.
public DiGi.ComputeSharp.Planar.Classes.Coordinate2 GetMin();Coordinate2
The minimum X and Y coordinates as a Coordinate2.
Moves the line by a specified translation vector.
public DiGi.ComputeSharp.Planar.Classes.Line2 GetMoved(DiGi.ComputeSharp.Planar.Classes.Coordinate2 vector);vector Coordinate2
The translation vector.
Line2
A new Line2 instance shifted by the provided vector.
Calculates the squared distance from a given point to the closest point on the line.
public double GetSquaredDistance(DiGi.ComputeSharp.Planar.Classes.Coordinate2 point);point Coordinate2
The point to measure distance from.
System.Double
The squared distance as a double.
Calculates the squared length of the line.
public double GetSquaredLength();System.Double
The squared distance between start and end, or positive infinity if the line is unbounded.
Gets the vector representing the direction and magnitude from the start to the end of the line.
public DiGi.ComputeSharp.Planar.Classes.Coordinate2 GetVector();Coordinate2
A Coordinate2 representing the direction and magnitude of the line.
Determines whether a given point is within the range of this line's bounding box.
public bool InRange(DiGi.ComputeSharp.Planar.Classes.Coordinate2 point, double tolerance);point Coordinate2
The point to check.
tolerance System.Double
The overlap tolerance.
System.Boolean
True if the point is in range; otherwise, false.
Determines whether this line's bounding box overlaps with another line's bounding box within a given tolerance.
public bool InRange(DiGi.ComputeSharp.Planar.Classes.Line2 line, double tolerance);line Line2
The other line to check.
tolerance System.Double
The overlap tolerance.
System.Boolean
True if the lines are in range; otherwise, false.
Determines whether this line's bounding box overlaps with a triangle's bounding box within a given tolerance.
public bool InRange(DiGi.ComputeSharp.Planar.Classes.Triangle2 triangle, double tolerance);triangle DiGi.ComputeSharp.Planar.Classes.Triangle2
The triangle to check.
tolerance System.Double
The overlap tolerance.
System.Boolean
True if the line and triangle are in range; otherwise, false.
Checks if either the start or end coordinates of the line are Not-a-Number (NaN).
public bool IsNaN();System.Boolean
True if any coordinate is NaN; otherwise, false.
Determines whether a point lies on the line within a specified squared distance tolerance.
public bool On(DiGi.ComputeSharp.Planar.Classes.Coordinate2 point, double tolerance);point Coordinate2
The point to check.
tolerance System.Double
The squared distance tolerance.
System.Boolean
True if the point is on the line; otherwise, false.
Projects a given point onto the line, returning the closest point on the line.
public DiGi.ComputeSharp.Planar.Classes.Coordinate2 Project(DiGi.ComputeSharp.Planar.Classes.Coordinate2 point);point Coordinate2
The point to project.
Coordinate2
The closest Coordinate2 on this line to the given point.
Projects another line onto this line by finding the closest points for the start and end of the given line.
public DiGi.ComputeSharp.Planar.Classes.Line2 Project(DiGi.ComputeSharp.Planar.Classes.Line2 line);line Line2
The line to project onto this line.
Line2
A new Line2 representing the projected line, or a default Line2 if the projection collapses to a point.
Returns a string representation of the line showing start and end coordinates.
public override string ToString();System.String
A formatted string containing the start and end coordinates.