old style¶
- tfv.geometry.is_ccw(a, b, c)¶
Determines if elbow formed by points ABC is counter clockwise (ccw).
- Parameters:
a (tuple) – Point A as (x, y)
b (tuple) – Point B as (x, y)
c (tuple) – Point C as (x, y)
- Returns:
lgi – True if elbow ABC is counter clockwise
- Return type:
logical np.ndarray
- tfv.geometry.is_intersection(a, b, c, d)¶
Determines if polyline AB crosses polyline CD.
- Parameters:
a (tuple) – Point A as (x, y)
b (tuple) – Point B as (x, y)
c (tuple) – Point C as (x, y)
d (tuple) – Point D as (x, y)
- Returns:
lgi – True if line AB crosses line CD
- Return type:
logical np.ndarray
- tfv.geometry.get_intersection(a, b, c, d)¶
Gets parameters for intersections of line’s AB and line’s CD.
- Parameters:
a (tuple) – Point A as tuple (x, y) of line’s AB
b (tuple) – Point B as tuple (x, y) of line’s AB
c (tuple) – Point C as tuple (x, y) of line’s CD
d (tuple) – Point D as tuple (x, y) of line’s CD
- Returns:
x – Line intersection parameters
- Return type:
tuple (t, u, lc, rc, lgi)
- tfv.geometry.get_unit_vectors(xv, yv)¶
Gets unit tangent and unit normal vectors for line segments
- Parameters:
xv (1D np.ndarray) – X coordinate of polyline
yv (1D np.ndarray) – Y coordinate of polyline
- Returns:
uv – Unit tangent and unit normal vectors
- Return type:
tuple (ut, un)
- class tfv.geometry.Mesh(node_x, node_y, cell_node)¶
Creates object which handles common 2D polygonal mesh based geometry operations
- Parameters:
node_x (1D np.ndarray) – X coordinate of mesh vertices
node_y (1D np.ndarray) – Y coordinate of mesh vertices
cell_node (2D np.ndarray) – A (n, 4) array defining each mesh cell/element by four node indices
- nc2¶
Number of 2D mesh cells
- Type:
int
- nv2¶
Number of 2D mesh vertices
- Type:
int
- is_tri¶
Logical index of triangular elements
- Type:
1D np.ndarray
- is_quad¶
Logical index of quadrilateral elements
- Type:
1D np.ndarray
- edge_node¶
Tuple defining start node, end node and cell for each mesh half edge
- Type:
tuple
- weights¶
A (n, 4) array defining weighting of each cell gives to each mesh vertex
- Type:
2D np.ndarray
- tri_cell_node¶
A (n, 3) array defining each mesh cell/element by three node indices
- Type:
2D np.ndarray
- tri_cell_index¶
A (n,) array mapping triangular mesh elements to base mesh elements
- Type:
1D np.ndarray
- get_cell_index(xp, yp)¶
Query to extract the mesh cell indices of scatter points
- Parameters:
xp (1D np.ndarray) – X coordinate of scatter data
yp (1D np.ndarray) – Y coordinate of scatter data
- Returns:
index – Mesh cell index for each scatter point
- Return type:
1D np.ndarray
- get_grid_index(grid_x, grid_y)¶
Query to extract the mesh cell indices of each point in a grid
- Parameters:
grid_x (1D np.ndarray) – Horizontal grid point values
grid_y (1D np.ndarray) – Vertical grid point values
- Returns:
grid_index – Mesh cell index for each point in grid
- Return type:
2D np.ndarray
- get_intersection_data(polyline)¶
Query to extract data for intersections(x) of a polyline and the mesh half-edges
- Parameters:
polyline (2D np.ndarray) – Polyline as [x, y] which intersects mesh half-edges.
- Returns:
x – Intersection(x) data defined by coordinates & mesh cell index (x, y, ii)
- Return type:
tuple