Block Functions¶
- plot3d.blockfunctions.block_connection_matrix(blocks: List[Block], outer_faces: List[Dict[str, int]] = [], tol: float = 1e-08, *, node_tol_xyz: float = 1e-07, min_shared_frac: float = 0.02, min_shared_abs: int = 4, stride_u: int = 1, stride_v: int = 1, use_area_fallback: bool = True, area_min_overlap_frac: float = 0.01) Tuple[ndarray, ndarray, ndarray, ndarray][source]¶
 Creates matrices representing how blocks are connected.
- Returns:
 (n,n) overall connectivity (1 = connected, -1 = not) connectivity_i : (n,n) connections where both faces are I-constant connectivity_j : (n,n) connections where both faces are J-constant connectivity_k : (n,n) connections where both faces are K-constant
- Return type:
 connectivity
- plot3d.blockfunctions.build_connectivity_graph(connectivities: List[List[Dict]]) Graph[source]¶
 Build an undirected graph from a list of face-to-face block connectivities. Each edge connects two block indices.
- plot3d.blockfunctions.common_neighbor(G: Graph, a: int, b: int, exclude: Set[int]) int | None[source]¶
 Return a node that is connected to both a and b and not in exclude.
- plot3d.blockfunctions.get_outer_bounds(blocks: List[Block])[source]¶
 Get outer bounds for a set of blocks
- Parameters:
 blocks (List[Block]) – Blocks defining your shape
- Returns:
 xbounds (Tuple[float,float]): xmin,xmax ybounds (Tuple[float,float]): ymin,ymax zbounds (Tuple[float,float]): zmin,zmax
- Return type:
 (Tuple) containing
- plot3d.blockfunctions.rotate_block(block, rotation_matrix: ndarray) Block[source]¶
 Rotates a block by a rotation matrix
- Parameters:
 rotation_matrix (np.ndarray) – 3x3 rotation matrix
- Returns:
 returns a new rotated block
- Return type:
 
- plot3d.blockfunctions.split_blocks(blocks: List[Block], gcd: int = 4)[source]¶
 Split blocks but also keep greatest common divisor
- Parameters:
 blocks (List[]) – _description_
gcd (int, optional) – _description_. Defaults to 4.
- plot3d.blockfunctions.standardize_block_orientation(block: Block)[source]¶
 Standardizes the orientation of a block so that its physical coordinates increase consistently along each of the indexing axes:
X increases along the i-axis
Y increases along the j-axis
Z increases along the k-axis
This ensures consistent face orientation and alignment across multiple blocks, especially useful when merging, visualizing, or exporting grids. The function checks the dominant physical component (X, Y, or Z) along each axis, and flips the block along that axis if the component decreases.