use crate::geometry::{Point, Polygon};
use crate::material::{Material, MaterialGroup};
use crate::section::Section;
use crate::section_library::{ParametricSection, rectangle_polygon};
use std::f64::consts::PI;
#[derive(Debug, Clone)]
pub struct CompositeSection {
pub outer: Polygon,
pub holes: Vec<Polygon>,
pub extra_outers: Vec<Polygon>,
pub material_groups: Vec<MaterialGroup>,
pub reference_material: Material,
}
impl CompositeSection {
pub fn single_material(section: Section, material: Material) -> Self {
let reference_material = material;
Self {
outer: section.outer,
holes: section.holes,
extra_outers: Vec::new(),
material_groups: vec![MaterialGroup::new(material, vec![0])],
reference_material,
}
}
pub fn new(outer: Polygon, holes: Vec<Polygon>, material_groups: Vec<MaterialGroup>) -> Self {
let reference_material = material_groups
.first()
.map(|g| g.material)
.unwrap_or_else(|| Material::default());
Self {
outer,
holes,
extra_outers: Vec::new(),
material_groups,
reference_material,
}
}
pub fn from_parametric<S: ParametricSection>(section: &S, material: Material) -> Self {
Self::single_material(section.build(), material)
}
pub fn from_components(components: Vec<(Box<dyn ParametricSection>, Point, Material)>) -> Self {
if components.is_empty() {
return Self::new(Polygon::new(vec![]), Vec::new(), Vec::new());
}
let mut outers: Vec<Polygon> = Vec::new();
let mut all_holes: Vec<Polygon> = Vec::new();
let mut region_materials: Vec<(usize, Vec<usize>, Material)> = Vec::new();
for (section, offset, material) in components {
let built = section.build();
let mut outer = built.outer;
for v in &mut outer.vertices {
v.x += offset.x;
v.y += offset.y;
}
let outer_index = outers.len();
outers.push(outer);
let mut hole_indices = Vec::new();
for mut hole in built.holes {
for v in &mut hole.vertices {
v.x += offset.x;
v.y += offset.y;
}
hole_indices.push(all_holes.len());
all_holes.push(hole);
}
region_materials.push((outer_index, hole_indices, material));
}
let reference_material = region_materials[0].2.clone();
let outer = outers.remove(0);
Self {
outer,
holes: all_holes,
extra_outers: outers,
material_groups: region_materials
.into_iter()
.map(|(_o, h, m)| MaterialGroup::new(m, h))
.collect(),
reference_material,
}
}
pub fn reference_material(&self) -> &Material {
&self.reference_material
}
pub fn modular_ratios(&self) -> Vec<f64> {
self.material_groups
.iter()
.map(|g| g.material.modular_ratio(&self.reference_material))
.collect()
}
pub fn transformed_properties(&self) -> crate::section_properties::SectionProperties {
let mut total_area = 0.0;
let mut first_moment_x = 0.0;
let mut first_moment_y = 0.0;
let mut ix = 0.0;
let mut iy = 0.0;
let mut ixy = 0.0;
if let Some(group) = self
.material_groups
.iter()
.find(|g| g.polygon_indices.contains(&0))
{
let n = group.material.modular_ratio(&self.reference_material);
let poly = &self.outer;
let signed_area = poly.signed_area() * n;
let centroid = poly.centroid();
let i_x = poly.moment_of_inertia_x() * n;
let i_y = poly.moment_of_inertia_y() * n;
let i_xy = poly.product_of_inertia_xy() * n;
total_area += signed_area;
first_moment_x += signed_area * centroid.x;
first_moment_y += signed_area * centroid.y;
ix += i_x;
iy += i_y;
ixy += i_xy;
}
for (i, hole) in self.holes.iter().enumerate() {
let poly_index = i + 1;
if let Some(group) = self
.material_groups
.iter()
.find(|g| g.polygon_indices.contains(&poly_index))
{
let n = group.material.modular_ratio(&self.reference_material);
let signed_area = hole.signed_area() * n; let centroid = hole.centroid();
let i_x = hole.moment_of_inertia_x() * n;
let i_y = hole.moment_of_inertia_y() * n;
let i_xy = hole.product_of_inertia_xy() * n;
total_area += signed_area;
first_moment_x += signed_area * centroid.x;
first_moment_y += signed_area * centroid.y;
ix += i_x;
iy += i_y;
ixy += i_xy;
}
}
for (i, extra) in self.extra_outers.iter().enumerate() {
if let Some(group) = self.material_groups.get(i + 1) {
let n = group.material.modular_ratio(&self.reference_material);
let signed_area = extra.signed_area() * n;
let centroid = extra.centroid();
let i_x = extra.moment_of_inertia_x() * n;
let i_y = extra.moment_of_inertia_y() * n;
let i_xy = extra.product_of_inertia_xy() * n;
total_area += signed_area;
first_moment_x += signed_area * centroid.x;
first_moment_y += signed_area * centroid.y;
ix += i_x;
iy += i_y;
ixy += i_xy;
}
}
assert!(
total_area.abs() > f64::EPSILON,
"Transformed section area too small"
);
let centroid = Point::new(first_moment_x / total_area, first_moment_y / total_area);
let ix_c = ix - total_area * centroid.y.powi(2);
let iy_c = iy - total_area * centroid.x.powi(2);
let ixy_c = ixy - total_area * centroid.x * centroid.y;
let max_fiber_y = self
.outer
.vertices
.iter()
.chain(self.holes.iter().flat_map(|p| p.vertices.iter()))
.chain(self.extra_outers.iter().flat_map(|p| p.vertices.iter()))
.map(|v| (v.y - centroid.y).abs())
.fold(0.0, f64::max);
let max_fiber_x = self
.outer
.vertices
.iter()
.chain(self.holes.iter().flat_map(|p| p.vertices.iter()))
.chain(self.extra_outers.iter().flat_map(|p| p.vertices.iter()))
.map(|v| (v.x - centroid.x).abs())
.fold(0.0, f64::max);
let avg = (ix_c + iy_c) * 0.5;
let diff = (ix_c - iy_c) * 0.5;
let radius = (diff * diff + ixy_c * ixy_c).sqrt();
let i11 = avg + radius;
let i22 = avg - radius;
let phi = 0.5 * (2.0 * ixy_c).atan2(ix_c - iy_c);
crate::section_properties::SectionProperties {
geometric: crate::section_properties::GeometricProperties {
area: total_area,
centroid,
ix: ix_c,
iy: iy_c,
ixy: ixy_c,
max_fiber_distance_y: max_fiber_y,
max_fiber_distance_x: max_fiber_x,
zxx_plus: ix_c / max_fiber_y.max(1e-10),
zxx_minus: ix_c / max_fiber_y.max(1e-10),
zyy_plus: iy_c / max_fiber_x.max(1e-10),
zyy_minus: iy_c / max_fiber_x.max(1e-10),
perimeter: self.outer.perimeter(),
qx: 0.0,
qy: 0.0,
ixx_g: ix_c + total_area * centroid.y.powi(2),
iyy_g: iy_c + total_area * centroid.x.powi(2),
ixy_g: ixy_c + total_area * centroid.x * centroid.y,
},
principal: crate::section_properties::PrincipalProperties {
i11,
i22,
phi,
..Default::default()
},
gyration: crate::section_properties::GyrationProperties {
rx: (ix_c / total_area).sqrt(),
ry: (iy_c / total_area).sqrt(),
r11: (i11 / total_area).sqrt(),
r22: (i22 / total_area).sqrt(),
polar: ((ix_c + iy_c) / total_area).sqrt(),
},
}
}
pub fn material_group_properties(
&self,
group_index: usize,
) -> Option<crate::section_properties::SectionProperties> {
if group_index >= self.material_groups.len() {
return None;
}
let group = &self.material_groups[group_index];
let mut area = 0.0;
let mut fx = 0.0;
let mut fy = 0.0;
let mut ix = 0.0;
let mut iy = 0.0;
let mut ixy = 0.0;
for &poly_idx in &group.polygon_indices {
let poly = if poly_idx == 0 {
&self.outer
} else if poly_idx > 0 && poly_idx <= self.holes.len() {
&self.holes[poly_idx - 1]
} else {
continue;
};
let signed_area = poly.signed_area();
let centroid = poly.centroid();
area += signed_area;
fx += signed_area * centroid.x;
fy += signed_area * centroid.y;
ix += poly.moment_of_inertia_x();
iy += poly.moment_of_inertia_y();
ixy += poly.product_of_inertia_xy();
}
if area.abs() < f64::EPSILON {
return None;
}
let centroid = Point::new(fx / area, fy / area);
let ix_c = ix - area * centroid.y.powi(2);
let iy_c = iy - area * centroid.x.powi(2);
let ixy_c = ixy - area * centroid.x * centroid.y;
let max_fiber_y = self
.outer
.vertices
.iter()
.chain(self.holes.iter().flat_map(|p| p.vertices.iter()))
.chain(self.extra_outers.iter().flat_map(|p| p.vertices.iter()))
.map(|v| (v.y - centroid.y).abs())
.fold(0.0, f64::max);
let max_fiber_x = self
.outer
.vertices
.iter()
.chain(self.holes.iter().flat_map(|p| p.vertices.iter()))
.chain(self.extra_outers.iter().flat_map(|p| p.vertices.iter()))
.map(|v| (v.x - centroid.x).abs())
.fold(0.0, f64::max);
let avg = (ix_c + iy_c) * 0.5;
let diff = (ix_c - iy_c) * 0.5;
let radius = (diff * diff + ixy_c * ixy_c).sqrt();
let i11 = avg + radius;
let i22 = avg - radius;
let phi = 0.5 * (2.0 * ixy_c).atan2(ix_c - iy_c);
Some(crate::section_properties::SectionProperties {
geometric: crate::section_properties::GeometricProperties {
area,
centroid,
ix: ix_c,
iy: iy_c,
ixy: ixy_c,
max_fiber_distance_y: max_fiber_y,
max_fiber_distance_x: max_fiber_x,
zxx_plus: ix_c / max_fiber_y.max(1e-10),
zxx_minus: ix_c / max_fiber_y.max(1e-10),
zyy_plus: iy_c / max_fiber_x.max(1e-10),
zyy_minus: iy_c / max_fiber_x.max(1e-10),
perimeter: self.outer.perimeter(),
qx: 0.0,
qy: 0.0,
ixx_g: ix_c + area * centroid.y.powi(2),
iyy_g: iy_c + area * centroid.x.powi(2),
ixy_g: ixy_c + area * centroid.x * centroid.y,
},
principal: crate::section_properties::PrincipalProperties {
i11,
i22,
phi,
..Default::default()
},
gyration: crate::section_properties::GyrationProperties {
rx: (ix_c / area).sqrt(),
ry: (iy_c / area).sqrt(),
r11: (i11 / area).sqrt(),
r22: (i22 / area).sqrt(),
polar: ((ix_c + iy_c) / area).sqrt(),
},
})
}
pub fn n_groups(&self) -> usize {
self.material_groups.len()
}
pub fn group(&self, index: usize) -> Option<&MaterialGroup> {
self.material_groups.get(index)
}
pub fn add_group(&mut self, group: MaterialGroup) {
self.material_groups.push(group);
}
}
#[derive(Debug)]
pub struct SteelConcreteComposite {
pub steel_section: Box<dyn ParametricSection>,
pub concrete_slab: CompositeSlab,
pub shear_connectors: ShearConnectorLayout,
pub construction_stage: ConstructionStage,
}
#[derive(Debug, Clone, PartialEq)]
pub struct CompositeSlab {
pub width: f64, pub thickness: f64, pub deck_thickness: f64, pub deck_orientation: DeckOrientation,
pub concrete_grade: ConcreteGrade,
pub reinforcement: Vec<RebarLayer>,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum DeckOrientation {
Parallel, Perpendicular, }
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum ConcreteGrade {
C20_25,
C25_30,
C30_37,
C35_45,
C40_50,
C45_55,
C50_60,
}
impl ConcreteGrade {
pub fn fck(&self) -> f64 {
match self {
ConcreteGrade::C20_25 => 20e6,
ConcreteGrade::C25_30 => 25e6,
ConcreteGrade::C30_37 => 30e6,
ConcreteGrade::C35_45 => 35e6,
ConcreteGrade::C40_50 => 40e6,
ConcreteGrade::C45_55 => 45e6,
ConcreteGrade::C50_60 => 50e6,
}
}
pub fn fcm(&self) -> f64 {
self.fck() + 8e6
}
pub fn ecm(&self) -> f64 {
22e3 * (self.fcm() / 10e6).powf(0.3) * 1e6 }
pub fn material(&self) -> Material {
use crate::material::Material;
Material::with_all(
self.ecm(),
self.ecm() / (2.0 * (1.0 + 0.2)),
0.2,
2400.0,
10e-6,
self.fck(),
self.fcm(),
"Concrete",
)
}
}
#[derive(Debug, Clone, Copy, PartialEq)]
pub struct RebarLayer {
pub y: f64, pub diameter: f64,
pub spacing: f64,
pub count_per_m: usize, pub material: Material,
}
#[derive(Debug, Clone, Copy, PartialEq)]
pub struct ShearConnectorLayout {
pub type_: ShearConnectorType,
pub diameter: f64,
pub height: f64,
pub spacing: f64, pub n_per_row: usize, pub material: Material,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum ShearConnectorType {
HeadedStud,
Channel,
Perfobond,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum ConstructionStage {
BareSteel,
SteelWetConcrete,
Composite,
PartialInteraction,
}
impl SteelConcreteComposite {
pub fn new(
steel_section: impl ParametricSection + 'static,
concrete_slab: CompositeSlab,
shear_connectors: ShearConnectorLayout,
) -> Self {
Self {
steel_section: Box::new(steel_section),
concrete_slab,
shear_connectors,
construction_stage: ConstructionStage::Composite,
}
}
pub fn with_stage(mut self, stage: ConstructionStage) -> Self {
self.construction_stage = stage;
self
}
pub fn effective_width(&self, span: f64, beam_spacing: f64) -> f64 {
let beff = match self.concrete_slab.deck_orientation {
DeckOrientation::Parallel => {
let b0 = span / 8.0;
(b0.min(beam_spacing)).min(self.concrete_slab.width)
}
DeckOrientation::Perpendicular => {
let b0 = span / 8.0;
(b0.min(beam_spacing / 2.0)).min(self.concrete_slab.width)
}
};
beff
}
pub fn modular_ratio(&self, long_term: bool) -> f64 {
let steel_mat = crate::material::presets::STEEL_S355;
let conc_mat = self.concrete_slab.concrete_grade.material();
let n = steel_mat.modular_ratio(&conc_mat);
if long_term {
n * 2.0
} else {
n
}
}
pub fn build_section(&self, span: f64, beam_spacing: f64) -> CompositeSection {
let beff = self.effective_width(span, beam_spacing);
let _n = self.modular_ratio(matches!(
self.construction_stage,
ConstructionStage::Composite
));
let steel_sec = self.steel_section.build();
let steel_mat = crate::material::presets::STEEL_S355;
let conc_mat = self.concrete_slab.concrete_grade.material();
let steel_props = crate::section_properties::SectionProperties::from_section(&steel_sec);
let steel_top_y = steel_props.centroid.y
+ steel_sec
.outer
.vertices
.iter()
.map(|v| v.y)
.max_by(|a, b| a.partial_cmp(b).unwrap())
.unwrap_or(0.0);
let slab_y = steel_top_y + self.concrete_slab.thickness / 2.0;
let slab_offset = Point::new(0.0, slab_y - steel_props.centroid.y);
CompositeSection::from_components(vec![
(
Box::new(self.steel_section.build()),
Point::new(0.0, 0.0),
steel_mat,
),
(
Box::new(RectangularSection {
width: beff,
height: self.concrete_slab.thickness,
}),
slab_offset,
conc_mat,
),
])
}
pub fn composite_properties(
&self,
span: f64,
beam_spacing: f64,
) -> crate::section_properties::SectionProperties {
let comp = self.build_section(span, beam_spacing);
comp.transformed_properties()
}
pub fn plastic_moment_capacity(&self, span: f64, beam_spacing: f64) -> f64 {
let props = self.composite_properties(span, beam_spacing);
let steel_mat = crate::material::presets::STEEL_S355;
let fy = steel_mat.yield_strength;
props.ix.max(props.iy) / (self.height() / 2.0) * fy
}
fn height(&self) -> f64 {
let steel_sec = self.steel_section.build();
let _steel_props = crate::section_properties::SectionProperties::from_section(&steel_sec);
steel_sec
.outer
.vertices
.iter()
.map(|v| v.y)
.max_by(|a, b| a.partial_cmp(b).unwrap())
.unwrap_or(0.0)
- steel_sec
.outer
.vertices
.iter()
.map(|v| v.y)
.min_by(|a, b| a.partial_cmp(b).unwrap())
.unwrap_or(0.0)
+ self.concrete_slab.thickness
}
}
#[derive(Debug, Clone, Copy, PartialEq)]
struct RectangularSection {
width: f64,
height: f64,
}
impl ParametricSection for RectangularSection {
fn build(&self) -> Section {
Section::new(rectangle_polygon(self.width, self.height), Vec::new())
}
fn designation(&self) -> String {
format!(
"RECT {:.0}x{:.0}",
self.width * 1000.0,
self.height * 1000.0
)
}
}
#[derive(Debug)]
pub struct TimberConcreteComposite {
pub timber_section: Box<dyn ParametricSection>,
pub concrete_slab: CompositeSlab,
pub connection: TCCConnection,
}
#[derive(Debug, Clone, Copy, PartialEq)]
pub struct TCCConnection {
pub type_: TCCConnectorType,
pub stiffness: f64, pub spacing: f64, pub n_per_row: usize,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum TCCConnectorType {
Screw,
Nail,
Dowel,
Notch,
Glue,
ShearPlate,
}
impl TimberConcreteComposite {
pub fn new(
timber_section: impl ParametricSection + 'static,
concrete_slab: CompositeSlab,
connection: TCCConnection,
) -> Self {
Self {
timber_section: Box::new(timber_section),
concrete_slab,
connection,
}
}
pub fn gamma(&self, span: f64) -> f64 {
let k = self.connection.stiffness * 1000.0; let s = self.connection.spacing;
let n = self.connection.n_per_row as f64;
let k_ser = k * n / s;
let timber_mat = crate::material::presets::TIMBER_GL24H;
let conc_mat = self.concrete_slab.concrete_grade.material();
let timber_sec = self.timber_section.build();
let timber_props = crate::section_properties::SectionProperties::from_section(&timber_sec);
let beff = self.concrete_slab.width;
let tc = self.concrete_slab.thickness;
let ei_timber = timber_mat.youngs_modulus * timber_props.ix.max(timber_props.iy);
let ei_concrete = conc_mat.youngs_modulus * beff * tc.powi(3) / 12.0;
let ei_eff = ei_timber + ei_concrete;
let gamma = 1.0 / (1.0 + (PI * PI * ei_eff) / (k_ser * span * span));
gamma.clamp(0.0, 1.0)
}
}
#[derive(Debug)]
pub struct SandwichPanel {
pub face_sheet: Box<dyn ParametricSection>,
pub core: Box<dyn ParametricSection>,
pub face_material: Material,
pub core_material: Material,
}
impl SandwichPanel {
pub fn new(
face_sheet: impl ParametricSection + 'static,
core: impl ParametricSection + 'static,
face_material: Material,
core_material: Material,
) -> Self {
Self {
face_sheet: Box::new(face_sheet),
core: Box::new(core),
face_material,
core_material,
}
}
pub fn build(&self) -> CompositeSection {
let face_sec = self.face_sheet.build();
let core_sec = self.core.build();
let face_props = crate::section_properties::SectionProperties::from_section(&face_sec);
let core_props = crate::section_properties::SectionProperties::from_section(&core_sec);
let face_offset = Point::new(0.0, core_props.centroid.y + face_props.centroid.y);
CompositeSection::from_components(vec![
(
Box::new(self.face_sheet.build()),
Point::new(0.0, face_offset.y),
self.face_material,
),
(
Box::new(self.core.build()),
Point::new(0.0, 0.0),
self.core_material,
),
(
Box::new(self.face_sheet.build()),
Point::new(0.0, -face_offset.y),
self.face_material,
),
])
}
pub fn transformed_properties(&self) -> crate::section_properties::SectionProperties {
self.build().transformed_properties()
}
pub fn bending_stiffness_d(&self, width: f64) -> f64 {
let props = self.transformed_properties();
self.face_material.youngs_modulus * props.ix * width
}
}
#[cfg(test)]
mod tests {
use super::*;
use crate::material::presets::*;
use crate::section_library::ParametricSection;
use crate::section_library::concrete::RectangularConcreteSection;
use crate::section_library::steel::ISection;
#[test]
fn composite_single_material() {
let rect = RectangularConcreteSection::new(0.3, 0.5);
let comp = CompositeSection::from_parametric(&rect, CONCRETE_C30_37);
let props = comp.transformed_properties();
assert!((props.area - 0.15).abs() < 1e-6);
}
#[test]
fn composite_steel_concrete() {
let steel = ISection::from_designation("IPE300").expect("IPE300");
let slab = CompositeSlab {
width: 1.0,
thickness: 0.15,
deck_thickness: 0.0,
deck_orientation: DeckOrientation::Perpendicular,
concrete_grade: ConcreteGrade::C30_37,
reinforcement: vec![],
};
let connectors = ShearConnectorLayout {
type_: ShearConnectorType::HeadedStud,
diameter: 0.019,
height: 0.1,
spacing: 0.3,
n_per_row: 2,
material: STEEL_S355,
};
let composite = SteelConcreteComposite::new(steel, slab, connectors)
.with_stage(ConstructionStage::Composite);
let props = composite.composite_properties(6.0, 3.0);
assert!(props.area > 0.0);
assert!(props.ix > 0.0);
}
#[test]
fn concrete_grade_properties() {
let c30 = ConcreteGrade::C30_37;
assert!((c30.fck() - 30e6).abs() < 1e-3);
assert!((c30.ecm() - 33e9).abs() < 1e9); }
#[test]
fn modular_ratio_steel_concrete() {
let steel = ISection::from_designation("IPE300").expect("IPE300");
let slab = CompositeSlab {
width: 1.0,
thickness: 0.15,
deck_thickness: 0.0,
deck_orientation: DeckOrientation::Perpendicular,
concrete_grade: ConcreteGrade::C30_37,
reinforcement: vec![],
};
let connectors = ShearConnectorLayout {
type_: ShearConnectorType::HeadedStud,
diameter: 0.019,
height: 0.1,
spacing: 0.3,
n_per_row: 2,
material: STEEL_S355,
};
let composite = SteelConcreteComposite::new(steel, slab, connectors);
let n_short = composite.modular_ratio(false);
let n_long = composite.modular_ratio(true);
assert!(n_short > 6.0 && n_short < 7.0); assert!((n_long / n_short - 2.0).abs() < 0.1);
}
#[test]
fn sandwich_panel() {
use crate::section_library::primitive::RectangularSection as PrimRect;
let face = PrimRect::new(1.0, 0.002);
let core = PrimRect::new(1.0, 0.1);
let panel = SandwichPanel::new(
face,
core,
STEEL_S355,
crate::material::presets::ALUMINUM_6061_T6,
);
let props = panel.transformed_properties();
assert!(props.area > 0.0);
assert!(props.ix > 0.0);
}
#[test]
fn transformed_single_material_matches_homogeneous() {
let rect = RectangularConcreteSection::new(0.3, 0.5);
let comp = CompositeSection::from_parametric(&rect, CONCRETE_C30_37);
let tprops = comp.transformed_properties();
let section = rect.build();
let hprops = crate::section_properties::SectionProperties::from_section(§ion);
assert!((tprops.area - hprops.area).abs() / hprops.area < 1e-6);
assert!((tprops.ix - hprops.ix).abs() / hprops.ix < 1e-6);
assert!((tprops.iy - hprops.iy).abs() / hprops.iy < 1e-6);
}
#[test]
fn transformed_area_modular_ratio() {
let concrete_poly = crate::section_library::rectangle_polygon(0.3, 0.5);
let steel_poly = crate::section_library::rectangle_polygon(0.3, 0.01);
let mut steel_shifted = steel_poly.clone();
for v in &mut steel_shifted.vertices {
v.y += 0.255; }
let _groups = vec![
MaterialGroup::new(CONCRETE_C30_37, vec![0]),
MaterialGroup::new(STEEL_S355, vec![1]),
];
let comp = CompositeSection::new(
concrete_poly,
vec![],
vec![MaterialGroup::new(CONCRETE_C30_37, vec![0])],
);
let props = comp.transformed_properties();
assert!((props.area - 0.15).abs() < 1e-6);
}
#[test]
fn transformed_steel_concrete_section() {
let i_section = ISection::new(0.2, 0.1, 0.005, 0.008, 0.0);
let steel_section = i_section.build();
let comp = CompositeSection::single_material(steel_section.clone(), STEEL_S355);
let props = comp.transformed_properties();
let original_area = steel_section.area();
assert!((props.area - original_area).abs() / original_area < 1e-6);
let orig_props = crate::section_properties::SectionProperties::from_section(&steel_section);
assert!((props.ix - orig_props.ix).abs() / orig_props.ix < 1e-6);
}
#[test]
fn transformed_centroid_shift() {
let rect = RectangularConcreteSection::new(0.3, 0.5);
let comp = CompositeSection::from_parametric(&rect, CONCRETE_C30_37);
let props = comp.transformed_properties();
assert!(props.centroid.x.abs() < 1e-6);
assert!(props.centroid.y.abs() < 1e-6);
}
}