@@ -14,8 +14,8 @@ namespace Silk.NET.Maths
1414 /// <typeparam name="T">The type used to store values.</typeparam>
1515 [ Serializable ]
1616 [ DataContract ]
17- public struct Plane < T >
18- : IEquatable < Plane < T > > where T : unmanaged, IFormattable , IEquatable < T > , IComparable < T >
17+ public struct Plane < T > : IEquatable < Plane < T > >
18+ where T : unmanaged, IFormattable , IEquatable < T > , IComparable < T >
1919 {
2020 /// <summary>The normal vector of the Plane.</summary>
2121 [ DataMember ]
@@ -58,22 +58,21 @@ public Plane(Vector4D<T> value)
5858 /// <param name="value1">The first Plane to compare.</param>
5959 /// <param name="value2">The second Plane to compare.</param>
6060 /// <returns>True if the Planes are equal; False otherwise.</returns>
61- [ MethodImpl ( ( MethodImplOptions ) 768 ) ]
62- public static bool operator == ( Plane < T > value1 , Plane < T > value2 )
63- => value1 . Normal == value2 . Normal && Scalar . Equal ( value1 . Distance , value2 . Distance ) ;
61+ [ MethodImpl ( ( MethodImplOptions ) 768 ) ]
62+ public static bool operator == ( Plane < T > value1 , Plane < T > value2 ) =>
63+ value1 . Normal == value2 . Normal && Scalar . Equal ( value1 . Distance , value2 . Distance ) ;
6464
6565 /// <summary>Returns a boolean indicating whether the two given Planes are not equal.</summary>
6666 /// <param name="value1">The first Plane to compare.</param>
6767 /// <param name="value2">The second Plane to compare.</param>
6868 /// <returns>True if the Planes are not equal; False if they are equal.</returns>
69- [ MethodImpl ( ( MethodImplOptions ) 768 ) ]
70- public static bool operator != ( Plane < T > value1 , Plane < T > value2 )
71- => ! ( value1 == value2 ) ;
69+ [ MethodImpl ( ( MethodImplOptions ) 768 ) ]
70+ public static bool operator != ( Plane < T > value1 , Plane < T > value2 ) => ! ( value1 == value2 ) ;
7271
7372 /// <summary>Returns a boolean indicating whether the given Object is equal to this Plane instance.</summary>
7473 /// <param name="obj">The Object to compare against.</param>
7574 /// <returns>True if the Object is equal to this Plane; False otherwise.</returns>
76- [ MethodImpl ( ( MethodImplOptions ) 768 ) ]
75+ [ MethodImpl ( ( MethodImplOptions ) 768 ) ]
7776 public override readonly bool Equals ( object ? obj )
7877 {
7978 return ( obj is Plane < T > other ) && Equals ( other ) ;
@@ -82,7 +81,7 @@ public override readonly bool Equals(object? obj)
8281 /// <summary>Returns a boolean indicating whether the given Plane is equal to this Plane instance.</summary>
8382 /// <param name="other">The Plane to compare this instance to.</param>
8483 /// <returns>True if the other Plane is equal to this instance; False otherwise.</returns>
85- [ MethodImpl ( ( MethodImplOptions ) 768 ) ]
84+ [ MethodImpl ( ( MethodImplOptions ) 768 ) ]
8685 public readonly bool Equals ( Plane < T > other )
8786 {
8887 return Normal . Equals ( other . Normal ) && Scalar . Equal ( Distance , other . Distance ) ;
@@ -92,129 +91,135 @@ public readonly bool Equals(Plane<T> other)
9291 /// <returns>The hash code.</returns>
9392 public override readonly int GetHashCode ( )
9493 {
95- return Normal . GetHashCode ( ) + Distance . GetHashCode ( ) ;
94+ return HashCode . Combine ( Normal . GetHashCode ( ) , Distance . GetHashCode ( ) ) ;
9695 }
9796
9897 /// <summary>Returns a String representing this Plane instance.</summary>
9998 /// <returns>The string representation.</returns>
10099 public override readonly string ToString ( )
101100 {
102101 CultureInfo ci = CultureInfo . CurrentCulture ;
103- return string . Format ( ci , "{{Normal:{0} D:{1}}}" , Normal . ToString ( ) , Distance . ToString ( "G" , ci ) ) ;
102+ return string . Format (
103+ ci ,
104+ "{{Normal:{0} D:{1}}}" ,
105+ Normal . ToString ( ) ,
106+ Distance . ToString ( "G" , ci )
107+ ) ;
104108 }
105109
106110 /// <summary>
107111 /// Converts a <see cref="Plane{T}"/> into one with a <typeparamref name="T"/> of <see cref="Half"/>
108112 /// </summary>
109113 /// <param name="from">The source matrix</param>
110114 /// <returns>The <see cref="Half"/> matrix</returns>
111- public static explicit operator Plane < Half > ( Plane < T > from )
112- => new ( ( Vector3D < Half > ) from . Normal , Scalar . As < T , Half > ( from . Distance ) ) ;
115+ public static explicit operator Plane < Half > ( Plane < T > from ) =>
116+ new ( ( Vector3D < Half > ) from . Normal , Scalar . As < T , Half > ( from . Distance ) ) ;
113117
114118 /// <summary>
115119 /// Converts a <see cref="Plane{T}"/> into one with a <typeparamref name="T"/> of <see cref="float"/>
116120 /// </summary>
117121 /// <param name="from">The source matrix</param>
118122 /// <returns>The <see cref="float"/> matrix</returns>
119- public static explicit operator Plane < float > ( Plane < T > from )
120- => new ( ( Vector3D < float > ) from . Normal , Scalar . As < T , float > ( from . Distance ) ) ;
123+ public static explicit operator Plane < float > ( Plane < T > from ) =>
124+ new ( ( Vector3D < float > ) from . Normal , Scalar . As < T , float > ( from . Distance ) ) ;
121125
122126 /// <summary>
123127 /// Converts a <see cref="Plane{T}"/> into <see cref="System.Numerics.Plane"/>
124128 /// </summary>
125129 /// <param name="from">The source matrix</param>
126130 /// <returns>The <see cref="System.Numerics"/> matrix</returns>
127- public static explicit operator System . Numerics . Plane ( Plane < T > from )
128- => new ( ( System . Numerics . Vector3 ) from . Normal , Scalar . As < T , float > ( from . Distance ) ) ;
129-
131+ public static explicit operator System . Numerics . Plane ( Plane < T > from ) =>
132+ new ( ( System . Numerics . Vector3 ) from . Normal , Scalar . As < T , float > ( from . Distance ) ) ;
133+
130134 /// <summary>
131135 /// Converts a <see cref="Plane{T}"/> into one with a <typeparamref name="T"/> of <see cref="double"/>
132136 /// </summary>
133137 /// <param name="from">The source matrix</param>
134138 /// <returns>The <see cref="double"/> matrix</returns>
135- public static explicit operator Plane < double > ( Plane < T > from )
136- => new ( ( Vector3D < double > ) from . Normal , Scalar . As < T , double > ( from . Distance ) ) ;
139+ public static explicit operator Plane < double > ( Plane < T > from ) =>
140+ new ( ( Vector3D < double > ) from . Normal , Scalar . As < T , double > ( from . Distance ) ) ;
137141
138142 /// <summary>
139143 /// Converts a <see cref="Plane{T}"/> into one with a <typeparamref name="T"/> of <see cref="decimal"/>
140144 /// </summary>
141145 /// <param name="from">The source matrix</param>
142146 /// <returns>The <see cref="decimal"/> matrix</returns>
143- public static explicit operator Plane < decimal > ( Plane < T > from )
144- => new ( ( Vector3D < decimal > ) from . Normal , Scalar . As < T , decimal > ( from . Distance ) ) ;
147+ public static explicit operator Plane < decimal > ( Plane < T > from ) =>
148+ new ( ( Vector3D < decimal > ) from . Normal , Scalar . As < T , decimal > ( from . Distance ) ) ;
145149
146150 /// <summary>
147151 /// Converts a <see cref="Plane{T}"/> into one with a <typeparamref name="T"/> of <see cref="sbyte"/>
148152 /// </summary>
149153 /// <param name="from">The source matrix</param>
150154 /// <returns>The <see cref="sbyte"/> matrix</returns>
151- public static explicit operator Plane < sbyte > ( Plane < T > from )
152- => new ( ( Vector3D < sbyte > ) from . Normal , Scalar . As < T , sbyte > ( from . Distance ) ) ;
155+ public static explicit operator Plane < sbyte > ( Plane < T > from ) =>
156+ new ( ( Vector3D < sbyte > ) from . Normal , Scalar . As < T , sbyte > ( from . Distance ) ) ;
153157
154158 /// <summary>
155159 /// Converts a <see cref="Plane{T}"/> into one with a <typeparamref name="T"/> of <see cref="byte"/>
156160 /// </summary>
157161 /// <param name="from">The source matrix</param>
158162 /// <returns>The <see cref="byte"/> matrix</returns>
159- public static explicit operator Plane < byte > ( Plane < T > from )
160- => new ( ( Vector3D < byte > ) from . Normal , Scalar . As < T , byte > ( from . Distance ) ) ;
163+ public static explicit operator Plane < byte > ( Plane < T > from ) =>
164+ new ( ( Vector3D < byte > ) from . Normal , Scalar . As < T , byte > ( from . Distance ) ) ;
161165
162166 /// <summary>
163167 /// Converts a <see cref="Plane{T}"/> into one with a <typeparamref name="T"/> of <see cref="ushort"/>
164168 /// </summary>
165169 /// <param name="from">The source matrix</param>
166170 /// <returns>The <see cref="ushort"/> matrix</returns>
167- public static explicit operator Plane < ushort > ( Plane < T > from )
168- => new ( ( Vector3D < ushort > ) from . Normal , Scalar . As < T , ushort > ( from . Distance ) ) ;
171+ public static explicit operator Plane < ushort > ( Plane < T > from ) =>
172+ new ( ( Vector3D < ushort > ) from . Normal , Scalar . As < T , ushort > ( from . Distance ) ) ;
169173
170174 /// <summary>
171175 /// Converts a <see cref="Plane{T}"/> into one with a <typeparamref name="T"/> of <see cref="short"/>
172176 /// </summary>
173177 /// <param name="from">The source matrix</param>
174178 /// <returns>The <see cref="short"/> matrix</returns>
175- public static explicit operator Plane < short > ( Plane < T > from )
176- => new ( ( Vector3D < short > ) from . Normal , Scalar . As < T , short > ( from . Distance ) ) ;
179+ public static explicit operator Plane < short > ( Plane < T > from ) =>
180+ new ( ( Vector3D < short > ) from . Normal , Scalar . As < T , short > ( from . Distance ) ) ;
177181
178182 /// <summary>
179183 /// Converts a <see cref="Plane{T}"/> into one with a <typeparamref name="T"/> of <see cref="uint"/>
180184 /// </summary>
181185 /// <param name="from">The source matrix</param>
182186 /// <returns>The <see cref="uint"/> matrix</returns>
183- public static explicit operator Plane < uint > ( Plane < T > from )
184- => new ( ( Vector3D < uint > ) from . Normal , Scalar . As < T , uint > ( from . Distance ) ) ;
187+ public static explicit operator Plane < uint > ( Plane < T > from ) =>
188+ new ( ( Vector3D < uint > ) from . Normal , Scalar . As < T , uint > ( from . Distance ) ) ;
185189
186190 /// <summary>
187191 /// Converts a <see cref="Plane{T}"/> into one with a <typeparamref name="T"/> of <see cref="int"/>
188192 /// </summary>
189193 /// <param name="from">The source matrix</param>
190194 /// <returns>The <see cref="int"/> matrix</returns>
191- public static explicit operator Plane < int > ( Plane < T > from )
192- => new ( ( Vector3D < int > ) from . Normal , Scalar . As < T , int > ( from . Distance ) ) ;
195+ public static explicit operator Plane < int > ( Plane < T > from ) =>
196+ new ( ( Vector3D < int > ) from . Normal , Scalar . As < T , int > ( from . Distance ) ) ;
193197
194198 /// <summary>
195199 /// Converts a <see cref="Plane{T}"/> into one with a <typeparamref name="T"/> of <see cref="ulong"/>
196200 /// </summary>
197201 /// <param name="from">The source matrix</param>
198202 /// <returns>The <see cref="ulong"/> matrix</returns>
199- public static explicit operator Plane < ulong > ( Plane < T > from )
200- => new ( ( Vector3D < ulong > ) from . Normal , Scalar . As < T , ulong > ( from . Distance ) ) ;
203+ public static explicit operator Plane < ulong > ( Plane < T > from ) =>
204+ new ( ( Vector3D < ulong > ) from . Normal , Scalar . As < T , ulong > ( from . Distance ) ) ;
201205
202206 /// <summary>
203207 /// Converts a <see cref="Plane{T}"/> into one with a <typeparamref name="T"/> of <see cref="long"/>
204208 /// </summary>
205209 /// <param name="from">The source matrix</param>
206210 /// <returns>The <see cref="long"/> matrix</returns>
207- public static explicit operator Plane < long > ( Plane < T > from )
208- => new ( ( Vector3D < long > ) from . Normal , Scalar . As < T , long > ( from . Distance ) ) ;
209-
211+ public static explicit operator Plane < long > ( Plane < T > from ) =>
212+ new ( ( Vector3D < long > ) from . Normal , Scalar . As < T , long > ( from . Distance ) ) ;
213+
210214 /// <summary>
211215 /// Returns this plane casted to <typeparamref name="TOther"></typeparamref>
212216 /// </summary>
213217 /// <typeparam name="TOther">The type to cast to</typeparam>
214218 /// <returns>The casted plane</returns>
215- public Plane < TOther > As < TOther > ( ) where TOther : unmanaged, IFormattable , IEquatable < TOther > , IComparable < TOther >
219+ public Plane < TOther > As < TOther > ( )
220+ where TOther : unmanaged, IFormattable , IEquatable < TOther > , IComparable < TOther >
216221 {
217222 return new ( Normal . As < TOther > ( ) , Scalar . As < T , TOther > ( Distance ) ) ;
218223 }
219224 }
220- }
225+ }
0 commit comments