本文整理汇总了C++中pan函数的典型用法代码示例。如果您正苦于以下问题:C++ pan函数的具体用法?C++ pan怎么用?C++ pan使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了pan函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main()
{
int test;
scanf("%d",&test);
//printf("%lf\n",sqrt(2.0));
for(int tt = 1 ; tt <= test ;tt ++)
{
for(int i=0;i<4;i++)
{
scanf("%lf %lf",&x[i],&y[i]);
}
a[0] = 0;
a[1] = 2;a[2] = 1;a[3] = 3;
int flag = 0;
if(pan())flag=1;
a[0] = 0;
a[1] = 1;a[2] = 2;a[3] = 3;
if(pan())flag=1;
a[0] = 0;
a[1] = 1 ; a[2] = 3;a[3] = 2;
if(pan())flag=1;
if(tt != 1)printf("\n");
if(flag == 1)
printf("Case %d:\nYes\n",tt);
if(flag == 0)
printf("Case %d:\nNo\n",tt);
}
}
示例2: pan
void WaypointCamera::setOriginTarget(){
originTarNode.resetTransform();
originTarNode.setPosition(getPosition());
pan(-180); // Fix for camera orientation
originTarNode.setOrientation(getOrientationQuat());
pan(180); // Fix for camera orientation
}
示例3: main
int main(void)
{
int f,res,b[300],ji;
char a[300][20],c[20];
while(scanf("%s",&a[0])!=EOF)
{
strcpy(c,a[0]);
res=pan(a[0]);
ji=1;
for(ji=1;0==res;ji++)
{
b[ji]=tod(a[ji-1]);
fan(a[ji-1]);
b[ji]=b[ji]+tod(a[ji-1]);
tos(b[ji],a[ji]);
res=pan(a[ji]);
}
printf("%d\n",ji-1);
printf("%s",c);
for(f=1;f<ji;f++)
{
printf("--->");
printf("%s",a[f]);
}
printf("\n");
}
return 0;
}
示例4: Q_D
void Camera::setMotionAdjustment(const QVector3D& vector)
{
Q_D(Camera);
if (d->motionAdjustment != vector) {
d->motionAdjustment = vector;
if (vector.x() == 0.0f && vector.y() == 0.0f) {
// If the vector is centered, then don't perform any rotations.
d->motionQuaternion = QQuaternion();
} else {
// Determine the pan and tilt angles from the vector.
QVector3D view = -vector.normalized();
if (view.z() < 0.0f)
view = -view;
qreal xangle = asin(view.x()) * 180.0f / M_PI;
qreal yangle = asin(-view.y()) * 180.0f / M_PI;
// Construct the pan and tilt quaternions.
if (qFuzzyIsNull(xangle))
d->motionQuaternion = tilt(yangle);
else if (qFuzzyIsNull(yangle))
d->motionQuaternion = pan(xangle);
else
d->motionQuaternion = tilt(yangle) * pan(xangle);
}
emit viewChanged();
}
}
示例5: main
int main() {
ssc_init("/dev/ttyUSB0", 9600);
pan( 0 );
tilt( 0 );
cascade = (CvHaarClassifierCascade*)cvLoad(
"cascade.xml", 0, 0, 0 );
if( !cascade )
{
fprintf( stderr, "ERROR: Could not load classifier cascade\n" );
return 1;
}
storage = cvCreateMemStorage(0);
struct camera *cam = init_camera( LCAM );
load_params( cam );
cvNamedWindow( "Face", CV_WINDOW_AUTOSIZE );
CvPoint pt1, pt2;
CvRect *r;
CvSeq *faces;
float multip = 0.1;
int x_diff, y_diff;
while( cvWaitKey( 10 ) == -1 ) {
cap_frame( cam );
undistort( cam );
cvClearMemStorage( storage );
faces = cvHaarDetectObjects( cam->undist, cascade, storage,
1.1, 2, CV_HAAR_DO_CANNY_PRUNING, cvSize(40, 40) );
if (faces->total > 0) {
;
r = (CvRect*)cvGetSeqElem( faces, 0 );
pt1.x = r->x;
pt2.x = r->x + r->width;
pt1.y = r->y;
pt2.y = r->y + r->height;
cvRectangle( cam->undist, pt1, pt2, CV_RGB(255,0,0), 3, 8, 0 );
x_diff = (cam->frame->width / 2) - (r->x + (r->width/2)) ;
y_diff = (cam->frame->height / 2) - (r->y + (r->height/2)) ;
pan( -(int)(x_diff * multip) );
tilt( (int)(y_diff * multip) );
}
cvShowImage( "Face", cam->undist );
}
cvDestroyAllWindows();
cvReleaseMemStorage( &storage );
free_camera( cam );
}
示例6: switch
//------------------------------------------------------------------------------
//!
bool
CameraManipulator::onPointerMove( const Event& ev )
{
if( _mode == 0 ) return false;
switch( _mode )
{
case 1:
{
float radP = CGM::degToRad( _grabPos.x - ev.position().x );
float radS = CGM::degToRad( ev.position().y - _grabPos.y );
radP *= _direction;
if( _isLocked )
{
orbit( radP*0.75f, radS*0.75f );
}
else
{
tilt( radP*0.25f, radS*0.25f );
}
return true;
} break;
case 2: forward( ev.position() );
return true;
case 3: pan( ev.position() );
return true;
default:;
}
return false;
}
示例7: SDL_ConvertSurface
SDL_Surface *zoom100(SDL_Surface *image, SDL_Rect *pos, double *scale)
{
SDL_Surface *result = SDL_ConvertSurface(image, image->format, image->flags);
if (result == (SDL_Surface *) (NULL))
{
fprintf(stderr, "\n Error from ConvertSurface()\n\n");
quit();
}
if (*scale < 1.0) {
pos->x /= *scale;
pos->y /= *scale;
pos->x -= SCREENWIDTH * (1-(1 / *scale)) * 0.5;
pos->y -= SCREENHEIGHT * (1-(1 / *scale)) * 0.5;
} else {
pos->x += SCREENWIDTH * (1-*scale) * 0.5;
pos->y += SCREENHEIGHT * (1-*scale) * 0.5;
pos->x /= *scale;
pos->y /= *scale;
}
pan(result, pos, 0, 0);
*scale = 1.0;
return result;
}
示例8: getMaxPosPan_i
AREXPORT bool ArAMPTU::panTilt_i(double panDeg, double tiltDeg)
{
if (panDeg > getMaxPosPan_i())
panDeg = getMaxPosPan_i();
if (panDeg < getMaxNegPan_i())
panDeg = getMaxNegPan_i();
if (tiltDeg > getMaxPosTilt_i())
tiltDeg = getMaxPosTilt_i();
if (tiltDeg < getMaxNegTilt_i())
tiltDeg = getMaxNegTilt_i();
if (myPan - panDeg == 0 && myTilt - tiltDeg == 0)
return true;
if (myPan - panDeg == 0)
return tilt(tiltDeg);
if (myTilt - tiltDeg == 0)
return pan(panDeg);
myPan = panDeg;
myTilt = tiltDeg;
myPacket.empty();
myPacket.byteToBuf(ArAMPTUCommands::PANTILT);
myPacket.byte2ToBuf(ArMath::roundInt(myPan +
(getMaxPosPan_i() - getMaxNegPan_i())/2));
myPacket.byteToBuf(ArMath::roundInt(myTilt + (getMaxPosTilt_i() -
getMaxNegTilt_i())/2));
return sendPacket(&myPacket);
}
示例9: statusChanged
void BassPlayer::playPreproccessing() {
emit statusChanged(media_title, LoadedMedia);
BASS_CHANNELINFO info;
if (BASS_ChannelGetInfo(chan, &info))
channelsCount(info.chans);
else
channelsCount(2);
if (eq_in_use) registerEQ();
#ifdef BASS_USE_TEMPO
applyTempoToChannel();
newTempoProcessing(tempo());
#endif
setSampleRateQuality();
newVolumeProcessing(volume());
newPanProcessing(pan());
if (BASS_ChannelPlay(chan, true)) { // stalled with big sized video files
playPostprocessing(is_paused);
syncHandle = BASS_ChannelSetSync((HSYNC)chan, BASS_SYNC_END, 0, &endTrackSync, this);
syncDownloadHandle = BASS_ChannelSetSync(chan, BASS_SYNC_DOWNLOAD, 0, &endTrackDownloading, this);
// BASS_SYNC_STALL
// mixtime only Sync when playback of the channel is stalled/resumed.
// param : not used. data : 0 = stalled, 1 = resumed.
} else {
proceedErrorState();
qCritical() << "IS NOT PLAYED";
}
}
示例10: XTestGrabControl
void CommandInterpreter::handleCommand(TACommand command)
{
XTestGrabControl(display, True);
printf("COMMAND: %i, %i, %i, %i, %f\n", command.type, command.touch, command.xDifference, command.yDifference, command.zoomValue);
switch(command.type)
{
case TACommandTypeZoom:
zoom(command);
break;
case TACommandTypePan:
pan(command);
break;
case TACommandTypeRotate:
rotate(command);
break;
default:
break;
}
XSync(display, 0);
XTestGrabControl(display, False);
usleep(100);
}
示例11: pan
void Viewport::mouseMoveEvent(QMouseEvent *event)
{
_dragging = true;
_current_pos = event->pos();
QGraphicsView::mouseMoveEvent(event);
if (scene->mouseGrabberItem() == NULL)
{
if (event->buttons() == Qt::LeftButton)
{
pan(_click_pos_world - sceneToWorld(mapToScene(event->pos())));
}
else if (event->buttons() == Qt::RightButton && !angle_locked)
{
QPointF d = _click_pos - event->pos();
pitch = fmin(0, fmax(-M_PI, pitch - 0.01 * d.y()));
yaw = fmod(yaw + M_PI - 0.01 * d.x(), M_PI*2) - M_PI;
_click_pos = event->pos();
update();
scene->invalidate(QRect(),QGraphicsScene::ForegroundLayer);
emit(viewChanged());
}
}
updateInfo();
}
示例12: pan
void MdispGtkView::FillDisplay( bool on )
{
if(m_MilDisplay)
{
// Fill display is incompatible with pan.
pan( 0, 0 );
if(on)
{
// disable temporary using user's XDisplay
// filldisplay can generate excessive expose ( paint) event
// this can freeze main menu window
MdispControl(m_MilDisplay,M_WINDOW_ANNOTATIONS,M_NULL);
}
else
{
MdispControl(m_MilDisplay,M_WINDOW_ANNOTATIONS,M_PTR_TO_DOUBLE(GDK_WINDOW_XDISPLAY(m_window->window)));
}
//Using MIL, enable/disable Fill Display Mode [CALL TO MIL]
MdispControl(m_MilDisplay, M_FILL_DISPLAY, on ? M_ENABLE : M_DISABLE);
m_isFillDisplayEnabled = on;
UpdateContentSize();
}
}
示例13: main
int main()
{
int f,i;
while(scanf("%d",&nn)!=EOF)
{
group=nn;
n=2*group;
for(i=1;i<=nn;i++)
{
for(f=1;f<=nn;f++)
{
scanf("%d",&b[i][f]);
}
}
if(0 == pan())
{
printf("NO\n");
continue;
}
for(now=1;now<=31;now++)
{
chu();
for(i=1;i<=nn;i++)
{
for(f=i+1;f<=nn;f++)
{
if(i == f)
{
continue;
}
else if((i%2)==0 && (f%2)==0)
{
huo(i,f);
}
else if((i%2)==1 && (f%2)==1)
{
yu(i,f);
}
else
{
yihuo(i,f);
}
}
}
slove();
if(0 == check())
{
printf("NO\n");
break;
}
}
if(32 == now)
{
printf("YES\n");
}
}
return 0;
}
示例14: scalePoint
void QuatTrackBall::roll_ball(const Vec2i& v)
{
if(v[0] < 0 || v[0] >= static_cast<int>(width)
|| v[1] < 0 || v[1] >= static_cast<int>(height))
return;
Vec2f w = scalePoint(v);
switch (current_action)
{
case ROTATE_ACTION:
rotate(w);
break;
case PAN_ACTION:
pan(w);
break;
case ZOOM_ACTION:
zoom(w);
break;
case NO_ACTION:
default:
break;
}
last_pos = w;
}
示例15: checkmouse
static int
checkmouse(void) /* return button touched if any */
{
int c, b;
char *p;
extern int confirm(int);
b = waitdown();
last_but = 0;
last_hit = -1;
c = 0;
if (button3(b)) {
last_hit = emenuhit(3, &mouse, &mbut3);
last_but = 3;
} else if (button2(b)) {
last_hit = emenuhit(2, &mouse, &mbut2);
last_but = 2;
} else { /* button1() */
pan();
last_but = 1;
}
waitup();
if (last_but == 3 && last_hit >= 0) {
p = m3[last_hit];
c = p[strlen(p) - 1];
}
if (c == '?' && !confirm(last_but))
last_hit = -1;
return last_but;
}