Site Shape Tools#
If the site is defined as user-provided vertices, the vertices are checked for validity.
The site shape can be defined as a variety of default shapes:
Square Site Boundary#
- hopp.simulation.technologies.sites.site_shape_tools.make_square(area_m2, x0=0.0, y0=0.0)#
Generate square polygon shape of specified area.
- Parameters:
area_m2 (float) – area of shape in square meters.
x0 (float, Optional) – left-most x coordinate of the shape. Defaults to 0.0.
y0 (float, Optional) – bottom-most x coordinate of the shape. Defaults to 0.0.
- Returns:
2-element tuple containing
poly (
shapely.geometry.Polygon): site boundary polygonvertices (2D
numpy.ndarray): vertices of site polygon. list of [x,y] coordinates in meters.
Circle Site Boundary#
- hopp.simulation.technologies.sites.site_shape_tools.make_circle(area_m2, deg_diff=5.0, x0=0.0, y0=0.0)#
Generate circle polygon shape of specified area.
- Parameters:
area_m2 (float) – area of shape in square meters.
deg_diff (float | int) – difference in degrees for generating boundary. default to 10. number of points generated is equal to
360/deg_diffx0 (float, Optional) – left-most x coordinate of the shape. Defaults to 0.0.
y0 (float, Optional) – bottom-most x coordinate of the shape. Defaults to 0.0.
- Returns:
2-element tuple containing
poly (
shapely.geometry.Polygon): site boundary polygonvertices (2D
numpy.ndarray): vertices of site polygon. list of [x,y] coordinates in meters.
Rectangle Site Boundary#
- hopp.simulation.technologies.sites.site_shape_tools.make_rectangle(area_m2, aspect_ratio=1.5, x0=0.0, y0=0.0)#
Generate rectangle polygon shape of specified area.
- Parameters:
area_m2 (float) – area of shape in square meters.
aspect_ratio (float, Optional) – ratio of width/height. Defaults to 1.5. (width corresponds to x coordinates, height corresponds to y coordinates)
x0 (float, Optional) – left-most x coordinate of the shape. Defaults to 0.0.
y0 (float, Optional) – bottom-most x coordinate of the shape. Defaults to 0.0.
- Returns:
2-element tuple containing
poly (
shapely.geometry.Polygon): site boundary polygonvertices (2D
numpy.ndarray): vertices of site polygon. list of [x,y] coordinates in meters.
Hexagon Site Boundary#
- hopp.simulation.technologies.sites.site_shape_tools.make_hexagon(area_m2, x0=0.0, y0=0.0)#
Generate hexagon polygon shape of specified area.
- Parameters:
area_m2 (float) – area of shape in square meters.
x0 (float, Optional) – left-most x coordinate of the shape. Defaults to 0.0.
y0 (float, Optional) – bottom-most x coordinate of the shape. Defaults to 0.0.
- Returns:
2-element tuple containing
poly (
shapely.geometry.Polygon): site boundary polygonvertices (2D
numpy.ndarray): vertices of site polygon. list of [x,y] coordinates in meters.
Check Site Vertices#
- hopp.simulation.technologies.sites.site_shape_tools.check_site_verts(verts)#
Check that vertices are valid and re-sort as needed.
- Parameters:
verts (2D
numpy.ndarray) – vertices of site polygon. list of [x,y] coordinates in meters.- Returns:
numpy.ndarray – vertices ordered so that no linear rings may cross each other.