[−][src]Struct chip::Ball
A ball simulation.
Example
let mut ball = Ball::new(); ball.set_pos(Point3::new(0.0, 0.0, 100.0)); ball.set_vel(Vector3::new(300.0, 400.0, 500.0)); ball.step(1.0 / 120.0); println!("{:?}", ball.pos());
Methods
impl Ball
[src]
pub fn new() -> Self
[src]
Creates a Ball
.
pub fn pos(&self) -> Point3<f32>
[src]
Gets the ball's position.
pub fn set_pos(&mut self, pos: Point3<f32>)
[src]
Sets the ball's position.
pub fn vel(&self) -> Vector3<f32>
[src]
Gets the ball's velocity.
pub fn set_vel(&mut self, vel: Vector3<f32>)
[src]
Sets the ball's velocity.
pub fn omega(&self) -> Vector3<f32>
[src]
Gets the ball's angular velocity.
pub fn set_omega(&mut self, omega: Vector3<f32>)
[src]
Sets the ball's angular velocity.
pub fn t(&self) -> f32
[src]
Gets the time elapsed in the simulation.
pub fn set_t(&mut self, t: f32)
[src]
Sets the time elapsed in the simulation.
pub fn step(&mut self, dt: f32)
[src]
Simulates the next dt
seconds, and updates the ball's physics values.
Auto Trait Implementations
Blanket Implementations
impl<T> From for T
[src]
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Same for T
type Output = T
Should always be Self
impl<SS, SP> SupersetOf for SP where
SS: SubsetOf<SP>,
SS: SubsetOf<SP>,