httk.core.geometry module

Basic geometry helper functions

httk.core.geometry.hull_z(points, zs)[source]

points: a list of points=(x,y,..) with zs= a list of z values; a convex half-hull is constructed over negative z-values

returns data on the following format.:

{
  'hull_points': indices in points list for points that make up the convex hull,
   'interior_points':indices for points in the interior,
   'interior_zs':interior_zs
   'zs_on_hull': hull z values for each point (for points on the hull, the value of the hull if this point is excluded)
   'closest_points': list of best linear combination of other points for each point
   'closest_weights': weights of best linear combination of other points for each point
}

where hull_points and interior_points are lists of the points on the hull and inside the hull. and

hull_zs is a list of z-values that the hull would have at that point, had this point not been included. interior_zs is a list of z-values that the hull has at the interior points.
httk.core.geometry.is_any_part_of_cube_inside_cell(cell, midpoint, side)[source]

Checks if any part of a cube is inside the cell spanned by the vectors in cell

httk.core.geometry.is_point_inside_cell(cell, point)[source]

Checks if a given triple-vector is inside the cell given by the basis matrix in cell

httk.core.geometry.is_point_inside_tetra(tetra, point)[source]

Checks if a point is inside the tretrahedra spanned by the coordinates in tetra

httk.core.geometry.numpy_quickhull_2d(sample)[source]
httk.core.geometry.simplex_le_solver(a, b, c)[source]

Minimizie func = a[0]*x + a[1]*y + a[2]*z + … With constraints:

b[0,0]x + b[0,1]y + b[0,2]z + ... <= c[0]
b[1,0]x + b[1,1]y + b[1,2]z + ... <= c[1]
...
x,y,z, ... >= 0

Algorithm adapted from ‘taw9’, http://taw9.hubpages.com/hub/Simplex-Algorithm-in-Python