pyvale.render.rasterops module

Private rasterisation helpers used by 2D planar deformation renderers.

calculate_edge_function(point_a, point_b, point_c)[source]

Evaluate the signed two dimensional edge function.

Parameters:
  • point_a (np.ndarray) – First vertex coordinate array with shape (2,) and dtype float64 representing (X, Y).

  • point_b (np.ndarray) – Second vertex coordinate array with shape (2,) and dtype float64 representing (X, Y).

  • point_c (np.ndarray) – Evaluation point coordinate array with shape (2,) or (2, N) and dtype float64 representing (X, Y).

Returns:

np.ndarray – Signed edge function value(s) with dtype float64.

calculate_elem_bound_box_high(coord_max, image_px)[source]

Calculate upper pixel bounds for an element.

Parameters:
  • coord_max (np.ndarray) – Maximum coordinate array with shape (2,) and dtype float64 representing (max_x, max_y).

  • image_px (int) – Maximum image dimension in pixels.

Returns:

np.ndarray – Upper pixel bounding box array with shape (2,) and dtype int32 clamped to image_px.

calculate_elem_bound_box_low(coord_min)[source]

Calculate non negative lower pixel bounds for an element.

Parameters:

coord_min (np.ndarray) – Minimum coordinate array with shape (2,) and dtype float64 representing (min_x, min_y).

Returns:

np.ndarray – Lower pixel bounding box array with shape (2,) and dtype int32 clamped to a minimum of 0.

format_image_number(image_number, width)[source]

Format an image index with leading zeroes.

Parameters:
  • image_number (int) – Zero based image index.

  • width (int) – Total character width for zero padding.

Returns:

str – Zero padded image number string.