Skip to content

Commit

Permalink
Floor clip plane return Vec4 instead of Matrix44f
Browse files Browse the repository at this point in the history
  • Loading branch information
BanTheRewind committed Jun 9, 2014
1 parent 3922da0 commit f4db50b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 deletions.
19 changes: 11 additions & 8 deletions src/Kinect.cpp
Expand Up @@ -67,6 +67,11 @@ Vec3f toVec3f( const Vector4& v )
return Vec3f( v.x, v.y, v.z );
}

Vec4f toVec4f( const Vector4& v )
{
return Vec4f( v.x, v.y, v.z, v.w );
}

//////////////////////////////////////////////////////////////////////////////////////////////

Face::Face()
Expand Down Expand Up @@ -981,14 +986,13 @@ DeviceOptions& DeviceOptions::setSkeletonTransform( SkeletonTransform transform
//////////////////////////////////////////////////////////////////////////////////////////////

Frame::Frame()
: mDeviceId( "" ), mFrameId( 0 ), mNormalToGravity( Vec3f::zero() )
: mDeviceId( "" ), mFloorClipPlane( Vec4f::zero() ), mFrameId( 0 ), mNormalToGravity( Vec3f::zero() )
{
mFloorClipPlane.setToNull();
}

Frame::Frame( long long frameId, const std::string& deviceId, const Surface8u& color,
const Channel16u& depth, const Channel16u& infrared, const std::vector<Skeleton>& skeletons,
const Face& face, const Matrix44f& floorClipPlane, const Vec3f& normalToGravity )
const Face& face, const Vec4f& floorClipPlane, const Vec3f& normalToGravity )
: mColorSurface( color ), mDepthChannel( depth ), mDeviceId( deviceId ), mFace( face ),
mFloorClipPlane( floorClipPlane ), mFrameId( frameId ), mInfraredChannel( infrared ),
mNormalToGravity( normalToGravity ), mSkeletons( skeletons )
Expand All @@ -1015,7 +1019,7 @@ const Face& Frame::getFace() const
return mFace;
}

const Matrix44f& Frame::getFloorClipPlane() const
const Vec4f& Frame::getFloorClipPlane() const
{
return mFloorClipPlane;
}
Expand Down Expand Up @@ -1501,9 +1505,8 @@ void Device::update()
return;
}

Matrix44f floorClipPlane;
Vec3f normalToGravity = Vec3f::zero();
floorClipPlane.setToNull();
Vec4f floorClipPlane = Vec4f::zero();
Vec3f normalToGravity = Vec3f::zero();

if ( mSurfaceColor ) {
mSurfaceColor.reset();
Expand Down Expand Up @@ -1539,7 +1542,7 @@ void Device::update()
NUI_SKELETON_FRAME skeletonFrame;
if ( mDeviceOptions.isUserTrackingEnabled() &&
SUCCEEDED( KinectGetSkeletonFrame( mDeviceOptions.getDeviceHandle(), &skeletonFrame ) ) ) {
floorClipPlane = Matrix44f( toQuatf( skeletonFrame.vFloorClipPlane ) );
floorClipPlane = toVec4f( skeletonFrame.vFloorClipPlane );
normalToGravity = toVec3f( skeletonFrame.vNormalToGravity );
for ( int32_t i = 0; i < NUI_SKELETON_COUNT; ++i ) {
mSkeletons.at( i ).clear();
Expand Down
8 changes: 4 additions & 4 deletions src/Kinect.h
Expand Up @@ -443,8 +443,8 @@ class Frame
const std::string& getDeviceId() const;
//! Returns face if tracking is enabled.
const Face& getFace() const;
//! Returns matrix representing floor clip plane when skeleton is present.
const ci::Matrix44f& getFloorClipPlane() const;
//! Returns Vec4f representing floor clip plane when skeleton is present.
const ci::Vec4f& getFloorClipPlane() const;
//! Returns unique, sequential frame ID.
long long getFrameId() const;
//! Returns infrared channel for this frame.
Expand All @@ -457,13 +457,13 @@ class Frame
Frame( long long frameId, const std::string& deviceId, const ci::Surface8u& color,
const ci::Channel16u& depth, const ci::Channel16u& infrared,
const std::vector<Skeleton>& skeletons, const Face& face,
const ci::Matrix44f& floorClipPlane, const ci::Vec3f& normalToGravity );
const ci::Vec4f& floorClipPlane, const ci::Vec3f& normalToGravity );

ci::Surface8u mColorSurface;
ci::Channel16u mDepthChannel;
std::string mDeviceId;
MsKinect::Face mFace;
ci::Matrix44f mFloorClipPlane;
ci::Vec4f mFloorClipPlane;
long long mFrameId;
ci::Channel16u mInfraredChannel;
ci::Vec3f mNormalToGravity;
Expand Down

0 comments on commit f4db50b

Please sign in to comment.