cleanup and rename
This commit is contained in:
parent
acb86b8013
commit
1f332614f2
7 changed files with 153 additions and 216 deletions
|
|
@ -0,0 +1,4 @@
|
|||
from .split import split, clip
|
||||
from .moments import get_volume, get_moments, number_of_moments
|
||||
from .boundary import build_polyhedron, boundary_from_poly
|
||||
from .shapes import build_tetrahedron, build_box, planes_from_tetrahedron, planes_from_box
|
||||
|
|
@ -4,6 +4,7 @@ from numpy.linalg import norm
|
|||
from .util import _get_map, find_components, find_faces
|
||||
|
||||
try:
|
||||
# Check if running with line_profiler
|
||||
profile
|
||||
except NameError:
|
||||
def profile(f):
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import numpy
|
|||
from .util import find_faces
|
||||
|
||||
try:
|
||||
# Check if running with line_profiler
|
||||
profile
|
||||
except NameError:
|
||||
def profile(f):
|
||||
|
|
@ -14,6 +15,10 @@ def number_of_moments(order):
|
|||
return ((order + 1) * (order + 2) * (order + 3)) // 6
|
||||
|
||||
|
||||
def get_volume(poly):
|
||||
return get_moments(poly, 0)[0]
|
||||
|
||||
|
||||
@profile
|
||||
def get_moments(poly, poly_order):
|
||||
vertices = poly['vertices']
|
||||
|
|
@ -102,5 +107,3 @@ def get_moments(poly, poly_order):
|
|||
prevlayer, curlayer = curlayer, prevlayer
|
||||
|
||||
return moments
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ def build_box(rbounds):
|
|||
}
|
||||
|
||||
|
||||
def planes_from_box(rbounds):
|
||||
def planes_from_box(rbounds: numpy.ndarray):
|
||||
faces = [
|
||||
(( 0, 0, 1), -rbounds[0, 2]),
|
||||
(( 0, 0, -1), rbounds[1, 2]),
|
||||
|
|
@ -74,9 +74,3 @@ def planes_from_tetrahedron(vertices: numpy.ndarray):
|
|||
|
||||
return [plane for plane in zip(n, d)]
|
||||
|
||||
|
||||
def volume_of_tetrahedron(vertices):
|
||||
ad, bd, cd = vertices[0:3] - vertices[3]
|
||||
return -ad @ numpy.cross(bd, cd) / 6
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import numpy
|
|||
from .util import _searchsorted_rows, _argsort_rows
|
||||
|
||||
try:
|
||||
# Check if running with line_profiler
|
||||
profile
|
||||
except NameError:
|
||||
def profile(f):
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import numpy
|
||||
|
||||
try:
|
||||
# Check if running with line_profiler
|
||||
profile
|
||||
except NameError:
|
||||
def profile(f):
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ from .split import split
|
|||
from .moments import get_moments, number_of_moments
|
||||
|
||||
try:
|
||||
# Check if running with line_profiler
|
||||
profile
|
||||
except NameError:
|
||||
def profile(f):
|
||||
|
|
|
|||
Loading…
Reference in a new issue