本文整理汇总了C++中leap::Pointable类的典型用法代码示例。如果您正苦于以下问题:C++ Pointable类的具体用法?C++ Pointable怎么用?C++ Pointable使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Pointable类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: length
static VALUE length(VALUE self)
{
Leap::Pointable * pointer;
Data_Get_Struct(self, Leap::Pointable, pointer);
return DBL2NUM(pointer->length());
}
示例2: touch_distance
static VALUE touch_distance(VALUE self)
{
Leap::Pointable * pointer;
Data_Get_Struct(self, Leap::Pointable, pointer);
return DBL2NUM(pointer->touchDistance());
}
示例3: pointable_id
static VALUE pointable_id(VALUE self)
{
Leap::Pointable * pointer;
const char * string;
Data_Get_Struct(self, Leap::Pointable, pointer);
return INT2NUM(pointer->id());
}
示例4: MakePointable
VALUE MakePointable(Leap::Pointable pointable)
{
if (pointable.isFinger())
return WrapFinger(new Leap::Finger(pointable));
if (pointable.isTool())
return WrapTool(new Leap::Tool(pointable));
return WrapPointable(new Leap::Pointable(pointable));
}
示例5: direction
static VALUE direction(VALUE self)
{
Leap::Pointable * pointer;
Leap::Vector * vector;
Data_Get_Struct(self, Leap::Pointable, pointer);
vector = new Leap::Vector(pointer->direction());
return WrapVector(vector);
}
示例6: tip_velocity
static VALUE tip_velocity(VALUE self)
{
Leap::Pointable * pointer;
Leap::Vector * vector;
Data_Get_Struct(self, Leap::Pointable, pointer);
vector = new Leap::Vector(pointer->tipVelocity());
return WrapVector(vector);
}
示例7: stabilized_tip_position
static VALUE stabilized_tip_position(VALUE self)
{
Leap::Pointable * pointer;
Leap::Vector * vector;
Data_Get_Struct(self, Leap::Pointable, pointer);
vector = new Leap::Vector(pointer->stabilizedTipPosition());
return WrapVector(vector);
}
示例8: hand
static VALUE hand(VALUE self)
{
Leap::Pointable * pointer;
Leap::Hand * hand;
Data_Get_Struct(self, Leap::Pointable, pointer);
hand = new Leap::Hand(pointer->hand());
return WrapHand(hand);
}
示例9: valid_p
static VALUE valid_p(VALUE self)
{
Leap::Pointable * pointer;
Data_Get_Struct(self, Leap::Pointable, pointer);
if (pointer->isValid())
return Qtrue;
return Qfalse;
}
示例10: onFrame
void Quickstart::onFrame(const Leap::Controller &controller) {
// returns the most recent frame. older frames can be accessed by passing in
// a "history" parameter to retrieve an older frame, up to about 60
// (exact number subject to change)
const Leap::Frame frame = controller.frame();
// do nothing unless hands are detected
if (frame.hands().empty())
return;
// first detected hand
const Leap::Hand firstHand = frame.hands()[0];
// first pointable object (finger or tool)
const Leap::PointableList pointables = firstHand.pointables();
if (pointables.empty()) return;
const Leap::Pointable firstPointable = pointables[0];
// print velocity on the X axis
cout << "Pointable X velocity: " << firstPointable.tipVelocity()[0] << endl;
const Leap::FingerList fingers = firstHand.fingers();
if (fingers.empty()) return;
for (int i = 0; i < fingers.count(); i++) {
const Leap::Finger finger = fingers[i];
std::cout << "Detected finger " << i << " at position (" <<
finger.tipPosition().x << ", " <<
finger.tipPosition().y << ", " <<
finger.tipPosition().z << ")" << std::endl;
}
}
示例11: touch_zone
static VALUE touch_zone(VALUE self)
{
Leap::Pointable * pointer;
Data_Get_Struct(self, Leap::Pointable, pointer);
switch(pointer->touchZone()) {
case(Leap::Pointable::ZONE_NONE):
return ID2SYM(rb_intern("none"));
case(Leap::Pointable::ZONE_HOVERING):
return ID2SYM(rb_intern("hovering"));
case(Leap::Pointable::ZONE_TOUCHING):
return ID2SYM(rb_intern("touching"));
};
return Qfalse;
}
示例12: convertPointableRotation
void convertPointableRotation(const Leap::Pointable& pointable, MatrixF& outRotation)
{
// We need to convert from Motion coordinates to
// Torque coordinates. The conversion is:
//
// Motion Torque
// a b c a b c a -c b
// d e f --> -g -h -i --> -g i -h
// g h i d e f d -f e
Leap::Vector pointableFront = -pointable.direction();
Leap::Vector pointableRight = Leap::Vector::up().cross(pointableFront);
Leap::Vector pointableUp = pointableFront.cross(pointableRight);
outRotation.setColumn(0, Point4F( pointableRight.x, -pointableRight.z, pointableRight.y, 0.0f));
outRotation.setColumn(1, Point4F( -pointableFront.x, pointableFront.z, -pointableFront.y, 0.0f));
outRotation.setColumn(2, Point4F( pointableUp.x, -pointableUp.z, pointableUp.y, 0.0f));
outRotation.setPosition(Point3F::Zero);
}
示例13: if
void LeapSample03App::draw()
{
gl::clear( Color( .97, .93, .79 ) );
Leap::PointableList pointables = leap.frame().pointables();
Leap::InteractionBox iBox = leap.frame().interactionBox();
for ( int p = 0; p < pointables.count(); p++ ) {
Leap::Pointable pointable = pointables[p];
#if 1
// ここから追加
// 伸びている指、ツール以外は無視する
if ( !pointable.isExtended() ) {
continue;
}
// ここまで追加
#endif
Leap::Vector normalizedPosition =
iBox.normalizePoint( pointable.stabilizedTipPosition() );
float x = normalizedPosition.x * windowWidth;
float y = windowHeight - normalizedPosition.y * windowHeight;
// ホバー状態
if ( (pointable.touchDistance() > 0) &&
(pointable.touchZone() != Leap::Pointable::Zone::ZONE_NONE) ) {
gl::color(0, 1, 0, 1 - pointable.touchDistance());
}
// タッチ状態
else if ( pointable.touchDistance() <= 0 ) {
gl::color(1, 0, 0, -pointable.touchDistance());
}
// タッチ対象外
else {
gl::color(0, 0, 1, .05);
}
gl::drawSolidCircle( Vec2f( x, y ), 40 );
}
}
示例14: onFrame
void Quickstart::onFrame(const Leap::Controller &controller) {
// returns the most recent frame. older frames can be accessed by passing in
// a "history" parameter to retrieve an older frame, up to about 60
// (exact number subject to change)
const Leap::Frame frame = controller.frame();
// do nothing unless hands are detected
if (frame.hands().empty())
return;
// retrieve first pointable object (finger or tool)
// from the frame
const Leap::PointableList pointables = frame.hands()[0].pointables();
if (pointables.empty())
return;
const Leap::Pointable firstPointable = pointables[0];
// print velocity on the X axis
cout << "Pointable X velocity: " << firstPointable.tipVelocity()[0] << endl;
}
示例15: onFrame
void DefaultQtLeapMouseHandler::onFrame(const Leap::Frame &frame)
{
/////// MOUSE EVENTS /////////
// MOUSE BUTTON PRESSED
// MOUSE BUTTON RELEASED
// MOUSE MOVE
if (this->listeners.empty())
return ;
Leap::Pointable pointer = frame.pointable(this->savedMousePointableId);
if (!pointer.isValid())
{
pointer = frame.pointables().frontmost();
this->savedMousePointableId = pointer.id();
}
bool forceRelease = (frame.pointables().count() == 0 && this->mousePressed);
QMouseEvent::Type frameMouseEvent = QMouseEvent::None;
QPointF globalPointerPos = QtLeapUtils::convertPointablePosToScreenPos(frame.interactionBox(), pointer);
Qt::MouseButton button = Qt::NoButton;
Qt::MouseButtons buttons = Qt::NoButton;
// FINGER TOUCHING AND NO PREVIOUS PRESS -> SETTING BUTTON PRESS
if (pointer.touchDistance() <= 0 &&
pointer.touchZone() == Leap::Pointable::ZONE_TOUCHING &&
!this->mousePressed)
{
this->mousePressed = true;
frameMouseEvent = QMouseEvent::MouseButtonPress;
button = Qt::LeftButton;
}
else if (this->mousePressed && (pointer.touchDistance() > 0 ||
pointer.touchZone() == Leap::Pointable::ZONE_NONE ||
forceRelease)) // FINGER NOT TOUCHING AND PREVIOUS PRESS -> RELEASING BUTTON PRESS
{
frameMouseEvent = QMouseEvent::MouseButtonRelease;
this->mousePressed = false;
button = Qt::LeftButton;
}
else if (frameMouseEvent == QMouseEvent::None && // FINGER IN TOUCHING OR HOVERING ZONE AND NO BUTTON PRESS / RELEASE CHANGE -> MouseMove
pointer.touchZone() != Leap::Pointable::ZONE_NONE
&& globalPointerPos.toPoint() != this->previousPos)
{
frameMouseEvent = QMouseEvent::MouseMove;
this->previousPos = globalPointerPos.toPoint();
QCursor::setPos(this->previousPos);
}
if (this->mousePressed)
buttons |= Qt::LeftButton;
if (frameMouseEvent != QMouseEvent::None)
foreach (QObject *listener, this->listeners)
QCoreApplication::postEvent(listener, new QMouseEvent(frameMouseEvent,
QtLeapUtils::convertGlobalPosToLocalPos(listener, globalPointerPos),
globalPointerPos,
button,
buttons,
Qt::NoModifier));
}