Class: ModraUp::Camera
- Inherits:
-
Object
- Object
- ModraUp::Camera
Overview
Viewport Camera: eye, target, up, field of view, and projection. Obtain the current camera from ModraUp::View#camera, or create one with ModraUp::Camera.new. to_s returns "Sketchup::Camera".
Class Method Summary # collapse
-
.new ⇒ ModraUp::Camera
Construct the camera. With three parameters, it defaults to a perspective view with a field of view of 30 degrees.
Instance Method Summary # collapse
-
#set(eye, target, up) ⇒ ModraUp::Camera
Sets the eye, target, and up direction simultaneously.
-
#eye ⇒ Geom::Point3d
Camera position.
-
#target ⇒ Geom::Point3d
Target. The point where the camera is aimed.
-
#up ⇒ Geom::Vector3d
Up direction. The track camera is derived from the Z-axis, with custom roll not saved.
-
#perspective? ⇒ Boolean
Returns whether the projection is perspective.
-
#perspective ⇒ Boolean
See #perspective?.
-
#perspective= ⇒ Boolean
Perspective is true, orthographic is false.
-
#fov ⇒ Numeric
Vertical field of view in degrees.
-
#fov= ⇒ Numeric
Sets the vertical field of view.
-
#aspect_ratio ⇒ Float
Aspect ratio of the view. +0.0 indicates that it matches the viewport.
-
#aspect_ratio= ⇒ Numeric
Set the aspect ratio of the view. 0 indicates that it will match the viewport's aspect ratio.
-
#center_2d ⇒ Geom::Point3d
Translation: The translation offset for two-point perspective or photo matching (in normalized device coordinates). The z value is always 0.
-
#description ⇒ String
Camera description text.
-
#description= ⇒ String
Set the camera description text.
-
#direction ⇒ Geom::Vector3d
The direction of the view, which is the same as the #zaxis.
-
#focal_length ⇒ Float
The focal length (in millimeters) calculated from #fov and #image_width. If #image_width is 0, it defaults to 36 mm.
-
#focal_length= ⇒ Numeric
Sets the field of view using the focal length in millimeters. Valid range is 1..3000.
-
#fov_is_height? ⇒ Boolean
Returns whether the field of view is measured in the vertical direction.
-
#height ⇒ Float
Parallel projection visible height (in inches). Perspective camera also returns an equivalent height.
-
#height= ⇒ Numeric
Sets the visible height for parallel projection in inches.
-
#image_width ⇒ Float
Frame width in millimeters used to calculate #focal_length. A value of 0 means 36 mm.
-
#image_width= ⇒ Numeric
Set the image width in millimeters. 0 indicates that the focal length is calculated based on 36 mm. This does not affect the viewport display.
-
#is_2d? ⇒ Boolean
Returns true if the camera is in two-point perspective (or matches a photograph).
-
#scale_2d ⇒ Float
The scale factor for two-point perspective. Not scaled to 1.0.
-
#xaxis ⇒ Geom::Vector3d
The camera coordinate system X-axis (right) is obtained by the cross product of the view direction and the up direction.
-
#yaxis ⇒ Geom::Vector3d
Camera coordinate system y-axis (up), perpendicular to the line of sight.
-
#zaxis ⇒ Geom::Vector3d
The camera coordinate system Z-axis, which is the same as #direction.
-
#focus_at(point) ⇒ ModraUp::Camera
Focus the camera on the depth of point point, without translating or scaling the current view. Preserve the perspective eye position, and maintain the field of view height for parallel projection.
-
#zoom_at(point, factor) ⇒ ModraUp::Camera
Zoom around a world point while maintaining that point's screen position. A factor greater than 1 moves the view farther away, while a factor less than 1 moves the view closer.
Class Method Details
Camera.new ⇒ cameraCamera.new(eye, target, up) ⇒ cameraCamera.new(eye, target, up, perspective, fov) ⇒ camera
Construct the camera. With three parameters, it defaults to a perspective view with a field of view of 30 degrees.
Instance Method Details
camera.set(eye, target, up) ⇒ camera
Sets the eye, target, and up direction simultaneously.
camera.eye ⇒ Geom::Point3d
Camera position.
camera.target ⇒ Geom::Point3d
Target. The point where the camera is aimed.
camera.up ⇒ Geom::Vector3d
Up direction. The track camera is derived from the Z-axis, with custom roll not saved.
camera.perspective? ⇒ Boolean
Returns whether the projection is perspective.
camera.perspective ⇒ Boolean
See #perspective?.
camera.perspective = value ⇒ value
Perspective is true, orthographic is false.
camera.fov ⇒ Numeric
Vertical field of view in degrees.
camera.fov = degrees ⇒ Numeric
Sets the vertical field of view.
camera.aspect_ratio ⇒ Float
Aspect ratio of the view. +0.0 indicates that it matches the viewport.
camera.aspect_ratio = ratio ⇒ Numeric
Set the aspect ratio of the view. 0 indicates that it will match the viewport's aspect ratio.
camera.center_2d ⇒ Geom::Point3d
Translation: The translation offset for two-point perspective or photo matching (in normalized device coordinates). The z value is always 0.
camera.description ⇒ String
Camera description text.
camera.description = description ⇒ String
Set the camera description text.
camera.direction ⇒ Geom::Vector3d
The direction of the view, which is the same as the #zaxis.
camera.focal_length ⇒ Float
The focal length (in millimeters) calculated from #fov and #image_width. If #image_width is 0, it defaults to 36 mm.
camera.focal_length = focal_length ⇒ Numeric
Sets the field of view using the focal length in millimeters. Valid range is 1..3000.
camera.fov_is_height? ⇒ Boolean
Returns whether the field of view is measured in the vertical direction.
camera.height ⇒ Float
Parallel projection visible height (in inches). Perspective camera also returns an equivalent height.
camera.height = value ⇒ Numeric
Sets the visible height for parallel projection in inches.
camera.image_width ⇒ Float
Frame width in millimeters used to calculate #focal_length. A value of 0 means 36 mm.
camera.image_width = image_width ⇒ Numeric
Set the image width in millimeters. 0 indicates that the focal length is calculated based on 36 mm. This does not affect the viewport display.
camera.is_2d? ⇒ Boolean
Returns true if the camera is in two-point perspective (or matches a photograph).
camera.scale_2d ⇒ Float
The scale factor for two-point perspective. Not scaled to 1.0.
camera.xaxis ⇒ Geom::Vector3d
The camera coordinate system X-axis (right) is obtained by the cross product of the view direction and the up direction.
camera.yaxis ⇒ Geom::Vector3d
Camera coordinate system y-axis (up), perpendicular to the line of sight.
camera.zaxis ⇒ Geom::Vector3d
The camera coordinate system Z-axis, which is the same as #direction.
camera.focus_at(point) ⇒ camera
Focus the camera on the depth of point point, without translating or scaling the current view. Preserve the perspective eye position, and maintain the field of view height for parallel projection.
camera.zoom_at(point, factor) ⇒ camera
Zoom around a world point while maintaining that point's screen position. A factor greater than 1 moves the view farther away, while a factor less than 1 moves the view closer.