pub struct Force2D {
pub x: f64,
pub y: f64,
}Expand description
A validated planar force value.
Fields§
§x: f64Horizontal force component.
y: f64Vertical force component.
Implementations§
Source§impl Force2D
impl Force2D
Sourcepub fn new(x: f64, y: f64) -> Option<Self>
pub fn new(x: f64, y: f64) -> Option<Self>
Creates a new planar force when both components are finite.
Examples found in repository?
examples/basic_usage.rs (line 14)
13fn main() {
14 let Some(force_left) = Force2D::new(100.0, 0.0) else {
15 panic!("valid force should construct");
16 };
17 let Some(force_right) = Force2D::new(-100.0, 0.0) else {
18 panic!("valid force should construct");
19 };
20
21 let Some(system) = StaticSystem2D::new(vec![force_left, force_right], vec![0.0]) else {
22 panic!("valid system should construct");
23 };
24
25 assert_eq!(system.is_equilibrium(0.0), Some(true));
26
27 let Some((left, right)) = simply_supported_point_load_reactions(10.0, 100.0, 5.0) else {
28 panic!("valid point load should produce reactions");
29 };
30
31 approx_eq(left, 50.0, 1.0e-12);
32 approx_eq(right, 50.0, 1.0e-12);
33
34 assert_eq!(
35 cantilever_end_point_load_reaction(10.0, 100.0),
36 Some(CantileverReaction {
37 vertical_reaction: 100.0,
38 fixed_end_moment: 1000.0,
39 })
40 );
41}Sourcepub fn magnitude(&self) -> Option<f64>
pub fn magnitude(&self) -> Option<f64>
Returns the magnitude of this force.
§Examples
use use_statics::Force2D;
assert_eq!(Force2D::new(3.0, 4.0).and_then(|force| force.magnitude()), Some(5.0));Sourcepub fn angle_radians(&self) -> Option<f64>
pub fn angle_radians(&self) -> Option<f64>
Returns the planar angle of this force in radians.
Trait Implementations§
impl Copy for Force2D
impl StructuralPartialEq for Force2D
Auto Trait Implementations§
impl Freeze for Force2D
impl RefUnwindSafe for Force2D
impl Send for Force2D
impl Sync for Force2D
impl Unpin for Force2D
impl UnsafeUnpin for Force2D
impl UnwindSafe for Force2D
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