Surfaces#

Classes#

Surface#

class Surface[source]#

Bases: Base

__init__()[source]#

local coordinate system

f(P: ndarray) float[source]#

f(x,y,z) = 0

normal(P: ndarray) ndarray[source]#

Return the normal vector at the point.

within_boundary(P: ndarray) bool[source]#

Check if the point is inside the boundary.

parametric_boundary_3d(t: float) ndarray[source]#

Return the point on the boundary given the parameter t=[0,1].

merge_bbox(bbox1, bbox2)[source]#
merge_bboxs(bboxs)[source]#
solve_crosssection_ray_bbox_local(ray_origin, ray_direction) Tuple[float][source]#

Point#

class Point[source]#

Bases: Surface

__init__()[source]#

local coordinate system

f(P: ndarray) float[source]#

f(x,y,z) = 0

normal(P: ndarray) ndarray[source]#

Return the normal vector at the point.

within_boundary(P: ndarray) bool[source]#

Check if the point is inside the boundary.

parametric_boundary(t: Sequence[float], type: str) ndarray[source]#
get_bbox_local()[source]#

Plane#

class Plane[source]#

Bases: Surface

__init__()[source]#

local coordinate system

f(P: ndarray) float[source]#

f(x,y,z) = 0

normal(P: ndarray) ndarray[source]#

Return the normal vector at the point.

union(other)[source]#
subtract(other)[source]#

Circle#

class Circle(radius)[source]#

Bases: Plane

__init__(radius)[source]#

local coordinate system

within_boundary(P: ndarray) bool[source]#

Check if the point is inside the boundary.

parametric_boundary(t: Sequence[float], type: str) ndarray[source]#
get_bbox_local()[source]#

Rectangle#

class Rectangle(width, height)[source]#

Bases: Plane

__init__(width, height)[source]#

local coordinate system

within_boundary(P: ndarray) bool[source]#

Check if the point is inside the boundary.

parametric_boundary(t: Sequence[float], type: str) ndarray[source]#
get_bbox_local()[source]#

Cylinder#

class Cylinder(radius, height, theta_range=(-3.141592653589793, 3.141592653589793))[source]#

Bases: Surface

__init__(radius, height, theta_range=(-3.141592653589793, 3.141592653589793))[source]#

local coordinate system

f(P: ndarray) float[source]#

f(x,y,z) = 0

normal(P: ndarray) ndarray[source]#

Return the normal vector at the point.

within_boundary(P: ndarray) bool[source]#

Check if the point is inside the boundary.

parametric_boundary(t: Sequence[float], type: str) ndarray[source]#
get_bbox_local()[source]#

Sphere#

class Sphere(radius, height=None)[source]#

Bases: Surface

__init__(radius, height=None)[source]#

local coordinate system

f(P: ndarray) float[source]#

f(x,y,z) = 0

normal(P: ndarray) ndarray[source]#

Return the normal vector at the point.

within_boundary(P: ndarray) bool[source]#

Check if the point is inside the boundary.

parametric_boundary(t: Sequence[float], type: str) ndarray[source]#
get_bbox_local()[source]#

ASphere#

class ASphere(radius, f_asphere: callable)[source]#

Bases: Surface

__init__(radius, f_asphere: callable)[source]#

x = -f_asphere(r)

roc_r(r: float) float[source]#

Return the radius of curvature at radius r.

roc(P: ndarray) float[source]#
f(P: ndarray) float[source]#

f(x,y,z) = 0

normal(P: ndarray) ndarray[source]#

Return the normal vector at the point.

within_boundary(P: ndarray) bool[source]#

Check if the point is inside the boundary.

parametric_boundary(t: Sequence[float], type: str) ndarray[source]#
get_bbox_local()[source]#

Polygon#

class Polygon(vertices: Sequence[Sequence[float]], normal: Sequence[float] | None = None)[source]#

Bases: Plane

Planar polygon surface.

If vertices are supplied as (N, 2) or as (N, 3) with every x = 0, the polygon is taken to lie in the x = 0 plane with normal (1, 0, 0).

Parameters:
  • vertices (Sequence[Sequence[float]]) – Coordinates of the polygon vertices (N ≥ 3, 2- or 3-D). Ordering must be counter-clockwise when viewed along the supplied/implicit normal.

  • normal (Sequence[float] | None) – Optional outward normal. Required if the vertices are not in a single x = const plane.

__init__(vertices: Sequence[Sequence[float]], normal: Sequence[float] | None = None)[source]#

local coordinate system

f(P: ndarray) float[source]#

Signed distance from point to the polygon’s plane.

within_boundary(P: ndarray) bool[source]#

Check if the point is inside the boundary.

parametric_boundary(t: Sequence[float], type: str) ndarray[source]#
get_bbox_local() Tuple[float, float, float, float, float, float][source]#