Skip to content

Instantly share code, notes, and snippets.

@mikedh
Created May 8, 2020 18:09
Show Gist options
  • Save mikedh/49be00831a56c76fc736c23e0f8d0e2b to your computer and use it in GitHub Desktop.
Save mikedh/49be00831a56c76fc736c23e0f8d0e2b to your computer and use it in GitHub Desktop.
import os
import trimesh
import numpy as np
tol_norm = 1e-4
def test_align(align):
"""
Test an "align two vectors" function
"""
is_rigid = trimesh.transformations.is_rigid
# start with some edge cases and make sure the transform works
target = np.array([0, 0, -1], dtype=np.float64)
vectors = np.vstack((
trimesh.unitize(np.random.random((1000, 3)) - .5),
[-target, target],
trimesh.util.generate_basis(target),
[[7.12106798e-07, -7.43194705e-08, 1.00000000e+00],
[0, 0, -1],
[1e-4, 1e-4, -1]]))
for vector in vectors:
T, a = align(vector, target, return_angle=True)
assert is_rigid(T)
assert np.isclose(np.linalg.det(T), 1.0)
# rotate vector with transform
check = np.dot(T[:3, :3], vector)
# compare to target vector
norm = np.linalg.norm(check - target)
assert norm < tol_norm
# these vectors should be perpendicular and zero
angles = [align(i, target, return_angle=True)[1]
for i in trimesh.util.generate_basis(target)]
assert np.allclose(
angles, [np.pi / 2, np.pi / 2, 0.0])
# generate angles from 0 to 180 degrees
angles = np.linspace(0.0, np.pi / 1e7, 10000)
# generate on- plane vectors
vectors = np.column_stack((np.cos(angles),
np.sin(angles),
np.zeros(len(angles))))
T = align([0, 0, -1], [-1e-17, 1e-17, 1])
assert np.isclose(np.linalg.det(T), 1.0)
T = align([0, 0, -1], [-1e-4, 1e-4, 1])
assert np.isclose(np.linalg.det(T), 1.0)
vector_1 = np.array([7.12106798e-07, -7.43194705e-08, 1.00000000e+00])
vector_2 = np.array([0, 0, -1])
T, angle = align(vector_1, vector_2, return_angle=True)
assert np.isclose(np.linalg.det(T), 1.0)
def generate_basis(vector):
vector = np.array(vector)
u = np.linalg.svd(vector[:, np.newaxis])[0]
if np.linalg.det(u) < 0.0:
u[:, -1] *= -1
return u
def align_svd(a, b, return_angle=False):
"""
Find the rotation matrix that transforms one 3D vector
to another.
Parameters
------------
a : (3,) float
Unit vector
b : (3,) float
Unit vector
return_angle : bool
Return the angle between vectors or not
Returns
-------------
matrix : (4, 4) float
Homogenous transform to rotate from `a` to `b`
angle : float
If `return_angle` angle in radians between `a` and `b`
"""
a = np.array(a, dtype=np.float64)
b = np.array(b, dtype=np.float64)
if a.shape != (3,) or b.shape != (3,):
raise ValueError('vectors must be (3,)!')
# unitize vectors in place
a /= np.linalg.norm(a)
b /= np.linalg.norm(b)
# find the SVD of the two vectors
au = np.linalg.svd(a.reshape((-1, 1)))[0]
bu = np.linalg.svd(b.reshape((-1, 1)))[0]
if np.linalg.det(au) < 0:
au[:, -1] *= -1
if np.linalg.det(bu) < 0:
bu[:, -1] *= -1
# put rotation into homogenous transformation
matrix = np.eye(4)
matrix[:3, :3] = bu.dot(au.T)
if return_angle:
# projection of a onto b
dot = np.dot(a, b)
# clip to avoid floating point error
angle = np.arccos(np.clip(dot, -1.0, 1.0))
if dot < -1e-5:
angle += np.pi
return matrix, angle
return matrix
if __name__ == '__main__':
import cProfile
import pstats
import io
import time
pr = cProfile.Profile()
pr.enable()
tic = [time.time()]
test_align(align_svd)
tic.append(time.time())
print(r'\n\n\`align_svd`\n\n')
# ... do something ...
pr.disable()
s = io.StringIO()
sortby = 'cumulative'
ps = pstats.Stats(pr, stream=s).sort_stats(sortby)
ps.print_stats()
print(s.getvalue())
pr = cProfile.Profile()
pr.enable()
tic.append(time.time())
test_align(trimesh.geometry.align_vectors)
tic.append(time.time())
print(r'\n\n\`trimesh.geometry.align_vectors`\n\n')
pr.disable()
s = io.StringIO()
sortby = 'cumulative'
ps = pstats.Stats(pr, stream=s).sort_stats(sortby)
ps.print_stats()
print(s.getvalue())
print('`align_svd`: {}s\n`trimesh.geometry.align_vectors`: {}s\n'.format(
*np.diff(tic)[[0, -1]]))
@mikedh
Copy link
Author

mikedh commented May 8, 2020

Results:

align_svd
         180499 function calls in 0.374 seconds

   Ordered by: cumulative time

   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
        1    0.012    0.012    0.374    0.374 err.py:10(test_align)
     1014    0.037    0.000    0.188    0.000 err.py:71(align_svd)
     2028    0.041    0.000    0.067    0.000 /home/mikedh/miniconda/lib/python3.6/site-packages/numpy/linalg/linalg.py:1468(svd)
     1012    0.007    0.000    0.067    0.000 /home/mikedh/miniconda/lib/python3.6/site-packages/numpy/core/numeric.py:2431(isclose)
     1008    0.019    0.000    0.067    0.000 /dropbox/drop/Dropbox/robotics/trimesh/trimesh/transformations.py:2139(is_rigid)
     3039    0.034    0.000    0.061    0.000 /home/mikedh/miniconda/lib/python3.6/site-packages/numpy/linalg/linalg.py:2040(det)
     2016    0.002    0.000    0.033    0.000 {method 'ptp' of 'numpy.ndarray' objects}
     3042    0.018    0.000    0.033    0.000 /home/mikedh/miniconda/lib/python3.6/site-packages/numpy/linalg/linalg.py:2293(norm)
     2016    0.012    0.000    0.031    0.000 /home/mikedh/miniconda/lib/python3.6/site-packages/numpy/core/_methods.py:151(_ptp)
     1012    0.013    0.000    0.030    0.000 /home/mikedh/miniconda/lib/python3.6/site-packages/numpy/core/numeric.py:2508(within_tol)
     6058    0.028    0.000    0.028    0.000 {method 'reduce' of 'numpy.ufunc' objects}
     2025    0.002    0.000    0.023    0.000 /home/mikedh/miniconda/lib/python3.6/site-packages/numpy/core/fromnumeric.py:2171(all)
     2026    0.005    0.000    0.021    0.000 /home/mikedh/miniconda/lib/python3.6/site-packages/numpy/core/fromnumeric.py:69(_wrapreduction)
    14211    0.016    0.000    0.016    0.000 {built-in method numpy.array}
     6071    0.016    0.000    0.016    0.000 {built-in method numpy.dot}
     5067    0.009    0.000    0.015    0.000 /home/mikedh/miniconda/lib/python3.6/site-packages/numpy/linalg/linalg.py:144(_commonType)
     2022    0.009    0.000    0.014    0.000 /home/mikedh/miniconda/lib/python3.6/site-packages/numpy/lib/twodim_base.py:154(eye)
     2022    0.004    0.000    0.013    0.000 {method 'all' of 'numpy.generic' objects}
     2024    0.004    0.000    0.011    0.000 /home/mikedh/miniconda/lib/python3.6/site-packages/numpy/core/numeric.py:2656(seterr)
     6085    0.010    0.000    0.010    0.000 {method 'astype' of 'numpy.ndarray' objects}
     3039    0.010    0.000    0.010    0.000 {method 'astype' of 'numpy.generic' objects}
     2022    0.001    0.000    0.009    0.000 /home/mikedh/miniconda/lib/python3.6/site-packages/numpy/core/_methods.py:45(_all)
     3039    0.001    0.000    0.008    0.000 /home/mikedh/miniconda/lib/python3.6/site-packages/numpy/core/numeric.py:541(asanyarray)
     1012    0.001    0.000    0.007    0.000 /home/mikedh/miniconda/lib/python3.6/site-packages/numpy/core/numeric.py:3058(__enter__)
     1012    0.001    0.000    0.006    0.000 /home/mikedh/miniconda/lib/python3.6/site-packages/numpy/core/fromnumeric.py:1903(clip)
     8113    0.002    0.000    0.006    0.000 /home/mikedh/miniconda/lib/python3.6/site-packages/numpy/core/numeric.py:469(asarray)
     1012    0.001    0.000    0.006    0.000 /home/mikedh/miniconda/lib/python3.6/site-packages/numpy/core/numeric.py:3063(__exit__)
    13176    0.003    0.000    0.006    0.000 /home/mikedh/miniconda/lib/python3.6/site-packages/numpy/linalg/linalg.py:121(isComplexType)
     1012    0.001    0.000    0.005    0.000 /home/mikedh/miniconda/lib/python3.6/site-packages/numpy/core/fromnumeric.py:54(_wrapfunc)
     2023    0.005    0.000    0.005    0.000 {built-in method numpy.zeros}
     3042    0.005    0.000    0.005    0.000 {method 'ravel' of 'numpy.ndarray' objects}
    21285    0.005    0.000    0.005    0.000 {built-in method builtins.issubclass}
     7095    0.003    0.000    0.004    0.000 /home/mikedh/miniconda/lib/python3.6/site-packages/numpy/linalg/linalg.py:134(_realType)
     2024    0.004    0.000    0.004    0.000 /home/mikedh/miniconda/lib/python3.6/site-packages/numpy/core/numeric.py:2758(geterr)
     1012    0.004    0.000    0.004    0.000 {method 'clip' of 'numpy.generic' objects}
     5067    0.004    0.000    0.004    0.000 /home/mikedh/miniconda/lib/python3.6/site-packages/numpy/linalg/linalg.py:203(_assertRankAtLeast2)
     2028    0.002    0.000    0.003    0.000 /home/mikedh/miniconda/lib/python3.6/site-packages/numpy/linalg/linalg.py:116(_makearray)
     1014    0.003    0.000    0.003    0.000 {method 'dot' of 'numpy.ndarray' objects}
     2030    0.002    0.000    0.002    0.000 {method 'reshape' of 'numpy.ndarray' objects}
     3039    0.002    0.000    0.002    0.000 /home/mikedh/miniconda/lib/python3.6/site-packages/numpy/linalg/linalg.py:209(_assertNdSquareness)
     2028    0.002    0.000    0.002    0.000 /home/mikedh/miniconda/lib/python3.6/site-packages/numpy/linalg/linalg.py:111(get_linalg_error_extobj)
     2024    0.002    0.000    0.002    0.000 {built-in method numpy.seterrobj}
     2024    0.002    0.000    0.002    0.000 {built-in method builtins.abs}
     1012    0.001    0.000    0.002    0.000 /home/mikedh/miniconda/lib/python3.6/site-packages/numpy/core/numeric.py:3054(__init__)
     7095    0.002    0.000    0.002    0.000 {method 'get' of 'dict' objects}
     5063    0.001    0.000    0.001    0.000 {built-in method builtins.getattr}
     2026    0.001    0.000    0.001    0.000 /home/mikedh/miniconda/lib/python3.6/site-packages/numpy/core/fromnumeric.py:70(<dictcomp>)
     1013    0.001    0.000    0.001    0.000 {built-in method numpy.result_type}
     4048    0.001    0.000    0.001    0.000 {built-in method numpy.geterrobj}
     4056    0.001    0.000    0.001    0.000 {method '__array_prepare__' of 'numpy.ndarray' objects}
        1    0.000    0.000    0.001    0.001 err.py:38(<listcomp>)
        2    0.000    0.000    0.000    0.000 /dropbox/drop/Dropbox/robotics/trimesh/trimesh/util.py:2050(generate_basis)
     1012    0.000    0.000    0.000    0.000 {method 'pop' of 'dict' objects}
     2026    0.000    0.000    0.000    0.000 {method 'items' of 'dict' objects}
        2    0.000    0.000    0.000    0.000 /home/mikedh/miniconda/lib/python3.6/site-packages/numpy/core/numeric.py:1701(cross)
        1    0.000    0.000    0.000    0.000 /home/mikedh/miniconda/lib/python3.6/site-packages/numpy/lib/shape_base.py:599(column_stack)
        1    0.000    0.000    0.000    0.000 /home/mikedh/miniconda/lib/python3.6/site-packages/numpy/core/function_base.py:37(linspace)
        2    0.000    0.000    0.000    0.000 {built-in method numpy.concatenate}
        6    0.000    0.000    0.000    0.000 /home/mikedh/miniconda/lib/python3.6/site-packages/numpy/core/numeric.py:1620(moveaxis)
        1    0.000    0.000    0.000    0.000 /home/mikedh/miniconda/lib/python3.6/site-packages/numpy/core/numeric.py:2355(allclose)
        1    0.000    0.000    0.000    0.000 /dropbox/drop/Dropbox/robotics/trimesh/trimesh/util.py:72(unitize)
       12    0.000    0.000    0.000    0.000 /home/mikedh/miniconda/lib/python3.6/site-packages/numpy/core/numeric.py:1557(normalize_axis_tuple)
        1    0.000    0.000    0.000    0.000 /home/mikedh/miniconda/lib/python3.6/site-packages/numpy/core/shape_base.py:229(vstack)
        1    0.000    0.000    0.000    0.000 {method 'random_sample' of 'mtrand.RandomState' objects}
        1    0.000    0.000    0.000    0.000 {built-in method numpy.arange}
        1    0.000    0.000    0.000    0.000 /home/mikedh/miniconda/lib/python3.6/site-packages/numpy/core/shape_base.py:283(<listcomp>)
        1    0.000    0.000    0.000    0.000 {built-in method builtins.print}
        1    0.000    0.000    0.000    0.000 /home/mikedh/miniconda/lib/python3.6/site-packages/numpy/core/fromnumeric.py:2083(any)
        4    0.000    0.000    0.000    0.000 /home/mikedh/miniconda/lib/python3.6/site-packages/numpy/core/shape_base.py:83(atleast_2d)
        1    0.000    0.000    0.000    0.000 {method 'any' of 'numpy.generic' objects}
        2    0.000    0.000    0.000    0.000 /home/mikedh/miniconda/lib/python3.6/site-packages/numpy/core/shape_base.py:220(_warn_for_nonsequence)
       18    0.000    0.000    0.000    0.000 {built-in method numpy.core._multiarray_umath.normalize_axis_index}
       12    0.000    0.000    0.000    0.000 /home/mikedh/miniconda/lib/python3.6/site-packages/numpy/core/numeric.py:1607(<listcomp>)
        1    0.000    0.000    0.000    0.000 /home/mikedh/miniconda/lib/python3.6/site-packages/numpy/core/_methods.py:42(_any)
        6    0.000    0.000    0.000    0.000 {built-in method builtins.sorted}
       44    0.000    0.000    0.000    0.000 {built-in method builtins.len}
        2    0.000    0.000    0.000    0.000 /home/mikedh/miniconda/lib/python3.6/site-packages/numpy/core/shape_base.py:209(_arrays_for_stack_dispatcher)
        6    0.000    0.000    0.000    0.000 {method 'transpose' of 'numpy.ndarray' objects}
        2    0.000    0.000    0.000    0.000 {built-in method builtins.hasattr}
        1    0.000    0.000    0.000    0.000 /home/mikedh/miniconda/lib/python3.6/site-packages/numpy/core/numeric.py:2035(isscalar)
        1    0.000    0.000    0.000    0.000 /home/mikedh/miniconda/lib/python3.6/site-packages/numpy/core/function_base.py:20(_index_deprecate)
        1    0.000    0.000    0.000    0.000 /home/mikedh/miniconda/lib/python3.6/site-packages/numpy/core/fromnumeric.py:2847(ndim)
        2    0.000    0.000    0.000    0.000 {built-in method numpy.empty}
        6    0.000    0.000    0.000    0.000 {method 'insert' of 'list' objects}
        2    0.000    0.000    0.000    0.000 {built-in method time.time}
        2    0.000    0.000    0.000    0.000 {built-in method numpy.promote_types}
        8    0.000    0.000    0.000    0.000 {method 'append' of 'list' objects}
        1    0.000    0.000    0.000    0.000 {built-in method builtins.isinstance}
       13    0.000    0.000    0.000    0.000 {built-in method _operator.index}
        1    0.000    0.000    0.000    0.000 {method 'disable' of '_lsprof.Profiler' objects}
        6    0.000    0.000    0.000    0.000 /home/mikedh/miniconda/lib/python3.6/site-packages/numpy/core/numeric.py:1683(<listcomp>)



\n\n\`trimesh.geometry.align_vectors`\n\n
         174260 function calls in 0.349 seconds

   Ordered by: cumulative time

   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
        1    0.012    0.012    0.349    0.349 err.py:10(test_align)
     1014    0.036    0.000    0.165    0.000 /dropbox/drop/Dropbox/robotics/trimesh/trimesh/geometry.py:37(align_vectors)
     1012    0.030    0.000    0.082    0.000 /home/mikedh/miniconda/lib/python3.6/site-packages/numpy/core/numeric.py:1701(cross)
     1012    0.007    0.000    0.066    0.000 /home/mikedh/miniconda/lib/python3.6/site-packages/numpy/core/numeric.py:2431(isclose)
     1008    0.018    0.000    0.064    0.000 /dropbox/drop/Dropbox/robotics/trimesh/trimesh/transformations.py:2139(is_rigid)
     3036    0.013    0.000    0.045    0.000 /home/mikedh/miniconda/lib/python3.6/site-packages/numpy/core/numeric.py:1620(moveaxis)
     3052    0.018    0.000    0.033    0.000 /home/mikedh/miniconda/lib/python3.6/site-packages/numpy/linalg/linalg.py:2293(norm)
     2016    0.002    0.000    0.032    0.000 {method 'ptp' of 'numpy.ndarray' objects}
     2016    0.012    0.000    0.030    0.000 /home/mikedh/miniconda/lib/python3.6/site-packages/numpy/core/_methods.py:151(_ptp)
     1012    0.013    0.000    0.029    0.000 /home/mikedh/miniconda/lib/python3.6/site-packages/numpy/core/numeric.py:2508(within_tol)
     6058    0.027    0.000    0.027    0.000 {method 'reduce' of 'numpy.ufunc' objects}
     1011    0.015    0.000    0.026    0.000 /home/mikedh/miniconda/lib/python3.6/site-packages/numpy/linalg/linalg.py:2040(det)
     6072    0.017    0.000    0.024    0.000 /home/mikedh/miniconda/lib/python3.6/site-packages/numpy/core/numeric.py:1557(normalize_axis_tuple)
     2025    0.002    0.000    0.023    0.000 /home/mikedh/miniconda/lib/python3.6/site-packages/numpy/core/fromnumeric.py:2171(all)
    14223    0.022    0.000    0.022    0.000 {built-in method numpy.array}
     2026    0.005    0.000    0.021    0.000 /home/mikedh/miniconda/lib/python3.6/site-packages/numpy/core/fromnumeric.py:69(_wrapreduction)
     3036    0.011    0.000    0.019    0.000 /home/mikedh/miniconda/lib/python3.6/site-packages/numpy/lib/twodim_base.py:154(eye)
     7089    0.018    0.000    0.018    0.000 {built-in method numpy.dot}
     2022    0.004    0.000    0.013    0.000 {method 'all' of 'numpy.generic' objects}
     2024    0.004    0.000    0.010    0.000 /home/mikedh/miniconda/lib/python3.6/site-packages/numpy/core/numeric.py:2656(seterr)
     2022    0.001    0.000    0.009    0.000 /home/mikedh/miniconda/lib/python3.6/site-packages/numpy/core/_methods.py:45(_all)
     3039    0.001    0.000    0.007    0.000 /home/mikedh/miniconda/lib/python3.6/site-packages/numpy/core/numeric.py:541(asanyarray)
     3037    0.007    0.000    0.007    0.000 {built-in method numpy.zeros}
     1012    0.001    0.000    0.007    0.000 /home/mikedh/miniconda/lib/python3.6/site-packages/numpy/core/numeric.py:3058(__enter__)
     9108    0.006    0.000    0.006    0.000 {built-in method numpy.core._multiarray_umath.normalize_axis_index}
     1012    0.001    0.000    0.006    0.000 /home/mikedh/miniconda/lib/python3.6/site-packages/numpy/core/numeric.py:3063(__exit__)
     6072    0.003    0.000    0.005    0.000 /home/mikedh/miniconda/lib/python3.6/site-packages/numpy/core/numeric.py:1607(<listcomp>)
     3060    0.005    0.000    0.005    0.000 {method 'ravel' of 'numpy.ndarray' objects}
     6095    0.002    0.000    0.004    0.000 /home/mikedh/miniconda/lib/python3.6/site-packages/numpy/core/numeric.py:469(asarray)
     2024    0.004    0.000    0.004    0.000 /home/mikedh/miniconda/lib/python3.6/site-packages/numpy/core/numeric.py:2758(geterr)
     1011    0.004    0.000    0.004    0.000 {method 'astype' of 'numpy.generic' objects}
     1011    0.002    0.000    0.004    0.000 /home/mikedh/miniconda/lib/python3.6/site-packages/numpy/linalg/linalg.py:144(_commonType)
     3036    0.003    0.000    0.003    0.000 {built-in method builtins.sorted}
     5074    0.001    0.000    0.002    0.000 /home/mikedh/miniconda/lib/python3.6/site-packages/numpy/linalg/linalg.py:121(isComplexType)
     9137    0.002    0.000    0.002    0.000 {built-in method builtins.issubclass}
     3036    0.002    0.000    0.002    0.000 {method 'transpose' of 'numpy.ndarray' objects}
    19234    0.002    0.000    0.002    0.000 {built-in method builtins.len}
     2024    0.002    0.000    0.002    0.000 {built-in method numpy.seterrobj}
     2024    0.002    0.000    0.002    0.000 {built-in method builtins.abs}
     1012    0.001    0.000    0.002    0.000 /home/mikedh/miniconda/lib/python3.6/site-packages/numpy/core/numeric.py:3054(__init__)
     2026    0.001    0.000    0.001    0.000 /home/mikedh/miniconda/lib/python3.6/site-packages/numpy/core/fromnumeric.py:70(<dictcomp>)
     3036    0.001    0.000    0.001    0.000 {method 'insert' of 'list' objects}
     1011    0.001    0.000    0.001    0.000 /home/mikedh/miniconda/lib/python3.6/site-packages/numpy/linalg/linalg.py:203(_assertRankAtLeast2)
     1013    0.001    0.000    0.001    0.000 {built-in method numpy.result_type}
     1011    0.001    0.000    0.001    0.000 /home/mikedh/miniconda/lib/python3.6/site-packages/numpy/linalg/linalg.py:209(_assertNdSquareness)
        6    0.000    0.000    0.001    0.000 /dropbox/drop/Dropbox/robotics/trimesh/trimesh/util.py:2050(generate_basis)
     4048    0.001    0.000    0.001    0.000 {built-in method numpy.geterrobj}
     3036    0.001    0.000    0.001    0.000 /home/mikedh/miniconda/lib/python3.6/site-packages/numpy/core/numeric.py:1683(<listcomp>)
     6073    0.001    0.000    0.001    0.000 {built-in method _operator.index}
     1012    0.001    0.000    0.001    0.000 {built-in method numpy.empty}
     1011    0.000    0.000    0.001    0.000 /home/mikedh/miniconda/lib/python3.6/site-packages/numpy/linalg/linalg.py:134(_realType)
     2023    0.001    0.000    0.001    0.000 {built-in method builtins.getattr}
     1012    0.001    0.000    0.001    0.000 {built-in method numpy.promote_types}
     1012    0.000    0.000    0.000    0.000 {method 'pop' of 'dict' objects}
        1    0.000    0.000    0.000    0.000 err.py:38(<listcomp>)
     2026    0.000    0.000    0.000    0.000 {method 'items' of 'dict' objects}
     1011    0.000    0.000    0.000    0.000 {method 'get' of 'dict' objects}
        1    0.000    0.000    0.000    0.000 /home/mikedh/miniconda/lib/python3.6/site-packages/numpy/core/function_base.py:37(linspace)
        1    0.000    0.000    0.000    0.000 /home/mikedh/miniconda/lib/python3.6/site-packages/numpy/core/numeric.py:2355(allclose)
        1    0.000    0.000    0.000    0.000 /home/mikedh/miniconda/lib/python3.6/site-packages/numpy/lib/shape_base.py:599(column_stack)
        2    0.000    0.000    0.000    0.000 {built-in method numpy.concatenate}
        1    0.000    0.000    0.000    0.000 /dropbox/drop/Dropbox/robotics/trimesh/trimesh/util.py:72(unitize)
        4    0.000    0.000    0.000    0.000 /home/mikedh/miniconda/lib/python3.6/site-packages/numpy/core/numeric.py:1121(outer)
        1    0.000    0.000    0.000    0.000 {method 'random_sample' of 'mtrand.RandomState' objects}
        1    0.000    0.000    0.000    0.000 /home/mikedh/miniconda/lib/python3.6/site-packages/numpy/core/shape_base.py:229(vstack)
        1    0.000    0.000    0.000    0.000 {built-in method numpy.arange}
        1    0.000    0.000    0.000    0.000 {built-in method builtins.print}
        1    0.000    0.000    0.000    0.000 /home/mikedh/miniconda/lib/python3.6/site-packages/numpy/core/shape_base.py:283(<listcomp>)
        4    0.000    0.000    0.000    0.000 /home/mikedh/miniconda/lib/python3.6/site-packages/numpy/core/shape_base.py:83(atleast_2d)
        1    0.000    0.000    0.000    0.000 /home/mikedh/miniconda/lib/python3.6/site-packages/numpy/core/fromnumeric.py:2083(any)
        2    0.000    0.000    0.000    0.000 /home/mikedh/miniconda/lib/python3.6/site-packages/numpy/core/shape_base.py:220(_warn_for_nonsequence)
        1    0.000    0.000    0.000    0.000 {method 'any' of 'numpy.generic' objects}
        1    0.000    0.000    0.000    0.000 /home/mikedh/miniconda/lib/python3.6/site-packages/numpy/core/_methods.py:42(_any)
        2    0.000    0.000    0.000    0.000 /home/mikedh/miniconda/lib/python3.6/site-packages/numpy/core/shape_base.py:209(_arrays_for_stack_dispatcher)
        2    0.000    0.000    0.000    0.000 {method 'reshape' of 'numpy.ndarray' objects}
        1    0.000    0.000    0.000    0.000 /home/mikedh/miniconda/lib/python3.6/site-packages/numpy/core/numeric.py:2035(isscalar)
        1    0.000    0.000    0.000    0.000 {method 'astype' of 'numpy.ndarray' objects}
        2    0.000    0.000    0.000    0.000 {built-in method builtins.hasattr}
        1    0.000    0.000    0.000    0.000 {method 'disable' of '_lsprof.Profiler' objects}
        1    0.000    0.000    0.000    0.000 /home/mikedh/miniconda/lib/python3.6/site-packages/numpy/core/function_base.py:20(_index_deprecate)
        9    0.000    0.000    0.000    0.000 {method 'append' of 'list' objects}
        2    0.000    0.000    0.000    0.000 {built-in method time.time}
        1    0.000    0.000    0.000    0.000 /home/mikedh/miniconda/lib/python3.6/site-packages/numpy/core/fromnumeric.py:2847(ndim)
        1    0.000    0.000    0.000    0.000 {built-in method builtins.isinstance}



`align_svd`: 0.37407684326171875s
`trimesh.geometry.align_vectors`: 0.3488731384277344s

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment