Enum StructuralShape

Source
#[non_exhaustive]
pub enum StructuralShape { Pipe { outer_radius: Length, thickness: Length, center_of_gravity: (Length, Length), }, IBeam { width: Length, height: Length, web_thickness: Length, flange_thickness: Length, center_of_gravity: (Length, Length), }, BoxBeam { width: Length, height: Length, thickness: Length, center_of_gravity: (Length, Length), }, Rod { radius: Length, center_of_gravity: (Length, Length), }, Rectangle { width: Length, height: Length, center_of_gravity: (Length, Length), }, }
Expand description

This enum contains different structural shapes

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

Pipe

This is a pipe with an outer_radius and a thickness

Fields

§outer_radius: Length

Outer radius of hte pipe

§thickness: Length

Thickness of the pipe wall

§center_of_gravity: (Length, Length)

Coordinates of center of gravity

§

IBeam

This is an I-Beam, with a width, height, web thickness, and flange thickness

Fields

§width: Length

Width of the beam

§height: Length

Height of the beam

§web_thickness: Length

Thickness of the web

§flange_thickness: Length

Thickness of the flange

§center_of_gravity: (Length, Length)

Coordinates of center of gravity

§

BoxBeam

This is a box beam with a width, height, and thickness

Fields

§width: Length

Width of the box beam

§height: Length

Height of the box beam

§thickness: Length

Thickness of the wall

§center_of_gravity: (Length, Length)

Coordinates of center of gravity

§

Rod

This is a rod with a radius only

Fields

§radius: Length

Radius of the road

§center_of_gravity: (Length, Length)

Coordinates of center of gravity

§

Rectangle

This is a solid rectangular with width and height

Fields

§width: Length

Width of the rectangle

§height: Length

Height of the rectangle

§center_of_gravity: (Length, Length)

Coordinates of center of gravity

Implementations§

Source§

impl StructuralShape

Source

pub fn new_rod(radius: f64) -> StructuralShape

Make a new rod without COG

let shape = StructuralShape::new_rod(2.0);
Source

pub fn new_pipe(radius: f64, thickness: f64) -> StructuralShape

Make a new pipe without COG

let shape = StructuralShape::new_pipe(2.0, 0.15);
Source

pub fn new_rectangle(height: f64, width: f64) -> StructuralShape

Make a new rectangle without COG

let shape = StructuralShape::new_rectangle(2.0, 2.0);
Source

pub fn new_boxbeam(height: f64, width: f64, thickness: f64) -> StructuralShape

Make a new boxbeam without COG

let shape = StructuralShape::new_boxbeam(2.0, 2.0, 0.15);
Source

pub fn new_ibeam( height: f64, width: f64, web_thickness: f64, flange_thickness: f64, ) -> StructuralShape

Make a new Ibeam without COG

let shape = StructuralShape::new_ibeam(2.0, 2.0, 0.15, 0.15);
Source

pub fn moi_x(&self) -> Quantity<ISQ<P4, Z0, Z0, Z0, Z0, Z0, Z0>, SI<f64>, f64>

This function returns the moment of inertia of the structural shape around the x-axis

let shape = StructuralShape::new_rod(2.0);
let moi = shape.moi_x();
Source

pub fn moi_y(&self) -> Quantity<ISQ<P4, Z0, Z0, Z0, Z0, Z0, Z0>, SI<f64>, f64>

This function returns the moment of inertia of hte structural shape around the y-axis

let shape = StructuralShape::new_rod(2.0);
let area = shape.moi_y();
Source

pub fn polar_moi( &self, ) -> Quantity<ISQ<P4, Z0, Z0, Z0, Z0, Z0, Z0>, SI<f64>, f64>

This function returns the polar moment of inertia of the composite shape about the origin.

let shape = StructuralShape::new_rod(2.0);
let area = shape.polar_moi();
Source

pub fn area(&self) -> Area

This function returns the cross-sectional area of the structural shape

let shape = StructuralShape::new_rod(2.0);
let area = shape.area();
Source

pub fn with_cog(&mut self, x: f64, y: f64) -> StructuralShape

A function to set the center of gravity of a shape

let shape = StructuralShape::new_rod(2.0).with_cog(0.0, 0.0);
let moi = shape.moi_x();

Trait Implementations§

Source§

impl Clone for StructuralShape

Source§

fn clone(&self) -> StructuralShape

Returns a duplicate of the value. Read more
1.0.0 · Source§

const fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for StructuralShape

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Copy for StructuralShape

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.