当前位置: 首页>>代码示例>>C++>>正文


C++ draw_circle函数代码示例

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


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

示例1: draw_cylinder

//draw cylinder based on two circles and multiple triangles
void draw_cylinder (float baser, float topr, float h, int slices, float color[3],bool center,glm::mat4 M ) 
{
  glPushMatrix();
  glMultMatrixf(&M[0][0]);
  if(center) glTranslatef(0,0,h/2);

  glTranslatef(0,0,h/2);
  draw_circle(topr,color);
  glTranslatef(0,0,-h);
  draw_circle(baser,color);
  glTranslatef(0,0,h/2);
  for (int i = 0; i < slices; ++i)
  {
    //sida = 360/slices
    draw_triangle(baser*cos(i*2*PI/slices),baser*sin(i*2*PI/slices),-h/2,
                  baser*cos((i+1)*2*PI/slices),baser*sin((i+1)*2*PI/slices),-h/2,
                  topr*cos(i*2*PI/slices),topr*sin(i*2*PI/slices),h/2);

    draw_triangle(topr*cos(i*2*PI/slices),topr*sin(i*2*PI/slices),h/2,
                  topr*cos((i+1)*2*PI/slices),topr*sin((i+1)*2*PI/slices),h/2,
                  baser*cos((i+1)*2*PI/slices),baser*sin((i+1)*2*PI/slices),-h/2);
  }
  //draw_triangle(base,-1,-h/2, -1,-1,-h/2, -1,1,-h/2);



  glPopMatrix();
}
开发者ID:worm6206,项目名称:lab3,代码行数:29,代码来源:lab3.c

示例2: r

void GWait::draw_this(LCD_MODULE* lcd)
{
	uint8_t mask=1;
	if(R > 5)
	{
		POINT_T p;//, r(R-2,R-2);
		for(int i=0; i < 8; i++, mask <<=1)
		{
			p = PolarToDevXY(i*45, R-4, lcd);
			p += base;
			if(last_state & mask)
			{
				lcd->color = PIX_BLACK;
				fill_circle(p, 2);
				lcd->color = PIX_WHITE;
				draw_circle(p, 2);
				continue;
			}
			if(new_state & mask)
				fill_circle(p, 2);
			else
				draw_circle(p, 2);
		}
	}
}
开发者ID:bratkov,项目名称:tmos,代码行数:25,代码来源:gdowait.cpp

示例3: sun_layer_update

static void sun_layer_update(Layer *layer, GContext *ctx) {
  if (data_loaded) {
    const GRect entire_screen = GRect(0, 0, 180, 180);
    const GRect sun_outline_rect = GRect(70, 70, 40, 40);
    const GRect sun_rect = GRect(72, 72, 36, 36);

    draw_circle(ctx, entire_screen, GColorVividCerulean, 90, 360);

    graphics_context_set_stroke_color(ctx, GColorChromeYellow);
    graphics_context_set_stroke_width(ctx, 2);

    int i;
    for (i = 0; i < 360; i += 12) {
      const GPoint in = gpoint_from_polar(
        sun_outline_rect,
        GOvalScaleModeFitCircle,
        DEG_TO_TRIGANGLE(i)
      );
      const GPoint out = gpoint_from_polar(
        entire_screen,
        GOvalScaleModeFitCircle,
        DEG_TO_TRIGANGLE(i)
      );
      graphics_draw_line(ctx, out, in);
    }

    draw_circle(ctx, sun_outline_rect, GColorWindsorTan, 20, 360);
    draw_circle(ctx, sun_rect, GColorOrange, 18, 360);
  }
}
开发者ID:mcdonaldca,项目名称:day-and-night,代码行数:30,代码来源:day-and-night.c

示例4: prev_wband_dir

void energy::Wristband::track(LinearSystem &system)
{
    if(!handfinder->wristband_found()) return;
    if(!classifier_enable) return;

    /// @brief ugly hack to flip the direction of the PCA axis
    /// Ugly, but sufficient to get the teaser video recording!
    if(classifier_temporal){
        static Vector3 prev_wband_dir(0,1,0);
        if(handfinder->wristband_direction().dot(prev_wband_dir)<0)
            handfinder->wristband_direction_flip();
        prev_wband_dir = handfinder->wristband_direction();
    }

    int hand_id = skeleton->getID("Hand");
    Vector3 hand_root = skeleton->getJoint("Hand")->getGlobalTranslation();
    Vector3 wband_offpoint = handfinder->wristband_center() + handfinder->wristband_direction()*100;

    Vector2 root_scr = camera->world_to_image(hand_root);
    Vector2 wband_center_scr = camera->world_to_image(handfinder->wristband_center());
    Vector2 wband_offpnt_scr = camera->world_to_image(wband_offpoint);

#ifdef DEBUG_VIZ
    image = current_frame.color.clone();
    draw_circle(image, root_scr, cv::Scalar(255,0,0));
    draw_circle(image, wband_center_scr, cv::Scalar(0,255,0));
    draw_line(image, wband_center_scr, wband_offpnt_scr);
    cv::imshow("image", image);
#endif

    Vector2 n_wrist2 = (wband_center_scr-wband_offpnt_scr).normalized();
    n_wrist2 = Vector2(n_wrist2[1], -n_wrist2[0]);

    ///--- LHS
    Matrix_3xN J_sk = skeleton->jacobian(hand_id, hand_root);
    Matrix_2x3 J_pr = camera->projection_jacobian(hand_root);
    Matrix_1xN J = n_wrist2.transpose() * J_pr * J_sk;

    ///--- RHS
    Scalar rhs = n_wrist2.transpose() * (wband_center_scr - root_scr);

    ///--- Add to solver
    Scalar weight = classifier_weight;
    system.lhs += weight * J.transpose() * J;
    system.rhs += weight * J.transpose() * rhs;

    // std::ofstream("lhs.txt") << transp(J) * J;
    // std::ofstream("rhs.txt") << transp(J) * rhs;

    ///--- Visualize
    if(classifier_show_axis)
    {
        DebugRenderer::instance().clear();
        // Debug_renderer::instance().add_points(pts, Vector3(1,0,0));
        std::vector<std::pair<Vector3, Vector3>> segs;
        segs.push_back( std::make_pair(handfinder->wristband_center(), handfinder->wristband_center() + handfinder->wristband_direction()*100) );
        DebugRenderer::instance().add_segments(segs,Vector3(1,0,0));
    }
}
开发者ID:OpenGP,项目名称:htrack,代码行数:59,代码来源:Wristband.cpp

示例5: draw

static cairo_test_status_t
draw (cairo_t *cr, int width, int height)
{
    cairo_surface_t *surface;

    cairo_translate (cr, PAD, PAD);

    cairo_save (cr);

    /* Draw overlapping circle and fallback circle */
    cairo_set_source_rgb (cr, 0.0, 1.0, 0.0);
    cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
    draw_circle (cr, CIRCLE_SIZE*0.5,  CIRCLE_SIZE*1.5);

    cairo_set_source_rgb (cr, 1.0, 0.0, 0.0);
    cairo_set_operator (cr, CAIRO_OPERATOR_ADD);
    draw_circle (cr, CIRCLE_SIZE*0.75, CIRCLE_SIZE*1.75);

    /* Draw circles */
    cairo_set_source_rgb (cr, 0.0, 1.0, 0.0);
    cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
    cairo_translate (cr, CIRCLE_SIZE*2.5, CIRCLE_SIZE*0.6);
    draw_circles (cr);

    /* Draw fallback circles */
    cairo_set_source_rgb (cr, 1.0, 0.0, 0.0);
    cairo_set_operator (cr, CAIRO_OPERATOR_ADD);
    cairo_translate (cr, 0, CIRCLE_SIZE*2);
    draw_circles (cr);

    cairo_restore (cr);
    cairo_translate (cr, 0, CIRCLE_SIZE * 3.5);

    /* Draw using fallback surface */
    surface = surface_create (cr);

    cairo_set_source_rgb (cr, 0.0, 1.0, 0.0);
    cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
    draw_circle (cr, CIRCLE_SIZE*0.5,  CIRCLE_SIZE*1.5);

    cairo_set_operator (cr, CAIRO_OPERATOR_ADD);
    draw_image_circle (cr, surface, CIRCLE_SIZE/4, CIRCLE_SIZE + CIRCLE_SIZE/4);

    /* Draw circles */
    cairo_set_source_rgb (cr, 0.0, 1.0, 0.0);
    cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
    cairo_translate (cr, CIRCLE_SIZE*2.5, CIRCLE_SIZE*0.6);
    draw_circles (cr);

    cairo_set_operator (cr, CAIRO_OPERATOR_ADD);
    cairo_translate (cr, -CIRCLE_SIZE/2, CIRCLE_SIZE*1.5);
    draw_image_circles (cr, surface);

    cairo_surface_destroy (surface);

    return CAIRO_TEST_SUCCESS;
}
开发者ID:kangaroo,项目名称:moon,代码行数:57,代码来源:finer-grained-fallbacks.c

示例6: draw_avatar

void draw_avatar(Avatar* av) {
    glPushMatrix();
    glTranslatef(av->pos.x, av->pos.y, 0);
    glScalef(av->radius, av->radius, 1);
    draw_circle(true);
    glScalef(av->range / av->radius, av->range / av->radius, 1);
    draw_circle(false);
    glPopMatrix();
}
开发者ID:codders,项目名称:soylent,代码行数:9,代码来源:main.cpp

示例7: draw_circles

static void
draw_circles (cairo_t *cr)
{
    draw_circle (cr, 0,               -CIRCLE_SIZE*0.1);
    draw_circle (cr, CIRCLE_SIZE*0.4,  CIRCLE_SIZE*0.25);

    draw_circle (cr, CIRCLE_SIZE*2, 0);
    draw_circle (cr, CIRCLE_SIZE*4, 0);
    draw_circle (cr, CIRCLE_SIZE*6, 0);
}
开发者ID:kangaroo,项目名称:moon,代码行数:10,代码来源:finer-grained-fallbacks.c

示例8: m_free

// Constructor
RotateManipulator::RotateManipulator (Rotatable& rotatable, std::size_t segments, float radius) :
    m_free(rotatable), m_axis(rotatable), m_circle_x((segments << 2) + 1), m_circle_y((segments << 2) + 1), m_circle_z(
        (segments << 2) + 1), m_circle_screen(segments << 3), m_circle_sphere(segments << 3)
{
    draw_semicircle(segments, radius, m_circle_x.m_vertices.data(), RemapYZX());
    draw_semicircle(segments, radius, m_circle_y.m_vertices.data(), RemapZXY());
    draw_semicircle(segments, radius, m_circle_z.m_vertices.data(), RemapXYZ());

    draw_circle(segments, radius * 1.15f, m_circle_screen.m_vertices.data(), RemapXYZ());
    draw_circle(segments, radius, m_circle_sphere.m_vertices.data(), RemapXYZ());
}
开发者ID:AresAndy,项目名称:ufoai,代码行数:12,代码来源:Manipulators.cpp

示例9: draw_line

// Given the coordinates of two endpoints, finds the y = mx + b equation for the 
// line and draws dots for every pixel in the relatively less constrained 
// dimmension
void draw_line(unsigned char pixelArray[PIXEL_DIMMENSION][PIXEL_DIMMENSION], 
		double brushRadius, int startY, int startX, int endY, int endX) {
	double slope = (double)(endY - startY) / (endX - startX);
	double b = calculate_b(startX, startY, slope);

	// if abs(slope) is less than 1, do operations on x, more than 1, y
	// if start of point is less that end, increment, otherwise decrement 
	int i;
	if (abs(slope) < 1) {
		if (startX >= endX) {
			for (i = startX; i >= endX; --i) {
				double y = calculate_other_coordinate('y', i, slope, b);
				if (startY == endY) {
					double y = startY;
				}
				draw_circle(pixelArray, PIXEL_DIMMENSION - i, round(y), 
						brushRadius);
			}
		} else {
			for (i = startX; i <= endX; ++i) {
				double y = calculate_other_coordinate('y', i, slope, b);
				if (startY == endY) {
					double y = startY;
				}
				draw_circle(pixelArray, PIXEL_DIMMENSION - i, round(y), 
						brushRadius);
			}
		}
	} else {
		if (startY >= endY) {
			for (i = startY; i >= endY; --i) {
				double x;
				if (startX == endX) {
					x = startX;
				} else {
					x = calculate_other_coordinate('x', i, slope, b);
				}
				draw_circle(pixelArray, PIXEL_DIMMENSION - round(x), i, 
						brushRadius);
			}
		} else {
			for (i = startY; i <= endY; ++i) {
				double x;
				if (startX == endX) {
					x = startX;
				} else {
					x = calculate_other_coordinate('x', i, slope, b);
				}
				draw_circle(pixelArray, PIXEL_DIMMENSION - round(x), i, 
						brushRadius);
			}
		}	
	}
}
开发者ID:RDerber,项目名称:REU2016,代码行数:57,代码来源:VECTOR_TO_PIXEL.c

示例10: n_circles

void n_circles(cairo_t *cr, int n, double interval){
  // Draw n circles
  draw_circle(cr, interval*1.5, interval, 0);
  int i;
  for (i=1; i<n; i++){
    if (i%8 == 0){
      cairo_translate(cr, (-1)*interval*(8 + ((i/8)%2)) , interval);
      draw_circle(cr, interval*1.5, 0, i);
    }
    else
      draw_circle(cr, interval, 0, i);
  }
}
开发者ID:atkm,项目名称:cs441,代码行数:13,代码来源:simple_drawing.c

示例11: draw

void draw(const Planet& p) {
    glPushMatrix();
    glColor4fv(color::planet_color);
    glColor4fv(color::WHITE);
    image::atm_image->activate();
    draw_circle(p.x(), p.y(), p.r());
    image::atm_image->deactivate();
    glColor4fv(color::WHITE);
    image::planet_images[p.type]->activate();
    draw_circle(p.x(), p.y(), p.inr());
    image::planet_images[p.type]->deactivate();
    glPopMatrix();
}
开发者ID:jureslak,项目名称:planetwars,代码行数:13,代码来源:Drawing.hpp

示例12: draw

void draw(){
	if(testunit==0){
		display_string(2,title);
		display_string(3,author);
	}else if(testunit==1){
		display_string(1,string_line);
		draw_line(20+frame*4,20,40+frame*4,40);
		draw_line(40+frame*4,20,20+frame*4,40);
		draw_line(30+frame*4,20,30+frame*4,40);
		draw_line(20+frame*4,30,40+frame*4,30);
	}else if(testunit==2){
		display_string(1,string_box);
		draw_box(20,20,20,20,0);
		draw_box(30+frame*4,30,20,20,1);
	}else if(testunit==3){
		display_string(1,string_circle);
		draw_circle(30,30,10,0);
		draw_circle(40+frame*4,40,10,1);
	}else if(testunit==4){
		display_string(1,string_font1);
		display_string_58(0,15,test_string_l,0,1);
		display_string_58(0,24,test_string_l_2,0,1);
		display_string_58(0,33,test_string_s,0,1);
		display_string_58(0,42,test_string_s_2,0,1);
	}else if(testunit==5){
		display_string(1,string_font1);
		display_string_58(20+frame*2,20,test_string,90,1);
	}else if(testunit==6){
		display_string(1,string_font1);
		display_string_58(40+frame*2,30,test_string,180,1);
	}else if(testunit==7){
		display_string(1,string_font1);
		display_string_58(20+frame*2,40,test_string,270,1);
	}else if(testunit==8){
		display_string(2,finish);
	}
	if(frame==15){
		frame=0;
		if(testunit==8){
			;
		}else{
			testunit++;
		}
	}else{
		frame++;
	}
	delayms(100);
}
开发者ID:pikipity,项目名称:QC12864B_8051,代码行数:48,代码来源:glcd_test.c

示例13: draw_fisheye_magnifier

void draw_fisheye_magnifier(ViewInfo * view)
{
    if (get_mode(view)==MM_FISHEYE_MAGNIFIER) {
	float a;
	GLfloat mg_x, mg_y, mg_z;
	a = GetOGLDistance((int) view->fmg.constantR);
	view->fmg.R = (int) a;
	GetOGLPosRef((int) view->mouse.pos.x, (int) view->mouse.pos.y,
		     &mg_x, &mg_y, &mg_z);
	glColor4f((GLfloat) 0.3, (GLfloat) 0.1, (GLfloat) 0.8,
		  (GLfloat) 1);
	if ((view->fmg.x != mg_x) || (view->fmg.y != mg_y)) {
	    if (view->active_camera == -1) {
		/* fisheye_polar(mg_x, mg_y, view->Topview); */
		draw_circle(mg_x, mg_y, a);
	    }
	    else {
		/* fisheye_spherical(mg_x, mg_y, 0.00, view->Topview); */
		if (!fisheyesphere)
		    fisheyesphere = gluNewQuadric();
		gluQuadricDrawStyle(fisheyesphere, GLU_LINE);
		glColor4f((GLfloat) 0.3, (GLfloat) 0.1, (GLfloat) 0.8, (GLfloat) 0.05);
		glTranslatef(mg_x, mg_y, 0);
		gluSphere(fisheyesphere, a, 30, 30);
		glTranslatef(-mg_x, -mg_y, 0);
	    }
	    view->fmg.x = mg_x;
	    view->fmg.y = mg_y;
	}
    }
}
开发者ID:AhmedAMohamed,项目名称:graphviz,代码行数:31,代码来源:draw.c

示例14: Graph_DrawBottomRightShadow

static void Graph_DrawBottomRightShadow( LCUI_PaintContext paint, LCUI_Rect *box,
					 LCUI_BoxShadow *shadow )
{
	LCUI_Graph canvas;
	LCUI_Rect bound;
	LCUI_Pos pos;
	
	bound.x = BoxShadow_GetX( shadow ) + BLUR_WIDTH(shadow);
	bound.x += BoxShadow_GetBoxWidth( shadow, box->w );
	bound.x += INNER_SHADOW_WIDTH(shadow)*2;
	bound.y = BoxShadow_GetY( shadow ) + BLUR_WIDTH(shadow);
	bound.y += BoxShadow_GetBoxHeight( shadow, box->h );
	bound.y += INNER_SHADOW_WIDTH(shadow)*2;
	bound.w = bound.h = BLUR_WIDTH(shadow);
	pos.x = 0;
	pos.y = 0;
	if( LCUIRect_GetOverlayRect( &bound, &paint->rect, &bound ) ) {
		bound.x -= paint->rect.x;
		bound.y -= paint->rect.y;
		pos.x -= paint->rect.x;
		pos.y -= paint->rect.y;
		Graph_Quote( &canvas, &paint->canvas, &bound );
		draw_circle( &canvas, pos, bound.w, shadow->color );
	}
}
开发者ID:add0,项目名称:LCUI,代码行数:25,代码来源:boxshadow.c

示例15: on_expose_event

static gboolean
on_expose_event(GtkWidget      *widget,
		GdkEventExpose *event,
		gpointer        data)
{
	cairo_t *cr;
	gint x, y, width, height;
	int i;
	cr = gdk_cairo_create(widget->window);

	gdk_window_get_position(widget->window, &x, &y);
	gdk_drawable_get_size(widget->window, &width, &height);

	
	cairo_set_source_rgb (cr, 0, 0, 0);
	//cairo_set_source(cr, bgpattern);
	cairo_paint (cr);

	for (i = 0; i < NUM_CIRCLES; ++i) {
		draw_circle(cr, width, height, circles + i);
	}

	cairo_destroy(cr);

	return FALSE;
}
开发者ID:krig,项目名称:krigsavers,代码行数:26,代码来源:circlesaver.c


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