Open stfnp opened 3 years ago
Prototyping repository with some python code: https://github.com/stfnp/virtualbow-cross-sections
Can be implemented using Greens theorem and numerical integration https://leancrew.com/all-this/2018/01/greens-theorem-and-section-properties/
use itertools::Itertools;
#[derive(Debug)]
struct AreaMoments {
A: f64,
S: f64,
I: f64
}
impl AreaMoments {
fn new(vertices: &[(f64, f64)]) -> Self{
Self {
A: vertices.iter().tuple_windows().map(|(prev, next)| (next.0 + prev.0)*(next.1 - prev.1)).sum::<f64>()/2.0,
S: vertices.iter().tuple_windows().map(|(prev, next)| (next.1.powi(2) + next.1*prev.1 + prev.1.powi(2))*(next.0 - prev.0)).sum::<f64>()/6.0,
I: vertices.iter().tuple_windows().map(|(prev, next)| (next.1.powi(2) + next.1*prev.1 + prev.1.powi(2))*(prev.0*next.1 - next.0*prev.1)).sum::<f64>()/12.0,
}
}
}
fn main() {
let rectangle = &[(0.0, 0.0), (2.0, 0.0), (2.0, 2.0), (0.0, 2.0), (0.0, 0.0)];
let moments = AreaMoments::new(rectangle);
println!("{:?}", moments);
}
Make the cross section configurable with the following new user inputs:
There should be a choice whether the inputs are absolute (e.g. edge rounding of r=5mm) or relative (e.g. rounding=10%). This way there is some flexibility with regards to how the sections change over the length of the bow.