Most users are intimidated by the complexity of the camera. There is no need for alarm, since sensible defaults have been chosen for all instance variables. As a bare minimum, the user should specify position and focal_point. The easiest way to do this is to use the default! message. See the explanation of default! below.
Only experienced users should directly set position, focal_point, and view_plane_normal. See default! , azimuth: , elevation: , yaw: , pitch: and zoom: for more convenient ways to modify these variables.
focal_point is the point the camera is looking at. In Foley and Van Dam, this is the view reference point. The focal point is often called the look at point. The default focal_point is (0,0,0).
orientation is the x, y, z orientation of the camera. The default orientation is (0,0,0).
view_up is the direction of up as viewed from position. The default view_up is (0,1,0).
view_plane_normal is a unit vector from position to focal_point. The view plane normal is recalculated whenever position or focal point are changed. The default view_plane_normal is (0,0, -1).
view_angle is the angle, in degrees, that defines the extent of viewing in the projection plane. The default view_angle is 30.
clipping_range is the location of the front and back clipping planes, measured as a distance from position. The back clipping plane is recalculated whenever the thickness is changed. The default clipping_range is (.01, 1000.01).
thickness is the distance between the front and back clipping planes. Thickness is recalculated whenever the clipping range is changed.
status is either 1 (on) of 0 (off). The default status is 0 (off).
x_range, y_range, z_range is the x, y, z extent of the camera's view.
left_eye is used to keep track of what eye is currently being rendered for stereo images. Camera alternates between left and right eye. 1.0 indicates the left eye, 0.0 indicates the right eye is to be rendered.
eye_angle for stereo viewing this instance variable indicates half the angle formed by the vectors from the camera focus to each eye. Typically around 2.0 degrees.
focal_point=, focal_point+, at=, at+ (x, y, z) sets focal_point , recalculates distance and view_plane_normal.
orientation=, orientation+ (x, y, z) set orientation , recalculates focal_point , view_up and view_plane_normal.
view_plane_normal=, view_plane_normal+ (x, y, z) normalizes the input vector, sets view_plane_normal and recalculates focal_point.
clipping_range=, clipping_range+ (front, back) sets clipping_range and recalculates thickness. If thickness is less than .015, recalculates back clipping distance using front distance and thickness.
front=, front+, hither=, hither+ distance sets front clipping plane distance and recalculates back clipping plane.
back=, back+, yon=, yon+ distance sets back clipping plane and recalculates front clipping plane.
thickness=, thickness+ amount checks amount to be greater than .015, sets thickness and recalculates back clipping plane distance.
distance=, distance+ amount checks amount against .1 and recalculates focal_point using distance , view_plane_normal , and position.
azimuth: angle rotates position about view_up centered at focal_point.
elevation: angle rotates position about the cross product of view_plane_normal and view_up centered at focal_point.
yaw: angle rotates focal_point about view_up centered at position.
pitch: angle rotates focal_point about the cross product of view_plane_normal and view_up centered at position.
roll: angle rotates view_up about view_plane_normal.
range= (xmin,xmax,ymin,ymax,zmin,zmax) is a shorthand message for setting the x_range, y_range, and z_range instance variables.
zoom: ratio moves position along view_plane_normal by ratio * distance. If ratio is < 1, zoom: moves position
towards focal_point. If ratio > 1, it moves position away from focal_point.
default! uses x_range, y_range, z_range to set the following:
focal_point to the center of the x, y, z, range.
distance such that the x, y, z range will fit in the projection plane.
clipping_range to .5 * distance and 2.5 * distance.
position to be distance units from focal_point along view_plane_normal.
Before sending default! the user can set position and focal_point to calculate view_plane_normal. Also, the current view_angle and view_up are used.
centered at 1,2,3 that is 10 units wide
we start by looking down the -x axis */
camera new: a_camera position=(0,0,-1) x_range=(-4,6) y_range=(-3,7) z_range=(-2,8) default!; a_camera print: (position, focal_point); a_camera: position= (1,2,-34.32) a_camera: focal_point= (1,2,3)
/* create another camera using defaults */ camera new: another_camera print: (position, focal_point); another_camera: position= (0,0,1) another_camera: focal_point= (0,0,0) /* NOTE: now we're looking down +z axis */
/* change its position using azimuth: */ another_camera azimuth: 90 print: (position, focal_point); another_camera: position= (-1,0,0) another_camera: focal_point= (0,0,0) /* NOTE: now we're looking down -x axis */
/* change its position using azimuth: */ another_camera azimuth: 90 print: (position, focal_point); another_camera: position= (0,0,-1) another_camera: focal_point= (0,0,0) /* NOTE: now we're looking down -z axis */
/* now change focal_point with yaw: */ another_camera yaw:90 print: (position, focal_point); another_camera: position= (0,0,-1) another_camera: focal_point= (-1,0,-1) /* NOTE: now we're looking along +x axis, but at a point on z */
/* reset back to where we started and move position with zoom: */ another_camera position=(0,0,1) focal_point=(0,0,0) default! zoom: 2; another_camera print: (position,focal_point); another_camera: position= (0,0,0.5) another_camera: focal_point= (0,0,0)