Skip to content

Commit

Permalink
Added standard views to api
Browse files Browse the repository at this point in the history
  • Loading branch information
jasmine-schoch committed Aug 29, 2023
1 parent 93b933b commit 7c45fb8
Showing 1 changed file with 70 additions and 0 deletions.
70 changes: 70 additions & 0 deletions API/oursin/camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,76 @@ def set_rotation(self, rotation):
self.rotation = rotation
client.sio.emit('SetCameraRotation', {self.id: rotation})

def set_rotation_axial(self, bool=True):
"""Set the camera to the standard axial view. Does not change the window, only the rotation.
Parameters
----------
bool : boolean
default true, the above view
Examples
--------
>>> c1.set_rotation_axial(True)
"""
if self.in_unity == False:
raise Exception("Camera is not created. Please create camera before calling method.")

if bool:
rotation = [0,0,0]
else:
rotation = [0,-180,0]
rotation = utils.sanitize_vector3(rotation)
self.rotation = rotation
client.sio.emit('SetCameraRotation', {self.id: rotation})


def set_rotation_coronal(self, bool=True):
"""Set the camera to the standard coronal view. Does not change the window, only the rotation.
Parameters
----------
bool : boolean
default true, the back view
Examples
--------
>>> c1.set_rotation_coronal(True)
"""
if self.in_unity == False:
raise Exception("Camera is not created. Please create camera before calling method.")

if bool:
rotation = [90,0,0]
else:
rotation = [90,-180,0]
rotation = utils.sanitize_vector3(rotation)
self.rotation = rotation
client.sio.emit('SetCameraRotation', {self.id: rotation})


def set_rotation_sagittal(self, bool=True):
"""Set the camera to the standard sagittal view. Does not change the window, only the rotation.
Parameters
----------
bool : boolean
default true, the left view
Examples
--------
>>> c1.set_rotation_sagittal(True)
"""
if self.in_unity == False:
raise Exception("Camera is not created. Please create camera before calling method.")

if bool:
rotation = [90,-90,0]
else:
rotation = [90,90,0]
rotation = utils.sanitize_vector3(rotation)
self.rotation = rotation
client.sio.emit('SetCameraRotation', {self.id: rotation})



def set_zoom(self,zoom):
"""Set the camera zoom.
Expand Down

0 comments on commit 7c45fb8

Please sign in to comment.