Inviwo  0.9.10.1
Inviwo documentation
inviwo::TouchEvent Class Reference

Touch event contains all touch points associated with the event. Touch events are usually generated by touch screens or touch pads, see TouchDevice. More...

#include <touchevent.h>

+ Inheritance diagram for inviwo::TouchEvent:

Public Member Functions

 TouchEvent (const std::vector< TouchPoint > &touchPoints, const TouchDevice *source)
 
virtual TouchEventclone () const override
 
bool hasTouchPoints () const
 
const std::vector< TouchPoint > & touchPoints () const
 
std::vector< TouchPoint > & touchPoints ()
 
void setTouchPoints (std::vector< TouchPoint > val)
 
uvec2 canvasSize () const
 
dvec2 centerPoint () const
 Computes average position. Returns dvec2(0) if no touch points exist. More...
 
dvec2 centerPointNormalized () const
 Computes average normalized position. Returns dvec2(0) if no touch points exist. More...
 
dvec2 prevCenterPointNormalized () const
 Computes previous average normalized position. Returns dvec2(0) if no touch points exist. More...
 
dvec3 centerNDC () const
 Average of touch points in normalized device coordinates, TouchPoint::ndc() Defined in (-1,1) in a left handed coordinate system. More...
 
double averageDepth () const
 Average depth of touch points, TouchPoint::depth() Defined in [-1 1], where -1 is the near plane and 1 is the far plane. More...
 
const TouchDevicegetDevice () const
 Return TouchDevice that generated the event.
 
std::vector< const TouchPoint * > findClosestTwoTouchPoints () const
 Retrieve pointers to the two closest touch points. More...
 
virtual uint64_t hash () const override
 
virtual void print (std::ostream &ss) const override
 
- Public Member Functions inherited from inviwo::InteractionEvent
 InteractionEvent (KeyModifiers modifiers=KeyModifiers(flags::empty))
 
 InteractionEvent (const InteractionEvent &rhs)=default
 
InteractionEventoperator= (const InteractionEvent &that)=default
 
KeyModifiers modifiers () const
 
void setModifiers (KeyModifiers modifiers)
 
std::string modifierNames () const
 
void setToolTip (const std::string &tooltip) const
 
void setToolTipCallback (ToolTipCallback callback)
 
const ToolTipCallback & getToolTipCallback () const
 
- Public Member Functions inherited from inviwo::Event
virtual bool shouldPropagateTo (Inport *inport, Processor *processor, Outport *source)
 
void markAsUsed ()
 
bool hasBeenUsed () const
 
void markAsUnused ()
 
void markAsVisited (Processor *)
 
void markAsVisited (Event &)
 
bool hasVisitedProcessor (Processor *) const
 
const std::vector< Processor * > & getVisitedProcessors () const
 
template<typename EventType >
EventType * getAs ()
 
template<typename EventType >
const EventType * getAs () const
 

Static Public Member Functions

static PickingState getPickingState (const std::vector< TouchPoint > &points)
 Get PickingState by analyzing all touch points. More...
 
static constexpr uint64_t chash ()
 

Additional Inherited Members

- Public Types inherited from inviwo::InteractionEvent
using ToolTipCallback = std::function< void(const std::string &)>
 
- Protected Member Functions inherited from inviwo::Event
 Event (const Event &rhs)=default
 
Eventoperator= (const Event &that)=default
 
- Protected Attributes inherited from inviwo::InteractionEvent
KeyModifiers modifiers_
 
ToolTipCallback tooltip_
 

Detailed Description

Touch event contains all touch points associated with the event. Touch events are usually generated by touch screens or touch pads, see TouchDevice.

See also
TouchPoint

Member Function Documentation

◆ averageDepth()

double inviwo::TouchEvent::averageDepth ( ) const

Average depth of touch points, TouchPoint::depth() Defined in [-1 1], where -1 is the near plane and 1 is the far plane.

Returns
sum(touch points.depth()) / nPoints, or 1 if no touch points exist.

◆ centerNDC()

dvec3 inviwo::TouchEvent::centerNDC ( ) const

Average of touch points in normalized device coordinates, TouchPoint::ndc() Defined in (-1,1) in a left handed coordinate system.

Returns
sum(touch points.ndc()) / nPoints, or dvec3(0) if no touch points exist.

◆ centerPoint()

dvec2 inviwo::TouchEvent::centerPoint ( ) const

Computes average position. Returns dvec2(0) if no touch points exist.

Returns
dvec2 sum(touch points) / nPoints

◆ centerPointNormalized()

dvec2 inviwo::TouchEvent::centerPointNormalized ( ) const

Computes average normalized position. Returns dvec2(0) if no touch points exist.

Returns
dvec2 sum(touch points) / nPoints

◆ findClosestTwoTouchPoints()

std::vector< const TouchPoint * > inviwo::TouchEvent::findClosestTwoTouchPoints ( ) const

Retrieve pointers to the two closest touch points.

Returns
std::vector<const TouchPoint*>, pointers to the two closest touch points vector can have less then two elements, which indicate that not enough points exist

◆ getPickingState()

PickingState inviwo::TouchEvent::getPickingState ( const std::vector< TouchPoint > &  points)
static

Get PickingState by analyzing all touch points.

Returns
PickingState::Started or PickingState::Finished when all touch points started or finished. Return PickingState::Updated when any of the touch points updated or some started and some finished.

◆ prevCenterPointNormalized()

dvec2 inviwo::TouchEvent::prevCenterPointNormalized ( ) const

Computes previous average normalized position. Returns dvec2(0) if no touch points exist.

Returns
dvec2 sum(touch points) / nPoints

The documentation for this class was generated from the following files: