use ifc_model::EntityId;
#[derive(Debug, Clone, PartialEq)]
#[non_exhaustive]
pub struct ProfileDescription {
pub entity: EntityId,
pub type_name: String,
pub name: Option<String>,
pub position: Option<ProfilePosition>,
pub parameters: ProfileParameters,
}
impl ProfileDescription {
pub fn bounds_area(&self) -> bool {
match &self.parameters {
ProfileParameters::ArbitraryOpen { .. } => false,
ProfileParameters::Composite { profiles, .. } => {
profiles.iter().all(ProfileDescription::bounds_area)
}
ProfileParameters::Derived { parent, .. }
| ProfileParameters::Mirrored { parent, .. } => parent.bounds_area(),
_ => true,
}
}
}
#[derive(Debug, Clone, Copy, PartialEq)]
#[non_exhaustive]
pub struct ProfilePosition {
pub origin: [f64; 2],
pub x_axis: [f64; 2],
}
impl ProfilePosition {
pub fn y_axis(&self) -> [f64; 2] {
[-self.x_axis[1], self.x_axis[0]]
}
}
#[derive(Debug, Clone, Copy, PartialEq)]
#[non_exhaustive]
pub struct ProfileOperator {
pub x_axis: [f64; 2],
pub y_axis: [f64; 2],
pub origin: [f64; 2],
}
#[derive(Debug, Clone, PartialEq)]
#[non_exhaustive]
pub enum ProfileParameters {
#[non_exhaustive]
Rectangle {
x_dim: f64,
y_dim: f64,
},
#[non_exhaustive]
RoundedRectangle {
x_dim: f64,
y_dim: f64,
rounding_radius: f64,
},
#[non_exhaustive]
RectangleHollow {
x_dim: f64,
y_dim: f64,
wall_thickness: f64,
inner_fillet_radius: Option<f64>,
outer_fillet_radius: Option<f64>,
},
#[non_exhaustive]
Circle {
radius: f64,
},
#[non_exhaustive]
CircleHollow {
radius: f64,
wall_thickness: f64,
},
#[non_exhaustive]
Ellipse {
semi_axis_1: f64,
semi_axis_2: f64,
},
#[non_exhaustive]
IShape {
overall_width: f64,
overall_depth: f64,
web_thickness: f64,
flange_thickness: f64,
fillet_radius: Option<f64>,
flange_edge_radius: Option<f64>,
flange_slope: Option<f64>,
},
#[non_exhaustive]
AsymmetricIShape {
bottom_flange_width: f64,
overall_depth: f64,
web_thickness: f64,
bottom_flange_thickness: f64,
bottom_flange_fillet_radius: Option<f64>,
top_flange_width: f64,
top_flange_thickness: Option<f64>,
top_flange_fillet_radius: Option<f64>,
bottom_flange_edge_radius: Option<f64>,
bottom_flange_slope: Option<f64>,
top_flange_edge_radius: Option<f64>,
top_flange_slope: Option<f64>,
},
#[non_exhaustive]
LShape {
depth: f64,
width: Option<f64>,
thickness: f64,
fillet_radius: Option<f64>,
edge_radius: Option<f64>,
leg_slope: Option<f64>,
},
#[non_exhaustive]
TShape {
depth: f64,
flange_width: f64,
web_thickness: f64,
flange_thickness: f64,
fillet_radius: Option<f64>,
flange_edge_radius: Option<f64>,
web_edge_radius: Option<f64>,
web_slope: Option<f64>,
flange_slope: Option<f64>,
},
#[non_exhaustive]
UShape {
depth: f64,
flange_width: f64,
web_thickness: f64,
flange_thickness: f64,
fillet_radius: Option<f64>,
edge_radius: Option<f64>,
flange_slope: Option<f64>,
},
#[non_exhaustive]
CShape {
depth: f64,
width: f64,
wall_thickness: f64,
girth: f64,
internal_fillet_radius: Option<f64>,
},
#[non_exhaustive]
ZShape {
depth: f64,
flange_width: f64,
web_thickness: f64,
flange_thickness: f64,
fillet_radius: Option<f64>,
edge_radius: Option<f64>,
},
#[non_exhaustive]
Trapezium {
bottom_x_dim: f64,
top_x_dim: f64,
y_dim: f64,
top_x_offset: f64,
},
#[non_exhaustive]
ArbitraryClosed {
outer_curve: EntityId,
},
#[non_exhaustive]
ArbitraryWithVoids {
outer_curve: EntityId,
inner_curves: Vec<EntityId>,
},
#[non_exhaustive]
ArbitraryOpen {
curve: EntityId,
},
#[non_exhaustive]
CenterLine {
curve: EntityId,
thickness: f64,
},
#[non_exhaustive]
Composite {
profiles: Vec<ProfileDescription>,
label: Option<String>,
},
#[non_exhaustive]
Derived {
parent: Box<ProfileDescription>,
operator: ProfileOperator,
label: Option<String>,
},
#[non_exhaustive]
Mirrored {
parent: Box<ProfileDescription>,
label: Option<String>,
},
}