Inviwo 0.9.12-pre
Inviwo documentation
Loading...
Searching...
No Matches
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, KeyModifiers modifiers)
 
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.
 
dvec2 centerPointNormalized () const
 Computes average normalized position. Returns dvec2(0) if no touch points exist.
 
dvec2 prevCenterPointNormalized () const
 Computes previous average normalized position. Returns dvec2(0) if no touch points exist.
 
dvec3 centerNDC () const
 Average of touch points in normalized device coordinates, TouchPoint::ndc() Defined in (-1,1) in a left handed coordinate system.
 
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.
 
const TouchDevicegetDevice () const
 Return TouchDevice that generated the event.
 
std::vector< const TouchPoint * > findClosestTwoTouchPoints () const
 Retrieve pointers to the two closest touch points.
 
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 (std::string_view 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)
 
bool markAsUsed ()
 
bool hasBeenUsed () const
 
bool markAsUnused ()
 
bool setUsed (bool isUsed)
 
bool 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.
 
static constexpr uint64_t chash ()
 

Additional Inherited Members

- Public Types inherited from inviwo::InteractionEvent
using ToolTipCallback = std::function<void(std::string_view)>
 
- 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

◆ clone()

virtual TouchEvent * inviwo::TouchEvent::clone ( ) const
overridevirtual

◆ 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()

static 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.

◆ hash()

virtual uint64_t inviwo::TouchEvent::hash ( ) const
overridevirtual

Implements inviwo::Event.

◆ 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

◆ print()

virtual void inviwo::TouchEvent::print ( std::ostream & ss) const
overridevirtual

Reimplemented from inviwo::Event.


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