CGPdocs

camera_orbit_euler

Camera orbiting around a center, oriented by two angles (keeps the up direction).

Derives from: camera_generic_base

module 10_camera_modelsource: camera_orbit_euler.hpp

Fields and methods

Members of the struct camera_orbit_euler. Most of what you do with a CGP type goes through the free functions listed below.

Fields

float rollTwist angle in radians around the view direction, 0 by default (not used in standard orbit mode).
float pitchUp/down rotation angle in radians around the local x axis, 0 by default.
float yawLeft/right rotation angle in radians around axis_of_rotation, 0 by default.
vec3 axis_of_rotationUp direction of the orbit when pitch = 0, around which yaw rotates, (0,1,0) by default.
vec3 center_of_rotationPoint the camera orbits around and looks at, (0,0,0) by default.
float distance_to_centerDistance between the camera position and center_of_rotation, 5 by default.

Methods

Returns the camera position, center_of_rotation + orientation() * (0,0,distance_to_center). src
Returns the rotation R_axis * R_yaw * R_pitch * R_roll, where R_axis maps (0,1,0) to axis_of_rotation, yaw is around y, pitch around x and roll around -z. src
Adds d_roll, d_pitch and d_yaw (radians) to the angles roll, pitch and yaw. src
Rotates axis_of_rotation by the angle magnitude (radians) around R_axis * (0,0,1), the front direction of the frame when yaw = pitch = 0. src
Multiplies distance_to_center by (1 + magnitude), clamped to at least 0.01; the center is unchanged. src
Translates center_of_rotation (and thus the camera) by tr.x * right() + tr.y * up(). src
Translates center_of_rotation (and thus the camera) by magnitude * front(). src
Sets axis_of_rotation to axis without changing the angles (the axis is used as given, it is not normalized). src
Places the camera at eye looking toward center by setting center_of_rotation, distance_to_center, pitch and yaw; roll and axis_of_rotation are kept, so the up vector is not a free parameter. src
Builds an Euler orbit camera with zero angles, axis_of_rotation (0,1,0), center at the origin and distance_to_center = 5. src
Inherited from camera_generic_base (6 members)

Methods

Returns the camera frame built from orientation() and position(). src
Returns the 4x4 view matrix (world to camera), the inverse of the camera frame matrix. src
Returns the 4x4 matrix of the camera frame (camera to world), the inverse of matrix_view(). src
Returns the viewing direction, the opposite of the third column (local z axis) of orientation(). src
Returns the up direction of the camera, the second column (local y axis) of orientation(). src
Returns the right direction of the camera, the first column (local x axis) of orientation(). src

Functions taking a camera_orbit_euler

Compute 3

Documented on another page

  • picking_mesh_vertex_as_sphereCasts the camera ray through the screen position and returns the closest vertex whose sphere of radius picking_distance it hits, with the hit point, the vertex normal and the vertex index (active is false if none).on vec2
  • picking_plane_orthogonal_to_cameraIntersects the camera ray through the screen position (relative coordinates) with the plane through plane_position orthogonal to the front direction of the camera.on vec2
  • picking_spheresCast a ray through a screen position (normalized device coordinates) and return the closest hit among spheres of common radius, with its index, position and normal.on vec2

Functions returning a camera_orbit_euler

None.

Operators

None.

CGP - Computer Graphics Programming.