1
Fork 0

more center spar work

This commit is contained in:
Andy Killorin 2023-11-05 15:50:04 -06:00
parent c4a6380bbd
commit e43d30dbc3
Signed by: ank
GPG key ID: B6241CA3B552BCA4
2 changed files with 17 additions and 4 deletions

View file

@ -1,3 +1,5 @@
use std::ops::Range;
use crate::WingConfig; use crate::WingConfig;
/// Constants /// Constants
@ -23,7 +25,7 @@ pub const FUSELAGE_GAP: f32 = 0.4 * IN2MM;
/// a very large number, used to place unknown objects such that they do not intersect /// a very large number, used to place unknown objects such that they do not intersect
pub const INF: f32 = 1000.0; pub const INF: f32 = 1000.0;
pub const RUDDER_HEIGHT: f32 = 5.0 * IN2MM; pub const RUDDER_HEIGHT: f32 = 5.0 * IN2MM;
pub const RUDDER_CHORD: f32 = 3.0 * IN2MM; pub const RUDDER_CHORD: f32 = 4.0 * IN2MM;
pub const RUDDER_TAPER: f32 = 0.7; pub const RUDDER_TAPER: f32 = 0.7;
pub const RUDDER_STRUTS: usize = 3; pub const RUDDER_STRUTS: usize = 3;
pub const RUDDER: WingConfig = WingConfig { pub const RUDDER: WingConfig = WingConfig {
@ -42,5 +44,6 @@ pub const ELEVATOR: WingConfig = WingConfig {
taper: ELEVATOR_TAPER, taper: ELEVATOR_TAPER,
struts: ELEVATOR_STRUTS, struts: ELEVATOR_STRUTS,
}; };
pub const MIDSPAR_RANGE: Range<f32> = 0.1..0.4;
pub const STOCK_HEIGHT: f32 = 25.0 * IN2MM; pub const STOCK_HEIGHT: f32 = 25.0 * IN2MM;
pub const STOCK_WIDTH: f32 = 37.0 * IN2MM; pub const STOCK_WIDTH: f32 = 37.0 * IN2MM;

View file

@ -176,9 +176,17 @@ fn wing(wing_airfoil: &SeligFile, wing_config: &WingConfig, spar: SparType) -> (
spar spar
}, },
SparType::Center => { SparType::Center => {
// TODO: negative in struts
// TODO: taper // TODO: taper
centered_cube(vec3(wing_config.chord * 0.5, wing_config.length, CARDBOARD_WIDTH), (false, false, true)) let mut mid_spar = scad!(Hull);
let bottom = centered_cube(vec3(wing_config.chord * (MIDSPAR_RANGE.end - MIDSPAR_RANGE.start) , CARDBOARD_WIDTH, CARDBOARD_WIDTH), (false, false, true));
let mut top = scad!(Translate(vec3(0.0, wing_config.length - CARDBOARD_WIDTH, 0.0)));
top.add_child(scad!(Scale(vec3(wing_config.taper, 1.0, 1.0)); bottom.clone()));
mid_spar.add_child(top);
mid_spar.add_child(bottom);
mid_spar = scad!(Translate(vec3(MIDSPAR_RANGE.start * wing_config.chord, 0.0, 0.0)); mid_spar);
let mut spar = scad!(Difference; mid_spar);
spar.add_child(wing.clone());
spar
}, },
}; };
@ -208,7 +216,9 @@ fn strut(airfoil: &SeligFile, chord: f32, width: f32, spar: &SparType) -> Constr
match spar { match spar {
SparType::Top => topspar_negative(airfoil, chord, 0.1..0.6), SparType::Top => topspar_negative(airfoil, chord, 0.1..0.6),
SparType::Center => { SparType::Center => {
scad!(Union) scad!(Translate2d(vec2(MIDSPAR_RANGE.start, 0.0));
centered_square(vec2(MIDSPAR_RANGE.end - MIDSPAR_RANGE.start, CARDBOARD_WIDTH/ chord), (false,true))
)
} }
SparType::None => { SparType::None => {
scad!(Union) scad!(Union)