Camera#
- pyenki.viewer.to_3d(xy: VectorLike, z: SupportsFloat) Vector3#
Concatenate a 2D vector and an vertical component as a 3D vector
- Parameters:
xy – The horizontal vector
(x, y)z – The vertical component
- Returns:
The concatenation
(x, y, z)
- pyenki.viewer.rotate(value: Vector3, angle: float) Vector3#
Rotates a 3D vector around the vertical axis
- Parameters:
value – The vector
angle – The rotation angle in rad.
- Returns:
The rotated vector
- class pyenki.viewer.CameraConfig#
- camera_altitude: NotRequired[SupportsFloat]#
- camera_is_ortho: NotRequired[bool]#
- camera_pitch: NotRequired[SupportsFloat]#
- camera_position: NotRequired[VectorLike]#
- camera_reset: NotRequired[bool]#
- camera_yaw: NotRequired[SupportsFloat]#
- class pyenki.viewer.Camera#
This class describes a camera.
- __init__(position: Vector3 = array([0., 0., 0.]), yaw: float = 0, pitch: float = 0, is_ortho: bool = False) None#
Constructs a new instance.
- Parameters:
position – The position
yaw – The yaw
pitch – The pitch
is_ortho – Whether to use orthographic projection
- move(target_position: Vector3Like, target_distance: float = 30.0) None#
Translates the camera to point a target while maintaining its attitude.
- Parameters:
target_position – The target position
target_distance – The target distance
- point(target_position: Vector3Like) None#
Rotates the camera to point a target while maintaining its position.
- Parameters:
target_position – The target position
- reset(world: World | None = None) None#
Resets the camera to capture the world from a default POV.
- Parameters:
world – An optional The world
- set_viewport(width: float, height: float) None#
Sets the viewport.
- Parameters:
width – The width in pixels
height – The height in pixels
- property config: CameraConfig#
Returns the relevant camera attributes as a dictionary
- Returns:
The camera configuration.
- class pyenki.viewer.camera.HasCamera#
Mixins for classes that hold and manipulate a camera, like
pyenki.viewer.WorldViewandpyenki.buffer.EnkiRemoteFrameBuffer- move_camera(target_position: VectorLike, target_altitude: SupportsFloat = 0.0, target_distance: SupportsFloat = 30.0, yaw: SupportsFloat | None = None, pitch: SupportsFloat | None = None) None#
Translates the camera to point a target while maintaining its attitude.
- Parameters:
target_position – The target horizontal position in cm.
target_altitude – The target vertical position in cm.
target_distance – The distance to the target.
yaw – Optionally sets the camera yaw.
pitch – Optionally sets the camera pitch.
- point_camera(target_position: VectorLike, target_altitude: SupportsFloat = 0.0, position: VectorLike | None = None, altitude: SupportsFloat | None = None) None#
Rotates the camera to point a target while maintaining its position.
- Parameters:
target_position – The target horizontal position in cm.
target_altitude – The target vertical position in cm.
position – Optionally sets the camera position.
altitude – Optionally sets the camera altitude.
- update_camera_config(**config: Unpack[CameraConfig]) None#
Updates the camera configuration
- Parameters:
config – The (potentially partial) configuration
- property camera_config: CameraConfig#
The camera configuration
- property camera_matrix: QMatrix4x4#
The transformation matrix between camera frame to world frame
- property camera_projection: QMatrix4x4#
The projection matrix
- property tracked_object: PhysicalObject | None#
The object being tracked