class methods

- ofNode()
- ~ofNode()
- boom()
- clearParent()
- customDraw()
- dolly()
- draw()
- getGlobalOrientation()
- getGlobalPosition()
- getGlobalScale()
- getGlobalTransformMatrix()
- getHeadingDeg()
- getHeadingRad()
- getLocalTransformMatrix()
- getLookAtDir()
- getOrientationEulerDeg()
- getOrientationEulerRad()
- getOrientationQuat()
- getParent()
- getPitchDeg()
- getPitchRad()
- getPosition()
- getRollDeg()
- getRollRad()
- getScale()
- getSideDir()
- getUpDir()
- getX()
- getXAxis()
- getY()
- getYAxis()
- getZ()
- getZAxis()
- lookAt()
- move()
- operator=()
- orbitDeg()
- orbitRad()
- panDeg()
- panRad()
- resetTransform()
- restoreTransformGL()
- rollDeg()
- rollRad()
- rotate()
- rotateAround()
- rotateAroundDeg()
- rotateAroundRad()
- rotateDeg()
- rotateRad()
- setGlobalOrientation()
- setGlobalPosition()
- setOrientation()
- setParent()
- setPosition()
- setScale()
- tiltDeg()
- tiltRad()
- transformGL()
- truck()

The ofNode is the base of all things 3d. It lets you represent a location and orientation in 3d space and also allows you to add children or parents so that sets of nodes can move together. This is handy for representing complex 3d models that are linked together, the same way that your hand is linked to your wrist (hopefully), which is linked to your elbow (hopefully), and so on. Nodes are the base of the ofPrimitives, ofCamera, and ofEasyCamera, among other things.

To get the current position, check out: getX(), getY(), getZ(). To get the axis of the node call getXAxis() (or the y and z variants for those other axes). Another really useful feature of the ofNode is that you can get the Eulerian angles of each node: getPitch(), getHeading(), getRoll(). The global transformation matrix of the ofNode is also available using the getGlobalTransformMatrix(), very handy for figuring out things in relation to the OpenGL representation of your OF world. getGlobalOrientation() also is handy, returning a ofQuaternion that you can use to find out whether your node is upside down in relation to the rest of your OF world (really an OpenGL context, but let's not get into that quite yet).

*Documentation from code comments*

*Documentation from code comments*

A generic 3d object in space with transformation (position, rotation, scale).

# boom(...)

## void ofNode::boom(float amount)

Move up+down (in local y axis).

*Documentation from code comments*

*Documentation from code comments*

Move node up+down relative to current position (in local y axis).

**Parameters:**

param0 Desired relative position change along local y axis as float.

# clearParent(...)

## void ofNode::clearParent(bool bMaintainGlobalTransform=false)

*Documentation from code comments*

*Documentation from code comments*

Remove parent node linking.

**Parameters:**

param0 Boolean if maintain child's global transformations (default = false).

# customDraw()

## void ofNode::customDraw()

# customDraw(...)

## void ofNode::customDraw(const ofBaseRenderer *renderer)

*Documentation from code comments*

*Documentation from code comments*

If you extend ofNode and wish to change the way it draws, extend this.

**Parameters:**

param0 A pointer to the renderer you want to draw to. \note Try to not use global functions for rendering and instead use the passed renderer.

# dolly(...)

## void ofNode::dolly(float amount)

Move forward+backward (in local z axis)

*Documentation from code comments*

*Documentation from code comments*

Move node backward+forward relative to current position (in local z axis).

**Parameters:**

param0 Desired relative position change along local z axis as float.

# draw()

## void ofNode::draw()

Draw function. do NOT override this transforms the node to its position+orientation+scale and calls the virtual 'customDraw' method above which you CAN override.

# getGlobalOrientation()

## glm::quat ofNode::getGlobalOrientation()

*Documentation from code comments*

*Documentation from code comments*

Get the global orientation of the node as a quaternion.

**Returns**: An quaternion of the global orientations(useful for complex rotations)

# getGlobalPosition()

## glm::vec3 ofNode::getGlobalPosition()

*Documentation from code comments*

*Documentation from code comments*

Get node's global position as a 3D vector.

**Returns**: A 3D vector with the global coordinates.

# getGlobalScale()

## glm::vec3 ofNode::getGlobalScale()

*Documentation from code comments*

*Documentation from code comments*

Get global scale of node in xyz axes where 1 is default.

**Returns**: The global scale in the xyz axes where 1 = 100% of size.

# getGlobalTransformMatrix()

## glm::mat4 ofNode::getGlobalTransformMatrix()

*Documentation from code comments*

*Documentation from code comments*

Get node's global transformations (position, orientation, scale).

**Returns**: A refrence to mat4 containing node's global transformations.

**See also**: https://open.gl/transformations

# getHeadingDeg()

## float ofNode::getHeadingDeg()

*Documentation from code comments*

*Documentation from code comments*

Get heading of node, aka the rotation along local y axis.

**Returns**: The rotation around the local y axis in degrees, as a float.

# getHeadingRad()

## float ofNode::getHeadingRad()

*Documentation from code comments*

*Documentation from code comments*

Get heading of node, aka the rotation along local y axis.

**Returns**: The rotation around the local y axis in degrees, as a float.

# getLocalTransformMatrix()

## const glm::mat4 & ofNode::getLocalTransformMatrix()

*Documentation from code comments*

*Documentation from code comments*

Get node's local transformations (position, orientation, scale).

**Returns**: A refrence to mat4 containing node's local transformations.

**See also**: https://open.gl/transformations

# getLookAtDir()

## glm::vec3 ofNode::getLookAtDir()

Get -z axis.

*Documentation from code comments*

*Documentation from code comments*

Get direction the node looks at aka local -z axis, as 3d vector.

**Returns**: A normalized 3D vector of the node's local -z axis direction.

# getOrientationEulerDeg()

## glm::vec3 ofNode::getOrientationEulerDeg()

*Documentation from code comments*

*Documentation from code comments*

Get local orientation of node in degrees around x, y, and z axes.

**Returns**: The local x, y and z axes orientation in degrees, as a 3D vector.

# getOrientationEulerRad()

## glm::vec3 ofNode::getOrientationEulerRad()

*Documentation from code comments*

*Documentation from code comments*

Get local orientation of node in degrees around x, y, and z axes.

**Returns**: The local x, y and z axes orientation in degrees, as a 3D vector.

# getOrientationQuat()

## glm::quat ofNode::getOrientationQuat()

*Documentation from code comments*

*Documentation from code comments*

Get the local orientation of the node as a quaternion.

**Returns**: A quaternion of local orientation (useful for complex rotations)

# getParent()

## ofNode * ofNode::getParent()

*Documentation from code comments*

*Documentation from code comments*

Get the parent node of this node.

**Returns**: Pointer to parent ofNode.

# getPitchDeg()

## float ofNode::getPitchDeg()

*Documentation from code comments*

*Documentation from code comments*

Get pitch of node, aka the rotation along local x axis.

**Returns**: The rotation around the local x axis in degrees, as a float.

# getPitchRad()

## float ofNode::getPitchRad()

*Documentation from code comments*

*Documentation from code comments*

Get pitch of node, aka the rotation along local x axis.

**Returns**: The rotation around the local x axis in degrees, as a float.

# getPosition()

## glm::vec3 ofNode::getPosition()

*Documentation from code comments*

*Documentation from code comments*

Get node's local position as a 3D vector.

**Returns**: A 3D vector with the local coordinates.

# getRollDeg()

## float ofNode::getRollDeg()

*Documentation from code comments*

*Documentation from code comments*

Get roll of node, aka the rotation along local z axis.

**Returns**: The rotation around the local z axis in degrees, as a float.

# getRollRad()

## float ofNode::getRollRad()

*Documentation from code comments*

*Documentation from code comments*

Get roll of node, aka the rotation along local z axis.

**Returns**: The rotation around the local z axis in degrees, as a float.

# getScale()

## glm::vec3 ofNode::getScale()

*Documentation from code comments*

*Documentation from code comments*

Get local scale of node in xyz axes where 1 is default.

**Returns**: The local scale in the xyz axes where 1 = 100% of size.

# getSideDir()

## glm::vec3 ofNode::getSideDir()

*Documentation from code comments*

*Documentation from code comments*

Get direction of node's side aka local x axis, as 3d vector.

**Returns**: A normalized 3D vector of the node's local x axis direction.

# getUpDir()

## glm::vec3 ofNode::getUpDir()

Get y axis.

*Documentation from code comments*

*Documentation from code comments*

Get direction of node's top aka local y axis, as 3d vector.

**Returns**: A normalized 3D vector of the node's local y axis direction.

# getX()

## float ofNode::getX()

Get x coodinate.

*Documentation from code comments*

*Documentation from code comments*

Get node's local x position.

**Returns**: Local x coordinate as a float.

# getXAxis()

## glm::vec3 ofNode::getXAxis()

Get x axis.

*Documentation from code comments*

*Documentation from code comments*

Get the node's local x axis as 3d vector.

**Returns**: A normalized 3D vector of the node's local x axis direction.

# getY()

## float ofNode::getY()

Get y coordinate.

*Documentation from code comments*

*Documentation from code comments*

Get node's local y position.

**Returns**: Local y coordinate as a float.

# getYAxis()

## glm::vec3 ofNode::getYAxis()

Get y axis.

*Documentation from code comments*

*Documentation from code comments*

Get the node's local y axis as 3d vector.

**Returns**: A normalized 3D vector of the node's local y axis direction.

# getZ()

## float ofNode::getZ()

Get z coordinate.

*Documentation from code comments*

*Documentation from code comments*

Get node's local z position.

**Returns**: Local z coordinate as a float.

# getZAxis()

## glm::vec3 ofNode::getZAxis()

Get z axis.

*Documentation from code comments*

*Documentation from code comments*

Get the node's local z axis as 3d vector.

**Returns**: A normalized 3D vector of the node's local z axis direction.

# lookAt(...)

## void ofNode::lookAt(const glm::vec3 &lookAtPosition)

*Documentation from code comments*

*Documentation from code comments*

Orient node to look at point (-z axis pointing to global position).

**Parameters:**

param0 XYZ coordinates of point to look at as ref to 3D vector. \note This version calculates the up vector automatically to try to keep it relatively consistant with the original angle.

# lookAt(...)

## void ofNode::lookAt(const glm::vec3 &lookAtPosition, glm::vec3 upVector)

Orient node to look at position (-z axis pointing to position).

*Documentation from code comments*

*Documentation from code comments*

Orient node to look at point (-z axis pointing to global position).

**Parameters:**

param0 XYZ coordinates of point to look at as ref to 3D vector.

param1 The desired up axis as a cartesian 3D vector.

# lookAt(...)

## void ofNode::lookAt(const ofNode &lookAtNode)

*Documentation from code comments*

*Documentation from code comments*

Orient node to look at another node (-z axis pointing at other node).

**Parameters:**

param0 A reference to the node to look at. \note This version calculates the up vector automatically to try to keep it relatively consistant with the original angle.

# lookAt(...)

## void ofNode::lookAt(const ofNode &lookAtNode, const glm::vec3 &upVector)

Orient node to look at node (-z axis pointing to node).

*Documentation from code comments*

*Documentation from code comments*

Orient node to look at another node (-z axis pointing at other node).

**Parameters:**

param0 A reference to the node to look at.

param1 The desired up axis as a ref to cartesian 3D vector.

# move(...)

## void ofNode::move(const glm::vec3 &offset)

Move by arbitrary amount.

*Documentation from code comments*

*Documentation from code comments*

Move node by relative amount with xyz as ref to 3D vector.

**Parameters:**

param0 Desired relative position change along all axes as ref to 3D vector.

# move(...)

## void ofNode::move(float x, float y, float z)

Move by arbitrary amount.

*Documentation from code comments*

*Documentation from code comments*

Move node by relative amount with xyz coordinates.

**Parameters:**

param0 Desired relative position change along x axis as a float.

param1 Desired relative position change along y axis as a float.

param2 Desired relative position change along z axis as a float.

# orbitDeg(...)

## void ofNode::orbitDeg(float longitude, float latitude, float radius, const glm::vec3 ¢erPoint)

*Documentation from code comments*

*Documentation from code comments*

Orbit node around a global position at a specific radius.

**Parameters:**

param0 The longitudinal position of the node in degrees as float.

param1 The latitudinal position of the node in degrees as float.

param2 The desired radius from the position in degrees as float.

param3 The global position to orbit around as ref to 3D vector. Default = (0, 0, 0).

# orbitDeg(...)

## void ofNode::orbitDeg(float longitude, float latitude, float radius, ofNode ¢erNode)

*Documentation from code comments*

*Documentation from code comments*

Orbit node around another node at a specific radius.

**Parameters:**

param0 The longitudinal position of the node in degrees as float.

param1 The latitudinal position of the node in degrees as float.

param2 The desired radius from the other node in degrees as float.

param3 A reference to the node to rotate around.

# orbitRad(...)

## void ofNode::orbitRad(float longitude, float latitude, float radius, const glm::vec3 ¢erPoint)

*Documentation from code comments*

*Documentation from code comments*

Orbit node around a global position at a specific radius.

**Parameters:**

param0 The longitudinal position of the node in radians as float.

param1 The latitudinal position of the node in radians as float.

param2 The desired radius from the position in radians as float.

param3 The global position to orbit around as ref to 3D vector. Default = (0, 0, 0).

# orbitRad(...)

## void ofNode::orbitRad(float longitude, float latitude, float radius, ofNode ¢erNode)

*Documentation from code comments*

*Documentation from code comments*

Orbit node around another node at a specific radius.

**Parameters:**

param0 The longitudinal position of the node in radians as float.

param1 The latitudinal position of the node in radians as float.

param2 The desired radius from the other node in radians as float.

param3 A reference to the node to rotate around.

# panDeg(...)

## void ofNode::panDeg(float degrees)

*Documentation from code comments*

*Documentation from code comments*

Rotate left+right relative to current orientation (around local y axis).

**Parameters:**

param0 Desired relative rotation change along local y axis in degrees as float.

# panRad(...)

## void ofNode::panRad(float radians)

*Documentation from code comments*

*Documentation from code comments*

Rotate left+right relative to current orientation (around local y axis).

**Parameters:**

param0 Desired relative rotation change along local y axis in radians as float.

# resetTransform()

## void ofNode::resetTransform()

*Documentation from code comments*

*Documentation from code comments*

Reset this node's transformations, position, rotation and scale.

# restoreTransformGL(...)

## void ofNode::restoreTransformGL(ofBaseRenderer *renderer)

*Documentation from code comments*

*Documentation from code comments*

Restore opengl renderer's previous modelview transform matrix.

**Parameters:**

param0 A pointer to the renderer you want to restore transformation to;

# rollDeg(...)

## void ofNode::rollDeg(float degrees)

*Documentation from code comments*

*Documentation from code comments*

Roll left+right relative to current orientation (around local z axis).

**Parameters:**

param0 Desired relative rotation change along local z axis in degrees as float.

# rollRad(...)

## void ofNode::rollRad(float radians)

*Documentation from code comments*

*Documentation from code comments*

Roll left+right relative to current orientation (around local z axis).

**Parameters:**

param0 Desired relative rotation change along local z axis in radians as float.

# rotate(...)

## void ofNode::rotate(const glm::quat &q)

Rotate around arbitrary axis by angle.

*Documentation from code comments*

*Documentation from code comments*

Rotate relative to current orientation by quaternion.

**Parameters:**

param0 Desired relative rotation change as a ref to quaternion.

# rotateAround(...)

## void ofNode::rotateAround(const glm::quat &q, const glm::vec3 &point)

Rotate around arbitrary axis by angle around point.

*Documentation from code comments*

*Documentation from code comments*

Rotate relative to current orientation by quaternion around point.

**Parameters:**

param0 Desired relative rotation change as a ref to quaternion.

param1 Point to rotate around in local xyz coordinates as ref to 3D vector.

# rotateAroundDeg(...)

## void ofNode::rotateAroundDeg(float degrees, const glm::vec3 &axis, const glm::vec3 &point)

*Documentation from code comments*

*Documentation from code comments*

Rotate relative to current orientation around arbitrary axis around point.

**Parameters:**

param0 Desired relative angle change in degrees as float.

param1 The arbitrary axis to rotate around as ref to cartesian 3D vector.

param2 Point to rotate around in local xyz coordinates as ref to 3D vector.

# rotateAroundRad(...)

## void ofNode::rotateAroundRad(float radians, const glm::vec3 &axis, const glm::vec3 &point)

*Documentation from code comments*

*Documentation from code comments*

Rotate relative to current orientation around arbitrary axis around point.

**Parameters:**

param0 Desired relative angle change in degrees as float.

param1 The arbitrary axis to rotate around as ref to cartesian 3D vector.

param2 Point to rotate around in local xyz coordinates as ref to 3D vector.

# rotateDeg(...)

## void ofNode::rotateDeg(float degrees, const glm::vec3 &v)

*Documentation from code comments*

*Documentation from code comments*

Rotate relative to current orientation around arbitrary axis.

**Parameters:**

param0 Desired relative angle change in degrees as float.

param1 Desired axis to rotate around as a ref to cartesian 3D Vector.

# rotateDeg(...)

## void ofNode::rotateDeg(float degrees, float vx, float vy, float vz)

*Documentation from code comments*

*Documentation from code comments*

Rotate relative to current orientation around arbitrary axis.

**Parameters:**

param0 Desired relative angle change in degrees as float.

param1 X angle of the axis to rotate around in degrees as float.

param2 Y angle of the axis to rotate around in degrees as float.

param3 Z angle of the axis to rotate around in degrees as float.

# rotateRad(...)

## void ofNode::rotateRad(float radians, const glm::vec3 &v)

*Documentation from code comments*

*Documentation from code comments*

Rotate relative to current orientation around arbitrary axis.

**Parameters:**

param0 Desired relative angle change in radians as float.

param1 Desired axis to rotate around as a ref to cartesian 3D Vector.

# rotateRad(...)

## void ofNode::rotateRad(float radians, float vx, float vy, float vz)

*Documentation from code comments*

*Documentation from code comments*

Rotate relative to current orientation around arbitrary axis.

**Parameters:**

param0 Desired relative angle change in radians as float.

param1 X angle of the axis to rotate around in degrees as float.

param2 Y angle of the axis to rotate around in degrees as float.

param3 Z angle of the axis to rotate around in degrees as float.

# setGlobalOrientation(...)

## void ofNode::setGlobalOrientation(const glm::quat &q)

*Documentation from code comments*

*Documentation from code comments*

Set global orientation with a quaternion.

**Parameters:**

param0 Desired global orientation as ref to an glm::quat.

# setGlobalPosition(...)

## void ofNode::setGlobalPosition(const glm::vec3 &p)

*Documentation from code comments*

*Documentation from code comments*

Set the global position of the node using a 3D vector of coordinates.

**Parameters:**

param0 Desired global xyz coordinates as ref to 3D vector.

# setGlobalPosition(...)

## void ofNode::setGlobalPosition(float px, float py, float pz)

*Documentation from code comments*

*Documentation from code comments*

Set the global position of the node using xyz coordinates.

**Parameters:**

param0 Desired global x coordinate as a float.

param1 Desired global y coordinate as a float.

param2 Desired global z coordinate as a float.

# setOrientation(...)

## void ofNode::setOrientation(const glm::quat &q)

*Documentation from code comments*

*Documentation from code comments*

Set local orientation with a quaternion.

**Parameters:**

param0 Desired local orientation as ref to an glm::quat.

# setOrientation(...)

## void ofNode::setOrientation(const glm::vec3 &eulerAngles)

*Documentation from code comments*

*Documentation from code comments*

Set local orientation with xyz euler angles.

**Parameters:**

param0 Desired local xyz angles in degrees, as ref to 3D vector. \note Using euler angles can cause gimbal lock.

**See also**: https://en.wikipedia.org/wiki/Gimbal_lock

# setParent(...)

## void ofNode::setParent(ofNode &parent, bool bMaintainGlobalTransform=false)

Set parent to link nodes transformations are inherited from parent node set to NULL if not needed (default).

*Documentation from code comments*

*Documentation from code comments*

Set parent for the node. The node will inherit transformations from parent.

**Parameters:**

param0 Reference to the ofNode which becomes the parent node.

param1 Boolean if maintain child's global transformations (default = false).

# setPosition(...)

## void ofNode::setPosition(const glm::vec3 &p)

*Documentation from code comments*

*Documentation from code comments*

Set the local position of the node using a 3D vector of coordinates.

**Parameters:**

param0 Desired local xyz coordinates as ref to 3D vector.

# setPosition(...)

## void ofNode::setPosition(float px, float py, float pz)

*Documentation from code comments*

*Documentation from code comments*

Set the local position of the node using xyz coordinates.

**Parameters:**

param0 Desired local x coordinate as a float.

param1 Desired local y coordinate as a float.

param2 Desired local z coordinate as a float.

# setScale(...)

## void ofNode::setScale(const glm::vec3 &s)

*Documentation from code comments*

*Documentation from code comments*

Set local scale for xyz axes individually with a 3D vector.

**Parameters:**

param0 Desired local scale for all axes as ref to 3D vector where 1 = 100%.

# setScale(...)

## void ofNode::setScale(float s)

*Documentation from code comments*

*Documentation from code comments*

Set local uniform scale (x, y, and z are equally scaled).

**Parameters:**

param0 Desired scale for all axes as a float where 1 = 100%.

# setScale(...)

## void ofNode::setScale(float sx, float sy, float sz)

*Documentation from code comments*

*Documentation from code comments*

Set local scale for xyz axes individually.

**Parameters:**

param0 Desired local scale for x axis as a float where 1 = 100%.

param1 Desired local scale for y axis as a float where 1 = 100%.

param2 Desired local scale for z axis as a float where 1 = 100%.

# tiltDeg(...)

## void ofNode::tiltDeg(float degrees)

*Documentation from code comments*

*Documentation from code comments*

Tilt up+down relative to current orientation (around local x axis).

**Parameters:**

param0 Desired relative rotation change along local x axis in degrees as float.

# tiltRad(...)

## void ofNode::tiltRad(float radians)

*Documentation from code comments*

*Documentation from code comments*

Tilt up+down relative to current orientation (around local x axis).

**Parameters:**

param0 Desired relative rotation change along local x axis in radians as float.

# transformGL(...)

## void ofNode::transformGL(ofBaseRenderer *renderer)

Set opengl's modelview matrix to this nodes transform. If you want to draw something at the position+orientation+scale of this node... ...call ofNode::transform(); write your draw code, and ofNode::restoreTransform(); OR A simpler way is to extend ofNode and override ofNode::customDraw().

# truck(...)

## void ofNode::truck(float amount)

move sideways (in local x axis)

*Documentation from code comments*

*Documentation from code comments*

Move node left+right relative to current position (in local x axis).

**Parameters:**

param0 Desired relative position change along local x axis as float.

Last updated 금요일, 05 1월 2024 04:30:08 UTC - 76da1a94ddd033ed7b011f01e62bc1521791976d

If you have any doubt about the usage of this module you can ask in the forum.

If you want to contribute better documentation or start documenting this section you can do so here

If you find anything wrong with this docs you can report any error by opening an issue