|
2 | 2 |
|
3 | 3 | use crate::math::Real; |
4 | 4 | use crate::simd::{SimdBool, SimdReal}; |
5 | | -use na::{Matrix3, Point2, Point3, Scalar, SimdRealField, Vector2, Vector3}; |
| 5 | +use na::{Scalar, SimdRealField, Vector2, Vector3}; |
6 | 6 | use simba::simd::SimdValue; |
7 | 7 |
|
8 | | -#[cfg(feature = "simd-is-enabled")] |
9 | | -use na::SimdPartialOrd; |
10 | | - |
11 | 8 | /// Conditionally swaps each lanes of `a` with those of `b`. |
12 | 9 | /// |
13 | 10 | /// For each `i in [0..SIMD_WIDTH[`, if `do_swap.extract(i)` is `true` then |
@@ -72,36 +69,6 @@ impl WSign<SimdReal> for SimdReal { |
72 | 69 | } |
73 | 70 | } |
74 | 71 |
|
75 | | -pub(crate) trait WComponent: Sized { |
76 | | - type Element; |
77 | | - |
78 | | - fn min_component(self) -> Self::Element; |
79 | | - fn max_component(self) -> Self::Element; |
80 | | -} |
81 | | - |
82 | | -impl WComponent for Real { |
83 | | - type Element = Real; |
84 | | - |
85 | | - fn min_component(self) -> Self::Element { |
86 | | - self |
87 | | - } |
88 | | - fn max_component(self) -> Self::Element { |
89 | | - self |
90 | | - } |
91 | | -} |
92 | | - |
93 | | -#[cfg(feature = "simd-is-enabled")] |
94 | | -impl WComponent for SimdReal { |
95 | | - type Element = Real; |
96 | | - |
97 | | - fn min_component(self) -> Self::Element { |
98 | | - self.simd_horizontal_min() |
99 | | - } |
100 | | - fn max_component(self) -> Self::Element { |
101 | | - self.simd_horizontal_max() |
102 | | - } |
103 | | -} |
104 | | - |
105 | 72 | /// Trait to compute the orthonormal basis of a vector. |
106 | 73 | pub trait WBasis: Sized { |
107 | 74 | /// The type of the array of orthonormal vectors. |
@@ -137,118 +104,6 @@ impl<N: SimdRealField + Copy + WSign<N>> WBasis for Vector3<N> { |
137 | 104 | } |
138 | 105 | } |
139 | 106 |
|
140 | | -pub(crate) trait WVec: Sized { |
141 | | - type Element; |
142 | | - |
143 | | - fn horizontal_inf(&self) -> Self::Element; |
144 | | - fn horizontal_sup(&self) -> Self::Element; |
145 | | -} |
146 | | - |
147 | | -impl<N: Scalar + Copy + WComponent> WVec for Vector2<N> |
148 | | -where |
149 | | - N::Element: Scalar, |
150 | | -{ |
151 | | - type Element = Vector2<N::Element>; |
152 | | - |
153 | | - fn horizontal_inf(&self) -> Self::Element { |
154 | | - Vector2::new(self.x.min_component(), self.y.min_component()) |
155 | | - } |
156 | | - |
157 | | - fn horizontal_sup(&self) -> Self::Element { |
158 | | - Vector2::new(self.x.max_component(), self.y.max_component()) |
159 | | - } |
160 | | -} |
161 | | - |
162 | | -impl<N: Scalar + Copy + WComponent> WVec for Point2<N> |
163 | | -where |
164 | | - N::Element: Scalar, |
165 | | -{ |
166 | | - type Element = Point2<N::Element>; |
167 | | - |
168 | | - fn horizontal_inf(&self) -> Self::Element { |
169 | | - Point2::new(self.x.min_component(), self.y.min_component()) |
170 | | - } |
171 | | - |
172 | | - fn horizontal_sup(&self) -> Self::Element { |
173 | | - Point2::new(self.x.max_component(), self.y.max_component()) |
174 | | - } |
175 | | -} |
176 | | - |
177 | | -impl<N: Scalar + Copy + WComponent> WVec for Vector3<N> |
178 | | -where |
179 | | - N::Element: Scalar, |
180 | | -{ |
181 | | - type Element = Vector3<N::Element>; |
182 | | - |
183 | | - fn horizontal_inf(&self) -> Self::Element { |
184 | | - Vector3::new( |
185 | | - self.x.min_component(), |
186 | | - self.y.min_component(), |
187 | | - self.z.min_component(), |
188 | | - ) |
189 | | - } |
190 | | - |
191 | | - fn horizontal_sup(&self) -> Self::Element { |
192 | | - Vector3::new( |
193 | | - self.x.max_component(), |
194 | | - self.y.max_component(), |
195 | | - self.z.max_component(), |
196 | | - ) |
197 | | - } |
198 | | -} |
199 | | - |
200 | | -impl<N: Scalar + Copy + WComponent> WVec for Point3<N> |
201 | | -where |
202 | | - N::Element: Scalar, |
203 | | -{ |
204 | | - type Element = Point3<N::Element>; |
205 | | - |
206 | | - fn horizontal_inf(&self) -> Self::Element { |
207 | | - Point3::new( |
208 | | - self.x.min_component(), |
209 | | - self.y.min_component(), |
210 | | - self.z.min_component(), |
211 | | - ) |
212 | | - } |
213 | | - |
214 | | - fn horizontal_sup(&self) -> Self::Element { |
215 | | - Point3::new( |
216 | | - self.x.max_component(), |
217 | | - self.y.max_component(), |
218 | | - self.z.max_component(), |
219 | | - ) |
220 | | - } |
221 | | -} |
222 | | - |
223 | | -pub(crate) trait WCrossMatrix: Sized { |
224 | | - type CrossMat; |
225 | | - |
226 | | - fn gcross_matrix(self) -> Self::CrossMat; |
227 | | -} |
228 | | - |
229 | | -impl WCrossMatrix for Vector3<Real> { |
230 | | - type CrossMat = Matrix3<Real>; |
231 | | - |
232 | | - #[inline] |
233 | | - #[rustfmt::skip] |
234 | | - fn gcross_matrix(self) -> Self::CrossMat { |
235 | | - Matrix3::new( |
236 | | - 0.0, -self.z, self.y, |
237 | | - self.z, 0.0, -self.x, |
238 | | - -self.y, self.x, 0.0, |
239 | | - ) |
240 | | - } |
241 | | -} |
242 | | - |
243 | | -impl WCrossMatrix for Vector2<Real> { |
244 | | - type CrossMat = Vector2<Real>; |
245 | | - |
246 | | - #[inline] |
247 | | - fn gcross_matrix(self) -> Self::CrossMat { |
248 | | - Vector2::new(-self.y, self.x) |
249 | | - } |
250 | | -} |
251 | | - |
252 | 107 | pub(crate) trait WCross<Rhs>: Sized { |
253 | 108 | type Result; |
254 | 109 | fn gcross(&self, rhs: Rhs) -> Self::Result; |
@@ -278,60 +133,6 @@ impl WCross<Vector2<Real>> for Real { |
278 | 133 | } |
279 | 134 | } |
280 | 135 |
|
281 | | -pub(crate) trait WDot<Rhs>: Sized { |
282 | | - type Result; |
283 | | - fn gdot(&self, rhs: Rhs) -> Self::Result; |
284 | | -} |
285 | | - |
286 | | -impl WDot<Vector3<Real>> for Vector3<Real> { |
287 | | - type Result = Real; |
288 | | - |
289 | | - fn gdot(&self, rhs: Vector3<Real>) -> Self::Result { |
290 | | - self.x * rhs.x + self.y * rhs.y + self.z * rhs.z |
291 | | - } |
292 | | -} |
293 | | - |
294 | | -impl WDot<Vector2<Real>> for Vector2<Real> { |
295 | | - type Result = Real; |
296 | | - |
297 | | - fn gdot(&self, rhs: Vector2<Real>) -> Self::Result { |
298 | | - self.x * rhs.x + self.y * rhs.y |
299 | | - } |
300 | | -} |
301 | | - |
302 | | -impl WDot<Real> for Real { |
303 | | - type Result = Real; |
304 | | - |
305 | | - fn gdot(&self, rhs: Real) -> Self::Result { |
306 | | - *self * rhs |
307 | | - } |
308 | | -} |
309 | | - |
310 | | -#[cfg(feature = "simd-is-enabled")] |
311 | | -impl WCrossMatrix for Vector3<SimdReal> { |
312 | | - type CrossMat = Matrix3<SimdReal>; |
313 | | - |
314 | | - #[inline] |
315 | | - #[rustfmt::skip] |
316 | | - fn gcross_matrix(self) -> Self::CrossMat { |
317 | | - Matrix3::new( |
318 | | - num::zero(), -self.z, self.y, |
319 | | - self.z, num::zero(), -self.x, |
320 | | - -self.y, self.x, num::zero(), |
321 | | - ) |
322 | | - } |
323 | | -} |
324 | | - |
325 | | -#[cfg(feature = "simd-is-enabled")] |
326 | | -impl WCrossMatrix for Vector2<SimdReal> { |
327 | | - type CrossMat = Vector2<SimdReal>; |
328 | | - |
329 | | - #[inline] |
330 | | - fn gcross_matrix(self) -> Self::CrossMat { |
331 | | - Vector2::new(-self.y, self.x) |
332 | | - } |
333 | | -} |
334 | | - |
335 | 136 | #[cfg(feature = "simd-is-enabled")] |
336 | 137 | impl WCross<Vector3<SimdReal>> for Vector3<SimdReal> { |
337 | 138 | type Result = Vector3<SimdReal>; |
@@ -360,30 +161,3 @@ impl WCross<Vector2<SimdReal>> for Vector2<SimdReal> { |
360 | 161 | prod.x - prod.y |
361 | 162 | } |
362 | 163 | } |
363 | | - |
364 | | -#[cfg(feature = "simd-is-enabled")] |
365 | | -impl WDot<Vector3<SimdReal>> for Vector3<SimdReal> { |
366 | | - type Result = SimdReal; |
367 | | - |
368 | | - fn gdot(&self, rhs: Vector3<SimdReal>) -> Self::Result { |
369 | | - self.x * rhs.x + self.y * rhs.y + self.z * rhs.z |
370 | | - } |
371 | | -} |
372 | | - |
373 | | -#[cfg(feature = "simd-is-enabled")] |
374 | | -impl WDot<Vector2<SimdReal>> for Vector2<SimdReal> { |
375 | | - type Result = SimdReal; |
376 | | - |
377 | | - fn gdot(&self, rhs: Vector2<SimdReal>) -> Self::Result { |
378 | | - self.x * rhs.x + self.y * rhs.y |
379 | | - } |
380 | | -} |
381 | | - |
382 | | -#[cfg(feature = "simd-is-enabled")] |
383 | | -impl WDot<SimdReal> for SimdReal { |
384 | | - type Result = SimdReal; |
385 | | - |
386 | | - fn gdot(&self, rhs: SimdReal) -> Self::Result { |
387 | | - *self * rhs |
388 | | - } |
389 | | -} |
0 commit comments