seapipy.lattice_class.Lattice
- class seapipy.lattice_class.Lattice(number_cells_x: int, number_cells_y: int, tessellation: object | None = None)
Bases:
objectLattice class with all lattice properties
- Parameters:
number_cells_x (int) – Number of cells in the x-axis to create
number_cells_y – Number of cells in the x-axis to create
- create_example_lattice(voronoi_seeds_std: float = 0.15, voronoi_seeds_step: int = 20) tuple[dict, dict, dict]
Create a lattice with the initial Voronoi tessellation
- create_lattice_elements() tuple
Create the vertices, edges and cells from the scipy.spatial.Voronoi() objects
- Returns:
Vertices, edges and cell’s list
- Return type:
- generate_square_seeds(standard_deviation: float = 0, spatial_step: int = 1) list
Generate seeds for tessellation as a rectangular grid
- generate_voronoi_tessellation(seed_values: list) object
Generates the voronoi tessellation from the seed values provided
- Parameters:
seed_values (list) – [x, y] list of positions to use as seeds for the voronoi tessellation
- Returns:
Voronoi tessellation object generated from the seed values
- Return type:
scipy.spatial.Voronoi()
- static get_cell_area(cell_vertices: list, vertices: dict) float
Area of a polygon using the shoelace formula
- Parameters:
cell_vertices – List of vertex’s id of the polygon
vertices – Dictionary of vertices in the system
- Returns:
Area of the polygon. Positive number indicates clockwise orientation, negative number
counterclockwise.
- get_cell_area_sign(cell: list, all_vertices: dict) int
Get the orientation of the polygon for a cell_vertices using the sign of the area through gauss formula
- static get_edge_centroid(edge_id: int, vertices: list, edges: list) tuple
Get the center of the requested edge
- static get_enum(edge: list, edges: dict) int
Get id of the edge from the vertex position or new possible ID if the vertex is already known
- static get_normally_distributed_densities(edges: dict, center: float = 1, standard_deviation: float = 0.01) dict
Get a dictionary of tensions that is normally distributed around the center with a certain standard deviation
- static get_vertex_number(vertex: list, vertices: dict) int
Get id of the vertex from the vertex position or new possible ID if the vertex is already known
- static line_eq(p0: float, p1: float, x: numpy.ndarray) list
Get the value of linear function that goes through p0 and p1 at x
- Parameters:
p0 (list) – First point to join
p1 – Second point to join
x – Independent variable of the equation
- Returns:
Value of y(x) for a line that goes through p0 and p1