示例#1
0
文件: draw.c 项目: Mikhail-Rudoy/ml6
/*======== void add_edge() ==========
Inputs:   struct matrix * points
          int x0, int y0, int z0, int x1, int y1, int z1
Returns: 
add the line connecting (x0, y0, z0) to (x1, y1, z1) to points
should call add_point
====================*/
void add_edge( struct matrix * points, 
	       int x0, int y0, int z0, 
	       int x1, int y1, int z1)
{
  add_point(points, x0, y0, z0);
  add_point(points, x1, y1, z1);
}
示例#2
0
文件: draw.c 项目: nspektor/3dHW
/*======== void generate_torus() ==========
  Inputs:   struct matrix * points
            double cx
	    double cy
	    double r
	    double step  
  Returns: 

  Generates all the points along the surface of a 
  tarus with center (cx, cy) and radii r1 and r2

  Adds these points to the matrix parameter

  jdyrlandweaver
  ====================*/
void generate_torus( struct matrix * points, 
		     double cx, double cy, double r1, double r2, 
		     double step ) {

  //t = θ = angle of circle generation
  //p = ϕ = angle of circle rotation
  double x0, y0, z0, x, y, z, t, p;


  x0 = cx + r1;
  y0 = cy;
  z0 = 0;
  for ( t = step; t <= 1; t+= step ) {
    for ( p = step; p <= 1; p+= step ) {
      x = r1 * cos( 2 * M_PI * t ) + cx;
      y = cos( 2 * M_PI * p)*( r1 * sin( 2 * M_PI * t ) + r2) + cy;
      z = sin( 2 * M_PI * p)*( r1 * sin( 2 * M_PI * t ) + r2) + 0;
    
    add_point(points, x0, y0, z0);
    x0 = x;
    y0 = y;
    z0 = z;
    }
  }

  add_point( points, x0, y0, z0);
}
                inline bool operator()(const segment<const PS>& s, state_type& state) const
                {
                    /* Algorithm:
                    For each segment:
                    begin
                        dx = x2 - x1;
                        dy = y2 - y1;
                        sx = x2 + x1;
                        sy = y2 + y1;
                        mx = dx * sy;
                        my = sx * dy;

                        sum_mx += mx;
                        sum_my += my;
                        sum_msx += mx * sx;
                        sum_msy += my * sy;
                    end;
                    return POINT(0.5 * sum_msx / sum_mx, 0.5 * sum_msy / sum_my);
                    */

                    PS diff = s.second, sum = s.second;
                    subtract_point(diff, s.first);
                    add_point(sum, s.first);

                    // We might create an arithmatic operation for this.
                    PS m;
                    get<0>(m) = get<0>(diff) * get<1>(sum);
                    get<1>(m) = get<0>(sum) * get<1>(diff);

                    add_point(state.sum_m, m);
                    multiply_point(m, sum);
                    add_point(state.sum_ms, m);

                    return true;
                }
示例#4
0
void do_ss_frame(Widget w, XtPointer client_data, XtPointer call_data)
/* 
 * Gte the selected set and call the routine to open up an Xbae widget 
 */
{
    EditPoints *ep;
    int gno = cg;
    int setno = GetSelectedSet(editp_set_item);
    if (setno == SET_SELECT_ERROR) {
        errwin("No set selected");
        return;
    }
	if( setno == SET_SELECT_NEXT ) {
		if( (setno=nextset(gno)) != -1 ) { 
			add_point(gno, setno, 0., 0., 0, 0, SET_XY);
			add_point(gno, setno, 1, 1, 0, 0, SET_XY);
			setcomment( gno, setno, "editor" );
			update_set_status( gno, setno );
		} else {
       		 errwin("No set selected");
       		 return;
    	}
	}
    if (isactive_set(gno, setno)) {
		if (((ep = (EditPoints *) geteditpoints(gno, setno)) != NULL)
												 && (ep->top != NULL)) {
			XtRaise(ep->top);
		} else {
			ep = newep(gno, setno);
			create_ss_frame(ep);
		}
    } else {
		errwin("Set not active");
    }
}
示例#5
0
Line31::Line31(
    const Brush* brush, const Color* stroke, const Color* fill,
    Coord x1, Coord y1, Coord x2, Coord y2, Transformer* t
) : Graphic31(brush, stroke, fill, nil, false, false, 2, t) {
    add_point(x1, y1);
    add_point(x2, y2);
}
示例#6
0
文件: draw.c 项目: nspektor/3dHW
/*======== void generate_sphere() ==========
  Inputs:   struct matrix * points
            double cx
	    double cy
	    double r
	    double step  
  Returns: 

  Generates all the points along the surface of a 
  sphere with center (cx, cy) and radius r

  Adds these points to the matrix parameter

  03/22/12 11:30:26
  jdyrlandweaver
  ====================*/
void generate_sphere( struct matrix * points, 
		      double cx, double cy, double r, 
		      double step ) {
  //t = θ = angle of circle generation
  //p = ϕ = angle of circle rotation
  double x0, y0, z0, x, y, z, t, p;

  x0 = cx + r;
  y0 = cy;
  z0 = 0;
  for ( t = step; t <= 1; t+= step ) {
    for ( p = step; p <= 1; p+= step ) {
      x = r * cos( 2 * M_PI * t ) + cx;
      y = r * sin( 2 * M_PI * t ) * cos( 2 * M_PI * p ) + cy; //-sinp ?
      z =  r * sin( 2 * M_PI * t ) * sin( 2 * M_PI * p ) + 0; //-cos p?
    
    add_point(points, x0, y0, z0);
    x0 = x;
    y0 = y;
    z0 = z;
    }
  }

  add_point( points, x0, y0, z0);
}    
示例#7
0
文件: draw.c 项目: stuydw/polygons
/*======== void add_edge() ==========
Inputs:   struct matrix * points
          int x0, int y0, int z0, int x1, int y1, int z1
Returns: 
add the line connecting (x0, y0, z0) to (x1, y1, z1) to points
should use add_point
====================*/
void
add_edge (struct matrix *points,
	  double x0, double y0, double z0, double x1, double y1, double z1)
{
  add_point (points, x0, y0, z0);
  add_point (points, x1, y1, z1);
}
示例#8
0
void Graphic31::add_curve(
    Coord x, Coord y, Coord x1, Coord y1, Coord x2, Coord y2
) {
    add_point(x1, y1);
    add_point(x2, y2);
    add_point(x, y);
}
示例#9
0
t_point		*get_point(char *bu)
{
	t_var	var;
	char	*value;
	t_point	*bpoints;

	initvar(&var);
	bpoints = malloc(sizeof(t_point) * nbpoints(bu));
	while (bu[var.i])
	{
		if (ft_isdigit(bu[var.i]) == 0 && bu[var.i] != '\n' && bu[var.i] != '-')
			var.i++;
		else if (bu[var.i] == '\n')
			incremvar(&var.m, &var.i, &var.j, 1);
		else
		{
			bu = bu + var.i;
			var.i = 0;
			while (chartester(bu[var.i]) == 0)
				incremvar(&var.k, &var.i, &var.j, 0);
			value = ft_strncpy(ft_strnew(var.k), bu, var.k);
			bpoints[var.l] = add_point(value, var.m, var.j);
			incremvar(&var.j, &var.l, &var.k, 1);
		}
	}
	bpoints[var.l] = add_point("-1", -1, -1);
	return (bpoints);
}
示例#10
0
文件: draw.c 项目: stuydw/final
/*======== void add_edge() ==========
Inputs:   struct matrix * points
          int x0, int y0, int z0, int x1, int y1, int z1
Returns: 
add the line connecting (x0, y0, z0) to (x1, y1, z1) to points
should use add_point
====================*/
void add_edge( struct matrix * points, 
	       double x0, double y0, double z0, 
	       double x1, double y1, double z1) {
  //printf("(%lf,%lf,%lf) to (%lf,%lf,%lf)\n",x0,y0,z0,x1,y1,z1);
  add_point( points, x0, y0, z0 );
  add_point( points, x1, y1, z1 );
}
示例#11
0
static int handle_segment (const PluginLine *line, void *context, int extend_flags) {
	
	editor_line_copy_points		*copy_points = (editor_line_copy_points *)context;
	RoadMapPosition				from;
	RoadMapPosition				to;
	int								first;
	int								last;
	RoadMapShapeItr				itr;
	int								shape;
	
	roadmap_plugin_get_line_points (line, &from, &to, &first, &last, &itr);
	add_point (copy_points, &from);

	if (first >= 0) {
		for (shape = first; shape <= last; shape++) {
			if (itr)
				itr (shape, &from);
			else
				roadmap_shape_get_position (shape, &from);
			add_point (copy_points, &from);
		}
	} 
	
	return 0;
} 
示例#12
0
void add_infinit_points_to_K(CHpoints *S) {
  CHpoints *temp;
  key key;

  /* Allocate space for the Voronoi nodes and edges */
  K = (Knode *) calloc(2*CHno-1,sizeof(Knode));
  E = (Enode *) calloc(2*CHno-2,sizeof(Enode));
  CHSplaytree=CHinit();

  temp = S->next;
  
  /* Add v(S) to K. (1) */
  add_point(compute_v(S));                         /* Add the point to K */
  S->v = Kcount-1;                          /* Update the "pointer" in S 
					       to point to v(S) in K     */
  CHinsert(&CHSplaytree,S);
  
  while (temp != S) {
    /* Add v(S) to K. (1) */
    add_point(compute_v(temp));                    /* Add the point to K */
    temp->v=Kcount-1;                    /* Update the "pointer" in temp 
					    to point to v(S) in K        */
    CHinsert(&CHSplaytree,temp);
    temp=temp->next; }
}
示例#13
0
/*======== void add_curve() ==========
Inputs:   struct matrix *points
         double x0
         double y0
         double x1
         double y1
         double x2
         double y2
         double x3
         double y3
         double step
         int type  
Returns: 

Adds the curve bounded by the 4 points passsed as parameters
of type specified in type (see matrix.h for curve type constants)
to the matrix points

03/16/12 15:24:25
jdyrlandweaver
====================*/
void add_curve( struct matrix *points, 
		double x0, double y0, 
		double x1, double y1, 
		double x2, double y2, 
		double x3, double y3, 
		double step, int type ) {
  struct matrix* coefx;
  struct matrix* coefy;
  if(type == HERMITE_MODE){
    coefx = generate_curve_coefs(x0,x2,x1-x0,x2-x3,type);
    coefy = generate_curve_coefs(y0,y2,y1-y1,y2-y3,type);
  }
  else if(type == BEZIER_MODE){
    coefx = generate_curve_coefs(x0,x1,x2,x3,type);
    coefy = generate_curve_coefs(y0,y1,y2,y3,type);
  }
  double t = 0;
  double x,y;
  while(t<1.0){
    x = t*(t*(coefx->m[0][0]*t+coefx->m[1][0])+coefx->m[2][0])+coefx->m[3][0];
    y = t*(t*(coefy->m[0][0]*t+coefy->m[1][0])+coefy->m[2][0])+coefy->m[3][0];
    add_point(points,x,y,0);
    t += 1.0/step;
    x = t*(t*(coefx->m[0][0]*t+coefx->m[1][0])+coefx->m[2][0])+coefx->m[3][0];
    y = t*(t*(coefy->m[0][0]*t+coefy->m[1][0])+coefy->m[2][0])+coefy->m[3][0];
    add_point(points,x,y,0);
  }
}
示例#14
0
/*======== void add_edge() ==========
Inputs:   struct matrix * points
          int x0, int y0, int z0, int x1, int y1, int z1
Returns: 
add the line connecting (x0, y0, z0) to (x1, y1, z1) to points
should use add_point
====================*/
void add_edge( struct matrix * points, 
	       int x0, int y0, int z0, 
	       int x1, int y1, int z1) {
  printf("WHERE ARE U SEG FAULT ft. add_edge \n");
  add_point(points, x0, y0, z0);
  add_point(points, x1, y1, z1);
  printf("WHERE ARE U SEG FAULT ft. add_edge pt. 2\n");
}
示例#15
0
文件: draw.c 项目: stuydw/polygons
/*======== void add_polygon() ==========
Inputs: struct matrix *surfaces
double x0
double y0
double z0
double x1
double y1
double z1
double x2
double y2
double z2
Returns:
Adds the vertices (x0, y0, z0), (x1, y1, z1)
and (x2, y2, z2) to the polygon matrix. They
define a single triangle surface.

04/16/13 13:05:59
jdyrlandweaver
====================*/
void add_polygon( struct matrix *polygons,
double x0, double y0, double z0,
double x1, double y1, double z1,
double x2, double y2, double z2 ) {
  add_point(polygons, x0, y0, z0);
  add_point(polygons, x1, y1, z1);
  add_point(polygons, x2, y2, z2);
}
示例#16
0
void MeshWorld::add_triangle(Point p1, Point p2, Point p3)
{
    int p1_index = add_point(p1);
    int p2_index = add_point(p2);
    int p3_index = add_point(p3);
    Triangle *t = new Triangle(p1_index, p2_index, p3_index);
    polygons.push_back(t);
}
示例#17
0
bool LocalAnt::random_search_neighborhood_v2()
{

	int next[8] = { 0,0 };
	int total_next = 0;
	pos temp;
	for (int i = 0; i < 8; i++) {
		temp.set(m_pos.m_x + m_gp.next_step[i][0], m_pos.m_y + m_gp.next_step[i][1]);
		if (m_gp.judge(temp) && !mvv_visited[temp.m_x][temp.m_y] && inInNeighborhood_v2(temp))
		{
			total_next++;
			next[i] = 1;
		}
	}

	if (total_next == 0) {
		return false;
	}
	else {
		double randNum(Global::msp_global->getDoubleRand());
		randNum *= total_next;
		randNum = int(randNum);
		total_next = -1;
		int temp_next;
		for (int i = 0; i < 8; i++) {
			if (next[i])
			{
				total_next++;
				if (total_next >= randNum)
				{
					temp_next = i;
					break;
				}
			}
		}
		add_point(temp_next);
		if (m_gp.judgeFood(m_pos))
		{
			m_state = successfully_return_s;
			reset_from_food();
			//reset();
			return true;
		}

		if (m_gp.judgeNearFood(m_pos))
		{
			add_point(m_gp.m_food);
			m_state = successfully_return_s;
			reset_from_food();
			return true;
		}

		return true;


	}
}
示例#18
0
Polygon31::Polygon31 (
    const Brush* brush, const Color* stroke, const Color* fill, 
    Coord* x, Coord* y, int n, Transformer* t
) : Graphic31(brush, stroke, fill, nil, true, false, n, t) {
    add_point(x[0], y[0]);
    for (int i = 1; i < n; ++i) {
        add_point(x[i], y[i]);
    }
}
示例#19
0
Rectangle31::Rectangle31 (
    const Brush* brush, const Color* stroke, const Color* fill,
    Coord l, Coord b, Coord r, Coord t, Transformer* tx
) : Graphic31(brush, stroke, fill, nil, true, false, 4, tx) {
    add_point(r, b);
    add_point(r, t);
    add_point(l, t);
    add_point(l, b);
}
示例#20
0
inline bool projected_to_surface(Point3d const& origin, Point3d const& direction, Point3d & result1, Point3d & result2, Spheroid const& spheroid)
{
    typedef typename coordinate_type<Point3d>::type coord_t;

    coord_t const c0 = 0;
    coord_t const c1 = 1;
    coord_t const c2 = 2;
    coord_t const c4 = 4;

    // calculate the point of intersection of a ray and spheroid's surface
    //(x*x+y*y)/(a*a) + z*z/(b*b) = 1
    // x = o.x + d.x * t
    // y = o.y + d.y * t
    // z = o.z + d.z * t        
    coord_t const ox = get<0>(origin);
    coord_t const oy = get<1>(origin);
    coord_t const oz = get<2>(origin);
    coord_t const dx = get<0>(direction);
    coord_t const dy = get<1>(direction);
    coord_t const dz = get<2>(direction);

    //coord_t const a_sqr = math::sqr(get_radius<0>(spheroid));
    //coord_t const b_sqr = math::sqr(get_radius<2>(spheroid));
    // "unit" spheroid, a = 1
    coord_t const a_sqr = 1;
    coord_t const b_sqr = math::sqr(formula::unit_spheroid_b<coord_t>(spheroid));

    coord_t const param_a = (dx*dx + dy*dy) / a_sqr + dz*dz / b_sqr;
    coord_t const param_b = c2 * ((ox*dx + oy*dy) / a_sqr + oz*dz / b_sqr);
    coord_t const param_c = (ox*ox + oy*oy) / a_sqr + oz*oz / b_sqr - c1;

    coord_t const delta = math::sqr(param_b) - c4 * param_a*param_c;

    // equals() ?
    if (delta < c0 || param_a == 0)
    {
        return false;
    }

    // result = origin + direction * t

    coord_t const sqrt_delta = math::sqrt(delta);
    coord_t const two_a = c2 * param_a;

    coord_t const t1 = (-param_b + sqrt_delta) / two_a;
    result1 = direction;
    multiply_value(result1, t1);
    add_point(result1, origin);

    coord_t const t2 = (-param_b - sqrt_delta) / two_a;
    result2 = direction;
    multiply_value(result2, t2);
    add_point(result2, origin);

    return true;
}
示例#21
0
文件: test_astar.cpp 项目: 93i/godot
	ABCX() {
		add_point(A, Vector3(0, 0, 0));
		add_point(B, Vector3(1, 0, 0));
		add_point(C, Vector3(0, 1, 0));
		add_point(X, Vector3(0, 0, 1));
		connect_points(A, B);
		connect_points(A, C);
		connect_points(B, C);
		connect_points(X, A);
	}
示例#22
0
文件: pac_man.c 项目: Pespon/Pac-Man
void			move_pac_man(t_pac_man *pac_man, t_map map, t_tile tile[N_TILE])
{
	if (ABS(pac_man->sub_pos.x) == (CASE_SIZE / 2)
		|| ABS(pac_man->sub_pos.y) == (CASE_SIZE / 2))
			change_direction___(pac_man, map, tile);
	pac_man->sub_pos = add_point(pac_man->sub_pos, g_move[pac_man->direction]);
	pac_man->abs_pos = add_point(pac_man->abs_pos, g_move[pac_man->direction]);
	pac_man->sub_pos = add_point(pac_man->sub_pos, g_move[pac_man->direction]);
	move_case_axe(&pac_man->sub_pos.x, &pac_man->map_pos.x);
	move_case_axe(&pac_man->sub_pos.y, &pac_man->map_pos.y);
}
示例#23
0
bool LocalAnt::selectNextPointGreedy() {
	
	//bool isfind = 0;
	
	int next(-1);
	double dis (m_gp.m_inf);
//	double temp;
	pos next_pos;
	for (int i = 0; i < 8; i++) {
		//if(!mvv_visited[][])
		
		next_pos.set(m_pos.m_x + m_gp.next_step[i][0], m_pos.m_y + m_gp.next_step[i][1]);
		if (m_gp.judge(next_pos) && !mvv_visited[next_pos.m_x][next_pos.m_y]) {

			if (mvv_distance_from_food[next_pos.m_x][next_pos.m_y] < dis) {
				next = i;
				dis = mvv_distance_from_food[next_pos.m_x][next_pos.m_y];
			}
		}
	}

	if (dis == m_gp.m_inf) {
	//	reset_from_food();
		reset_start_from_home();
		m_state = second_search;
		return false;

	}
	else {

		add_point(next);
		if (m_gp.judgeFood(m_pos))
		{
				m_state = successfully_return_s;
				reset_from_food();
				//reset();
				return true;
		}

		if (m_gp.judgeNearFood(m_pos))
		{
			add_point(m_gp.m_food);
			m_state = successfully_return_s;
			reset_from_food();
			return true;
		}

	}

	return false;

}
示例#24
0
文件: draw.c 项目: stuydw/curves
/*======== void add_circle() ==========
  Inputs:   struct matrix * points
            double cx
	    double cy
	    double y
	    double step
  Returns:
rcos(2πt) + cx
y = rcos(2πt) + cy


  03/16/12 19:53:52
  jdyrlandweaver
  ====================*/
void add_circle( struct matrix * points,
                 double cx, double cy,
                 double r, double step ) {

    double t, x, y, x1, y1;
    x = x1 = cx + r;
    y = y1 = cy;
    for (t = 0; t <= 1; t += step) {
        add_point(points, x, y, 0);
        x = r * cos(2 * M_PI * t) + cx;
        y = r * sin(2 * M_PI * t) + cy;
        add_point(points, x, y, 0);
    }
    add_edge(points, x, y, 0, x1, y1, 0);
}
示例#25
0
void AddPointDialog::process_input()
{
    double x = x_text_box->text().toDouble();
    double y = y_text_box->text().toDouble();
    if(has_name_box->isChecked())
    {
        std::string name = point_name_tb->text().toStdString();
        emit add_point(x,y,name);
    }
    else
    {
        emit add_point(x,y);
    }
    close();
}
示例#26
0
文件: figures.c 项目: serioja90/v3dmc
v3dmc_object load_object(GLchar *filename){
	FILE *file;
	GLint i,npoints,nlines,ntriangles,nquads;
	v3dmc_object obj = object();
	v3dmc_point p;
	v3dmc_line l;
	v3dmc_triangle t;
	v3dmc_quad q;
	file = fopen(filename,"r");
	if(file!=NULL){
		fread(&npoints,sizeof(int),1,file);
		fread(&nlines,sizeof(int),1,file);
		fread(&ntriangles,sizeof(int),1,file);
		fread(&nquads,sizeof(int),1,file);
		for(i=0;i<npoints;i++){
			read_point(file,&p);
			add_point(&obj,p);
		}
		for(i=0;i<nlines;i++){
			fread(&l,sizeof(v3dmc_line),1,file);
			add_line(&obj,l);
		}
		for(i=0;i<ntriangles;i++){
			fread(&t,sizeof(v3dmc_triangle),1,file);
			add_triangle(&obj,t);
		}
		for(i=0;i<nquads;i++){
			fread(&q,sizeof(v3dmc_quad),1,file);
			add_quad(&obj,q);
		}
		fclose(file);
	}
	return obj;
}
示例#27
0
文件: draw.c 项目: stuydw/polygons
/*======== void generate_torus() ==========
  Inputs:   struct matrix * points
            double cx
	    double cy
	    double r
	    double step  
  Returns: 

  Generates all the points along the surface of a 
  tarus with center (cx, cy) and radii r1 and r2

  Adds these points to the matrix parameter

  03/22/12 11:30:26
  jdyrlandweaver
  ====================*/
void
generate_torus (struct matrix *points,
		double cx, double cy, double r1, double r2, double step)
{
  double x, y, z, circle, rotation;

  double rotStart = step * 0;
  double rotStop = 1;


  for (rotation = rotStart; rotation <= rotStop; rotation += step)
    {
      for (circle = 0; circle <= 1; circle += step)
	{

	  x = cos (2 * M_PI * rotation) *
	    (r1 * cos (2 * M_PI * circle) + r2) + cx;
	  y = r1 * sin (2 * M_PI * circle) + cy;
	  z = sin (2 * M_PI * rotation) * (r1 * cos (2 * M_PI * circle) + r2);

	  add_point (points, x, y, z);
	}
    }

}
示例#28
0
文件: read.c 项目: GRASS-GIS/grass-ci
/* read line coordinates */
void read_coor(FILE * fp, SYMBEL * e)
{
    char buf[501];
    double x, y;

    G_debug(5, "    read_coor()");

    while (G_getl2(buf, 500, fp) != 0) {
	G_chop(buf);

	/* skip empty and comment lines */
	if ((buf[0] == '#') || (buf[0] == '\0'))
	    continue;

	get_key_data(buf);

	if (strcmp(key, "END") == 0) {
	    G_debug(5, "    LINE END");
	    return;
	}

	if (sscanf(buf, "%lf %lf", &x, &y) != 2) {
	    G_warning(_("Cannot read symbol line coordinates: %s"), buf);
	    return;
	}
	G_debug(5, "      x = %f y = %f", x, y);
	add_point(e, x, y);
    }
}
示例#29
0
文件: draw.c 项目: Zilby/Stuy-Stuff
/*======== void generate_torus() ==========
  Inputs:   struct matrix * points
            double cx
	    double cy
	    double r
	    double step  
  Returns: 

  Generates all the points along the surface of a 
  tarus with center (cx, cy) and radii r1 and r2

  Adds these points to the matrix parameter

  03/22/12 11:30:26
  jdyrlandweaver
  ====================*/
void generate_torus( struct matrix * points, 
		     double cx, double cy, double cz, double r1, double r2, 
		     int step ) {

  double x, y, z, circ, rot;
  int circle, rotation;

  double rotStart = step * 0;
  double rotStop = MAX_STEPS;
  double circStart = step * 0;
  double circStop = MAX_STEPS;

  for ( rotation = rotStart; rotation < rotStop; rotation += step ) {

    rot = (double)rotation / MAX_STEPS;
    for ( circle = circStart; circle < circStop; circle+= step ) {

      circ = (double)circle / MAX_STEPS;
      x = cos( 2 * M_PI * rot ) *
	( r1 * cos( 2 * M_PI * circ ) + r2 ) + cx;
      y = r1 * sin( 2 * M_PI * circ ) + cy;
      z = sin( 2 * M_PI * rot ) *
	( r1 * cos( 2 * M_PI * circ ) + r2 ) + cz;

      add_point( points, x, y, z );
    }
  }
}
示例#30
0
文件: stats.C 项目: Keloran/okws
void
histogram_t::compile (const dataset_t &d)
{
  for (size_t s = 0; s < d.size (); s++) {
    add_point (d[s]);
  }
}