1. iorodeo
  2. roscad

Commits

Peter Polidoro  committed 1e66365

Changed camera_angle to units of radians. Added camera_up variable.

  • Participants
  • Parent commits 189de77
  • Branches default

Comments (0)

Files changed (2)

File cad/src/cad/cad_export/povray.py

View file
         except KeyError:
             file_header_str += "{indent}look_at <0,0,0>\n".format(indent = self.indent_str)
         try:
-            file_header_str += "{indent}angle {angle:0.5f}\n".format(indent = self.indent_str,angle = obj.camera.get_obj_parameter('camera_angle'))
+            camera_angle = (180/math.pi)*obj.camera.get_obj_parameter('camera_angle')
+            file_header_str += "{indent}angle {angle:0.5f}\n".format(indent = self.indent_str,angle = camera_angle)
         except KeyError:
-            # file_header_str += "{indent}angle 75\n".format(indent = self.indent_str)
+            pass
+        try:
+            camera_up = obj.camera.get_obj_parameter('camera_up')
+            if 0 < len(camera_up):
+                file_header_str += "{indent}up <{camera_up[0]:0.5f},{camera_up[1]:0.5f},{camera_up[2]:0.5f}>\n".format(indent = self.indent_str, camera_up = camera_up)
+        except KeyError:
             pass
         file_header_str += "}\n"
         file_header_str += str0

File cad/src/cad/render_object.py

View file
 from __future__ import division
 import os
 import copy
+import math
 
 import cad_object
 
 
 class Camera(cad_object.CADObject):
-    def __init__(self,name='default',projection='perspective',angle=65,position=[0,0,100],look_at=[0,0,0],image_size=[640,480],image_dir=''):
+    def __init__(self,name='default',projection='perspective',angle=1.134,position=[0,0,100],look_at=[0,0,0],image_size=[640,480],image_dir=''):
         super(Camera, self).__init__()
         image_ext = '.png'
         image_name = name + image_ext
         self.set_obj_parameter('camera_name',name)
         self.set_obj_parameter('camera_projection',projection)
+        if 2*math.pi < angle:
+            angle = angle*math.pi/180
         self.set_obj_parameter('camera_angle',angle)
         self.set_position(position)
         self.set_obj_parameter('camera_look_at',look_at)
     def clear_cameras(self):
         self.camera_dict = {}
 
-    def add_camera(self,name='',projection='perspective',angle=65,position=[0,0,100],look_at=[0,0,0],image_size=[640,480],image_dir=''):
+    def add_camera(self,name='',projection='perspective',angle=1.134,position=[0,0,100],look_at=[0,0,0],image_size=[640,480],image_dir=''):
         if name == '':
             camera_count = self.get_camera_count()
             name = 'camera' + str(camera_count)