Struct Point3D
Universal type for a set of three-dimensional coordinates.
Implements
Inherited Members
Namespace: TheXDS.MCART.Types
Assembly: MCART.dll
Syntax
public struct Point3D : IFormattable, IEquatable<Point3D>, IVector3D, IVector, IEquatable<IVector>, IEquatable<Vector2>, IEquatable<IVector3D>, IEquatable<Vector3>
Remarks
This structure is declared as partial to allow each MCART implementation to define methods for converting to the corresponding class for different available UI types.
Constructors
| Edit this page View SourcePoint3D(double, double)
Initializes a new instance of the Point3D structure for a pair of two-dimensional coordinates.
Declaration
public Point3D(double x, double y)
Parameters
| Type | Name | Description |
|---|---|---|
| double | x | X coordinate. |
| double | y | Y coordinate. |
Point3D(double, double, double)
Universal type for a set of three-dimensional coordinates.
Declaration
public Point3D(double x, double y, double z)
Parameters
| Type | Name | Description |
|---|---|---|
| double | x | X coordinate. |
| double | y | Y coordinate. |
| double | z | Z coordinate. |
Remarks
This structure is declared as partial to allow each MCART implementation to define methods for converting to the corresponding class for different available UI types.
Fields
| Edit this page View SourceNowhere
Gets a point that represents no position. This field is read-only.
Declaration
public static readonly Point3D Nowhere
Field Value
| Type | Description |
|---|---|
| Point3D |
Origin
Gets a point at the origin. This field is read-only.
Declaration
public static readonly Point3D Origin
Field Value
| Type | Description |
|---|---|
| Point3D | A Point3D with coordinates at the origin. |
Origin2D
Gets a point at the 2D origin. This field is read-only.
Declaration
public static readonly Point3D Origin2D
Field Value
| Type | Description |
|---|---|
| Point3D | A Point3D with coordinates at the 2D origin. |
Properties
| Edit this page View SourceX
X coordinate.
Declaration
public double X { readonly get; set; }
Property Value
| Type | Description |
|---|---|
| double |
Y
Y coordinate.
Declaration
public double Y { readonly get; set; }
Property Value
| Type | Description |
|---|---|
| double |
Z
Z coordinate.
Declaration
public double Z { readonly get; set; }
Property Value
| Type | Description |
|---|---|
| double |
Methods
| Edit this page View SourceEquals(object?)
Indicates whether this instance and a specified object are equal.
Declaration
public override readonly bool Equals(object? obj)
Parameters
| Type | Name | Description |
|---|---|---|
| object | obj | The object to compare with the current instance. |
Returns
| Type | Description |
|---|---|
| bool |
Overrides
| Edit this page View SourceEquals(IVector?)
Indicates whether this instance and a specified object are equal.
Declaration
public readonly bool Equals(IVector? other)
Parameters
| Type | Name | Description |
|---|---|---|
| IVector | other | The object to compare with the current instance. |
Returns
| Type | Description |
|---|---|
| bool | true if this instance and |
Equals(IVector3D?)
Indicates whether this instance and a specified object are equal.
Declaration
public readonly bool Equals(IVector3D? other)
Parameters
| Type | Name | Description |
|---|---|---|
| IVector3D | other | The object to compare with the current instance. |
Returns
| Type | Description |
|---|---|
| bool | true if this instance and |
Equals(Point3D)
Compares the equality of vectors from both points.
Declaration
public readonly bool Equals(Point3D other)
Parameters
| Type | Name | Description |
|---|---|---|
| Point3D | other | Point3D to compare against. |
Returns
| Type | Description |
|---|---|
| bool | true if all coordinates from both points are equal; otherwise, false. |
GetHashCode()
Returns the hash code for this instance.
Declaration
public override readonly int GetHashCode()
Returns
| Type | Description |
|---|---|
| int | The hash code for this instance. |
Overrides
| Edit this page View SourceMagnitude()
Calculates the magnitude of the coordinates.
Declaration
public readonly double Magnitude()
Returns
| Type | Description |
|---|---|
| double | The resulting magnitude between the point and the origin. |
Magnitude(double, double, double)
Calculates the magnitude of the coordinates from the specified point.
Declaration
public readonly double Magnitude(double fromX, double fromY, double fromZ)
Parameters
| Type | Name | Description |
|---|---|---|
| double | fromX | Source X coordinate. |
| double | fromY | Source Y coordinate. |
| double | fromZ | Source Z coordinate. |
Returns
| Type | Description |
|---|---|
| double | The resulting magnitude between the point and the specified coordinates. |
Magnitude(Point3D)
Calculates the magnitude of the coordinates from the specified point.
Declaration
public readonly double Magnitude(Point3D fromPoint)
Parameters
| Type | Name | Description |
|---|---|---|
| Point3D | fromPoint | Reference point to calculate the magnitude. |
Returns
| Type | Description |
|---|---|
| double | The resulting magnitude between both points. |
Parse(string)
Creates a Point3D from a string.
Declaration
public static Point3D Parse(string value)
Parameters
| Type | Name | Description |
|---|---|---|
| string | value | Value from which to create a Point. |
Returns
| Type | Description |
|---|---|
| Point3D | Point3D that has been created. |
Exceptions
| Type | Condition |
|---|---|
| FormatException | Occurs if the conversion fails. |
ToString()
Converts this object to its string representation.
Declaration
public override readonly string ToString()
Returns
| Type | Description |
|---|---|
| string | A string representation of this object. |
Overrides
| Edit this page View SourceToString(string?)
Converts this object to its string representation.
Declaration
public readonly string ToString(string? format)
Parameters
| Type | Name | Description |
|---|---|---|
| string | format | Format to use. |
Returns
| Type | Description |
|---|---|
| string | A string representation of this object. |
ToString(string?, IFormatProvider?)
Converts this object to its string representation.
Declaration
public readonly string ToString(string? format, IFormatProvider? formatProvider)
Parameters
| Type | Name | Description |
|---|---|---|
| string | format | Format to use. |
| IFormatProvider | formatProvider | Optional parameter. Format provider of the culture to use for formatting the string representation of this object. If omitted, CurrentCulture will be used. |
Returns
| Type | Description |
|---|---|
| string | A string representation of this object. |
TryParse(string, out Point3D)
Attempts to create a Point3D from a string.
Declaration
public static bool TryParse(string value, out Point3D point)
Parameters
| Type | Name | Description |
|---|---|---|
| string | value | Value from which to create a Point3D. |
| Point3D | point | Point3D that has been created. |
Returns
| Type | Description |
|---|---|
| bool |
WithinCube(in double, in double, in double, in double, in double, in double)
Determines whether the point is within the cube formed by the specified 3D points.
Declaration
public readonly bool WithinCube(in double x1, in double y1, in double z1, in double x2, in double y2, in double z2)
Parameters
| Type | Name | Description |
|---|---|---|
| double | x1 | The first X coordinate. |
| double | y1 | The first Y coordinate. |
| double | z1 | The first Z coordinate. |
| double | x2 | The second X coordinate. |
| double | y2 | The second Y coordinate. |
| double | z2 | The second Z coordinate. |
Returns
| Type | Description |
|---|---|
| bool | true if the point is within the cube formed, false otherwise. |
WithinCube(Point3D, Point3D)
Determines whether the point is within the cube formed by the specified 3D points.
Declaration
public readonly bool WithinCube(Point3D p1, Point3D p2)
Parameters
| Type | Name | Description |
|---|---|---|
| Point3D | p1 | First point. |
| Point3D | p2 | Second point. |
Returns
| Type | Description |
|---|---|
| bool | true if the point is within the cube formed, false otherwise. |
WithinCube(Range<double>, Range<double>, Range<double>)
Determines whether the point is within the rectangle formed by the specified ranges.
Declaration
public readonly bool WithinCube(Range<double> x, Range<double> y, Range<double> z)
Parameters
| Type | Name | Description |
|---|---|---|
| Range<double> | x | Range of values for the X axis. |
| Range<double> | y | Range of values for the Y axis. |
| Range<double> | z | Range of values for the Z axis. |
Returns
| Type | Description |
|---|---|
| bool | true if the point is within the rectangle formed, false otherwise. |
WithinCube(in Size3D)
Determines whether the point is within the rectangle formed by the specified coordinates.
Declaration
public readonly bool WithinCube(in Size3D size)
Parameters
| Type | Name | Description |
|---|---|---|
| Size3D | size | Size of the rectangle. |
Returns
| Type | Description |
|---|---|
| bool | true if the point is within the rectangle formed, false otherwise. |
WithinCube(in Size3D, in Point3D)
Determines whether the point is within the rectangle formed by the specified coordinates.
Declaration
public readonly bool WithinCube(in Size3D size, in Point3D topLeftFront)
Parameters
| Type | Name | Description |
|---|---|---|
| Size3D | size | Size of the rectangle. |
| Point3D | topLeftFront | Coordinates of the top-left front corner |
Returns
| Type | Description |
|---|---|
| bool | true if the point is within the rectangle formed, false otherwise. |
WithinSphere(Point3D, double)
Determines whether the point is within the specified sphere.
Declaration
public readonly bool WithinSphere(Point3D center, double radius)
Parameters
| Type | Name | Description |
|---|---|---|
| Point3D | center | Center point of the sphere. |
| double | radius | Radius of the sphere. |
Returns
| Type | Description |
|---|---|
| bool |
Operators
| Edit this page View Sourceoperator +(Point3D, double)
Performs addition operation on a point and a scalar.
Declaration
public static Point3D operator +(Point3D l, double r)
Parameters
| Type | Name | Description |
|---|---|---|
| Point3D | l | Point. |
| double | r | Scalar value. |
Returns
| Type | Description |
|---|---|
| Point3D | A new Point3D with each coordinate increased by r. |
operator +(Point3D, IVector3D)
Performs addition operation on a point and a vector.
Declaration
public static Point3D operator +(Point3D l, IVector3D r)
Parameters
| Type | Name | Description |
|---|---|---|
| Point3D | l | Point. |
| IVector3D | r | Vector. |
Returns
| Type | Description |
|---|---|
| Point3D | The sum of the point's vectors and the vector. |
operator +(Point3D, Point3D)
Performs addition operation on points.
Declaration
public static Point3D operator +(Point3D l, Point3D r)
Parameters
| Type | Name | Description |
|---|---|---|
| Point3D | l | First point. |
| Point3D | r | Second point. |
Returns
| Type | Description |
|---|---|
| Point3D | The sum of the vectors from the points. |
operator --(Point3D)
Decrements all coordinates of the point by one.
Declaration
public static Point3D operator --(Point3D p)
Parameters
| Type | Name | Description |
|---|---|---|
| Point3D | p | Point to decrement. |
Returns
| Type | Description |
|---|---|
| Point3D | A point with all coordinates decremented by one. |
operator /(Point3D, double)
Performs division operation on a point and a scalar.
Declaration
public static Point3D operator /(Point3D l, double r)
Parameters
| Type | Name | Description |
|---|---|---|
| Point3D | l | Point. |
| double | r | Scalar value. |
Returns
| Type | Description |
|---|---|
| Point3D | A new Point3D with each coordinate divided by r. |
operator /(Point3D, IVector3D)
Performs division operation on a point and a vector.
Declaration
public static Point3D operator /(Point3D l, IVector3D r)
Parameters
| Type | Name | Description |
|---|---|---|
| Point3D | l | First point. |
| IVector3D | r | Second vector. |
Returns
| Type | Description |
|---|---|
| Point3D | The quotient of the vectors from the point and vector. |
operator ==(Point3D, IVector3D)
Compares the equality of vectors from both points.
Declaration
public static bool operator ==(Point3D l, IVector3D r)
Parameters
| Type | Name | Description |
|---|---|---|
| Point3D | l | First point. |
| IVector3D | r | Second vector. |
Returns
| Type | Description |
|---|---|
| bool | true if all coordinates from both points are equal; otherwise, false. |
implicit operator Point3D(Vector3)
Declaration
public static implicit operator Point3D(Vector3 p)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector3 | p | Vector3 value to be converted. |
Returns
| Type | Description |
|---|---|
| Point3D |
implicit operator Point3D(Point)
Declaration
public static implicit operator Point3D(Point p)
Parameters
| Type | Name | Description |
|---|---|---|
| Point | p | Object to convert. |
Returns
| Type | Description |
|---|---|
| Point3D | A new Point3D with the same values of X and Y as the original Point, and a Z value of NaN. |
implicit operator Vector3(Point3D)
Declaration
public static implicit operator Vector3(Point3D p)
Parameters
| Type | Name | Description |
|---|---|---|
| Point3D | p | Point3D value to be converted. |
Returns
| Type | Description |
|---|---|
| Vector3 |
implicit operator Point(Point3D)
Declaration
public static implicit operator Point(Point3D p)
Parameters
| Type | Name | Description |
|---|---|---|
| Point3D | p | Object to convert. |
Returns
| Type | Description |
|---|---|
| Point | A new Point with the same values of X and Y as the original Point3D. |
operator ++(Point3D)
Increments all coordinates of the point by one.
Declaration
public static Point3D operator ++(Point3D p)
Parameters
| Type | Name | Description |
|---|---|---|
| Point3D | p | Point to increment. |
Returns
| Type | Description |
|---|---|
| Point3D | A point with all coordinates incremented by one. |
operator !=(Point3D, IVector3D)
Compares the inequality of vectors from both points.
Declaration
public static bool operator !=(Point3D l, IVector3D r)
Parameters
| Type | Name | Description |
|---|---|---|
| Point3D | l | First point. |
| IVector3D | r | Second vector. |
Returns
| Type | Description |
|---|---|
| bool | true if coordinates from both points are different; otherwise, false. |
operator %(Point3D, double)
Performs modulo operation on a point and a scalar.
Declaration
public static Point3D operator %(Point3D l, double r)
Parameters
| Type | Name | Description |
|---|---|---|
| Point3D | l | Point. |
| double | r | Scalar value. |
Returns
| Type | Description |
|---|---|
| Point3D | A new Point3D with each coordinate modulo r. |
operator %(Point3D, IVector3D)
Performs modulo operation on a point and a vector.
Declaration
public static Point3D operator %(Point3D l, IVector3D r)
Parameters
| Type | Name | Description |
|---|---|---|
| Point3D | l | First point. |
| IVector3D | r | Second vector. |
Returns
| Type | Description |
|---|---|
| Point3D | The remainder of the vectors from the point and vector. |
operator *(Point3D, double)
Performs multiplication operation on a point and a scalar.
Declaration
public static Point3D operator *(Point3D l, double r)
Parameters
| Type | Name | Description |
|---|---|---|
| Point3D | l | Point. |
| double | r | Scalar value. |
Returns
| Type | Description |
|---|---|
| Point3D | A new Point3D with each coordinate multiplied by r. |
operator *(Point3D, IVector3D)
Performs multiplication operation on a point and a vector.
Declaration
public static Point3D operator *(Point3D l, IVector3D r)
Parameters
| Type | Name | Description |
|---|---|---|
| Point3D | l | First point. |
| IVector3D | r | Second vector. |
Returns
| Type | Description |
|---|---|
| Point3D | The product of the vectors from the point and vector. |
operator -(Point3D, double)
Performs subtraction operation on a point and a scalar.
Declaration
public static Point3D operator -(Point3D l, double r)
Parameters
| Type | Name | Description |
|---|---|---|
| Point3D | l | Point. |
| double | r | Scalar value. |
Returns
| Type | Description |
|---|---|
| Point3D | A new Point3D with each coordinate decreased by r. |
operator -(Point3D, IVector3D)
Performs subtraction operation on a point and a vector.
Declaration
public static Point3D operator -(Point3D l, IVector3D r)
Parameters
| Type | Name | Description |
|---|---|---|
| Point3D | l | Point. |
| IVector3D | r | Vector. |
Returns
| Type | Description |
|---|---|
| Point3D | The difference of the point's vectors and the vector. |
operator -(Point3D)
Inverts the sign of all coordinates of the point.
Declaration
public static Point3D operator -(Point3D p)
Parameters
| Type | Name | Description |
|---|---|---|
| Point3D | p | Point to operate on. |
Returns
| Type | Description |
|---|---|
| Point3D | A point with inverted signs of all coordinates. |
operator +(Point3D)
Converts all coordinates of the point to positive values.
Declaration
public static Point3D operator +(Point3D p)
Parameters
| Type | Name | Description |
|---|---|---|
| Point3D | p | Point to operate on. |
Returns
| Type | Description |
|---|---|
| Point3D | A point with all coordinates positive. |