XdkWrl: CylinderSensor Class Reference

Home | Hierarchy | Members | Alphabetical | Related Pages

# CylinderSensor Class Reference
[Standard Node Types]

`#include <cylindersensor.h>`

Inherits Node.

List of all members.

## Public Member Functions
| CylinderSensor (const char *name="")
virtual | ~CylinderSensor ()
virtual unsigned int | nbFields () const
virtual FieldHandle | field (const std::string &n)
virtual FieldHandle | field (unsigned int i)
virtual bool | isSetToDefaultValue (unsigned int i) const
virtual unsigned int | nbEventsIn () const
virtual EventInHandle | eventIn (const std::string &n)
virtual EventInHandle | eventIn (unsigned int i)
virtual unsigned int | nbEventsOut () const
virtual EventOutHandle | eventOut (const std::string &n)
virtual EventOutHandle | eventOut (unsigned int i)
const char * | typeName () const
virtual Node * | duplicate () const
virtual Node * | duplicate (std::map< const Node *, Node * > &) const
## Public Attributes
Exposed Fields
A field that is capable of receiving events via an eventIn to change its value(s), and generating events via an eventOut when its value(s) change.
SFBool | autoOffset
SFFloat | diskAngle
SFBool | enabled
SFFloat | maxAngle
SFFloat | minAngle
SFFloat | offset
Events In
EventIn< SFBool > | set_autoOffset
EventIn< SFFloat > | set_diskAngle
EventIn< SFBool > | set_enabled
EventIn< SFFloat > | set_maxAngle
EventIn< SFFloat > | set_minAngle
EventIn< SFFloat > | set_offset
Events Out
EventOut< SFBool > | isActive
EventOut< SFRotation > | rotation_changed
EventOut< SFVec3f > | trackPoint_changed
EventOut< SFBool > | autoOffset_changed
EventOut< SFFloat > | diskAngle_changed
EventOut< SFBool > | enabled_changed
EventOut< SFFloat > | maxAngle_changed
EventOut< SFFloat > | minAngle_changed
EventOut< SFFloat > | offset_changed

## Detailed Description

Here is the documentation for this node type, from the ISO standard.

## 6.17 CylinderSensor

The CylinderSensor node maps pointer motion (e.g., a mouse or wand) into a rotation on an invisible cylinder that is aligned with the Y-axis of the local coordinate system. The CylinderSensor uses the descendent geometry of its parent node to determine whether it is liable to generate events.

The enabled exposed field enables and disables the CylinderSensor node. If TRUE, the sensor reacts appropriately to user events. If FALSE, the sensor does not track user input or send events. If enabled receives a FALSE event and isActive is TRUE, the sensor becomes disabled and deactivated, and outputs an isActive FALSE event. If enabled receives a TRUE event the sensor is enabled and ready for user activation.

A CylinderSensor node generates events when the pointing device is activated while the pointer is indicating any descendent geometry nodes of the sensor's parent group. See 4.6.7.5, Activating and manipulating sensors, for more details on using the pointing device to activate the CylinderSensor.

Upon activation of the pointing device while indicating the sensor's geometry, an isActive TRUE event is sent. The initial acute angle between the bearing vector and the local Y-axis of the CylinderSensor node determines whether the sides of the invisible cylinder or the caps (disks) are used for manipulation. If the initial angle is less than the diskAngle, the geometry is treated as an infinitely large disk lying in the local Y=0 plane and coincident with the initial intersection point. Dragging motion is mapped into a rotation around the local +Y-axis vector of the sensor's coordinate system. The perpendicular vector from the initial intersection point to the Y-axis defines zero rotation about the Y-axis. For each subsequent position of the bearing, a rotation_changed event is sent that equals the sum of the rotation about the +Y-axis vector (from the initial intersection to the new intersection) plus the offset value. trackPoint_changed events reflect the unclamped drag position on the surface of this disk. When the pointing device is deactivated and autoOffset is TRUE, offset is set to the last value of rotation_changed and an offset_changed event is generated. See 4.6.7.4, Drag sensors, for a more general description of autoOffset and offset fields.

If the initial acute angle between the bearing vector and the local Y-axis of the CylinderSensor node is greater than or equal to diskAngle, then the sensor behaves like a cylinder. The shortest distance between the point of intersection (between the bearing and the sensor's geometry) and the Y-axis of the parent group's local coordinate system determines the radius of an invisible cylinder used to map pointing device motion and marks the zero rotation value. For each subsequent position of the bearing, a rotation_changed event is sent that equals the sum of the right-handed rotation from the original intersection about the +Y-axis vector plus the offset value. trackPoint_changed events reflect the unclamped drag position on the surface of the invisible cylinder. When the pointing device is deactivated and autoOffset is TRUE, offset is set to the last rotation angle and an offset_changed event is generated. More details are available in 4.6.7.4, Drag sensors.

When the sensor generates an isActive TRUE event, it grabs all further motion events from the pointing device until it is released and generates an isActive FALSE event (other pointing-device sensors shall not generate events during this time). Motion of the pointing device while isActive is TRUE is referred to as a "drag." If a 2D pointing device is in use, isActive events will typically reflect the state of the primary button associated with the device (i.e., isActive is TRUE when the primary button is pressed and FALSE when it is released). If a 3D pointing device (e.g., a wand) is in use, isActive events will typically reflect whether the pointer is within or in contact with the sensor's geometry.

While the pointing device is activated, trackPoint_changed and rotation_changed events are output and are interpreted from pointing device motion based on the sensor's local coordinate system at the time of activation. trackPoint_changed events represent the unclamped intersection points on the surface of the invisible cylinder or disk. If the initial angle results in cylinder rotation (as opposed to disk behaviour) and if the pointing device is dragged off the cylinder while activated, browsers may interpret this in a variety of ways (e.g., clamp all values to the cylinder and continuing to rotate as the point is dragged away from the cylinder). Each movement of the pointing device while isActive is TRUE generates trackPoint_changed and rotation_changed events.

The minAngle and maxAngle fields clamp rotation_changed events to a range of values. If minAngle is greater than maxAngle, rotation_changed events are not clamped. The minAngle and maxAngle fields are restricted to the range [-2, 2].

More information about this behaviour is described in 4.6.7.3, Pointing-device sensors, 4.6.7.4, Drag sensors, and 4.6.7.5, Activating and manipulating sensors.

## Constructor & Destructor Documentation

CylinderSensor | ( | const char * | name = `""` | ) |

Construct a node with all its fields set to default value, which is equivalent to the code below:

      autoOffset = true;
      diskAngle = 0.262f;
      enabled = true;
      maxAngle = -1.0f;
      minAngle = 0.0f;
      offset = 0.0f;

~CylinderSensor | ( |  | ) | `[virtual]`

Virtual destructor, does nothing

## Member Function Documentation

unsigned int nbFields | ( |  | ) | const`[inline, virtual]`

Returns the number of fields (exposed or not) for this node type.

Implements Node.

wrl::Node::FieldHandle field | ( | const std::string & | n | ) | `[virtual]`

Return a handle on the field named `n` of the node or a "unknown" typed handle if there is no such field. Valid names are:

- autoOffset
- diskAngle
- enabled
- maxAngle
- minAngle
- offset

Implements Node.

wrl::Node::FieldHandle field | ( | unsigned int | n | ) | `[virtual]`

Return a handle on the `i` th field of the node or a "unknown" typed handle if there is no such node. Here is how `i` is related to fields:

- 0 : autoOffset
- 1 : diskAngle
- 2 : enabled
- 3 : maxAngle
- 4 : minAngle
- 5 : offset This function is useful, with nbFields() if you want to traverse all fields of a Node.

Implements Node.

bool isSetToDefaultValue | ( | unsigned int | i | ) | const`[virtual]`

Implements Node.

unsigned int nbEventsIn | ( |  | ) | const`[inline, virtual]`

Returns the number of events in for this node type.

Implements Node.

wrl::Node::EventInHandle eventIn | ( | const std::string & | n | ) | `[virtual]`

Return a handle on the event in named `n` of the node or a "unknown" typed handle if there is no such event. Valid names are:

- set_autoOffset
- set_diskAngle
- set_enabled
- set_maxAngle
- set_minAngle
- set_offset

Implements Node.

wrl::Node::EventInHandle eventIn | ( | unsigned int | n | ) | `[virtual]`

Return a handle on the `i` th event in of the node or a "unknown" typed handle if there is no such node. emarks This class has no eventIn. This function is useful, with nbEventsIn() if you want to traverse all events in of a Node.

Implements Node.

unsigned int nbEventsOut | ( |  | ) | const`[inline, virtual]`

Returns the number of events out for this node type.

Implements Node.

wrl::Node::EventOutHandle eventOut | ( | const std::string & | n | ) | `[virtual]`

Return a handle on the event out named `n` of the node or a "unknown" typed handle if there is no such event. Valid names are:

- isActive
- rotation_changed
- trackPoint_changed
- autoOffset_changed
- diskAngle_changed
- enabled_changed
- maxAngle_changed
- minAngle_changed
- offset_changed

Implements Node.

wrl::Node::EventOutHandle eventOut | ( | unsigned int | n | ) | `[virtual]`

Return a handle on the `i` th event out of the node or a "unknown" typed handle if there is no such node. Here is how `i` is related to fields:

- 0 : isActive
- 1 : rotation_changed
- 2 : trackPoint_changed
- 3 : autoOffset_changed
- 4 : diskAngle_changed
- 5 : enabled_changed
- 6 : maxAngle_changed
- 7 : minAngle_changed
- 8 : offset_changed This function is useful, with nbEventsOut() if you want to traverse all events in of a Node.

Implements Node.

const char * typeName | ( |  | ) | const`[inline, virtual]`

Returns `"CylinderSensor"`. Useful for printing.

Implements Node.

wrl::Node * duplicate | ( |  | ) | const`[virtual]`

Returns a deep copy of this node, that is a fully independant node with all children (if any) also copied. This is mainly useful for instanciating protos.

Implements Node.

virtual Node* duplicate | ( | std::map< const Node *, Node * > & |  | ) | const`[virtual]`

Implements Node.

## Member Data Documentation

SFBool autoOffset

See Detailed Description for meaning of this field. Default value is set to

           autoOffset = true;

SFFloat diskAngle

See Detailed Description for meaning of this field. Default value is set to

           diskAngle = 0.262f;

SFBool enabled

See Detailed Description for meaning of this field. Default value is set to

           enabled = true;

SFFloat maxAngle

See Detailed Description for meaning of this field. Default value is set to

           maxAngle = -1.0f;

SFFloat minAngle

See Detailed Description for meaning of this field. Default value is set to

           minAngle = 0.0f;

SFFloat offset

See Detailed Description for meaning of this field. Default value is set to

           offset = 0.0f;

EventIn<SFBool> set_autoOffset

Set event associated to exposedField autoOffset

EventIn<SFFloat> set_diskAngle

Set event associated to exposedField diskAngle

EventIn<SFBool> set_enabled

Set event associated to exposedField enabled

EventIn<SFFloat> set_maxAngle

Set event associated to exposedField maxAngle

EventIn<SFFloat> set_minAngle

Set event associated to exposedField minAngle

EventIn<SFFloat> set_offset

Set event associated to exposedField offset

EventOut<SFBool> isActive

See Detailed Description for meaning of this event.

EventOut<SFRotation> rotation_changed

See Detailed Description for meaning of this event.

EventOut<SFVec3f> trackPoint_changed

See Detailed Description for meaning of this event.

EventOut<SFBool> autoOffset_changed

Changed event associated to exposedField autoOffset

EventOut<SFFloat> diskAngle_changed

Changed event associated to exposedField diskAngle

EventOut<SFBool> enabled_changed

Changed event associated to exposedField enabled

EventOut<SFFloat> maxAngle_changed

Changed event associated to exposedField maxAngle

EventOut<SFFloat> minAngle_changed

Changed event associated to exposedField minAngle

EventOut<SFFloat> offset_changed

Changed event associated to exposedField offset

Generated on 5 Jan 2007 with version 1.5.1. |