Abstract definition of a shape. More...
Topics | |
Basic shapes | |
Basic shapes: circle and rectangle | |
CSG (Constructive Solid Geometry) shapes | |
CSG operations: union, intersection and difference | |
Polygon shape | |
Polygonal shape (2D only) | |
Surface mesh shape | |
Shape defined by a surface mesh (3D only) | |
Abstract type shape | |
Abstract definition of a shape | |
This group provides a way to define geometric shapes with a combination of:
Example of a shape defined by CSG operations:
┌───────────┐ │ union │ └───────────┘ ╭───────╯ ╰───────╮ │ │ ┌────────────┐ ┌────────────┐ │ circle │ │ difference │ └────────────┘ └────────────┘ ╭───────╯ ╰───────╮ │ │ ┌───────────┐ ┌───────────┐ │ polygon │ │ rectangle │ └───────────┘ └───────────┘
Every shape derived from the abstract type t_shape. Any shapes implements three operations:
get_samples_inside: Check if a sample of point in a given cell lies in the shape. The sampling level is driven by the n_samples
parameter.
Example of sampling for various sampling levels:
n_samples = 0 n_samples = 1 n_samples = 2 ┏━━━━━━━┓ ×━━━×━━━× ×━×━×━×━× ┃ ┃ ┃ ┃ × × × × × ┃ × ┃ × × × × × × × × ... ┃ ┃ ┃ ┃ × × × × × ┗━━━━━━━┛ ×━━━×━━━× ×━×━×━×━×