Show / Hide Table of Contents

Struct Point3D

Universal type for a set of three-dimensional coordinates.

Implements
IFormattable
IEquatable<Point3D>
IVector3D
IVector
IEquatable<IVector>
IEquatable<Vector2>
IEquatable<IVector3D>
IEquatable<Vector3>
Inherited Members
object.Equals(object, object)
object.GetType()
object.ReferenceEquals(object, object)
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 Source

Point3D(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.

| Edit this page View Source

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 Source

Nowhere

Gets a point that represents no position. This field is read-only.

Declaration
public static readonly Point3D Nowhere
Field Value
Type Description
Point3D

A Point3D with all coordinates set to NaN.

| Edit this page View Source

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.

| Edit this page View Source

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 Source

X

X coordinate.

Declaration
public double X { readonly get; set; }
Property Value
Type Description
double
| Edit this page View Source

Y

Y coordinate.

Declaration
public double Y { readonly get; set; }
Property Value
Type Description
double
| Edit this page View Source

Z

Z coordinate.

Declaration
public double Z { readonly get; set; }
Property Value
Type Description
double

Methods

| Edit this page View Source

Equals(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

true if this instance and obj are equal; otherwise, false.

Overrides
ValueType.Equals(object)
| Edit this page View Source

Equals(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 other are equal; otherwise, false.

| Edit this page View Source

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 other are equal; otherwise, false.

| Edit this page View Source

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.

| Edit this page View Source

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
ValueType.GetHashCode()
| Edit this page View Source

Magnitude()

Calculates the magnitude of the coordinates.

Declaration
public readonly double Magnitude()
Returns
Type Description
double

The resulting magnitude between the point and the origin.

| Edit this page View Source

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.

| Edit this page View Source

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.

| Edit this page View Source

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.

| Edit this page View Source

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
ValueType.ToString()
| Edit this page View Source

ToString(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.

| Edit this page View Source

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.

| Edit this page View Source

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

true if the conversion was successful, false otherwise.

| Edit this page View Source

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.

| Edit this page View Source

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.

| Edit this page View Source

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.

| Edit this page View Source

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.

| Edit this page View Source

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.

| Edit this page View Source

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

true if the point is within the sphere, false otherwise.

Operators

| Edit this page View Source

operator +(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.

| Edit this page View Source

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.

| Edit this page View Source

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.

| Edit this page View Source

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.

| Edit this page View Source

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.

| Edit this page View Source

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.

| Edit this page View Source

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.

| Edit this page View Source

implicit operator Point3D(Vector3)

Implicitly converts a Vector3 to a Point3D.

Declaration
public static implicit operator Point3D(Vector3 p)
Parameters
Type Name Description
Vector3 p

Vector3 value to be converted.

Returns
Type Description
Point3D
| Edit this page View Source

implicit operator Point3D(Point)

Implicitly converts a Point to a Point3D.

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.

| Edit this page View Source

implicit operator Vector3(Point3D)

Implicitly converts a Point3D to a Vector3.

Declaration
public static implicit operator Vector3(Point3D p)
Parameters
Type Name Description
Point3D p

Point3D value to be converted.

Returns
Type Description
Vector3
| Edit this page View Source

implicit operator Point(Point3D)

Implicitly converts a Point3D to a Point.

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.

| Edit this page View Source

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.

| Edit this page View Source

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.

| Edit this page View Source

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.

| Edit this page View Source

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.

| Edit this page View Source

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.

| Edit this page View Source

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.

| Edit this page View Source

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.

| Edit this page View Source

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.

| Edit this page View Source

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.

| Edit this page View Source

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.

Implements

IFormattable
IEquatable<T>
IVector3D
IVector
IEquatable<T>
IEquatable<T>
IEquatable<T>
IEquatable<T>

Extension Methods

Objects.ShallowCopyTo(object, object, Type)
ObjectExtensions.FieldsOf<T>(object)
ObjectExtensions.GetAttribute<T>(object)
ObjectExtensions.GetAttributes<T>(object)
ObjectExtensions.HasAttrValue<TAttribute, TValue>(object, out TValue)
ObjectExtensions.HasAttribute<T>(object)
ObjectExtensions.HasAttribute<T>(object, out T?)
ObjectExtensions.HasAttributes<T>(object, out IEnumerable<T>?)
ObjectExtensions.Is(object?, object?)
ObjectExtensions.IsEither(object, IEnumerable)
ObjectExtensions.IsEither(object, params object[])
ObjectExtensions.IsNeither(object, IEnumerable)
ObjectExtensions.IsNeither(object, params object[])
ObjectExtensions.IsNot(object?, object?)
ObjectExtensions.PropertiesOf<T>(object)
ObjectExtensions.WhichAre(object, IEnumerable<object>)
ObjectExtensions.WhichAre(object, params object[])
Objects.Itself<T>(T)
Objects.ShallowClone<T>(T)
Objects.ShallowCopyTo<T>(T, T)
CollectionExtensions.PushInto<TItem, TCollection>(TItem, ICollection<TCollection>)
DictionaryExtensions.PushInto<TKey, TValue>(TValue, TKey, IDictionary<TKey, TValue>)
  • Edit this page
  • View Source
In this article
Back to top Generated by DocFX