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

C++ drawAxis函数代码示例

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

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



在下文中一共展示了drawAxis函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: principalAxisGenList

GLuint principalAxisGenList(GLuint axisList)
{
	V4d specular = {1.0f,1.0f,1.0f,1.0f};
	V4d FirstDiffuse = {1.0f,1.0f,1.0f,1.0f};
	V4d FirstAmbiant = {1.0f,1.0f,1.0f,1.0f};
	V4d secondDiffuse = {1.0f,1.0f,1.0f,1.0f};
	V4d secondAmbiant = {1.0f,1.0f,1.0f,1.0f};
	V4d thirdDiffuse = {1.0f,1.0f,1.0f,1.0f};
	V4d thirdAmbiant = {1.0f,1.0f,1.0f,1.0f};
	V3d firstVector = {1.0f,1.0f,1.0f};
	V3d secondVector = {1.0f,1.0f,1.0f};
	V3d thirdVector = {1.0f,1.0f,1.0f};
	GLdouble radius = axis.radius;
	gint i;

	if (glIsList(axisList) == GL_TRUE) glDeleteLists(axisList,1);

	compute_the_principal_axis();

	if(!axis.def) return 0;

	for(i=0;i<3;i++)
	{
		FirstDiffuse[i] = axis.firstColor[i];
		secondDiffuse[i] = axis.secondColor[i];
		thirdDiffuse[i] = axis.thirdColor[i];

		FirstAmbiant[i] = FirstDiffuse[i]/10;
		secondAmbiant[i] = secondDiffuse[i]/10;
		thirdAmbiant[i] = thirdDiffuse[i]/10;
	}
	FirstDiffuse[3] = 1;
	FirstAmbiant[3] = 1;

	secondDiffuse[3] = 1;
	secondAmbiant[3] = 1;

	thirdDiffuse[3] = 1;
	thirdAmbiant[3] = 1;

	for(i=0;i<3;i++)
	{
		firstVector[i]   =  axis.firstVector[i]*axis.scal;
		secondVector[i]   =  axis.secondVector[i]*axis.scal;
		thirdVector[i] =  axis.thirdVector[i]*axis.scal;
	}
	

	

    axisList = glGenLists(1);
	glNewList(axisList, GL_COMPILE);
	drawAxis(firstVector, radius, axis.origin,  specular, FirstDiffuse, FirstAmbiant);
	drawAxis(secondVector, radius, axis.origin,  specular, secondDiffuse, secondAmbiant);
	drawAxis(thirdVector, radius, axis.origin,  specular, thirdDiffuse, thirdAmbiant);
	glEndList();
	return axisList;
}
开发者ID:xomachine,项目名称:gabedit,代码行数:58,代码来源:PrincipalAxisGL.c


示例2: main

int main()
{
    int gdriver = DETECT, gmode;
    initgraph(&gdriver, &gmode, "");
    setbkcolor(WHITE);

    Point p[4] =
    {
        Point{0,0},
        Point{100,0},
        Point{100,100},
        Point{0,100}
    };
    int ch;
    cleardevice();
    drawAxis(BLACK);
    for(int i = 0; i<4; i++)
    {
        Line l = {p[i], p[(i+1)%4]};
        l.plotLineDDA(RED);
    }
    while((ch = getKeyCode())!=ESC)
    {
        switch(ch)
        {
        case 'A' :
            for(int i = 0; i<4; i++)
            {
                rotateSingle(&p[i], toRadian(10));
            }
            break;
        case 'W' :
            for(int i = 0; i<4; i++)
            {
                translateSingle(&p[i], 10,10);
            }
            break;
        case 'D' :
            for(int i = 0; i<4; i++)
            {
                scaleSingle(&p[i], 1.5, 1.5);
            }
            break;
        }
        cleardevice();
        drawAxis(BLACK);
        for(int i = 0; i<4; i++)
        {
            Line l = {p[i], p[(i+1)%4]};
            l.plotLineDDA(RED);
        }
    }
    return 0;
}
开发者ID:karan173,项目名称:GraphicsAlgorithms,代码行数:54,代码来源:transformation2d.cpp


示例3: ofSetColor

//--------------------------------------------------------------
void graph::draw(){
	ofSetColor(255, 255, 255);
	ofRect(graphX, graphY, graphW, graphH);
	
	for ( int b=0; b<NUM_BEATS; b++ ) {
		for ( int s=0; s<NUM_STEPS; s++ ) {
			
			int num = (b * NUM_STEPS) + s;
			
			// Draw Graph
			int xDrawPoint = ((b * NUM_STEPS) + s) * (graphColPad + graphColW);
			float val = sequencer->getSParam()->getStepValue(b, s) * graphH;
			if (b == selectedBeat and s == selectedStep) {
				// step selected
				ofSetColor(204, 102, 0);
			} else if (b == sequencer->getBeat() and s == sequencer->getStep()) {
				// step playing
				ofSetColor(255, 255, 255);
			} else if (num >= highlightStart and num < highlightEnd) {
				// step selected
				ofSetColor(0, 204, 0);
			} else {
				ofSetColor(0, 102, 204);
			} 
			ofRect(1 + xDrawPoint, graphH - val, graphColW, val);
			
			// Draw Axis
			string marker;
			if (s == 0) {
				marker = ofToString(b + 1);
				drawAxis(marker, 15, xDrawPoint, graphH);
			} else if (s == 8) {
				marker = ofToString(b + 1) + ".2";
				drawAxis(marker, 5, xDrawPoint, graphH);
			} else if (s == 16) {
				marker = ofToString(b + 1) + ".3";
				drawAxis(marker, 5, xDrawPoint, graphH);
			} else if (s == 24) {
				marker = ofToString(b + 1) + ".4";
				drawAxis(marker, 5, xDrawPoint, graphH);
			}
			
			
			// Draw highlightStart and highlightEnd
			if (num == highlightStart || num == highlightEnd) {
				ofSetColor(204, 102, 0);
				ofRect(xDrawPoint, graphY, 1, graphH + 20);
			}
			
		}
	}
	
}
开发者ID:eriser,项目名称:osc_sequencer,代码行数:54,代码来源:graph.cpp


示例4: drawWorldModelAbsolute

void drawWorldModelAbsolute(Canvas& canvas, const WorldModel2D& wm, const geo::Vec2& p0)
{
    drawWorld(canvas, wm);

    for(unsigned int i = 1; i < wm.entities.size(); ++i)
    {
        const Entity2D& e = wm.entities[i];
        drawArrow(canvas, p0, e.pose.t, Color(150, 150, 150, 2));
        drawAxis(canvas, e.pose);
    }

    drawAxis(canvas, fromXYA(p0.x, p0.y, 0));
}
开发者ID:svddries,项目名称:image_creator,代码行数:13,代码来源:relative.cpp


示例5: getPlotArea

  void LinePlot::drawPlot(Frame* frame)
  {
    Frame innerFrame = getPlotArea(frame);

    // Obtain mins and maxes from the data
    double minXdata, maxXdata, minYdata, maxYdata;
    sl.findMinMax(minXdata,maxXdata,minYdata,maxYdata);

    // Assume these will be used as boundaries of the plots
    double minX=minXdata, maxX=maxXdata, minY=minYdata, maxY=maxYdata;
    
    // See if the user overrode the axes limits
    if (fixedXaxis)
    {
      minX = minx;
      maxX = minx + width;
    }

    if (fixedYaxis)
    {
       minY = miny;
       maxY = miny+height;
    }

    // Use default min/max
    sl.drawInFrame(innerFrame,minX,maxX,minY,maxY);

    setXAxis(minX, maxX);
    setYAxis(minY, maxY); 

    drawAxis(frame);
  }
开发者ID:etschneider,项目名称:GPSTk,代码行数:32,代码来源:LinePlot.cpp


示例6: glViewport

void OpenGLTransformation::drawSub1()
{
  glViewport(0, 0, windowWidth / 2, windowHeight);
  glScissor(0, 0, windowWidth / 2, windowHeight);

  glClearColor(0.1f, 0.1f, 0.1f, 1);
  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);

  MatStack.matrixMode(tgt::MatrixStack::PROJECTION);
  MatStack.pushMatrix();
  MatStack.loadMatrix(camera->getProjectionMatrix(glm::ivec2(windowWidth * 0.5f, windowHeight)));
  MatStack.matrixMode(tgt::MatrixStack::MODELVIEW);
  MatStack.pushMatrix();
  MatStack.loadMatrix(camera->getViewMatrix());

  // always draw the grid at the origin (before any modeling transform)
  drawGrid(10, 1);
  drawAxis(4);

  glm::mat4 cubeModel = glm::translate(glm::vec3(-0.5f));
  MatStack.pushMatrix();
  MatStack.loadMatrix(camera->getViewMatrix() * cubeModel);
  drawCube();
  MatStack.popMatrix();

  MatStack.matrixMode(tgt::MatrixStack::PROJECTION);
  MatStack.popMatrix();
  MatStack.matrixMode(tgt::MatrixStack::MODELVIEW);
  MatStack.popMatrix();
}
开发者ID:alvin-me,项目名称:MIVT,代码行数:30,代码来源:opengltransformation.cpp


示例7: glPushMatrix

/*!
 * \brief where points are draw and point of view set.
 */
void FrameGL::paintGL()
{
    glPushMatrix();
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    glLoadIdentity();

    // Se seleeciona el punto de vista desde donde se mira.
    //float ptoVista[3]={-50.f,-100.f,-1000.f};

    // Define una transformacion de vision.Punto de vista XYZ, centro de la
    // escena donde se mira XYZ y vector de direccion ascendente
    //gluLookAt(ptoVista[0],ptoVista[1],ptoVista[2],0.0,0.0,5000.0,0.0,-1.0,0.0);
    gluLookAt(-7*anglex, -7*angley-1000,-3000.0,    0.0,-1000.0,3000.0,   0.0,-1.0,0.0);

    glScalef(zoom, zoom, 1);

    //glRotatef(m_x,1.0f, 0.0f, 0.0f); // Rotacion X (ángulo, vector alrededor del que giras)
    //glRotatef(m_y,0.0f, 1.0f, 0.0f); // Rotacion Y

    drawAxis();
    drawCloud();
    //drawLines();//el de Raul Alves

    glPopMatrix();
}
开发者ID:gabrielalzamora,项目名称:apikinect,代码行数:28,代码来源:framegl.cpp


示例8: Vector3f

void GLWidget::paintGL(){
    // Lights
    bulb.pos = freeCam.pos;
    bulb.pos.u = 1.0;

    // Camera
    freeCam.ar = aspectRatio;
    if( !getQuaternion())
        freeCam.eye = freeCam.pos + Vector3f( sin(camP)*cos(camT), sin(camT), cos(camP)*cos(camT));
    setActiveCamera( freeCam);
    if( getQuaternion())
        setActiveViewTrackBall( m_trackBalls);

    stoma.isHidden = !drawWithTexture;
    render3dObjects();
    if( drawGraph)
        stoma.drawGraph();
    if( isAxisDrawn)
    {
        glPushMatrix();
        glTranslatef(80.0,130.0,0.0);
        drawAxis();
        glPopMatrix();
    }

    swapBuffers();
}
开发者ID:gokul989,项目名称:VirtualEndoscopy,代码行数:27,代码来源:glwidget.cpp


示例9: main

/*
Enter n for polygon
5
Enter points of polygon in clockwise/anticlockwise order\n
-20 50
50 200
120 50
50 -200
-20 50
Enter rectangle
0 -100 100 150
*/
int main()
{
    int gdriver = DETECT, gmode;
    initgraph(&gdriver, &gmode, "");
    setbkcolor(WHITE);
    cleardevice();
    drawAxis(BLACK);

    int n;
    Poly *head = NULL;
    printf("Enter n for polygon");
    scanf("%d", &n);
    printf("Enter points of polygon in clockwise/anticlockwise order\n");
    for(int i = 0; i<n; i++)
    {
        Point p;
        scanf("%lf%lf",&p.x,&p.y);
        Poly *x = (Poly *) malloc (sizeof(Poly));
        *x = {p, head};
        head = x;
    }
    head->plotPoly(MAGENTA,0);
    Rect r;
    printf("Enter rectangle\n");
    scanf("%lf%lf%lf%lf",&r.min.x, &r.min.y, &r.max.x, &r.max.y);
    r.plotRect(BLUE);
    Poly *op = sutherlandHodgeman(head, &r);
    op->plotPoly(YELLOW,0);
    getch();
	return 0;
}
开发者ID:karan173,项目名称:GraphicsAlgorithms,代码行数:43,代码来源:sutherlandHodgemanDriver.cpp


示例10: glClear

void GLWidget::paintGL() {

  std::cout << "paintGL()" << std::endl;
  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

  //================================
  // OpenGLの座標系を動かして描画
  //================================

  glMatrixMode(GL_MODELVIEW);
  glLoadIdentity();

  //初期状態では画面右がx,上がy,手前がz
  // z軸を上,x軸を手前にする
  glRotated(-90, 1, 0, 0);
  glRotated(-90, 0, 0, 1);

  glTranslatef(-5, 0.0, 0.0);

  // 描画設定
  glEnable(GL_BLEND);
  glEnable(GL_DEPTH_TEST);

  //軸の描写
  glPushMatrix();
  glLineWidth(2);
  drawAxis();
  glPopMatrix();

  glDisable(GL_BLEND);
  glDisable(GL_COLOR_MATERIAL);

  //全ての処理を実行
  glFlush();
}
开发者ID:hiroki14da,项目名称:QGLWidget_sample,代码行数:35,代码来源:glwidget.cpp


示例11: main

/*
-30 70
60 100
80 -10
20 -20
-80 0
-30 70
Enter line
-150 100
150 20

-30 70
60 100
80 -10
20 -20
-80 0
-30 70
Enter line
*/
int main()
{
	int gdriver = DETECT, gmode;
    initgraph(&gdriver, &gmode, "");
    setbkcolor(WHITE);
    cleardevice();
    drawAxis(BLACK);
    int n;
    Poly *poly = NULL;
    printf("Enter n for convex polygon\n");
    scanf("%d", &n);
    printf("Enter points in clockwise/anticlockwise order\n");
    for(int i = 0; i<n; i++)
    {
        int x,y;
        scanf("%d%d",&x,&y);
        Point p = Point{x,y};
        Poly *newPoly = (Poly *)malloc(sizeof(Poly));
        *newPoly = Poly{p, poly};
        poly = newPoly;
    }
    poly->plotPoly(BLACK, 0);
    printf("Enter line\n");
    Line l;
    scanf("%lf%lf%lf%lf", &l.p1.x, &l.p1.y, &l.p2.x, &l.p2.y);
    l.plotLineDDA(BLUE);
    cyrusBeck(poly, &l, YELLOW);
    getch();
    closegraph();
    return 0;

}
开发者ID:karan173,项目名称:GraphicsAlgorithms,代码行数:51,代码来源:cyrusBeckDriver.cpp


示例12: display

void display(void)
{
	int i,k;
	glColor3f(1.0,1.0,1.0) ;
	glClear(GL_COLOR_BUFFER_BIT);

	drawAxis () ;


	glColor3f( 1,0,0);

	for(i=0;i<n;i++)
	{
		y[i] = 0 ;

		for(k=1;k<=i;k++)
		{
			y[i] += - a[k]*y[i-k] ;
		}

		for(k=0;k<=i;k++)
		{
			y[i] += b[k]*U(i-k) ;
		}
	}

	for(i=0;i<n;i++)
		drawPixel(i*10,y[i]*1.0);

	glFlush();
}
开发者ID:Rijul1204,项目名称:Graphics,代码行数:31,代码来源:lab4.cpp


示例13: Mat

void DrawAxis::openWebcam()
{
	webcam.open(0);

	webcam.set(CV_CAP_PROP_FRAME_WIDTH, frameWidth);
	webcam.set(CV_CAP_PROP_FRAME_HEIGHT, frameHeight);
	rvec = Mat(Size(3, 1), CV_64F);
	tvec = Mat(Size(3, 1), CV_64F);
	cout << "intrinsinc = " << intrinsic_params << endl;
	cout << "dist = " << distortion_params << endl;
	cout << "intrinsic.size = " << intrinsic_params.size() << endl;
	while (true){
		webcam.read(webcamImage);
		bool findCorners = findChessboardCorners(webcamImage, boardSize, corners, CALIB_CB_FAST_CHECK);
		if (findCorners){
			solvePnP(Mat(boardPoints), Mat(corners), intrinsic_params, distortion_params, rvec, tvec, false);
			projectPoints(cubePoints, rvec, tvec, intrinsic_params, distortion_params, cubeFramePoints);
			projectPoints(framePoints, rvec, tvec, intrinsic_params, distortion_params, imageFramePoints);

			drawAxis(webcamImage, color, 3);
			drawCube(webcamImage, cubeFramePoints, Scalar(255, 0, 255), 2);

		}
		namedWindow("OpenCV Webcam", 0);
		imshow("OpenCV Webcam", webcamImage);

		waitKey(10);
	}
}
开发者ID:DrM0SK4,项目名称:Ass1,代码行数:29,代码来源:DrawAxis.cpp


示例14: main

int main(void)
{
    int gdriver = DETECT, gmode;
    initgraph(&gdriver, &gmode, "");
    setbkcolor(WHITE);
    cleardevice();
    drawAxis(BLACK);
    setcolor(BLACK);
    int x1, y1, x2, y2;
    printf("Enter line1(midpoint)\n");
    scanf("%d%d%d%d",&x1,&y1,&x2, &y2);
    Line l1 = Line{Point{x1, y1}, Point{x2,y2}};
    outtextxy(x1+XREF,-y1+YREF,"midpoint algorithm");

    printf("Enter line2(dda)");
    scanf("%d%d%d%d",&x1,&y1,&x2, &y2);
    Line l2 = Line{Point{x1, y1}, Point{x2,y2}};
    outtextxy(x1+XREF,-y1+YREF,"dda algorithm");

    printf("Enter line2(bressenham)");
    scanf("%d%d%d%d",&x1,&y1,&x2, &y2);
    Line l3 = Line{Point{x1, y1}, Point{x2,y2}};
    outtextxy(x1+XREF,-y1+YREF,"bressenham algorithm");

    l1.plotLineMidPt(BLACK);
    l2.plotLineDDA(BLACK);
    l3.plotLineBressen(BLACK);
    getch();
    closegraph();
    return 0;

}
开发者ID:karan173,项目名称:GraphicsAlgorithms,代码行数:32,代码来源:lineDriver.cpp


示例15: myDisplay

void myDisplay(void)
{
    glClear(GL_COLOR_BUFFER_BIT);
    drawAxis();
    drawSin();
    glFlush();
}
开发者ID:jypeitao,项目名称:opengl_learn,代码行数:7,代码来源:drawSin.c


示例16: main

int main()
{
    int gdriver = DETECT, gmode;
    initgraph(&gdriver, &gmode, "");

    setbkcolor(WHITE);
    cleardevice();
    drawAxis(BLACK);
    setcolor(BLACK);

    Point p;
    int a,b;

    printf("Enter center and a,b(midpoint first order)\n");
    scanf("%lf%lf%d%d",&p.x,&p.y,&a,&b);
    Hyperbola h1 = {a,b,p};
    outtextxy(p.x+XREF, -p.y+YREF+b, "midpoint first order");
    h1.plotFirstOrder(BLACK, 40);

    printf("Enter center and a,b(midpoint second order)\n");
    scanf("%lf%lf%d%d",&p.x,&p.y,&a,&b);
    Hyperbola h2 = {a,b,p};
    outtextxy(p.x-a+XREF, -p.y+YREF+b, "midpoint second order");
    h2.plotSecondOrder(BLACK, 40);

    getch();
    closegraph();
    return 0;
}
开发者ID:karan173,项目名称:GraphicsAlgorithms,代码行数:29,代码来源:hyperbolaDriver1.cpp


示例17: drawElement

void 
drawElement(e2dElement* elem)  {
    glPushMatrix();
    
    multMatrix(&elem->localTransform);
    switch(elem->type)
    {
            
        case(E2D_GROUP):
            drawGroup((e2dGroup*)elem);
            break;
           
        case(E2D_PATH):
            drawPath((e2dPath*)elem);
            break;
            
        case(E2D_IMAGE):
            drawImage((e2dImage*)elem);
            break;
          
        case(E2D_CLONE):
            drawClone((e2dClone*)elem);
            break;
            
        default:
            break;
    }
        
    drawAxis();
    drawRect(elem->bboxPosition, elem->bboxWidth, elem->bboxHeight);
    glPopMatrix();
}
开发者ID:catdawg,项目名称:Ez2DS,代码行数:32,代码来源:Ez2DSDebugDraw.c


示例18: display

void display() {

	glClearColor(0.3, 0.5, 0.1, 1.0);
	glClear(GL_COLOR_BUFFER_BIT);

	// Projection Trans.
	glMatrixMode(GL_PROJECTION);

		glLoadIdentity();

		// Projection Matrix.
		gluPerspective(30, 1, 1, 30);

	// ModelView Trans.
	glMatrixMode(GL_MODELVIEW);

		glLoadIdentity();

		// Viewing Trans.
		viewingTransformation();

		// Modeling Trans.
		drawAxis(1.0);
		drawIronman();
	
	//glutPostRedisplay();
	glutSwapBuffers();
}
开发者ID:kidsnow,项目名称:GLUT,代码行数:28,代码来源:display.cpp


示例19: display

//display function
void display(void)
{
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    gluPerspective(45, 1, 1, 100);

    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();

    gluLookAt(camPos[0], camPos[1], camPos[2], 0,0,0, 0,1,0);
    glRotatef(angleY,1,0,0);
    glRotatef(angleX,0,1,0);

    drawAxis(50);
    //draw the sceneGraph
    glEnable(GL_LIGHTING);
    setMaterial(m1);
    drawXZPlane(0,50);

    glColor3f(0.5,0.5,0.5);
    SG->draw();
    drawText();

    glutSwapBuffers();
}
开发者ID:bickybilly,项目名称:graphics,代码行数:27,代码来源:modeller.cpp


示例20: gluLookAt

/**
 * Exposes the camera with gluLookAt function
 */
void Camera::expose() {
    
    Vector target = position + forward;
    gluLookAt(CO(position), CO(target), CO(up));
    
    drawAxis();
}
开发者ID:imranhasanhira,项目名称:opengl-oop-framework,代码行数:10,代码来源:Camera.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ drawBorder函数代码示例发布时间:2022-05-30
下一篇:
C++ drawAxes函数代码示例发布时间: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