pub struct TimeDilationRenderer {
pub c: f64,
pub show_clock_hands: bool,
pub clock_size: f32,
}Expand description
Render clocks with tick rate proportional to proper time rate.
Fields§
§c: f64§show_clock_hands: bool§clock_size: f32Implementations§
Source§impl TimeDilationRenderer
impl TimeDilationRenderer
pub fn new(c: f64) -> Self
Sourcepub fn tick_rate(&self, v: f64) -> f32
pub fn tick_rate(&self, v: f64) -> f32
Compute the apparent tick rate of a clock at velocity v. Returns a fraction of normal tick rate (0 to 1).
Sourcepub fn clock_hand_angle(&self, proper_time: f64) -> f32
pub fn clock_hand_angle(&self, proper_time: f64) -> f32
Compute the clock hand angle for a given proper time. One full rotation = 60 “seconds” of proper time.
Sourcepub fn clock_glyph_data(
&self,
center: Vec2,
proper_time: f64,
) -> (Vec<Vec2>, Vec2)
pub fn clock_glyph_data( &self, center: Vec2, proper_time: f64, ) -> (Vec<Vec2>, Vec2)
Generate glyph data for a clock face at a position. Returns positions for 12 hour markers and the hand endpoint.
Sourcepub fn render_clocks(
&self,
clocks: &[DilatedClock],
positions: &[Vec2],
) -> Vec<(Vec<Vec2>, Vec2)>
pub fn render_clocks( &self, clocks: &[DilatedClock], positions: &[Vec2], ) -> Vec<(Vec<Vec2>, Vec2)>
Render multiple clocks at different velocities.
Trait Implementations§
Source§impl Clone for TimeDilationRenderer
impl Clone for TimeDilationRenderer
Source§fn clone(&self) -> TimeDilationRenderer
fn clone(&self) -> TimeDilationRenderer
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for TimeDilationRenderer
impl RefUnwindSafe for TimeDilationRenderer
impl Send for TimeDilationRenderer
impl Sync for TimeDilationRenderer
impl Unpin for TimeDilationRenderer
impl UnsafeUnpin for TimeDilationRenderer
impl UnwindSafe for TimeDilationRenderer
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.