klampt.vis.camera module

This module defines a basic set of 3D cameras that can be controlled by a GUI.

klampt.vis.camera.orientation_matrix(axis1, axis2, axis3)[source]

Returns the matrix that maps the camera’s identity coordinate system (right,down,forward) to world axes 1,2,3 (assuming no camera translation).

Each axis can be either a 3-tuple or any element of [‘x’,’y’,’z’,’-x’,’-y’,’-z’]

class klampt.vis.camera.free[source]

Bases: object

A free-floating camera that is controlled using a translation and euler angle rotation vector.

- pos

camera center position

- rot

euler angle rotation

- ori

orientation matrix type (see orientation_matrix())

matrix()[source]

Returns the camera transform. Applying this transform converts points in OpenGL camera coordinates (x right, y up, -z forward), to points in world coordinates.

set_matrix(T)[source]
class klampt.vis.camera.target[source]

Bases: object

A look-at camera that is controlled using a translation, target point, and up vector

Attributes:

  • pos: camera center position

  • tgt: target point

  • up: up direction

matrix()[source]

Returns the camera transform. Applying this transform converts points in OpenGL camera coordinates (x right, y up, -z forward), to points in world coordinates.

set_matrix(T)[source]
class klampt.vis.camera.orbit[source]

Bases: object

An orbit camera that is controlled using a rotation, target point, distance, and orientation.

- tgt

target point (in world coordinates)

- rot

euler angle rotation (roll-pitch-yaw entries relative to default view with fwd = +y, right = +x, up = +z)

- dist

target distance

- ori

orientation matrix type (see orientation_matrix())

matrix()[source]

Returns the camera transform. Applying this transform converts points in OpenGL camera coordinates (x right, y up, -z forward), to points in world coordinates.

set_orientation(R, ori=None)[source]

Sets the orientation of the camera to the so3 element R.

If ori is provided, it is an orientation list (e.g., [‘x’,’y’,’z’]) that tells the function how to interpret the columns of R in terms of the right, down, and fwd axes of the camera. Its default value is None.

set_matrix(T)[source]

Restores from a matrix retrieved using matrix()