virtualbow icon indicating copy to clipboard operation
virtualbow copied to clipboard

Non-rectangular cross sections

Open stfnp opened this issue 4 years ago • 2 comments

Make the cross section configurable with the following new user inputs:

  • Rounding of the corners on the back
  • Rounding of the corners on the belly
  • Rounding of the back side
  • Rounding of the belly side

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.

stfnp avatar Jun 03 '21 13:06 stfnp

Prototyping repository with some python code: https://github.com/stfnp/virtualbow-cross-sections

stfnp avatar Apr 29 '22 19:04 stfnp

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);
}

stfnp avatar Sep 14 '24 16:09 stfnp