Skip to main content

surface_grid

Function surface_grid 

Source
pub fn surface_grid<S: ParametricSurface>(
    surface: &S,
    u_range: (f64, f64),
    v_range: (f64, f64),
    nu: usize,
    nv: usize,
) -> Vec<Vec<Point3>>
Expand description

Sample a regular N×M grid of surface points.

Returns nu rows, each with nv points.

  • Row i corresponds to u = u_range.0 + i*(u_range.1 - u_range.0) / (nu - 1).
  • Column j corresponds to v = v_range.0 + j*(v_range.1 - v_range.0) / (nv - 1).

Edge cases:

  • If nu == 0 or nv == 0, an empty Vec is returned.
  • If nu == 1, the single row is evaluated at u_range.0.
  • If nv == 1, each row contains one point evaluated at v_range.0.