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


C++ RAD函数代码示例

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


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

示例1: trajectory_set_windows

/** set windows for trajectory */
void trajectory_set_windows(struct trajectory *traj, double d_win,
			    double a_win_deg, double a_start_deg)
{
    traj->d_win = d_win ;
    traj->a_win_rad = RAD(a_win_deg);
	traj->a_start_rad = RAD(a_start_deg);
}
开发者ID:31415us,项目名称:modules,代码行数:8,代码来源:trajectory_manager.c

示例2: find_wall

float	find_wall(t_env *env , int **map, float each_x, unsigned int *color)
{
  float	x1;
  float	y1;
  float	k_x;
  float	k_y;
  float	tmp;

  x1 = env->x + 0.5;
  y1 = env->y + each_x;
  tmp = x1;
  x1 = cos(RAD(env->angle)) * (tmp - env->x) - sin(RAD(env->angle))
    * (y1 - env->y);
  y1 = sin(RAD(env->angle)) * (tmp - env->x) + cos(RAD(env->angle))
    * (y1 - env->y);
  k_x = find_x(env, map, x1, y1);
  k_y = find_y(env, map, x1, y1);
  *color = 0;
  (x1 > 0) ? (*color = FIRST_COLOR) : (*color = SECOND_COLOR);
  (k_x > k_y) ? ((y1 > 0) ? (*color = THIRD_COLOR)
		 : (*color = FOURTH_COLOR)) : (0);
  if (k_x > k_y)
    return (k_y);
  return (k_x);
}
开发者ID:sebastiencs,项目名称:wolf3d,代码行数:25,代码来源:find_wall.c

示例3: RAD

void camera_t::focus(real_t newFovX, real_t newFovY)
{
	fov[X] = RAD(newFovX);
	fov[Y] = RAD(newFovY);

	filmSize[X] = static_cast<real_t>( frustum[nearPlane].dist * tan( fov[X]/2 ) * 2 );
	filmSize[Y] = static_cast<real_t>( frustum[nearPlane].dist * tan( fov[Y]/2 ) * 2 );

	frustum[topPlane].normal = forward;
	frustum[topPlane].normal.rotateAround( right, fov[Y]/2 );
	frustum[topPlane].dist = - ( position dot frustum[topPlane].normal );

	frustum[bottomPlane].normal = forward;
	frustum[bottomPlane].normal.rotateAround( right, -fov[Y]/2 );
	frustum[bottomPlane].dist = - ( position dot frustum[bottomPlane].normal );

	frustum[leftPlane].normal = forward;
	frustum[leftPlane].normal.rotateAround( up, fov[X]/2 );
	frustum[leftPlane].dist = - ( position dot frustum[leftPlane].normal );

	frustum[rightPlane].normal = forward;
	frustum[rightPlane].normal.rotateAround( up, -fov[X]/2 );
	frustum[rightPlane].dist = - ( position dot frustum[rightPlane].normal );

	frustum[nearPlane].normal = forward;
	frustum[nearPlane].dist = 1;

	frustum[farPlane].normal = -forward;
	frustum[farPlane].dist = 1000;
}
开发者ID:valentingalea,项目名称:newpas,代码行数:30,代码来源:CAMERA.CPP

示例4: rotate

	vec3 &		rotate(vec3 angle)
	{
		vec3	radangle = { RAD(angle.x), RAD(angle.y), RAD(angle.z) };
		vec3	tmpsin = { sin(radangle.x), sin(radangle.y), sin(radangle.z) };
		vec3	tmpcos = { cos(radangle.x), cos(radangle.y), cos(radangle.z) };
		return rotateByCache(tmpsin, tmpcos);
	}
开发者ID:JeanGamain,项目名称:jmax,代码行数:7,代码来源:vec3.hpp

示例5: RAD

int cPositioner::CalcHourAngle(int Longitude)
{
  double Alpha = RAD(Longitude - Setup.SiteLon);
  double Lat = RAD(Setup.SiteLat);
  int Sign = Setup.SiteLat >= 0 ? -1 : 1; // angles to the right are positive, angles to the left are negative
  return Sign * round(DEG(atan2(sin(Alpha), cos(Alpha) - cos(Lat) * SAT_EARTH_RATIO)));
}
开发者ID:nvertigo,项目名称:vdr,代码行数:7,代码来源:positioner.c

示例6: calc_delta_cone

double	calc_delta_cone(t_object *object, double *vect, t_cam *cam)
{
  double	a;
  double	b;
  double	c;
  double	delta;
  t_point	*point;
  t_point	*point2;
  double	r;

  point = init_point(vect[X], vect[Y], vect[Z], 0);
  point2 = init_point(cam->x, cam->y, cam->z, 0);
  point2 = inv_rotate(point2, (t_cam *) object);
  point = inv_rotate(point, (t_cam *) object);
  r = (double) object->r;
  a = (pow(point->x, 2) + pow(point->z, 2) - (pow(point->y, 2) * pow(tan(RAD(r)), 2)));
  b = 2 * ((point->x * (point2->x - object->x)) + (point->z * (point2->z - object->z))
	   - (point->y * (point2->y - object->y) * pow(tan(RAD(r)), 2)));
  c = pow((point2->x - object->x), 2) + pow((point2->z - object->z), 2) 
       - (pow(((point2->y - object->y)), 2) * pow(tan(RAD(r)), 2));
  delta = (b * b) - (4.0 * a * c);
  vect[X] = b;
  vect[Y] = a;
  return (delta);
}
开发者ID:Frozenhorns,项目名称:project,代码行数:25,代码来源:calc_delta.c

示例7: star_parse_hip

int star_parse_hip(struct star *s, FILE *fp)
{
    char buf[STAR_HIP_RECLEN + 1];

    /* Constants for use in computing galactic coordinates. */

    const double c1 = PI * 282.25 / 180.0;
    const double c2 = PI *  62.6  / 180.0;
    const double c3 = PI *  33.0  / 180.0;

    /* Read a single line from the given file. */

    if (fgets(buf, STAR_HIP_RECLEN + 1, fp))
    {
        double ra;
        double de;
        double mag;
        double plx;

        /* Attempt to parse necessary data from the line. */

        if (sscanf(buf + 51, "%lf", &ra)  == 1 &&
            sscanf(buf + 64, "%lf", &de)  == 1 &&
            sscanf(buf + 41, "%lf", &mag) == 1 &&
            sscanf(buf + 79, "%lf", &plx) == 1 && plx > 0.0)
        {
            double b, l, n1, n2, n3;

            /* Compute equatorial position in parsecs and radians. */

            plx = 1000.0 / fabs(plx);
            ra  = RAD(ra);
            de  = RAD(de);

            /* Compute the position in galactic coordinates. */
            n1 =                     cos(de) * cos(ra - c1);
            n2 = sin(de) * sin(c2) + cos(de) * sin(ra - c1) * cos(c2);
            n3 = sin(de) * cos(c2) - cos(de) * sin(ra - c1) * sin(c2);

            l = -atan2(n1, n2) + c3;
            b =  asin(n3);

            /* l = ra; */
            /* b = de; */

            s->pos[0] = (float) (sin(l) * cos(b) * plx);
            s->pos[1] = (float) (         sin(b) * plx);
            s->pos[2] = (float) (cos(l) * cos(b) * plx);

            /* Compute the absolute magnitude and color. */

            s->mag =  (float) (mag - 5.0 * log(plx / 10.0) / log(10.0));

            star_color(buf[435], s->col);
            
            return 1;
        }
    }
    return 0;
}
开发者ID:johnh530,项目名称:electro,代码行数:60,代码来源:star.c

示例8: calculate_solar_azimuth

//sjin: add solar azimuth wrapper funcions
EXPORT int64 calculate_solar_azimuth(OBJECT *obj, double lititude, double *value)
{
	static SolarAngles sa; // just for the functions
	double std_time = 0.0;
	double solar_time = 0.0;
	short int doy = 0;
	DATETIME dt;

	climate *cli;
	if (obj == 0 || value == 0){
		//throw "climate/calc_solar: null object pointer in arguement";
		return 0;
	}
	cli = OBJECTDATA(obj, climate);
	if(gl_object_isa(obj, "climate", "climate") == 0){
		//throw "climate/calc_solar: input object is not a climate object";
		return 0;
	}

	gl_localtime(obj->clock, &dt);
	std_time = (double)(dt.hour) + ((double)dt.minute)/60.0 + (dt.is_dst ? -1:0);
	solar_time = sa.solar_time(std_time, doy, RAD(cli->tz_meridian), RAD(obj->longitude));

	double hr_ang = -(15.0 * PI_OVER_180)*(solar_time-12.0); // morning +, afternoon -

    double decl = 0.409280*sin(2.0*PI*(284+doy)/365);

	double alpha = (90.0 * PI_OVER_180) - lititude + decl;

	*value = acos( (sin(decl)*cos(lititude) - cos(decl)*sin(lititude)*cos(hr_ang))/cos(alpha) );

    return 1;
}
开发者ID:Noah-Maze,项目名称:windlab-d,代码行数:34,代码来源:climate.cpp

示例9: display

void
display(void) {
    glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);

    glLoadIdentity();
#define RAD(x) (((x)*M_PI)/180.)
    gluLookAt(-sinf(RAD(rotx))*5.5,transy,cosf(RAD(rotx))*5.5, 0.,0.,0., 0.,1.,0.);

    glTranslatef(0.f, 0.f, transx*10.f);

    /* floor */
    glColor4f(0.f,.2f,0.f,1.f);
    glBegin(GL_POLYGON);
	glVertex3f(-4.0, -1.0, -4.0);
	glVertex3f( 4.0, -1.0, -4.0);
	glVertex3f( 4.0, -1.0,  4.0);
	glVertex3f(-4.0, -1.0,  4.0);
    glEnd();

    glEnable(GL_COLOR_MATERIAL);
    glEnable(GL_LIGHTING);
    glColor3f(.1f,.1f,.1f);
    glPushMatrix();
    glTranslatef(-1.f, -1.+.2f, -1.5f);
    glScalef(.2f,.2f, .2f);
    logs();
    glDisable(GL_LIGHTING);
    glPopMatrix();

    glPushMatrix();
    glTranslatef(-1.f, -1.f+.2f, -1.5f);
    calcMatrix();
    draw_smoke(smoke);
    glPopMatrix();

    glPushMatrix();
    glTranslatef(-1.f, -.25f, -1.5f);
    calcMatrix();
    glScalef(1.f,1.f,1.);
    if (texture) {
	glBindTexture(GL_TEXTURE_2D, the_texture+1);
	glEnable(GL_TEXTURE_2D);
    }
    glColor4f(intensity, intensity, intensity, opacity);
    glRotatef(rot, 0., 0., 1.);
    glDepthMask(0);
    glBegin(GL_POLYGON);
	glTexCoord2f(0.0, 0.0); glVertex2f(-1.0, -1.0);
	glTexCoord2f(1.0, 0.0); glVertex2f(1.0, -1.0);
	glTexCoord2f(1.0, 1.0); glVertex2f(1.0, 1.0);
	glTexCoord2f(0.0, 1.0); glVertex2f(-1.0, 1.0);
    glEnd();
    glDepthMask(1);
    glPopMatrix();
    glDisable(GL_TEXTURE_2D);

    glutSwapBuffers();
}
开发者ID:mox601,项目名称:grafica,代码行数:58,代码来源:fire.c

示例10: star_parse_tyc

int star_parse_tyc(struct star *s, FILE *fp)
{
    char buf[STAR_TYC_RECLEN + 1];

    /* Constants for use in computing galactic coordinates. */

    const double c1 = PI * 282.25 / 180.0;
    const double c2 = PI *  62.6  / 180.0;
    const double c3 = PI *  33.0  / 180.0;

    /* Read a single line from the given file. */

    if (fgets(buf, STAR_TYC_RECLEN + 1, fp))
    {
        double ra, de;
        double bt, vt;
        double mag;
        double plx;
        int    hip;

        /* Attempt to parse necessary data from the line. */

        if (sscanf(buf + 142, "%d",  &hip) == 0 &&
            sscanf(buf + 152, "%lf", &ra)  == 1 &&
            sscanf(buf + 165, "%lf", &de)  == 1 &&
            sscanf(buf + 110, "%lf", &bt)  == 1 &&
            sscanf(buf + 123, "%lf", &vt)  == 1)
        {
            double b, l, n1, n2, n3;
        
            /* Compute equatorial position in parsecs and radians. */
            
            mag = vt - 0.090 * (bt - vt);
            ra  = RAD(ra);
            de  = RAD(de);
            plx = 10.0;

            /* Compute the position in galactic coordinates. */

            n1 =                     cos(de) * cos(ra - c1);
            n2 = sin(de) * sin(c2) + cos(de) * sin(ra - c1) * cos(c2);
            n3 = sin(de) * cos(c2) - cos(de) * sin(ra - c1) * sin(c2);

            l = -atan2(n1, n2) + c3;
            b =  asin(n3);

            s->pos[0] = (GLfloat) (sin(l) * cos(b) * plx);
            s->pos[1] = (GLfloat) (         sin(b) * plx);
            s->pos[2] = (GLfloat) (cos(l) * cos(b) * plx);
            s->mag    =   (float) mag;

            star_color('K', s->col);

            return 1;
        }
    }
    return 0;
}
开发者ID:johnh530,项目名称:electro,代码行数:58,代码来源:star.c

示例11: RAD

void RobotsMover::rotateTable(int counter, float angle_step)
{
    std::vector<double> angles;  
    angles.resize(6);
    angles = p.table_start_pose;
    angles[5] = RAD(180.0) - counter * RAD(angle_step); 
    
    table_mover->moveToPose(angles);
}
开发者ID:roboticlab,项目名称:object_scanner,代码行数:9,代码来源:robots_mover.cpp

示例12: Timer

void Timer(int value)
{
  glutTimerFunc(estado.delayMovimento, Timer, 0);
  // ... accoes do temporizador ... 
  if(estado.teclas.q==GL_TRUE)
	  modelo.tanque.angCanhao+=5;
  if(estado.teclas.a==GL_TRUE)
	  modelo.tanque.angCanhao-=5;
  if(estado.teclas.z==GL_TRUE)
	  modelo.tanque.angTorre-=5;
  if(estado.teclas.x==GL_TRUE)
	  modelo.tanque.angTorre+=5;
  if(estado.teclas.up==GL_TRUE){
	  if(modelo.tanque.velocidade<=1)
			modelo.tanque.velocidade+=0.20;
	  if(modelo.tanque.gForceV<=1)
			modelo.tanque.gForceV+=0.3;
  }else{
	  if(modelo.tanque.velocidade>0)
			modelo.tanque.velocidade-=0.05;
	  if(modelo.tanque.gForceV>=0)
			modelo.tanque.gForceV-=0.3;
  }
  if(estado.teclas.down){
	  if(modelo.tanque.velocidade>=-1)
			modelo.tanque.velocidade-=0.20;
	  if(modelo.tanque.gForceV>=-1)
			modelo.tanque.gForceV-=0.3;
  }else{
	  if(modelo.tanque.velocidade<0)
			modelo.tanque.velocidade+=0.05;
	  if(modelo.tanque.gForceV>=0)
			modelo.tanque.gForceV+=0.3;
  }
  if(estado.teclas.left){
	  if(modelo.tanque.direccaoRodas<=3)
		modelo.tanque.direccaoRodas+=0.5;
  }
  if(estado.teclas.right){
	  if(modelo.tanque.direccaoRodas>=-3)
		modelo.tanque.direccaoRodas-=0.5;
  }

  if(!estado.teclas.left && !estado.teclas.right){
	  modelo.tanque.direccaoRodas = modelo.tanque.direccaoRodas*0.9;
  }

  modelo.tanque.direccao+=modelo.tanque.velocidade*modelo.tanque.direccaoRodas;
  modelo.tanque.x = modelo.tanque.x+modelo.tanque.velocidade*cos(RAD(modelo.tanque.direccao));
  modelo.tanque.y = modelo.tanque.y+modelo.tanque.velocidade*sin(RAD(modelo.tanque.direccao));

  if(estado.menuActivo || modelo.parado) // sair em caso de o jogo estar parado ou menu estar activo
    return;

  // redesenhar o ecra 
  glutPostRedisplay();
}
开发者ID:1100580,项目名称:Cplusplus-graphic-systems,代码行数:57,代码来源:main.cpp

示例13: random_robot_pos2

static Pos2 random_robot_pos2(const FieldGeometry *f) {
  std::uniform_real_distribution<Float> rx(
      -f->field_length / 2 + ROBOT_DIAM / 2,
      f->field_length / 2 + ROBOT_DIAM / 2);
  std::uniform_real_distribution<Float> ry(-f->field_width / 2 + ROBOT_DIAM / 2,
                                           f->field_width / 2 + ROBOT_DIAM / 2);
  std::uniform_real_distribution<Float> rw(-RAD(180), RAD(180));
  // return std::forward(rx(gen), ry(gen), rw(gen));
  return {rx(gen), ry(gen), rw(gen)};
}
开发者ID:gustavokcouto,项目名称:ssl-sim,代码行数:10,代码来源:sslsim.cpp

示例14: acos

int cPositioner::HorizonLongitude(ePositionerDirection Direction)
{
  double Delta;
  if (abs(Setup.SiteLat) <= SAT_VISIBILITY_LAT)
     Delta = acos(SAT_EARTH_RATIO / cos(RAD(Setup.SiteLat)));
  else
     Delta = 0;
  if ((Setup.SiteLat >= 0) != (Direction == pdLeft))
     Delta = -Delta;
  return NormalizeAngle(round(DEG(RAD(Setup.SiteLon) + Delta)));
}
开发者ID:nvertigo,项目名称:vdr,代码行数:11,代码来源:positioner.c

示例15: fit

// Fit
void fit(orbit_t orb,int *ia)
{
  int i,n;
  double a[7],da[7];
  double db[7]={0.1,0.1,0.002,0.1,0.1,0.01,0.0001};

  // Copy parameters
  a[0]=orb.eqinc*R2D;
  da[0]=da[0]*R2D;
  a[1]=orb.ascn*R2D;
  da[1]=da[1]*R2D;
  a[2]=orb.ecc;
  a[3]=orb.argp*R2D;
  da[3]=da[3]*R2D;
  a[4]=orb.mnan*R2D;
  da[4]=da[4]*R2D;
  a[5]=orb.rev;
  a[6]=orb.bstar;

  for (i=0;i<7;i++) {
    if (ia[i]==1)
      da[i]=db[i];
    else
      da[i]=0.0;
  }

  // Construct struct
  // a[0]: inclination
  // a[1]: RA of ascending node
  // a[2]: eccentricity
  // a[3]: argument of periastron
  // a[4]: mean anomaly
  // a[5]: revs per day
  // a[6]: bstar

  // Count highlighted points
  for (i=0,n=0;i<d.n;i++)
    if (d.p[i].flag==1)
      n++;

  if (n>0)
    versafit(n,7,a,da,chisq,0.0,1e-7,"n");

  // Return parameters
  orb.eqinc=RAD(a[0]);
  orb.ascn=RAD(modulo(a[1],360.0));
  orb.ecc=a[2];
  orb.argp=RAD(modulo(a[3],360.0));
  orb.mnan=RAD(modulo(a[4],360.0));
  orb.rev=a[5];
  orb.bstar=a[6];

  return;
}
开发者ID:cbassa,项目名称:sattools,代码行数:55,代码来源:xyz2tle.c


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