Struct chip::Ball [−][src]
pub struct 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]
impl Ballpub fn new() -> Self[src]
pub fn new() -> SelfCreates a Ball.
pub fn pos(&self) -> Point3<f32>[src]
pub fn pos(&self) -> Point3<f32>Gets the ball's position.
pub fn set_pos(&mut self, pos: Point3<f32>)[src]
pub fn set_pos(&mut self, pos: Point3<f32>)Sets the ball's position.
pub fn vel(&self) -> Vector3<f32>[src]
pub fn vel(&self) -> Vector3<f32>Gets the ball's velocity.
pub fn set_vel(&mut self, vel: Vector3<f32>)[src]
pub fn set_vel(&mut self, vel: Vector3<f32>)Sets the ball's velocity.
pub fn omega(&self) -> Vector3<f32>[src]
pub fn omega(&self) -> Vector3<f32>Gets the ball's angular velocity.
pub fn set_omega(&mut self, omega: Vector3<f32>)[src]
pub fn set_omega(&mut self, omega: Vector3<f32>)Sets the ball's angular velocity.
pub fn t(&self) -> f32[src]
pub fn t(&self) -> f32Gets the time elapsed in the simulation.
pub fn set_t(&mut self, t: f32)[src]
pub fn set_t(&mut self, t: f32)Sets the time elapsed in the simulation.
pub fn step(&mut self, dt: f32)[src]
pub fn step(&mut self, dt: f32)Simulates the next dt seconds, and updates the ball's physics values.