memea::gds

Function compute_enc

Source
fn compute_enc(
    elems: &Vec<GdsElement>,
    w: Float,
    h: Float,
    units: f64,
    verbose: bool,
) -> Result<(Float, Float), MemeaError>
Expand description

Computes enclosure requirements from GDS geometry elements.

This function analyzes the boundary polygons in a GDS cell to determine the enclosure margins needed around the core component dimensions. It calculates the bounding box of all geometry and computes the difference between the total span and the core dimensions.

§Arguments

  • elems - Vector of GDS elements containing boundary polygons
  • w - Core component width in micrometers
  • h - Core component height in micrometers
  • units - GDS unit conversion factor (database units to meters)
  • verbose - Whether to print detailed computation information

§Returns

  • Ok((enc_x, enc_y)) - Horizontal and vertical enclosure margins
  • Err(MemeaError) - Error if no valid geometry is found