tools.mesh¶
- class piperabm.tools.mesh.triangle.Triangle(point_1: list, point_2: list, point_3: list, density: float = 1)¶
Bases:
objectRepresent a single triangle for meshing purpose.
- Parameters:
point_1 (list) – x and y coordinates of the vertice 1.
point_2 (list) – x and y coordinates of the vertice 1.
point_3 (list) – x and y coordinates of the vertice 1.
density (float, default=1) – The higher the density is, the higher the chance of containing the point is.
- property area¶
Calculate the area of the triangle.
- random_point() list¶
Generate a random point inside the triangle using Barycentric coordinates.
- property weight: float¶
Both area and density are proportional to the probability of containing a point inside. Therefore, weight is defined as a more suitable parameter for point generation.
- class piperabm.tools.mesh.patch.Patch¶
Bases:
objectA group of triangles create a patch.
- add(*triangles)¶
Add new triangle objects to the patch.
- property indexes: list¶
Return the list of triangle indexes.
- random_point()¶
Generate a random point inside the patch based on the weights.
- property weights: list¶
Return a list of weights oeganized by triangle orders.