Skip to content

Hull

ConvexHull(pts)

A class to handle convex-hull calculations.

seg_dict is a dictionary object that contains information about segments within the convex hull.

  • The keys are 2x3 tuples, which represent two ends of a segment in space.
  • The values of seg_dict are the number of times a segment has been part of a triangle, either 1 or 2. 0 times would mean that the segment doesn't exist in the dictionary yet.

Initializes the ConvexHull class.

hull = self.gift_wrapping_3d(akl_toussaint_pts)

akl_toussaint(points)

The Akl-Toussaint Heuristic.

Given a set of points, this definition will create an octahedron whose corners are the extremes in x, y, and z directions. Every point within this octahedron will be removed because they are not part of the convex hull. This causes any expected running time for a convex hull algorithm to be reduced to linear time.

PARAMETER DESCRIPTION

points

An nx3 array of x,y,z coordinates.

TYPE: NDArray[float64]

RETURNS DESCRIPTION
NDArray[float64]

All members of original set of points that fall outside the Akl-Toussaint octahedron.

get_seg_dict_num(seg_dict, seg_index)

This function looks up and returns the value of a seg_index from seg_dict.

PARAMETER DESCRIPTION

seg_dict

The dictionary of segment 2x3 tuples as keys, integers as values.

TYPE: dict[tuple[tuple[float64, ...], ...], int]

seg_index

the key of the dictionary member we are going to retrieve

TYPE: tuple[tuple[float64, ...], ...]

RETURNS DESCRIPTION
int

If seg_index exists in the keys of seg_dict, return the value. Otherwise, return 0.

gift_wrapping_3d(raw_points)

Gift wrapping for 3d convex hull.

PARAMETER DESCRIPTION

raw_points

A nx3 array of points, where each row corresponds to an x,y,z point coordinate.

TYPE: NDArray[float64]

RETURNS DESCRIPTION
list[NDArray[float64]]

A convex hull represented by a list of triangles. Each triangle is a 3x3 array, where each row is an x,y,z coordinate in space. The 3 rows describe the location of the 3 corners of the triangle. Each of the 3 points are arranged so that a cross product will point outwards from the hull.

increment_seg_dict(seg_dict, seg_index)

This function increments the values within seg_dict, or initiates them if they dont exist yet.

PARAMETER DESCRIPTION

seg_dict

the dictionary of segment 2x3 tuples as keys, integers as values.

TYPE: dict[tuple[tuple[float64, ...], ...], int]

seg_index

the key of the dictionary member we are going to increment.

TYPE: tuple[tuple[float64, ...], ...]

inside_hull(our_point)

Determines if a point is inside the hull

PARAMETER DESCRIPTION

our_point

An x,y,z array

RETURNS DESCRIPTION

A boolean, True if the point is inside the hull, False otherwise.

outside_hull(point, triangles, epsilon=1e-05)

Given the hull as defined by a list of triangles, this definition will return whether a point is within these or not.

PARAMETER DESCRIPTION

point

an x,y,z array that is being tested to see whether it exists inside the hull or not.

TYPE: list[float]

triangles

a list of triangles that define the hull.

TYPE: list[NDArray[float64]]

epsilon

needed for imprecisions in the floating-point operations.

TYPE: float DEFAULT: 1e-05

RETURNS DESCRIPTION
bool

True if our_point exists outside of the hull, False otherwise

volume(frame_indx, pdb, pts, regions_contig, output_prefix, config)

TaskCalcVolume

Bases: RayTaskGeneral

A class for calculating the volume.

process_item(item)

Calculate the volume.

PARAMETER DESCRIPTION

item

A list or tuple containing necessary input data.

RETURNS DESCRIPTION

A tuple with frame index, calculated volume, and any extra data.

unique_rows(a)

Identifies unique points (rows) in an array of points.

PARAMETER DESCRIPTION

a

A nx3 np.array representing 3D points.

RETURNS DESCRIPTION

A nx2 np.array containing the 3D points that are unique.