IDS peak ICV v1.3.0
Loading...
Searching...
No Matches
CoordinateSystem.cs
Go to the documentation of this file.
2
4
17public class CoordinateSystem
18{
23 public CoordinateSystem() : this(new PointF(0, 0), new VectorF(1, 0), new VectorF(0, 1), new VectorF(0, 0))
24 {
25 }
26
39 public CoordinateSystem(PointF origin, VectorF xAxis, VectorF yAxis, VectorF zAxis)
40 {
41 Origin = origin;
42 XAxis = xAxis;
43 YAxis = yAxis;
44 ZAxis = zAxis;
45 }
46
47 internal CoordinateSystem(Backend.Types.peak_icv_coordinate_system coordinateSystem) : this(
48 coordinateSystem.origin, coordinateSystem.x_axis, coordinateSystem.y_axis,
49 coordinateSystem.z_axis)
50 {
51 }
52
57 public PointF Origin { get; }
58
67 public VectorF XAxis { get; }
68
77 public VectorF YAxis { get; }
78
87 public VectorF ZAxis { get; }
88
95 public override string ToString()
96 {
97 return
98 $"{nameof(Origin)}: ({Origin}), {nameof(XAxis)}: ({XAxis}), {nameof(YAxis)}: ({YAxis}), {nameof(ZAxis)}: ({ZAxis})";
99 }
100
105 public bool Equals(CoordinateSystem? other)
106 {
107 if (other is null) return false;
108 if (ReferenceEquals(this, other)) return true;
109 return Origin.Equals(other.Origin) && XAxis.Equals(other.XAxis) && YAxis.Equals(other.YAxis) && ZAxis.Equals(other.ZAxis);
110 }
111
116 public override bool Equals(object? obj)
117 {
118 if (obj is null) return false;
119 if (ReferenceEquals(this, obj)) return true;
120 if (obj.GetType() != GetType()) return false;
121 return Equals((CoordinateSystem)obj);
122 }
123
128 public override int GetHashCode()
129 {
130 unchecked
131 {
132 var hashCode = Origin.GetHashCode();
133 hashCode = (hashCode * 397) ^ XAxis.GetHashCode();
134 hashCode = (hashCode * 397) ^ YAxis.GetHashCode();
135 hashCode = (hashCode * 397) ^ ZAxis.GetHashCode();
136 return hashCode;
137 }
138 }
139}
override int GetHashCode()
Returns a hash code for the current point.
Definition Point.cs:74
override bool Equals(object? obj)
Determines whether the specified object is equal to the current PointT<T>.
Definition Point.cs:41
Represents a 2D point with floating-point coordinates.
Definition Point.cs:126
Represents a 2D vector with floating-point values.
Definition Point.cs:182
Represents the coordinate system of a calibration view projected into the image plane.
CoordinateSystem()
Initializes a new instance of the CoordinateSystem.
VectorF YAxis
Gets the vector that describes the y-axis of the coordinate system.
VectorF ZAxis
Gets the vector that describes the z-axis of the coordinate system.
override int GetHashCode()
Generates a hash code from the classes properties.
override bool Equals(object? obj)
Compares the coordinate systems by value.
override string ToString()
Converts the CoordinateSystem to a string representation.
bool Equals(CoordinateSystem? other)
Compares the coordinate systems by value.
CoordinateSystem(PointF origin, VectorF xAxis, VectorF yAxis, VectorF zAxis)
Initializes a new instance of the CoordinateSystem class with specified coordinates.
VectorF XAxis
Gets the vector that describes the x-axis of the coordinate system.
PointF Origin
Gets the location of the coordinate system origin.