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


C++ rad函数代码示例

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


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

示例1: set_high_res_screen_image_viewangle_2

void set_high_res_screen_image_viewangle_2 ( void )
{

	full_screen_width_view_angle = rad ( 90 );

	full_screen_height_view_angle = rad ( 73.74 );
}
开发者ID:Comanche93,项目名称:eech,代码行数:7,代码来源:scrnshot.c

示例2: set_high_res_screen_image_viewangle_3

void set_high_res_screen_image_viewangle_3 ( void )
{

	full_screen_width_view_angle = rad ( 120 );

	full_screen_height_view_angle = rad ( 104.82 );
}
开发者ID:Comanche93,项目名称:eech,代码行数:7,代码来源:scrnshot.c

示例3: rot

Matrix rot(Matrix a, double theta, int axis)
{
	if(axis!=1 && axis!=2 && axis!=3){
		printf("Error, axis must equal 1, 2, or 3.");
		exit(EXIT_FAILURE);
	}
    /*left or right coordianate system??*/
	double s, c;
	Matrix r, rot;
	r = new_matrix(4, 4);
	rot = new_matrix(4, 4);
	
	s = sin(rad(theta));
	c = cos(rad(theta));
	double elem1[16] = {1, 0, 0, 0, 0, c, -s, 0, 0, s, c, 0, 0, 0, 0, 1};
	double elem2[16] = {c, 0, s, 0, 0, 1, 0, 0, -s, 0, c, 0, 0, 0, 0, 1};
	double elem3[16] = {c, -s, 0, 0, s, c, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1};
	
	switch(axis){
	    case 1:
		    rot.t = elem1;
			break;
		case 2:
		    rot.t = elem2;
			break;
		case 3:
		    rot.t = elem3;
			break;
	}
	r = matrix_mult(rot, a);
	
	return r;
}
开发者ID:ThomasWilshaw,项目名称:render,代码行数:33,代码来源:matmult.c

示例4: set_high_res_screen_image_viewangle_1

void set_high_res_screen_image_viewangle_1 ( void )
{

	full_screen_width_view_angle = rad ( 59.99 );

	full_screen_height_view_angle = rad ( 46.82 );
}
开发者ID:Comanche93,项目名称:eech,代码行数:7,代码来源:scrnshot.c

示例5: set_high_res_screen_image_viewangle_4

void set_high_res_screen_image_viewangle_4 ( void )
{

	full_screen_width_view_angle = rad ( 20 );

	full_screen_height_view_angle = rad ( 15.6 );
}
开发者ID:Comanche93,项目名称:eech,代码行数:7,代码来源:scrnshot.c

示例6: citi_create_vector

/* Create a valid vector for the dataset. */
static vector * citi_create_vector (struct citi_package_t * p, int i,
				    char * n, char * type) {
  vector * vec;
  vec = citi_get_vector (p, i); // fetch vector
  vec = new vector (*vec);      // copy vector
  vec->reverse ();              // reverse vector

  // convert data if necessary
  if (!strcmp (type, "MAGANGLE")) {
    for (int i = 0; i < vec->getSize (); i++) {
      nr_complex_t val = vec->get (i);
      val = polar (real (val), rad (imag (val)));
      vec->set (val, i);
    }
  }
  else if (!strcmp (type, "DBANGLE")) {
    for (int i = 0; i < vec->getSize (); i++) {
      nr_complex_t val = vec->get (i);
      val = polar (pow (10.0, real (val) / 20.0), rad (imag (val)));
      vec->set (val, i);
    }
  }

  // return named vector
  vec->setName (n);
  return vec;
}
开发者ID:Freecore,项目名称:qucs,代码行数:28,代码来源:check_citi.cpp

示例7: main

int main(int argc, char** argv) {
	long nrh, nrl, nch, ncl;
	byte** I;
	byte** binary;
	byte** droits;

	int theta, roMax, ro;
	int** tableRT;

	I = LoadPGM_bmatrix("route0.pgm", &nrl, &nrh, &ncl, &nch);

	binary = bmatrix(nrl, nrh, ncl, nch);
	roMax = sqrt(nrh * nrh + nch * nch);
	tableRT = imatrix(0, 179, 0, roMax);
	droits = bmatrix(0, 179, 0, roMax);

	int i, j;
	for (i = nrl; i < nrh; i++) {
		for (j = ncl; j < nch; j++) {
			if (I[i][j] >= 180)
				binary[i][j] = 255;
			else
				binary[i][j] = 0;
		}
	}

	for (theta = 0; theta < 180; theta++) {
		for (ro = 0; ro < roMax; ro++) {
			tableRT[theta][ro] = 0;
		}
	}

	for (theta = 0; theta < 180; theta++) {
		for (i = nrl; i < nrh; i++) {
			for (j = ncl; j < nch; j++) {
				if (I[i][j] >= 180) {
					ro = i * cos(rad(theta)) + j * sin(rad(theta));
					tableRT[theta][abs(ro)]++;
				}

			}
		}
	}
	int max = 0;
	for (theta = 0; theta < 180; theta++) {
		for (ro = 0; ro < roMax; ro++) {
			if (tableRT[theta][ro] > max) {
				max = tableRT[theta][ro];
			}
		}
	}

	SavePGM_bmatrix(binary, nrl, nrh, ncl, nch, "route_binary.pgm");

	free_bmatrix(I, nrl, nrh, ncl, nch);
	free_bmatrix(binary, nrl, nrh, ncl, nch);
	return 0;
}
开发者ID:ghak,项目名称:M1_TSI_TP3,代码行数:58,代码来源:m1_tsi_tp3.c

示例8: geodist

inline double geodist(double long1, double lat1, double long2, double lat2)
{
    double radLat1 = rad(lat1);
    double radLat2 = rad(lat2);
    double a = radLat1 - radLat2;
    double b = rad(long1) - rad(long2);
    double s = 2 * asin(sqrt(pow(sin(a / 2), 2) + cos(radLat1) * cos(radLat2) * pow(sin(b / 2), 2)));
    return s * EARTH_RADIUS * 1000.0;
}
开发者ID:bruce2008github,项目名称:sf1r-ad-delivery,代码行数:9,代码来源:GeoLocationRanker.cpp

示例9: cos

Point MathHelper::calcEndPoint(const Point &startPoint, float angle, float length)
{
  Point endPoint;

  endPoint.setX(startPoint.x() + length * cos(rad(angle)));
  endPoint.setY(startPoint.y()+ length * sin(rad(angle)));

  return endPoint;
}
开发者ID:Ulle84,项目名称:UllesSourceCode,代码行数:9,代码来源:MathHelper.cpp

示例10: resetCamera

void resetCamera() {
    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();
    // página 19 http://professor.unisinos.br/ltonietto/jed/pgr/CameraSintetica.pdf
    gluLookAt(
              currentPosition.x, currentPosition.y, currentPosition.z,
              currentPosition.x + cos(rad(angleH)), sin(rad(angleV)), currentPosition.z + sin(rad(angleH)),
              0, 1, 0
              );
}
开发者ID:rafaeleyng,项目名称:unisinos,代码行数:10,代码来源:main.cpp

示例11: animate_havoc_external_wipers

void animate_havoc_external_wipers (object_3d_instance *inst3d)
{
	object_3d_sub_object_search_data
		search;

	////////////////////////////////////////
	//
	// pilot's wipers
	//
	////////////////////////////////////////

	search.search_depth = 0;
	search.search_object = inst3d;
	search.sub_object_index = OBJECT_3D_SUB_OBJECT_WIPER_ARM_PILOT;

	if (find_object_3d_sub_object (&search) == SUB_OBJECT_SEARCH_RESULT_OBJECT_FOUND)
	{
		search.result_sub_object->relative_roll = wiper_position * (rad (65.3756) / MAX_WIPER_POSITION);
	}

	search.search_depth = 0;
	search.search_object = inst3d;
	search.sub_object_index = OBJECT_3D_SUB_OBJECT_WIPER_BLADE_PILOT;

	if (find_object_3d_sub_object (&search) == SUB_OBJECT_SEARCH_RESULT_OBJECT_FOUND)
	{
		search.result_sub_object->relative_roll = (wiper_position * (rad (-74.7756) / MAX_WIPER_POSITION)) + rad (4.7);
	}

	////////////////////////////////////////
	//
	// co-pilot's wipers
	//
	////////////////////////////////////////

	search.search_depth = 0;
	search.search_object = inst3d;
	search.sub_object_index = OBJECT_3D_SUB_OBJECT_WIPER_ARM_COPILOT;

	if (find_object_3d_sub_object (&search) == SUB_OBJECT_SEARCH_RESULT_OBJECT_FOUND)
	{
		search.result_sub_object->relative_roll = wiper_position * (rad (90.0) / MAX_WIPER_POSITION);
	}

	search.search_depth = 0;
	search.search_object = inst3d;
	search.sub_object_index = OBJECT_3D_SUB_OBJECT_WIPER_BLADE_COPILOT;

	if (find_object_3d_sub_object (&search) == SUB_OBJECT_SEARCH_RESULT_OBJECT_FOUND)
	{
		search.result_sub_object->relative_roll = (wiper_position * (rad (-100.0) / MAX_WIPER_POSITION)) + rad (5.0);
	}
}
开发者ID:DexterWard,项目名称:comanche,代码行数:53,代码来源:ha_wiper.c

示例12: update_vector_main_rotor_dynamics

void update_vector_main_rotor_dynamics (void)
{

	float
		rotor_roll,
		rotor_pitch,
		cyclic_x,
		cyclic_y,
		collective,
		blade_pitch;

	// calculate blade pitch 0->5 Degs. collective = blade_pitch^3

	collective = current_flight_dynamics->input_data.collective.value;

	blade_pitch = pow (fabs (collective), (float) (1.0 / 3.0)) * (current_flight_dynamics->main_blade_pitch.max / 4.64);

	current_flight_dynamics->main_blade_pitch.value = blade_pitch;

	current_flight_dynamics->main_blade_pitch.value = bound (
																current_flight_dynamics->main_blade_pitch.value,
																current_flight_dynamics->main_blade_pitch.min,
																current_flight_dynamics->main_blade_pitch.max);

	// calculate 'Tip Plane Path' roll and pitch

	// roll

	cyclic_x = current_flight_dynamics->input_data.cyclic_x.value;

	rotor_roll = rad (cyclic_x / (current_flight_dynamics->input_data.cyclic_x.max / deg (current_flight_dynamics->main_rotor_roll_angle.max)));

	current_flight_dynamics->main_rotor_roll_angle.value = rotor_roll;

	current_flight_dynamics->main_rotor_roll_angle.value = bound (
																current_flight_dynamics->main_rotor_roll_angle.value,
																current_flight_dynamics->main_rotor_roll_angle.min,
																current_flight_dynamics->main_rotor_roll_angle.max);

	// pitch

	cyclic_y = current_flight_dynamics->input_data.cyclic_y.value;

	rotor_pitch = -rad (cyclic_y / (current_flight_dynamics->input_data.cyclic_y.max / deg (current_flight_dynamics->main_rotor_pitch_angle.max)));

	current_flight_dynamics->main_rotor_pitch_angle.value = rotor_pitch;

	current_flight_dynamics->main_rotor_pitch_angle.value = bound (
																current_flight_dynamics->main_rotor_pitch_angle.value,
																current_flight_dynamics->main_rotor_pitch_angle.min,
																current_flight_dynamics->main_rotor_pitch_angle.max);
}
开发者ID:Comanche93,项目名称:eech,代码行数:52,代码来源:vec_dyn.c

示例13: acos

 void Plan13::footprintOctagon(float *points, float SLATin, float SLONin, float REin, float RSin) {
	//static float points[16];
	Serial.print("SLAT: ");
	Serial.print(SLATin);
	Serial.print(", SLON: ");
	Serial.print(SLONin);
	Serial.print(", RE: ");
	Serial.print(REin);
	Serial.print(", RS: ");
	Serial.println(RSin);
	float srad = acos(REin/RSin); // Beta in Davidoff diag. 13.2, this is in rad
	Serial.print("srad: ");
	Serial.println(srad);
	float cla= cos(rad(SLATin));
	float sla = sin(rad(SLATin));
	float clo = cos(rad(SLONin));
	float slo = sin(rad(SLONin));
	float sra = sin(srad);
	float cra = cos(srad);
	for (int i = 0; i < 16; i = i +2) {
		float a = 2 * M_PI * i / 16;
		Serial.print("\ta: ");
		Serial.println(a);
		float X = cra;
		Serial.print("\t first X: ");
		Serial.println(X);
		Serial.print("\t first Y: ");
		float Y = sra*sin(a);
		Serial.println(Y);
		float Z = sra*cos(a);
		Serial.print("\t first Z: ");
		Serial.println(Z);
		float x = X*cla - Z*sla;
		float y = Y;
		float z = X*sla + Z*cla;
		X = x*clo - y*slo;
		Serial.print("\tX: ");
		Serial.println(X);
		Y = x*slo + y*clo;
		Serial.print("\tY: ");
		Serial.println(Y);
		Z = z; 
		Serial.print("\tZ: ");
		Serial.println(Z);
		points[i] = deg(FNatn(Y,X));
		Serial.print("\t Long: ");
		Serial.print(points[i]);
		points[i+1] = deg(asin(Z));
		Serial.print("\t Lat: ");
		Serial.println(points[i+1]);
	}
}
开发者ID:BackupGGCode,项目名称:qrptracker,代码行数:52,代码来源:Plan13.cpp

示例14: fast_rotate_air_radar_scan_datum_right

static void fast_rotate_air_radar_scan_datum_right (void)
{
	air_radar.scan_datum += rad (90.0);

	air_radar.sweep_offset -= rad (90.0);

	if (air_radar.scan_datum > rad (180.0))
	{
		air_radar.scan_datum -= rad (360.0);
	}

	limit_radar_sweep (&air_radar);
}
开发者ID:Comanche93,项目名称:eech,代码行数:13,代码来源:df_radar.c

示例15: rotate_air_radar_scan_datum_right

static void rotate_air_radar_scan_datum_right (void)
{
	air_radar.scan_datum += APACHE_AIR_RADAR_SCAN_DATUM_ROTATE_STEP;

	air_radar.sweep_offset -= APACHE_AIR_RADAR_SCAN_DATUM_ROTATE_STEP;

	if (air_radar.scan_datum > rad (180.0))
	{
		air_radar.scan_datum -= rad (360.0);
	}

	limit_radar_sweep (&air_radar);
}
开发者ID:Comanche93,项目名称:eech,代码行数:13,代码来源:df_radar.c


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