CGPdocs

frame

Local coordinate frame.

module 09_geometric_transformationsource: frame.hpp
A frame is an origin (position) and three orthonormal axes ux(), uy(), uz(), the columns of orientation: the point of local coordinates (a, b, c) is position + a ux + b uy + c uz.
A frame is an origin (position) and three orthonormal axes ux(), uy(), uz(), the columns of orientation: the point of local coordinates (a, b, c) is position + a ux + b uy + c uz. Tap to enlarge.

Fields and methods

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

Fields

rotation_transform orientationRotation giving the axes of the frame, the columns of its matrix being ux, uy and uz.
vec3 positionPosition of the origin of the frame.

Methods

frame()Builds the world frame (identity orientation, origin at zero).4 overloads src
frame(rotation_transform const& orientation, vec3 const& position)Builds the frame of the given orientation and origin position (explicit). src
frame(affine_rt const& transformation)Builds the frame with the rotation and translation of a rigid transform (explicit). src
frame(vec3 const& ux, vec3 const& uy, vec3 const& position = {0,0,0})Builds the frame whose first two axes are the unit orthogonal vectors ux and uy (asserted), the third one being their cross product, with an origin position defaulting to zero (explicit). src
Returns the first axis of the frame, i.e. the first column of the orientation matrix. src
Returns the second axis of the frame, i.e. the second column of the orientation matrix. src
Returns the third axis of the frame, i.e. the third column of the orientation matrix. src
Returns the 4x4 matrix ((R, position), (0, 1)) mapping frame coordinates to world coordinates. src

Functions taking a frame

Construct 1

Documented on another page

  • mesh_primitive_frameMesh of the frame f: three arrows of length scale along ux, uy and uz (red, green and blue by default) and a sphere at its origin, the arrow radius being frame_thickness*scale.on mesh

Transform 1

frame inverse(frame const& f)

Frame of the inverse rigid transform (inverse orientation, position -R^-1 * position).

Functions returning a frame

Construct 1

frame camera_frame_look_at(vec3 const& eye, vec3 const& center, vec3 const& up)

Camera frame placed at eye and looking toward center (local -z axis), with its y axis aligned as much as possible with up.

Operators

Show the 5 operators (+, -, *, ==, ...)
frame operator+(frame const& f, vec3 const& tr)

Copy of the frame with its position translated by tr.

frame operator-(frame const& f, vec3 const& tr)

Copy of the frame with its position translated by -tr.

Documented on another page

  • operator*Frame transformed by the rigid transform: orientation and position are rotated, then the position is translated.on affine_rt
  • operator*Frame rotated around the origin: both its orientation and its position are rotated.on rotation_transform
  • operator+Copy of the frame with its position translated by tr.on vec3
CGP - Computer Graphics Programming.