pub struct Vec3<T: Sized + Copy> { /* private fields */ }
Implementations§
Source§impl<T: Sized + Copy> Vec3<T>
impl<T: Sized + Copy> Vec3<T>
Sourcepub fn new(x: T, y: T, z: T) -> Self
pub fn new(x: T, y: T, z: T) -> Self
Examples found in repository?
examples/points_cloud.rs (line 40)
30fn create_point_cloud() -> PointCloud {
31 let min = -10;
32 let max = 10;
33 let fov_factor = 150;
34 let mut points = Vec::<Vec3<i64>>::new();
35 let size = 2;
36
37 for x in min..max {
38 for y in min..max {
39 for z in min..max {
40 points.push(Vec3::new(x, y, z));
41 }
42 }
43 }
44
45 let camera = Camera::new(Vec3::new(0, 0, -20), Vec3::new(0, 0, 0), 90);
46
47 PointCloud::new(
48 points,
49 min,
50 max,
51 fov_factor,
52 camera,
53 Vec3::<f64>::new(0f64, 0f64, 0f64),
54 size,
55 )
56}
pub fn x(&self) -> T
pub fn y(&self) -> T
Sourcepub fn z(&self) -> T
pub fn z(&self) -> T
Examples found in repository?
examples/points_cloud.rs (line 24)
16 fn update<T: Canvas>(&mut self, canvas: &mut T) {
17 canvas.change_color(color::BLACK);
18 canvas.fill();
19
20 canvas.change_color(color::GREEN);
21 canvas.draw_shape(&mut self.point_cloud);
22
23 let rotation = self.point_cloud.rotation();
24 rotation.set_z(rotation.z() + 1f64);
25
26 return;
27 }
pub fn set_x(&mut self, x: T)
pub fn set_y(&mut self, y: T)
Sourcepub fn set_z(&mut self, z: T)
pub fn set_z(&mut self, z: T)
Examples found in repository?
examples/points_cloud.rs (line 24)
16 fn update<T: Canvas>(&mut self, canvas: &mut T) {
17 canvas.change_color(color::BLACK);
18 canvas.fill();
19
20 canvas.change_color(color::GREEN);
21 canvas.draw_shape(&mut self.point_cloud);
22
23 let rotation = self.point_cloud.rotation();
24 rotation.set_z(rotation.z() + 1f64);
25
26 return;
27 }
pub fn set(&mut self, x: T, y: T, z: T)
Trait Implementations§
impl<T: Copy + Sized + Copy> Copy for Vec3<T>
Auto Trait Implementations§
impl<T> Freeze for Vec3<T>where
T: Freeze,
impl<T> RefUnwindSafe for Vec3<T>where
T: RefUnwindSafe,
impl<T> Send for Vec3<T>where
T: Send,
impl<T> Sync for Vec3<T>where
T: Sync,
impl<T> Unpin for Vec3<T>where
T: Unpin,
impl<T> UnwindSafe for Vec3<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more