tlc.core.helpers.geometry_helper

Module Contents

Classes

Class

Description

GeometryHelper

Helper class for geometry.

API

class GeometryHelper

Helper class for geometry.

static create_isotropic_bounds_2d(
x_min: float,
x_max: float,
y_min: float,
y_max: float,
) tuple[float, float, float, float]

Create isotropic bounds for a set of 2D points.

static create_isotropic_bounds_3d(
x_min: float,
x_max: float,
y_min: float,
y_max: float,
z_min: float,
z_max: float,
force_z_min: bool = False,
) tuple[float, float, float, float, float, float]

Create isotropic bounds for a set of 3D points.

static load_obj_geometry(
obj_path: str,
scale: float = 1.0,
transform: ndarray | None = None,
bounds_3d: tuple[float, float, float, float, float, float] | None = None,
) Geometry3DInstances

Load vertices and triangles from a obj file.

The obj file should contain vertices and faces. The faces will be fan-triangulated if they are not triangles. The triangles will be assigned the material color of the face.

Parameters:
  • obj_path – The path to the obj file.

  • scale – The scale factor to apply to the vertices.

  • transform – The transformation matrix to apply to the vertices (shape (3,3) or (4,4)).

  • bounds_3d – The 3D bounds of the geometry. If None, the bounds will be computed from the vertices.

Returns:

A Geometry3DInstances object.