本文整理汇总了C++中TuioTime类的典型用法代码示例。如果您正苦于以下问题:C++ TuioTime类的具体用法?C++ TuioTime怎么用?C++ TuioTime使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TuioTime类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: update
void TuioContainer::update (TuioTime ttime, float xp, float yp) {
lastPoint = &path.back();
TuioPoint::update(ttime,xp, yp);
TuioTime diffTime = currentTime - lastPoint->getTuioTime();
float dt = diffTime.getTotalMilliseconds()/1000.0f;
float dx = xpos - lastPoint->getX();
float dy = ypos - lastPoint->getY();
float dist = sqrt(dx*dx+dy*dy);
float last_motion_speed = motion_speed;
float last_x_speed = x_speed;
float last_y_speed = y_speed;
x_speed = dx/dt;
y_speed = dy/dt;
motion_speed = dist/dt;
motion_accel = (motion_speed - last_motion_speed)/dt;
x_accel = (x_speed - last_x_speed)/dt;
y_accel = (y_speed - last_y_speed)/dt;
TuioPoint p(currentTime,xpos,ypos);
path.push_back(p);
if (path.size()>MAX_PATH_SIZE) path.pop_front();
if (motion_accel>0) state = TUIO_ACCELERATING;
else if (motion_accel<0) state = TUIO_DECELERATING;
else state = TUIO_STOPPED;
}
开发者ID:TUIOFX,项目名称:tongseng,代码行数:28,代码来源:TuioContainer.cpp
示例2: TuioTime
TuioTime TuioTime::operator+(TuioTime ttime) {
long sec = seconds + ttime.getSeconds();
long usec = micro_seconds + ttime.getMicroseconds();
sec += usec/USEC_SECOND;
usec = usec%USEC_SECOND;
return TuioTime(sec,usec);
}
开发者ID:Stigmatized,项目名称:glassomium,代码行数:7,代码来源:TuioTime.cpp
示例3: TuioPoint
TuioPoint TuioContainer::predictPosition() {
/*if (path.size()>1) {
std::list<TuioPoint>::iterator iter = path.end();
std::advance(iter, -2);
TuioTime diffTime = currentTime - (*iter).getTuioTime();
float dt = diffTime.getTotalMilliseconds()/1000.0f;
float tx = x_speed * dt;
float ty = y_speed * dt;
float nx = xpos+tx-tx*x_accel*dt;
float ny = ypos+ty-ty*y_accel*dt;
//if (xposFilter && yposFilter) {
// nx = xposFilter->filter(nx,dt);
// ny = yposFilter->filter(ny,dt);
// //std::cout << dt << " " << xp << " " << xpos << " " << yp << " " << ypos << std::endl;
//}
//std::cout << nx << " " << ny << std::endl;
return TuioPoint(nx,ny);
} else return TuioPoint(xpos,ypos);*/
TuioTime diffTime = currentTime - lastPoint->getTuioTime();
float dt = diffTime.getTotalMilliseconds()/1000.0f;
float tx = x_speed * dt;
float ty = y_speed * dt;
float nx = xpos+tx-tx*x_accel*dt;
float ny = ypos+ty-ty*y_accel*dt;
//if (xposFilter && yposFilter) {
// nx = xposFilter->filter(nx,dt);
// ny = yposFilter->filter(ny,dt);
// //std::cout << dt << " " << xp << " " << xpos << " " << yp << " " << ypos << std::endl;
//}
//std::cout << nx << " " << ny << std::endl;
return TuioPoint(nx,ny);
}
开发者ID:TUIOFX,项目名称:tongseng,代码行数:44,代码来源:TuioContainer.cpp
示例4: update
void TuioBlob::update (TuioTime ttime, float xp, float yp, float a, float w, float h, float f) {
TuioPoint lastPoint = path.back();
TuioContainer::update(ttime,xp,yp);
TuioTime diffTime = currentTime - lastPoint.getTuioTime();
float dt = diffTime.getTotalMilliseconds()/1000.0f;
float last_rotation_speed = rotation_speed;
float prev_angle = angle_sum;
float da = a-angle;
if (da > M_PI/2.0f) angle_sum += (da-2*M_PI);
else if (da < M_PI/-2.0f) angle_sum += (da+2*M_PI);
else angle_sum += da;
if (angleFilter) angle_sum = angleFilter->filter(angle_sum,dt);
if (fabs(angle_sum-prev_angle)<angleThreshold) angle_sum = prev_angle;
int m = floor(angle_sum/(2*M_PI));
angle = angle_sum-(m*(2*M_PI));
da = (angle-a)/(2*M_PI);
if (da > 0.75f) da-=1.0f;
else if (da < -0.75f) da+=1.0f;
if (widthFilter && heightFilter) {
w = widthFilter->filter(w,dt);
h = heightFilter->filter(h,dt);
}
float dw = fabs(width - w);
float dh = fabs(height - h);
if ((dw>sizeThreshold) || (dh>sizeThreshold)) {
width = w;
height = h;
}
area = f;
rotation_speed = (float)da/dt;
rotation_accel = (rotation_speed - last_rotation_speed)/dt;
if ((rotation_accel!=0) && (state==TUIO_STOPPED)) state = TUIO_ROTATING;
}
开发者ID:TUIOFX,项目名称:tongseng,代码行数:43,代码来源:TuioBlob.cpp
示例5: update
void TuioObject::update (TuioTime ttime, float xp, float yp, float a) {
TuioPoint lastPoint = path.back();
TuioContainer::update(ttime,xp,yp);
TuioTime diffTime = currentTime - lastPoint.getTuioTime();
float dt = diffTime.getTotalMilliseconds()/1000.0f;
float last_angle = angle;
float last_rotation_speed = rotation_speed;
angle = a;
double da = (angle-last_angle)/(2*M_PI);
if (da > 0.75f) da-=1.0f;
else if (da < -0.75f) da+=1.0f;
rotation_speed = (float)da/dt;
rotation_accel = (rotation_speed - last_rotation_speed)/dt;
if ((rotation_accel!=0) && (state==TUIO_STOPPED)) state = TUIO_ROTATING;
}
开发者ID:512400330,项目名称:osgRecipes,代码行数:19,代码来源:TuioObject.cpp
示例6: refresh
void IupTuioListener::refresh(TuioTime frameTime)
{
if (this->changed)
{
Ihandle* ih_canvas = IupGetAttributeHandle(this->ih, "TARGETCANVAS");
if (!ih_canvas)
ih_canvas = this->ih;
this->changed = 0;
IFniiis cb = (IFniiis)IupGetCallback(ih_canvas, "TOUCH_CB");
IFniIIII mcb = (IFniIIII)IupGetCallback(ih_canvas, "MULTITOUCH_CB");
if (cb || mcb)
{
this->client->lockCursorList();
this->locked = 1;
}
if (this->debug)
printf("IupTuioClient-RefreshChanged(time=%d)\n", (int)frameTime.getTotalMilliseconds());
}
}
开发者ID:DavidPhillipOster,项目名称:IupCocoa,代码行数:22,代码来源:iup_tuio.cpp
示例7: initSession
void TuioTime::initSession()
{
TuioTime startTime = TuioTime::getSystemTime();
start_seconds = startTime.getSeconds();
start_micro_seconds = startTime.getMicroseconds();
}
开发者ID:vrsys,项目名称:avango,代码行数:6,代码来源:TuioTime.cpp
示例8:
bool TuioTime::operator!=(TuioTime ttime) {
if ((seconds!=(long)ttime.getSeconds()) || (micro_seconds!=(long)ttime.getMicroseconds())) return true;
else return false;
}
开发者ID:Stigmatized,项目名称:glassomium,代码行数:4,代码来源:TuioTime.cpp
示例9:
void Tuio2Dump::tuioRefresh(TuioTime frameTime) {
std::cout << "refresh " << frameTime.getFrameID() << " "<< frameTime.getTotalMilliseconds() << std::endl;
std::cout << std::flush;
}
开发者ID:JassiO,项目名称:TUIO20_CPP,代码行数:4,代码来源:Tuio2Dump.cpp
注:本文中的TuioTime类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论