Struct Point3D
Structure representing a point in 3D space with X, Y, and Z coordinates. Provides an indexer for accessing coordinates by indices 1, 2, and 3. Implements overloaded arithmetic operators and implicit conversions.
Implements
Inherited Members
Namespace: DotNet.Interpreter.Helper
Assembly: DotNet.Interpreter.Helper.dll
Syntax
public struct Point3D : IEquatable<Point3D>
Constructors
Point3D(double, double, double)
Structure representing a point in 3D space with X, Y, and Z coordinates. Provides an indexer for accessing coordinates by indices 1, 2, and 3. Implements overloaded arithmetic operators and implicit conversions.
Declaration
public Point3D(double x, double y, double z)
Parameters
Type | Name | Description |
---|---|---|
double | x | |
double | y | |
double | z |
Properties
this[int]
Indexer for accessing coordinates by index (1 - X, 2 - Y, 3 - Z).
Declaration
public double this[int index] { readonly get; set; }
Parameters
Type | Name | Description |
---|---|---|
int | index | Coordinate index (1, 2, or 3). |
Property Value
Type | Description |
---|---|
double | Coordinate value. |
Exceptions
Type | Condition |
---|---|
ArgumentOutOfRangeException | If |
X
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 |
Zero
Returns a point (vector) with zero coordinates.
Declaration
public static Point3D Zero { get; }
Property Value
Type | Description |
---|---|
Point3D |
Methods
Equals(Point3D)
Compares the current point with another point for equality.
Declaration
public readonly bool Equals(Point3D point)
Parameters
Type | Name | Description |
---|---|---|
Point3D | point | Point to compare. |
Returns
Type | Description |
---|---|
bool |
|
Equals(object)
Checks equality of this point with another object
Declaration
public override readonly bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
object | obj | Object to compare |
Returns
Type | Description |
---|---|
bool |
|
Overrides
GetHashCode()
Creates a hash code for the point based on its coordinates
Declaration
public override readonly int GetHashCode()
Returns
Type | Description |
---|---|
int |
Overrides
ToString()
Returns a string representation of the point in format "(X, Y, Z)"
Declaration
public override readonly string ToString()
Returns
Type | Description |
---|---|
string |
Overrides
Operators
operator +(Point3D, Point3D)
Overloads addition operator for two points (vectors).
Declaration
public static Point3D operator +(Point3D a, Point3D b)
Parameters
Type | Name | Description |
---|---|---|
Point3D | a | First point. |
Point3D | b | Second point. |
Returns
Type | Description |
---|---|
Point3D | New point resulting from coordinate addition. |
operator ==(Point3D, Point3D)
Overloads equality operator for two points.
Declaration
public static bool operator ==(Point3D a, Point3D b)
Parameters
Type | Name | Description |
---|---|---|
Point3D | a | First point. |
Point3D | b | Second point. |
Returns
Type | Description |
---|---|
bool |
|
implicit operator TNC3DPoint(Point3D)
Implicit conversion from Point3D to TNC3DPoint.
Declaration
public static implicit operator TNC3DPoint(Point3D point)
Parameters
Type | Name | Description |
---|---|---|
Point3D | point | The Point3D object to convert. |
Returns
Type | Description |
---|---|
TNC3DPoint | New TNC3DPoint object with corresponding coordinates. |
implicit operator Point3D(TNC3DPoint)
Implicit conversion from TNC3DPoint to Point3D.
Declaration
public static implicit operator Point3D(TNC3DPoint point)
Parameters
Type | Name | Description |
---|---|---|
TNC3DPoint | point | The TNC3DPoint object to convert. |
Returns
Type | Description |
---|---|
Point3D | New Point3D object with corresponding coordinates. |
operator !=(Point3D, Point3D)
Overloads inequality operator for two points.
Declaration
public static bool operator !=(Point3D a, Point3D b)
Parameters
Type | Name | Description |
---|---|---|
Point3D | a | First point. |
Point3D | b | Second point. |
Returns
Type | Description |
---|---|
bool |
|
operator *(Point3D, double)
Overloads multiplication operator for a point by a scalar.
Declaration
public static Point3D operator *(Point3D point, double scalar)
Parameters
Type | Name | Description |
---|---|---|
Point3D | point | Original point. |
double | scalar | Scalar value. |
Returns
Type | Description |
---|---|
Point3D | New point with coordinates multiplied by the scalar. |
operator *(double, Point3D)
Overloads multiplication operator for a scalar by a point.
Declaration
public static Point3D operator *(double scalar, Point3D point)
Parameters
Type | Name | Description |
---|---|---|
double | scalar | Scalar value. |
Point3D | point | Original point. |
Returns
Type | Description |
---|---|
Point3D | New point with coordinates multiplied by the scalar. |
operator -(Point3D, Point3D)
Overloads subtraction operator for two points (vectors).
Declaration
public static Point3D operator -(Point3D a, Point3D b)
Parameters
Type | Name | Description |
---|---|---|
Point3D | a | First point. |
Point3D | b | Second point. |
Returns
Type | Description |
---|---|
Point3D | New point resulting from coordinate subtraction. |