pycvxset.common.approximate_volume_from_grid¶
- pycvxset.common.approximate_volume_from_grid(set_to_compute_area_for, area_grid_step_size)[source]¶
Estimate area of a two-dimensional set using a grid of given step size
- Parameters:
set_to_compute_area_for (Polytope | ConstrainedZonotope | Ellipsoid) – Set for which area is to be computed
area_grid_step_size (float) – Scalar step size that is constant in both dimensions
- Raises:
ValueError – When set is not 2-dimensional
- Returns:
Approximate area of the set
- Return type:
float
Notes
This function creates a 2D grid of points with a given step size, and computes the fraction of points that lie in the set. Consequently, the computed area is an approximation of the actual area of the set. The area of the bounding box is computed using the
minimum_volume_circumscribing_rectangle()
method associated with the set.