Camera

class compas_view2.scene.Camera(view, fov=45, near=0.1, far=1000, position=None, target=None, scale=1.0)[source]

Bases: object

Camera object for the default view.

Parameters:
  • view (compas_view2.views.View,) – The parent view of the camera.

  • fov (float, optional) – The field-of-view of the camera in degrees.

  • near (float, optional) – Distance to the near clipping plane.

  • far (float, optional) – Distance to the far clipping plane.

  • position (list[float], optional) – The location the camera.

  • target (list[float], optional) – The target location the camera is aimed at. Default is None, in which case the origin of the world coordinate system is used.

  • scale (float, optional) – The scale factor for camera’s near, far and pan_delta. Default is 1.0.

Attributes:
  • fov (float) – The field of view as an angler in degrees.

  • near (float) – The location of the “near” clipping plane.

  • far (float) – The locaiton of the “far” clipping plane.

  • position (compas_view2.scene.camera.Position) – The location the camera.

  • rotation (compas_view2.scene.camera.RotationEuler) – The euler rotation of camera.

  • target (compas_view2.scene.camera.Position) – The viewing target. Default is the origin of the world coordinate system.

  • distance (float) – The distance from the camera standpoint to the target.

  • zoom_delta (float) – Size of one zoom increment.

  • rotation_delta (float) – Size of one rotation increment.

  • pan_delta (float) – Size of one pan increment.

  • scale (float) – The scale factor for camera’s near, far and pan_delta.

Notes

Under construction…

Methods

look_at

Set the target of the camera, while keeping the current position.

pan

Pan the camera based on current mouse movement.

projection

Compute the projection matrix corresponding to the current camera settings.

reset_position

Reset the position of the camera based current view type.

rotate

Rotate the camera based on current mouse movement.

viewworld

Compute the view-world matrix corresponding to the current camera settings.

zoom

Zoom in or out.

zoom_extents