本文整理汇总了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 );
}
示例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 );
}
示例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;
}
示例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 );
}
示例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 );
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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
);
}
示例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);
}
}
示例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);
}
示例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]);
}
}
示例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);
}
示例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);
}