• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ pan函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中pan函数的典型用法代码示例。如果您正苦于以下问题:C++ pan函数的具体用法?C++ pan怎么用?C++ pan使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了pan函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
	}
}
开发者ID:hphp,项目名称:Algorithm,代码行数:28,代码来源:1008_1.cpp


示例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
}
开发者ID:KoolJBlack,项目名称:twspp,代码行数:7,代码来源:WaypointCamera.cpp


示例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;
}
开发者ID:LinKin-22,项目名称:acm-algorithm,代码行数:28,代码来源:1282+2011-11-25+21+56+48.cpp


示例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();
    }
}
开发者ID:kaltsi,项目名称:qt-mobility,代码行数:27,代码来源:camera.cpp


示例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 );
}
开发者ID:sleepygarden,项目名称:VisionSystem,代码行数:59,代码来源:facetrack.cpp


示例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;
}
开发者ID:LudoSapiens,项目名称:Dev,代码行数:32,代码来源:CameraManipulator.cpp


示例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;
}
开发者ID:kyak,项目名称:imgv,代码行数:25,代码来源:sdl-imageviewer.c


示例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);
}
开发者ID:PSU-Robotics-Countess-Quanta,项目名称:Countess-Quanta-Control,代码行数:31,代码来源:ArAMPTU.cpp


示例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";
    }
}
开发者ID:jeyboy,项目名称:playo3,代码行数:34,代码来源:bass_player.cpp


示例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);
}
开发者ID:uhd,项目名称:modelremote,代码行数:25,代码来源:CommandInterpreter.cpp


示例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();
}
开发者ID:kidaa,项目名称:antimony,代码行数:27,代码来源:viewport.cpp


示例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();
      }
   }
开发者ID:DayStarEngineering,项目名称:CDH,代码行数:25,代码来源:mdispgtkview.cpp


示例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;
}
开发者ID:LinKin-22,项目名称:acm-algorithm,代码行数:60,代码来源:4421+2012-10-25+17+15+25.cpp


示例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;
    }
开发者ID:janba,项目名称:GEL,代码行数:27,代码来源:QuatTrackBall.cpp


示例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;
}
开发者ID:00001,项目名称:plan9port,代码行数:30,代码来源:screen.c


示例16: swipe

void DisplayGroupGraphicsView::gestureEvent( QGestureEvent* evt )
{
    QGesture* gesture = 0;

    if( ( gesture = evt->gesture( Qt::SwipeGesture )))
    {
        evt->accept( Qt::SwipeGesture );
        swipe( static_cast< QSwipeGesture* >( gesture ));
    }
    else if( ( gesture = evt->gesture( PanGestureRecognizer::type( ))))
    {
        evt->accept( PanGestureRecognizer::type( ));
        pan( static_cast< PanGesture* >( gesture ));
    }
    else if( ( gesture = evt->gesture( PinchGestureRecognizer::type( ))))
    {
        evt->accept( PinchGestureRecognizer::type( ));
        pinch( static_cast< PinchGesture* >( gesture ));
    }
    else if( ( gesture = evt->gesture( Qt::TapGesture )))
    {
        evt->accept( Qt::TapGesture );
        tap( static_cast< QTapGesture* >( gesture ));
    }
    else if( ( gesture = evt->gesture( Qt::TapAndHoldGesture )))
    {
        evt->accept( Qt::TapAndHoldGesture );
        tapAndHold( static_cast< QTapAndHoldGesture* >( gesture ));
    }
}
开发者ID:holstgr-kaust,项目名称:DisplayCluster,代码行数:30,代码来源:DisplayGroupGraphicsView.cpp


示例17: rotate

void Camera::mouseInput( int x, int y, int Button, int State)
{
    if(State == GLUT_DOWN)
    {
        if(m_LastMouseX==-1) m_LastMouseX = x;
        if(m_LastMouseY==-1) m_LastMouseY = y;
        
        if( Button == GLUT_LEFT_BUTTON )
        {
            rotate((float)x, (float)y );
        }
        else if( Button == GLUT_RIGHT_BUTTON)
        {
            pan( (float)(m_LastMouseX-x)*0.01f, (float)(m_LastMouseY-y)*0.01f );
        }
        else if( Button == GLUT_MIDDLE_BUTTON)
        {
            zoom( (float)(m_LastMouseY-y)*0.01f );
            
        }

    }
    else
    {
        m_Position += m_Panning + m_Zoom + m_Rotation;
        m_Target += m_Panning;
        m_Panning = Vector(0,0,0);
        m_Zoom = Vector(0,0,0);
        m_Rotation = Vector(0,0,0);
        m_LastMouseX = -1;
        m_LastMouseY = -1;

    }
}
开发者ID:flair2005,项目名称:3D-room-planner,代码行数:34,代码来源:Camera.cpp


示例18: assert

void Navigation::panningProcess(const QPoint & mouse)
{
    assert(PanInteraction == m_mode);

    // The first click of the interaction yields a object space position m_i0.
    // this point is our constraint for panning, that means for every mouse 
    // position there has to be an appropriate positioning for the scene, so
    // that the point under the mouse remains m_i0.
    // With this point and the up normal we build a plane, that defines the 
    // panning space. For panning, a ray is created, pointing from the screen
    // pixel into the view frustum. This ray then is converted to object space
    // and used to intersect with the plane at p. 
    // The delta of m_i0 and p is the translation required for panning.

    // constrain mouse interaction to viewport (if disabled, could lead to mishaps)
    const QPoint clamped(
        clamp(0, m_camera.viewport().width(), mouse.x())
    ,   clamp(0, m_camera.viewport().height(), mouse.y()));

    bool intersects;
    m_i1 = mouseRayPlaneIntersection(intersects, clamped, m_i0, m_viewProjectionInverted);

    if (intersects)
        pan(m_i0 - m_i1);
}
开发者ID:Nuos,项目名称:demo_lod,代码行数:25,代码来源:Navigation.cpp


示例19: setYRotation

void GLWidget::mouseMoveEvent(QMouseEvent *event)
{
    int dx = event->x() - lastPos.x();
    int dy = event->y() - lastPos.y();

    if (event->buttons() & Qt::LeftButton) {
        // Es canvien els angles de visio de la camera segons el desplacament
        // Si hi ha un desplacament en X del viewport, es canviara l angle Y
        // Si hi ha un desplacament en Y del viewport, es canviara l angle X
        setYRotation( 8 * dx);
        setXRotation( 8 * dy);

    } else if (event->buttons() & Qt::RightButton) {

        // panning
        pan(dx, dy);

    } else if (event->buttons() & Qt::MidButton) {

        // zoom
        if (lastPos.y() > event->y())
            zoom(-0.05, dy);
        else
            zoom(0.05, dy);
    }

    lastPos = event->pos();
}
开发者ID:hermetico,项目名称:GRA,代码行数:28,代码来源:glwidget.cpp


示例20: clamped

void WorldInHandNavigation::panProcess(const glm::ivec2 & mouse)
{
    if (PanInteraction != m_mode || !m_refPositionValid)
        return;

    // The first click of the interaction yields an object space position m_referencePosition.
    // this point is our constraint for panning, that means for every mouse 
    // position there has to be an appropriate positioning for the scene, so
    // that the point under the mouse remains m_referencePosition.
    // With this point and the up normal we build a plane, that defines the 
    // panning space. For panning, a ray is created, pointing from the screen
    // pixel into the view frustum. This ray then is converted to object space
    // and used to intersect with the plane at p. 
    // The delta of m_referencePosition and p is the translation required for panning.

    // constrain mouse interaction to viewport (if disabled, could lead to mishaps)
    const glm::ivec2 clamped(
        glm::clamp(mouse.x, 0, m_viewportCapability.width()),
        glm::clamp(mouse.y, 0, m_viewportCapability.height()));

    bool intersects = false;
    m_modifiedPosition = mouseRayPlaneIntersection(intersects, clamped, m_referencePosition, glm::vec3(0.f, 1.f, 0.f));

    if (intersects)
        pan(m_referencePosition - m_modifiedPosition);
}
开发者ID:SebSchmech,项目名称:gloperate,代码行数:26,代码来源:WorldInHandNavigation.cpp



注:本文中的pan函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ panel_next_on函数代码示例发布时间:2022-05-30
下一篇:
C++ pam_syslog函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap