mod helpers;
mod extrusion;
mod tessellated;
mod brep;
mod surface;
mod boolean;
mod mapped;
mod swept;
mod advanced;
#[cfg(test)]
mod tests;
pub use extrusion::ExtrudedAreaSolidProcessor;
pub use tessellated::{TriangulatedFaceSetProcessor, PolygonalFaceSetProcessor};
pub use brep::{FacetedBrepProcessor, FaceBasedSurfaceModelProcessor, ShellBasedSurfaceModelProcessor};
pub use surface::SurfaceOfLinearExtrusionProcessor;
pub use boolean::BooleanClippingProcessor;
pub use mapped::MappedItemProcessor;
pub use swept::{SweptDiskSolidProcessor, RevolvedAreaSolidProcessor};
pub use advanced::AdvancedBrepProcessor;
#[inline]
fn extract_coord_index_bytes(bytes: &[u8]) -> Option<&[u8]> {
let eq_pos = bytes.iter().position(|&b| b == b'=')?;
let open_paren = bytes[eq_pos..].iter().position(|&b| b == b'(')?;
let args_start = eq_pos + open_paren + 1;
let mut depth = 1;
let mut attr_count = 0;
let mut attr_start = args_start;
let mut i = args_start;
let mut in_string = false;
while i < bytes.len() && depth > 0 {
let b = bytes[i];
if b == b'\'' {
in_string = !in_string;
i += 1;
continue;
}
if in_string {
i += 1;
continue;
}
if b == b'/' && i + 1 < bytes.len() && bytes[i + 1] == b'*' {
i += 2;
while i + 1 < bytes.len() && !(bytes[i] == b'*' && bytes[i + 1] == b'/') {
i += 1;
}
i += 2;
continue;
}
match b {
b'(' => {
if depth == 1 && attr_count == 3 {
attr_start = i;
}
depth += 1;
}
b')' => {
depth -= 1;
if depth == 1 && attr_count == 3 {
let candidate = &bytes[attr_start..i + 1];
if validate_coord_index_structure(candidate) {
return Some(candidate);
}
return None;
}
}
b',' if depth == 1 => {
attr_count += 1;
}
b'$' if depth == 1 && attr_count == 3 => {
return None;
}
_ => {}
}
i += 1;
}
None
}
#[inline]
fn validate_coord_index_structure(bytes: &[u8]) -> bool {
if bytes.is_empty() {
return false;
}
let first = bytes.first().copied();
let last = bytes.last().copied();
if first != Some(b'(') || last != Some(b')') {
return false;
}
let mut depth = 0;
for &b in bytes {
match b {
b'(' => depth += 1,
b')' => {
if depth == 0 {
return false; }
depth -= 1;
}
b'0'..=b'9' | b',' | b' ' | b'\t' | b'\n' | b'\r' | b'-' => {}
b'$' | b'\'' | b'"' | b'/' | b'*' | b'#' => {
return false;
}
_ => {
if b.is_ascii_alphabetic() {
return false;
}
}
}
}
depth == 0
}