1#![allow(dead_code)]
2
3use std::{
4 fmt::Display,
5 ops::{Add, AddAssign, Div, DivAssign, Index, IndexMut, Mul, MulAssign, Neg, Sub, SubAssign},
6};
7
8use super::{vec3d, Vec2f, Vec3d, Vec4f};
9
10#[derive(Clone, Copy, PartialEq, Debug)]
11pub struct Vec3f {
12 x: f32,
13 y: f32,
14 z: f32,
15}
16
17pub fn vec3f(x: f32, y: f32, z: f32) -> Vec3f {
18 Vec3f::new(x, y, z)
19}
20
21impl Display for Vec3f {
22 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
23 write!(f, "Vec3f(x: {}, y: {}, z: {})", self.x, self.y, self.z)
24 }
25}
26
27impl Default for Vec3f {
28 fn default() -> Self {
29 Self::new(0.0, 0.0, 0.0)
30 }
31}
32
33impl Add<Vec3f> for Vec3f {
34 type Output = Vec3f;
35
36 fn add(self, rhs: Vec3f) -> Self::Output {
37 Vec3f::new(self.x + rhs.x, self.y + rhs.y, self.z + rhs.z)
38 }
39}
40
41impl Add<f32> for Vec3f {
42 type Output = Vec3f;
43
44 fn add(self, rhs: f32) -> Self::Output {
45 Vec3f::new(self.x + rhs, self.y + rhs, self.z + rhs)
46 }
47}
48
49impl Add<Vec3f> for f32 {
50 type Output = Vec3f;
51
52 fn add(self, rhs: Vec3f) -> Self::Output {
53 Vec3f::new(self + rhs.x, self + rhs.y, self + rhs.z)
54 }
55}
56
57impl AddAssign<Vec3f> for Vec3f {
58 fn add_assign(&mut self, rhs: Vec3f) {
59 self.x += rhs.x;
60 self.y += rhs.y;
61 self.z += rhs.z;
62 }
63}
64
65impl AddAssign<f32> for Vec3f {
66 fn add_assign(&mut self, rhs: f32) {
67 self.x += rhs;
68 self.y += rhs;
69 self.z += rhs;
70 }
71}
72
73impl Sub<Vec3f> for Vec3f {
74 type Output = Vec3f;
75
76 fn sub(self, rhs: Vec3f) -> Self::Output {
77 Vec3f::new(self.x - rhs.x, self.y - rhs.y, self.z - rhs.z)
78 }
79}
80
81impl Sub<f32> for Vec3f {
82 type Output = Vec3f;
83
84 fn sub(self, rhs: f32) -> Self::Output {
85 Vec3f::new(self.x - rhs, self.y - rhs, self.z - rhs)
86 }
87}
88
89impl Sub<Vec3f> for f32 {
90 type Output = Vec3f;
91
92 fn sub(self, rhs: Vec3f) -> Self::Output {
93 Vec3f::new(self - rhs.x, self - rhs.y, self - rhs.z)
94 }
95}
96
97impl SubAssign<Vec3f> for Vec3f {
98 fn sub_assign(&mut self, rhs: Vec3f) {
99 self.x -= rhs.x;
100 self.y -= rhs.y;
101 self.z -= rhs.z;
102 }
103}
104
105impl SubAssign<f32> for Vec3f {
106 fn sub_assign(&mut self, rhs: f32) {
107 self.x -= rhs;
108 self.y -= rhs;
109 self.z -= rhs;
110 }
111}
112
113impl Mul<Vec3f> for Vec3f {
114 type Output = Vec3f;
115
116 fn mul(self, rhs: Vec3f) -> Self::Output {
117 Vec3f::new(self.x * rhs.x, self.y * rhs.y, self.z * rhs.z)
118 }
119}
120
121impl Mul<f32> for Vec3f {
122 type Output = Vec3f;
123
124 fn mul(self, rhs: f32) -> Self::Output {
125 Vec3f::new(self.x * rhs, self.y * rhs, self.z * rhs)
126 }
127}
128
129impl Mul<Vec3f> for f32 {
130 type Output = Vec3f;
131
132 fn mul(self, rhs: Vec3f) -> Self::Output {
133 Vec3f::new(self * rhs.x, self * rhs.y, self * rhs.z)
134 }
135}
136
137impl MulAssign<Vec3f> for Vec3f {
138 fn mul_assign(&mut self, rhs: Vec3f) {
139 self.x *= rhs.x;
140 self.y *= rhs.y;
141 self.z *= rhs.z;
142 }
143}
144
145impl MulAssign<f32> for Vec3f {
146 fn mul_assign(&mut self, rhs: f32) {
147 self.x *= rhs;
148 self.y *= rhs;
149 self.z *= rhs;
150 }
151}
152
153impl Div<Vec3f> for Vec3f {
154 type Output = Vec3f;
155
156 fn div(self, rhs: Vec3f) -> Self::Output {
157 Vec3f::new(self.x / rhs.x, self.y / rhs.y, self.z / rhs.z)
158 }
159}
160
161impl Div<f32> for Vec3f {
162 type Output = Vec3f;
163
164 fn div(self, rhs: f32) -> Self::Output {
165 Vec3f::new(self.x / rhs, self.y / rhs, self.z / rhs)
166 }
167}
168
169impl Div<Vec3f> for f32 {
170 type Output = Vec3f;
171
172 fn div(self, rhs: Vec3f) -> Self::Output {
173 Vec3f::new(self / rhs.x, self / rhs.y, self / rhs.z)
174 }
175}
176
177impl DivAssign<Vec3f> for Vec3f {
178 fn div_assign(&mut self, rhs: Vec3f) {
179 self.x /= rhs.x;
180 self.y /= rhs.y;
181 self.z /= rhs.z;
182 }
183}
184
185impl DivAssign<f32> for Vec3f {
186 fn div_assign(&mut self, rhs: f32) {
187 self.x /= rhs;
188 self.y /= rhs;
189 self.z /= rhs;
190 }
191}
192
193impl Neg for Vec3f {
194 type Output = Vec3f;
195
196 fn neg(self) -> Self::Output {
197 Self::new(-self.x, -self.y, -self.z)
198 }
199}
200
201impl Index<usize> for Vec3f {
202 type Output = f32;
203
204 fn index(&self, index: usize) -> &Self::Output {
205 match index {
206 0 => &self.x,
207 1 => &self.y,
208 2 => &self.z,
209 _ => panic!("`rmath::algebra::Vec3f::index`: index out of bounds."),
210 }
211 }
212}
213
214impl IndexMut<usize> for Vec3f {
215 fn index_mut(&mut self, index: usize) -> &mut Self::Output {
216 match index {
217 0 => &mut self.x,
218 1 => &mut self.y,
219 2 => &mut self.z,
220 _ => panic!("`rmath::algebra::Vec3f::index_mut`: index out of bounds."),
221 }
222 }
223}
224
225impl From<f32> for Vec3f {
226 fn from(v: f32) -> Self {
227 Self::new(v, v, v)
228 }
229}
230
231impl From<(f32, f32, f32)> for Vec3f {
232 fn from(v: (f32, f32, f32)) -> Self {
233 let (x, y, z) = v;
234 Self::new(x, y, z)
235 }
236}
237
238impl From<(Vec2f, f32)> for Vec3f {
239 fn from(v: (Vec2f, f32)) -> Self {
240 let (xy, z) = v;
241 let (x, y) = xy.to_tuple();
242 Self::new(x, y, z)
243 }
244}
245
246impl From<Vec4f> for Vec3f {
247 fn from(v: Vec4f) -> Self {
248 v.xyz()
249 }
250}
251
252impl Vec3f {
253 pub fn new(x: f32, y: f32, z: f32) -> Self {
254 Self { x, y, z }
255 }
256
257 pub fn one() -> Self {
258 Self::new(1.0, 1.0, 1.0)
259 }
260
261 pub fn zero() -> Self {
262 Self::new(0.0, 0.0, 0.0)
263 }
264}
265
266impl Vec3f {
267 pub fn floor(self) -> Self {
268 Self::new(self.x.floor(), self.y.floor(), self.z.floor())
269 }
270
271 pub fn ceil(self) -> Self {
272 Self::new(self.x.ceil(), self.y.ceil(), self.z.ceil())
273 }
274
275 pub fn round(self) -> Self {
276 Self::new(self.x.round(), self.y.round(), self.z.round())
277 }
278
279 pub fn trunc(self) -> Self {
280 Self::new(self.x.trunc(), self.y.trunc(), self.z.trunc())
281 }
282
283 pub fn fract(self) -> Self {
284 Self::new(self.x.fract(), self.y.fract(), self.z.fract())
285 }
286
287 pub fn abs(self) -> Self {
288 Self::new(self.x.abs(), self.y.abs(), self.z.abs())
289 }
290
291 pub fn signum(self) -> Self {
292 Self::new(self.x.signum(), self.y.signum(), self.z.signum())
293 }
294
295 pub fn powf(self, n: f32) -> Self {
296 Self::new(self.x.powf(n), self.y.powf(n), self.z.powf(n))
297 }
298
299 pub fn sqrt(self) -> Self {
300 Self::new(self.x.sqrt(), self.y.sqrt(), self.z.sqrt())
301 }
302
303 pub fn exp(self) -> Self {
304 Self::new(self.x.exp(), self.y.exp(), self.z.exp())
305 }
306
307 pub fn exp2(self) -> Self {
308 Self::new(self.x.exp2(), self.y.exp2(), self.z.exp2())
309 }
310
311 pub fn ln(self) -> Self {
312 Self::new(self.x.ln(), self.y.ln(), self.z.ln())
313 }
314
315 pub fn log(self, base: f32) -> Self {
316 Self::new(self.x.log(base), self.y.log(base), self.z.log(base))
317 }
318
319 pub fn log2(self) -> Self {
320 Self::new(self.x.log2(), self.y.log2(), self.z.log2())
321 }
322
323 pub fn log10(self) -> Self {
324 Self::new(self.x.log10(), self.y.log10(), self.z.log10())
325 }
326
327 pub fn cbrt(self) -> Self {
328 Self::new(self.x.cbrt(), self.y.cbrt(), self.z.cbrt())
329 }
330
331 pub fn sin(self) -> Self {
332 Self::new(self.x.sin(), self.y.sin(), self.z.sin())
333 }
334
335 pub fn cos(self) -> Self {
336 Self::new(self.x.cos(), self.y.cos(), self.z.cos())
337 }
338
339 pub fn tan(self) -> Self {
340 Self::new(self.x.tan(), self.y.tan(), self.z.tan())
341 }
342
343 pub fn sin_cos(self) -> (Self, Self) {
344 (self.sin(), self.cos())
345 }
346
347 pub fn lerp(self, rhs: Self, s: f32) -> Self {
348 self + (rhs - self) * s
349 }
350
351 pub fn lerp_vec(self, rhs: Self, s: Self) -> Self {
352 self + (rhs - self) * s
353 }
354
355 pub fn is_nan(self) -> bool {
356 self.x.is_nan() || self.y.is_nan() || self.z.is_nan()
357 }
358
359 pub fn is_infinite(self) -> bool {
360 self.x.is_infinite() || self.y.is_infinite() || self.z.is_infinite()
361 }
362
363 pub fn is_finite(self) -> bool {
364 self.x.is_finite() && self.y.is_finite() && self.z.is_finite()
365 }
366
367 pub fn recip(self) -> Self {
368 Self::new(self.x.recip(), self.y.recip(), self.z.recip())
369 }
370
371 pub fn max(self, rhs: Self) -> Self {
372 Self::new(self.x.max(rhs.x), self.y.max(rhs.y), self.z.max(rhs.z))
373 }
374
375 pub fn min(self, rhs: Self) -> Self {
376 Self::new(self.x.min(rhs.x), self.y.min(rhs.y), self.z.min(rhs.z))
377 }
378
379 pub fn clamp(self, min: Self, max: Self) -> Self {
380 ruby_assert!(min.x <= max.x);
381 ruby_assert!(min.y <= max.y);
382 ruby_assert!(min.z <= max.z);
383
384 self.min(max).max(min)
385 }
386
387 pub fn saturate(self) -> Self {
388 self.clamp(Self::zero(), Self::one())
389 }
390
391 pub fn min_element(self) -> f32 {
392 self.x.min(self.y).min(self.z)
393 }
394
395 pub fn max_element(self) -> f32 {
396 self.x.max(self.y).max(self.z)
397 }
398}
399
400impl Vec3f {
401 pub fn dot(self, rhs: Self) -> f32 {
402 self.x * rhs.x + self.y * rhs.y + self.z * rhs.z
403 }
404
405 pub fn cross(self, rhs: Self) -> Self {
406 Self::new(
407 self.y * rhs.z - self.z * rhs.y,
408 self.z * rhs.x - self.x * rhs.z,
409 self.x * rhs.y - self.y * rhs.x,
410 )
411 }
412
413 pub fn length(self) -> f32 {
414 self.dot(self).sqrt()
415 }
416
417 pub fn length_squared(self) -> f32 {
418 self.dot(self)
419 }
420
421 pub fn length_recip(self) -> f32 {
422 self.length().recip()
423 }
424
425 pub fn distance(self, rhs: Self) -> f32 {
426 (rhs - self).length()
427 }
428
429 pub fn distance_squared(self, rhs: Self) -> f32 {
430 (rhs - self).length_squared()
431 }
432
433 pub fn normalize(self) -> Self {
434 let normalized = self * self.length_recip();
435 ruby_assert!(normalized.is_finite());
436 normalized
437 }
438
439 pub fn try_normalize(self) -> Option<Self> {
440 let recip = self.length_recip();
441 if recip.is_finite() && recip > 0.0 {
442 Some(self * recip)
443 } else {
444 None
445 }
446 }
447
448 pub fn normalize_or_zero(self) -> Self {
449 let recip = self.length_recip();
450 if recip.is_finite() && recip > 0.0 {
451 self * recip
452 } else {
453 Self::zero()
454 }
455 }
456
457 pub fn is_normalized(self) -> bool {
458 (self.length_squared() - 1.0f32).abs() < f32::EPSILON
459 }
460
461 pub fn angle_between(self, rhs: Self) -> f32 {
462 self.dot(rhs)
463 .div(self.length_squared().mul(rhs.length_squared()).sqrt())
464 .acos()
465 }
466}
467
468impl Vec3f {
469 pub fn to_array(self) -> [f32; 3] {
470 [self.x, self.y, self.z]
471 }
472
473 pub fn to_tuple(self) -> (f32, f32, f32) {
474 (self.x, self.y, self.z)
475 }
476
477 pub fn to_vec3d(self) -> Vec3d {
478 vec3d(self.x as f64, self.y as f64, self.z as f64)
479 }
480
481 pub fn to_homogeneous_coord_point(self) -> Vec4f {
482 Vec4f::from((self, 1.0))
483 }
484
485 pub fn to_homogeneous_coord_vector(self) -> Vec4f {
486 Vec4f::from((self, 0.0))
487 }
488}
489
490impl Vec3f {
491 pub fn x(self) -> f32 {
492 self.x
493 }
494
495 pub fn y(self) -> f32 {
496 self.y
497 }
498
499 pub fn z(self) -> f32 {
500 self.z
501 }
502
503 pub fn xx(self) -> Vec2f {
504 Vec2f::new(self.x, self.x)
505 }
506
507 pub fn xy(self) -> Vec2f {
508 Vec2f::new(self.x, self.y)
509 }
510
511 pub fn xz(self) -> Vec2f {
512 Vec2f::new(self.x, self.z)
513 }
514
515 pub fn yx(self) -> Vec2f {
516 Vec2f::new(self.y, self.x)
517 }
518
519 pub fn yy(self) -> Vec2f {
520 Vec2f::new(self.y, self.y)
521 }
522
523 pub fn yz(self) -> Vec2f {
524 Vec2f::new(self.y, self.z)
525 }
526
527 pub fn zx(self) -> Vec2f {
528 Vec2f::new(self.z, self.x)
529 }
530
531 pub fn zy(self) -> Vec2f {
532 Vec2f::new(self.z, self.y)
533 }
534
535 pub fn zz(self) -> Vec2f {
536 Vec2f::new(self.z, self.z)
537 }
538
539 pub fn xxx(self) -> Self {
540 Self::new(self.x, self.x, self.x)
541 }
542
543 pub fn xxy(self) -> Self {
544 Self::new(self.x, self.x, self.y)
545 }
546
547 pub fn xxz(self) -> Self {
548 Self::new(self.x, self.x, self.z)
549 }
550
551 pub fn xyx(self) -> Self {
552 Self::new(self.x, self.y, self.x)
553 }
554
555 pub fn xyy(self) -> Self {
556 Self::new(self.x, self.y, self.y)
557 }
558
559 pub fn xyz(self) -> Self {
560 Self::new(self.x, self.y, self.z)
561 }
562
563 pub fn xzx(self) -> Self {
564 Self::new(self.x, self.z, self.x)
565 }
566
567 pub fn xzy(self) -> Self {
568 Self::new(self.x, self.z, self.y)
569 }
570
571 pub fn xzz(self) -> Self {
572 Self::new(self.x, self.z, self.z)
573 }
574
575 pub fn yxx(self) -> Self {
576 Self::new(self.y, self.x, self.x)
577 }
578
579 pub fn yxy(self) -> Self {
580 Self::new(self.y, self.x, self.y)
581 }
582
583 pub fn yxz(self) -> Self {
584 Self::new(self.y, self.x, self.z)
585 }
586
587 pub fn yyx(self) -> Self {
588 Self::new(self.y, self.y, self.x)
589 }
590
591 pub fn yyy(self) -> Self {
592 Self::new(self.y, self.y, self.y)
593 }
594
595 pub fn yyz(self) -> Self {
596 Self::new(self.y, self.y, self.z)
597 }
598
599 pub fn yzx(self) -> Self {
600 Self::new(self.y, self.z, self.x)
601 }
602
603 pub fn yzy(self) -> Self {
604 Self::new(self.y, self.z, self.y)
605 }
606
607 pub fn yzz(self) -> Self {
608 Self::new(self.y, self.z, self.z)
609 }
610
611 pub fn zxx(self) -> Self {
612 Self::new(self.z, self.x, self.x)
613 }
614
615 pub fn zxy(self) -> Self {
616 Self::new(self.z, self.x, self.y)
617 }
618
619 pub fn zxz(self) -> Self {
620 Self::new(self.z, self.x, self.z)
621 }
622
623 pub fn zyx(self) -> Self {
624 Self::new(self.z, self.y, self.x)
625 }
626
627 pub fn zyy(self) -> Self {
628 Self::new(self.z, self.y, self.y)
629 }
630
631 pub fn zyz(self) -> Self {
632 Self::new(self.z, self.y, self.z)
633 }
634
635 pub fn zzx(self) -> Self {
636 Self::new(self.z, self.z, self.x)
637 }
638
639 pub fn zzy(self) -> Self {
640 Self::new(self.z, self.z, self.y)
641 }
642
643 pub fn zzz(self) -> Self {
644 Self::new(self.z, self.z, self.z)
645 }
646
647 pub fn xxxx(self) -> Vec4f {
648 Vec4f::new(self.x, self.x, self.x, self.x)
649 }
650
651 pub fn xxxy(self) -> Vec4f {
652 Vec4f::new(self.x, self.x, self.x, self.y)
653 }
654
655 pub fn xxxz(self) -> Vec4f {
656 Vec4f::new(self.x, self.x, self.x, self.z)
657 }
658
659 pub fn xxyx(self) -> Vec4f {
660 Vec4f::new(self.x, self.x, self.y, self.x)
661 }
662
663 pub fn xxyy(self) -> Vec4f {
664 Vec4f::new(self.x, self.x, self.y, self.y)
665 }
666
667 pub fn xxyz(self) -> Vec4f {
668 Vec4f::new(self.x, self.x, self.y, self.z)
669 }
670
671 pub fn xxzx(self) -> Vec4f {
672 Vec4f::new(self.x, self.x, self.z, self.x)
673 }
674
675 pub fn xxzy(self) -> Vec4f {
676 Vec4f::new(self.x, self.x, self.z, self.y)
677 }
678
679 pub fn xxzz(self) -> Vec4f {
680 Vec4f::new(self.x, self.x, self.z, self.z)
681 }
682
683 pub fn xyxx(self) -> Vec4f {
684 Vec4f::new(self.x, self.y, self.x, self.x)
685 }
686
687 pub fn xyxy(self) -> Vec4f {
688 Vec4f::new(self.x, self.y, self.x, self.y)
689 }
690
691 pub fn xyxz(self) -> Vec4f {
692 Vec4f::new(self.x, self.y, self.x, self.z)
693 }
694
695 pub fn xyyx(self) -> Vec4f {
696 Vec4f::new(self.x, self.y, self.y, self.x)
697 }
698
699 pub fn xyyy(self) -> Vec4f {
700 Vec4f::new(self.x, self.y, self.y, self.y)
701 }
702
703 pub fn xyyz(self) -> Vec4f {
704 Vec4f::new(self.x, self.y, self.y, self.z)
705 }
706
707 pub fn xyzx(self) -> Vec4f {
708 Vec4f::new(self.x, self.y, self.z, self.x)
709 }
710
711 pub fn xyzy(self) -> Vec4f {
712 Vec4f::new(self.x, self.y, self.z, self.y)
713 }
714
715 pub fn xyzz(self) -> Vec4f {
716 Vec4f::new(self.x, self.y, self.z, self.z)
717 }
718
719 pub fn xzxx(self) -> Vec4f {
720 Vec4f::new(self.x, self.z, self.x, self.x)
721 }
722
723 pub fn xzxy(self) -> Vec4f {
724 Vec4f::new(self.x, self.z, self.x, self.y)
725 }
726
727 pub fn xzxz(self) -> Vec4f {
728 Vec4f::new(self.x, self.z, self.x, self.z)
729 }
730
731 pub fn xzyx(self) -> Vec4f {
732 Vec4f::new(self.x, self.z, self.y, self.x)
733 }
734
735 pub fn xzyy(self) -> Vec4f {
736 Vec4f::new(self.x, self.z, self.y, self.y)
737 }
738
739 pub fn xzyz(self) -> Vec4f {
740 Vec4f::new(self.x, self.z, self.y, self.z)
741 }
742
743 pub fn xzzx(self) -> Vec4f {
744 Vec4f::new(self.x, self.z, self.z, self.x)
745 }
746
747 pub fn xzzy(self) -> Vec4f {
748 Vec4f::new(self.x, self.z, self.z, self.y)
749 }
750
751 pub fn xzzz(self) -> Vec4f {
752 Vec4f::new(self.x, self.z, self.z, self.z)
753 }
754
755 pub fn yxxx(self) -> Vec4f {
756 Vec4f::new(self.y, self.x, self.x, self.x)
757 }
758
759 pub fn yxxy(self) -> Vec4f {
760 Vec4f::new(self.y, self.x, self.x, self.y)
761 }
762
763 pub fn yxxz(self) -> Vec4f {
764 Vec4f::new(self.y, self.x, self.x, self.z)
765 }
766
767 pub fn yxyx(self) -> Vec4f {
768 Vec4f::new(self.y, self.x, self.y, self.x)
769 }
770
771 pub fn yxyy(self) -> Vec4f {
772 Vec4f::new(self.y, self.x, self.y, self.y)
773 }
774
775 pub fn yxyz(self) -> Vec4f {
776 Vec4f::new(self.y, self.x, self.y, self.z)
777 }
778
779 pub fn yxzx(self) -> Vec4f {
780 Vec4f::new(self.y, self.x, self.z, self.x)
781 }
782
783 pub fn yxzy(self) -> Vec4f {
784 Vec4f::new(self.y, self.x, self.z, self.y)
785 }
786
787 pub fn yxzz(self) -> Vec4f {
788 Vec4f::new(self.y, self.x, self.z, self.z)
789 }
790
791 pub fn yyxx(self) -> Vec4f {
792 Vec4f::new(self.y, self.y, self.x, self.x)
793 }
794
795 pub fn yyxy(self) -> Vec4f {
796 Vec4f::new(self.y, self.y, self.x, self.y)
797 }
798
799 pub fn yyxz(self) -> Vec4f {
800 Vec4f::new(self.y, self.y, self.x, self.z)
801 }
802
803 pub fn yyyx(self) -> Vec4f {
804 Vec4f::new(self.y, self.y, self.y, self.x)
805 }
806
807 pub fn yyyy(self) -> Vec4f {
808 Vec4f::new(self.y, self.y, self.y, self.y)
809 }
810
811 pub fn yyyz(self) -> Vec4f {
812 Vec4f::new(self.y, self.y, self.y, self.z)
813 }
814
815 pub fn yyzx(self) -> Vec4f {
816 Vec4f::new(self.y, self.y, self.z, self.x)
817 }
818
819 pub fn yyzy(self) -> Vec4f {
820 Vec4f::new(self.y, self.y, self.z, self.y)
821 }
822
823 pub fn yyzz(self) -> Vec4f {
824 Vec4f::new(self.y, self.y, self.z, self.z)
825 }
826
827 pub fn yzxx(self) -> Vec4f {
828 Vec4f::new(self.y, self.z, self.x, self.x)
829 }
830
831 pub fn yzxy(self) -> Vec4f {
832 Vec4f::new(self.y, self.z, self.x, self.y)
833 }
834
835 pub fn yzxz(self) -> Vec4f {
836 Vec4f::new(self.y, self.z, self.x, self.z)
837 }
838
839 pub fn yzyx(self) -> Vec4f {
840 Vec4f::new(self.y, self.z, self.y, self.x)
841 }
842
843 pub fn yzyy(self) -> Vec4f {
844 Vec4f::new(self.y, self.z, self.y, self.y)
845 }
846
847 pub fn yzyz(self) -> Vec4f {
848 Vec4f::new(self.y, self.z, self.y, self.z)
849 }
850
851 pub fn yzzx(self) -> Vec4f {
852 Vec4f::new(self.y, self.z, self.z, self.x)
853 }
854
855 pub fn yzzy(self) -> Vec4f {
856 Vec4f::new(self.y, self.z, self.z, self.y)
857 }
858
859 pub fn yzzz(self) -> Vec4f {
860 Vec4f::new(self.y, self.z, self.z, self.z)
861 }
862
863 pub fn zxxx(self) -> Vec4f {
864 Vec4f::new(self.z, self.x, self.x, self.x)
865 }
866
867 pub fn zxxy(self) -> Vec4f {
868 Vec4f::new(self.z, self.x, self.x, self.y)
869 }
870
871 pub fn zxxz(self) -> Vec4f {
872 Vec4f::new(self.z, self.x, self.x, self.z)
873 }
874
875 pub fn zxyx(self) -> Vec4f {
876 Vec4f::new(self.z, self.x, self.y, self.x)
877 }
878
879 pub fn zxyy(self) -> Vec4f {
880 Vec4f::new(self.z, self.x, self.y, self.y)
881 }
882
883 pub fn zxyz(self) -> Vec4f {
884 Vec4f::new(self.z, self.x, self.y, self.z)
885 }
886
887 pub fn zxzx(self) -> Vec4f {
888 Vec4f::new(self.z, self.x, self.z, self.x)
889 }
890
891 pub fn zxzy(self) -> Vec4f {
892 Vec4f::new(self.z, self.x, self.z, self.y)
893 }
894
895 pub fn zxzz(self) -> Vec4f {
896 Vec4f::new(self.z, self.x, self.z, self.z)
897 }
898
899 pub fn zyxx(self) -> Vec4f {
900 Vec4f::new(self.z, self.y, self.x, self.x)
901 }
902
903 pub fn zyxy(self) -> Vec4f {
904 Vec4f::new(self.z, self.y, self.x, self.y)
905 }
906
907 pub fn zyxz(self) -> Vec4f {
908 Vec4f::new(self.z, self.y, self.x, self.z)
909 }
910
911 pub fn zyyx(self) -> Vec4f {
912 Vec4f::new(self.z, self.y, self.y, self.x)
913 }
914
915 pub fn zyyy(self) -> Vec4f {
916 Vec4f::new(self.z, self.y, self.y, self.y)
917 }
918
919 pub fn zyyz(self) -> Vec4f {
920 Vec4f::new(self.z, self.y, self.y, self.z)
921 }
922
923 pub fn zyzx(self) -> Vec4f {
924 Vec4f::new(self.z, self.y, self.z, self.x)
925 }
926
927 pub fn zyzy(self) -> Vec4f {
928 Vec4f::new(self.z, self.y, self.z, self.y)
929 }
930
931 pub fn zyzz(self) -> Vec4f {
932 Vec4f::new(self.z, self.y, self.z, self.z)
933 }
934
935 pub fn zzxx(self) -> Vec4f {
936 Vec4f::new(self.z, self.z, self.x, self.x)
937 }
938
939 pub fn zzxy(self) -> Vec4f {
940 Vec4f::new(self.z, self.z, self.x, self.y)
941 }
942
943 pub fn zzxz(self) -> Vec4f {
944 Vec4f::new(self.z, self.z, self.x, self.z)
945 }
946
947 pub fn zzyx(self) -> Vec4f {
948 Vec4f::new(self.z, self.z, self.y, self.x)
949 }
950
951 pub fn zzyy(self) -> Vec4f {
952 Vec4f::new(self.z, self.z, self.y, self.y)
953 }
954
955 pub fn zzyz(self) -> Vec4f {
956 Vec4f::new(self.z, self.z, self.y, self.z)
957 }
958
959 pub fn zzzx(self) -> Vec4f {
960 Vec4f::new(self.z, self.z, self.z, self.x)
961 }
962
963 pub fn zzzy(self) -> Vec4f {
964 Vec4f::new(self.z, self.z, self.z, self.y)
965 }
966
967 pub fn zzzz(self) -> Vec4f {
968 Vec4f::new(self.z, self.z, self.z, self.z)
969 }
970}