Celestia/Celx Scripting/CELX Lua Methods/CEL command setorientation

setorientation
setorientation { angle  axis  } 

-- OR --

setorientation { ow  ox  oy  oz  } 

Sets the camera orientation. If you are attempting to duplicate a position based on a Bookmark or Cel://URL, you will also need to set the proper Coordinate System, position, and other parameters.

-- OR --

CELX equivalent-1:

Based on Parameter list-1 and the celestia:newvector, celestia:newrotation(axis-angle) and observer:setorientation methods.


 * Create new vector, containing the axis of this rotation [ ,  ,  ], and store in "vec".

vec = celestia:newvector( , ,  )


 * Convert the  from degrees in radians and store in "angle": "angle" = math.pi / 180 *  (= 3.14159265 / 180 *  ). The Lua math.rad(  ) function can also be used for this.

angle = math.rad( <anglenumber> )


 * Create new rotation (i.e. a quaternion) of an "angle" about the specified axis of this rotation in "vec", and store in "rot".

rot = celestia:newrotation(vec, angle)


 * Get observer instance of the active view and rotate the observer according the created new rotation in "rot".

obs = celestia:getobserver obs:setorientation(rot) Summarized:

vec = celestia:newvector( <xrot>, <yrot>, <zrot> ) angle = math.rad( <anglenumber> ) rot = celestia:newrotation(vec, angle) obs = celestia:getobserver obs:setorientation(rot)

CELX equivalent-2:

Based on Parameter list-2 and the celestia:newrotation and observer:setorientation methods.


 * Create new rotation (i.e. a quaternion) from four scalar values and store in rot. <ownumber>: The OW-component of the new rotation, as a number-values taken from a cel-style URL &ow=. <oxnumber>: The OX-component of the new rotation, as a number-values taken from a cel-style URL &ox=. <oynumber>: The OY-component of the new rotation, as a number-values taken from a cel-style URL &oy=. <oznumber>: The OZ-component of the new rotation, as a number-values taken from a cel-style URL &oz=.

rot = celestia:newrotation( <ownumber>, <oxnumber>, <oynumber>, <oznumber> )


 * Get observer instance of the active view and rotate the observer according the created new rotation in "rot".

obs = celestia:getobserver obs:setorientation(rot)

Summarized:

rot = celestia:newrotation( <ownumber>, <oxnumber>, <oynumber>, <oznumber> ) obs = celestia:getobserver obs:setorientation(rot) Example: Set the camera orientation according parameterlist-1 :

CEL:

setorientation { angle 0.945208 axis [ 0.81466 -0.570975 -0.101573 ] }

CELX based on parameter list-1 :

vec = celestia:newvector(0.81466, -0.570975, -0.101573) angle = math.rad(0.945208) rot = celestia:newrotation(vec, angle) obs = celestia:getobserver obs:setorientation(rot)

Example: Set the camera orientation according parameterlist-2 :

CEL

setorientation { ow 0.090610 ox -0.494683 oy 0.860207 oz -0.084397 }

CELX based on parameter list-2 :

rot = celestia:newrotation(0.090610, -0.494683, 0.860207, -0.084397) obs = celestia:getobserver obs:setorientation(rot)

Back to CEL command index