Skip to content

Commit

Permalink
Updating README and adding a sample recording from the shell.
Browse files Browse the repository at this point in the history
  • Loading branch information
kaanaksit committed Dec 23, 2019
1 parent 7879b16 commit 3aabd4d
Show file tree
Hide file tree
Showing 4 changed files with 439 additions and 1 deletion.
1 change: 1 addition & 0 deletions THANKS.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

15 changes: 14 additions & 1 deletion odak/tools/file.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import subprocess
import os
from odak import np
from PIL import Image

Expand Down Expand Up @@ -74,7 +75,6 @@ def shell_command(cmd):
True if succesful.
"""
print('Last command executed: ', cmd)
proc = subprocess.Popen(
cmd,
cwd='.',
Expand All @@ -86,3 +86,16 @@ def shell_command(cmd):
proc.kill()
outs, errs = proc.communicate()
return True

def check_directory(directory):
"""
Definition to check if a directory exist. If it doesn't exist, this definition will create one.
Parameters
----------
directory : str
Full directory path.
"""
if not os.path.exists(directory):
os.makedirs(directory)
return True
28 changes: 28 additions & 0 deletions odak/tools/transformation.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,3 +106,31 @@ def rotate_point(point,angles=[0,0,0],mode='XYZ'):
elif mode == 'ZYX':
result = np.dot(rotx,np.dot(roty,np.dot(rotz,point)))
return result,rotx,roty,rotz

def tilt_towards(location,lookat):
"""
Definition to tilt surface normal of a plane towards a point.
Parameters
----------
location : list
Center of the plane to be tilted.
Returns
----------
lookat : list
Rotation angles in degrees.
"""
dx = location[0]-lookat[0]
dy = location[1]-lookat[1]
dz = location[2]-lookat[2]
dist = np.sqrt(dx**2+dy**2+dz**2)
phi = np.atan2(dy,dx)
theta = np.acos(dz/dist)
angles = [
0,
np.degrees(theta),
np.degrees(phi)
]
return angles

Loading

0 comments on commit 3aabd4d

Please sign in to comment.