#[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

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

This is a pipe with an outer_radius and a thickness

§

IBeam

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

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

§

BoxBeam

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

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

§

Rod

Fields

§radius: Length

Radius of the road

§center_of_gravity: (Length, Length)

Coordinates of center of gravity

This is a rod with a radius only

§

Rectangle

Fields

§width: Length

Width of the rectangle

§height: Length

Height of the rectangle

§center_of_gravity: (Length, Length)

Coordinates of center of gravity

This is a solid rectangular with width and height

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 copy of the value. Read more
1.0.0 · source§

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 Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

const: unstable · 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<T> for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for Twhere T: Clone,

§

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 Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.