diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-09-17 13:43:51 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-09-17 13:43:51 +0400 |
commit | d4898f9c40dd008b14eab053864cd2b035652827 (patch) | |
tree | 59065a423ca156385153195372e66c25b9e28700 | |
parent | 18d59e2645ed486e2530160da50abd87c652ed7a (diff) |
use macros RAD2DEG & DEG2RAD rather then multiplying by 180.0/M_PI or M_PI/180.0
20 files changed, 56 insertions, 58 deletions
diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c index 91091d3880f..a59092784dd 100644 --- a/source/blender/blenkernel/intern/constraint.c +++ b/source/blender/blenkernel/intern/constraint.c @@ -2167,7 +2167,7 @@ static void actcon_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstraint if (data->type < 10) { /* extract rotation (is in whatever space target should be in) */ mat4_to_eul(vec, tempmat); - mul_v3_fl(vec, (float)(180.0/M_PI)); /* rad -> deg */ + mul_v3_fl(vec, RAD2DEGF(1.0f)); /* rad -> deg */ axis= data->type; } else if (data->type < 20) { @@ -3325,7 +3325,7 @@ static void transform_evaluate (bConstraint *con, bConstraintOb *cob, ListBase * break; case 1: /* rotation (convert to degrees first) */ mat4_to_eulO(dvec, cob->rotOrder, ct->matrix); - mul_v3_fl(dvec, (float)(180.0/M_PI)); /* rad -> deg */ + mul_v3_fl(dvec, RAD2DEGF(1.0f)); /* rad -> deg */ break; default: /* location */ copy_v3_v3(dvec, ct->matrix[3]); diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c index bd70e365f51..794006e6f39 100644 --- a/source/blender/blenkernel/intern/curve.c +++ b/source/blender/blenkernel/intern/curve.c @@ -1924,7 +1924,7 @@ static void make_bevel_list_3D_minimum_twist(BevList *bl) /* flip rotation if needs be */ cross_v3_v3v3(cross_tmp, vec_1, vec_2); normalize_v3(cross_tmp); - if(angle_normalized_v3v3(bevp_first->dir, cross_tmp) < 90.0f/(float)(180.0/M_PI)) + if(angle_normalized_v3v3(bevp_first->dir, cross_tmp) < DEG2RADF(90.0f)) angle = -angle; bevp2= (BevPoint *)(bl+1); diff --git a/source/blender/blenkernel/intern/effect.c b/source/blender/blenkernel/intern/effect.c index 468f39bf731..7fb9f96e0cf 100644 --- a/source/blender/blenkernel/intern/effect.c +++ b/source/blender/blenkernel/intern/effect.c @@ -571,7 +571,7 @@ float effector_falloff(EffectorCache *eff, EffectorData *efd, EffectedPoint *UNU if(falloff == 0.0f) break; - r_fac=saacos(fac/len_v3(efd->vec_to_point))*180.0f/(float)M_PI; + r_fac= RAD2DEGF(saacos(fac/len_v3(efd->vec_to_point))); falloff*= falloff_func_rad(eff->pd, r_fac); break; diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c index 60432631492..82a2436a010 100644 --- a/source/blender/blenkernel/intern/particle.c +++ b/source/blender/blenkernel/intern/particle.c @@ -2542,7 +2542,7 @@ static void psys_thread_create_path(ParticleThread *thread, struct ChildParticle normalize_v3(v1); normalize_v3(v2); - d = saacos(dot_v3v3(v1, v2)) * 180.0f/(float)M_PI; + d = RAD2DEGF(saacos(dot_v3v3(v1, v2))); } if(p_max > p_min) diff --git a/source/blender/blenkernel/intern/seqeffects.c b/source/blender/blenkernel/intern/seqeffects.c index 43747fde729..e5d74177c91 100644 --- a/source/blender/blenkernel/intern/seqeffects.c +++ b/source/blender/blenkernel/intern/seqeffects.c @@ -2132,7 +2132,7 @@ static void do_transform(Scene *scene, Sequence *seq, float UNUSED(facf0), int x } // Rotate - rotate_radians = ((float)M_PI*transform->rotIni)/180.0f; + rotate_radians = DEG2RADF(transform->rotIni); transform_image(x,y, ibuf1, out, scale_x, scale_y, translate_x, translate_y, rotate_radians, transform->interpolation); } diff --git a/source/blender/collada/AnimationExporter.cpp b/source/blender/collada/AnimationExporter.cpp index 2ea10111bb9..ae568e69936 100644 --- a/source/blender/collada/AnimationExporter.cpp +++ b/source/blender/collada/AnimationExporter.cpp @@ -577,7 +577,7 @@ void AnimationExporter::get_source_values(BezTriple *bezt, COLLADASW::InputSeman case COLLADASW::InputSemantic::OUTPUT: *length = 1; if (rotation) { - values[0] = (bezt->vec[1][1]) * 180.0f/M_PI; + values[0] = RAD2DEGF(bezt->vec[1][1]); } else { values[0] = bezt->vec[1][1]; @@ -593,7 +593,7 @@ void AnimationExporter::get_source_values(BezTriple *bezt, COLLADASW::InputSeman values[1] = 0; } else if (rotation) { - values[1] = (bezt->vec[0][1]) * 180.0f/M_PI; + values[1] = RAD2DEGF(bezt->vec[0][1]); } else { values[1] = bezt->vec[0][1]; } @@ -608,7 +608,7 @@ void AnimationExporter::get_source_values(BezTriple *bezt, COLLADASW::InputSeman values[1] = 0; } else if (rotation) { - values[1] = (bezt->vec[2][1]) * 180.0f/M_PI; + values[1] = RAD2DEGF(bezt->vec[2][1]); } else { values[1] = bezt->vec[2][1]; } @@ -688,7 +688,7 @@ std::string AnimationExporter::create_source_from_array(COLLADASW::InputSemantic // val = convert_time(val); //else if (is_rot) - val *= 180.0f / M_PI; + val = RAD2DEGF(val); source.appendValues(val); } diff --git a/source/blender/collada/AnimationImporter.cpp b/source/blender/collada/AnimationImporter.cpp index 43428f57d4f..a176b6eb4cd 100644 --- a/source/blender/collada/AnimationImporter.cpp +++ b/source/blender/collada/AnimationImporter.cpp @@ -170,9 +170,9 @@ void AnimationImporter::fcurve_deg_to_rad(FCurve *cu) { for (unsigned int i = 0; i < cu->totvert; i++) { // TODO convert handles too - cu->bezt[i].vec[1][1] *= M_PI / 180.0f; - cu->bezt[i].vec[0][1] *= M_PI / 180.0f; - cu->bezt[i].vec[2][1] *= M_PI / 180.0f; + cu->bezt[i].vec[1][1] *= DEG2RADF(1.0f); + cu->bezt[i].vec[0][1] *= DEG2RADF(1.0f); + cu->bezt[i].vec[2][1] *= DEG2RADF(1.0f); } } @@ -741,7 +741,7 @@ void AnimationImporter::apply_matrix_curves( Object * ob, std::vector<FCurve*>& mat4_to_quat(rot, mat); /*for ( int i = 0 ; i < 4 ; i ++ ) { - rot[i] = rot[i] * (180 / M_PI); + rot[i] = RAD2DEGF(rot[i]); }*/ copy_v3_v3(loc, mat[3]); mat4_to_size(scale, mat); diff --git a/source/blender/collada/CameraExporter.cpp b/source/blender/collada/CameraExporter.cpp index 542409072f1..006d4c0ed23 100644 --- a/source/blender/collada/CameraExporter.cpp +++ b/source/blender/collada/CameraExporter.cpp @@ -73,7 +73,7 @@ void CamerasExporter::operator()(Object *ob, Scene *sce) if (cam->type == CAM_PERSP) { COLLADASW::PerspectiveOptic persp(mSW); - persp.setXFov(lens_to_angle(cam->lens)*(180.0f/M_PI),"xfov"); + persp.setXFov(RAD2DEGF(lens_to_angle(cam->lens)), "xfov"); persp.setAspectRatio((float)(sce->r.xsch)/(float)(sce->r.ysch),false,"aspect_ratio"); persp.setZFar(cam->clipend, false , "zfar"); persp.setZNear(cam->clipsta,false , "znear"); diff --git a/source/blender/collada/DocumentImporter.cpp b/source/blender/collada/DocumentImporter.cpp index 366837421e3..2387c9a1465 100644 --- a/source/blender/collada/DocumentImporter.cpp +++ b/source/blender/collada/DocumentImporter.cpp @@ -816,7 +816,7 @@ bool DocumentImporter::writeCamera( const COLLADAFW::Camera* camera ) double aspect = camera->getAspectRatio().getValue(); double xfov = aspect*yfov; // xfov is in degrees, cam->lens is in millimiters - cam->lens = angle_to_lens((float)xfov*(M_PI/180.0f)); + cam->lens = angle_to_lens(DEG2RADF(xfov));; } break; } @@ -837,7 +837,7 @@ bool DocumentImporter::writeCamera( const COLLADAFW::Camera* camera ) { double x = camera->getXFov().getValue(); // x is in degrees, cam->lens is in millimiters - cam->lens = angle_to_lens((float)x*(M_PI/180.0f)); + cam->lens = angle_to_lens(DEG2RADF(x)); } break; } @@ -854,7 +854,7 @@ bool DocumentImporter::writeCamera( const COLLADAFW::Camera* camera ) { double yfov = camera->getYFov().getValue(); // yfov is in degrees, cam->lens is in millimiters - cam->lens = angle_to_lens((float)yfov*(M_PI/180.0f)); + cam->lens = angle_to_lens(DEG2RADF(yfov)); } break; } diff --git a/source/blender/collada/TransformReader.cpp b/source/blender/collada/TransformReader.cpp index 625a0220830..fa14a548850 100644 --- a/source/blender/collada/TransformReader.cpp +++ b/source/blender/collada/TransformReader.cpp @@ -82,8 +82,8 @@ void TransformReader::dae_rotate_to_mat4(COLLADAFW::Transformation *tm, float m[ { COLLADAFW::Rotate *ro = (COLLADAFW::Rotate*)tm; COLLADABU::Math::Vector3& axis = ro->getRotationAxis(); - float angle = (float)(ro->getRotationAngle() * M_PI / 180.0f); - float ax[] = {axis[0], axis[1], axis[2]}; + const float angle = (float)DEG2RAD(ro->getRotationAngle()); + const float ax[] = {axis[0], axis[1], axis[2]}; // float quat[4]; // axis_angle_to_quat(quat, axis, angle); // quat_to_mat4(m, quat); diff --git a/source/blender/collada/TransformWriter.cpp b/source/blender/collada/TransformWriter.cpp index 88ed112c3fe..34d13a2184d 100644 --- a/source/blender/collada/TransformWriter.cpp +++ b/source/blender/collada/TransformWriter.cpp @@ -107,9 +107,9 @@ void TransformWriter::add_transform(COLLADASW::Node& node, float loc[3], float r /*node.addRotateZ("rotationZ", COLLADABU::Math::Utils::radToDegF(rot[2])); node.addRotateY("rotationY", COLLADABU::Math::Utils::radToDegF(rot[1])); node.addRotateX("rotationX", COLLADABU::Math::Utils::radToDegF(rot[0]));*/ - node.addRotateZ("rotationZ", rot[2] * 180.0f/M_PI); - node.addRotateY("rotationY", (rot[1]* 180.0f/M_PI)); - node.addRotateX("rotationX", (rot[0]* 180.0f/M_PI)); + node.addRotateZ("rotationZ", RAD2DEGF(rot[2])); + node.addRotateY("rotationY", RAD2DEGF(rot[1])); + node.addRotateX("rotationX", RAD2DEGF(rot[0])); node.addScale("scale", scale[0], scale[1], scale[2]); } diff --git a/source/blender/editors/animation/anim_draw.c b/source/blender/editors/animation/anim_draw.c index 70974386917..d2b1fcc4abd 100644 --- a/source/blender/editors/animation/anim_draw.c +++ b/source/blender/editors/animation/anim_draw.c @@ -404,9 +404,9 @@ float ANIM_unit_mapping_get_factor (Scene *scene, ID *id, FCurve *fcu, short res /* if the radians flag is not set, default to using degrees which need conversions */ if ((scene) && (scene->unit.system_rotation == USER_UNIT_ROT_RADIANS) == 0) { if (restore) - return M_PI / 180.0; /* degrees to radians */ + return DEG2RADF(1.0f); /* degrees to radians */ else - return 180.0 / M_PI; /* radians to degrees */ + return RAD2DEGF(1.0f); /* radians to degrees */ } } diff --git a/source/blender/editors/armature/editarmature.c b/source/blender/editors/armature/editarmature.c index a4b1e9a6e2c..eafe65b4492 100644 --- a/source/blender/editors/armature/editarmature.c +++ b/source/blender/editors/armature/editarmature.c @@ -361,7 +361,7 @@ static void fix_bonelist_roll (ListBase *bonelist, ListBase *editbonelist) print_m4("premat", premat); print_m4("postmat", postmat); print_m4("difmat", difmat); - printf ("Roll = %f\n", (-atan2(difmat[2][0], difmat[2][2]) * (180.0/M_PI))); + printf ("Roll = %f\n", RAD2DEGF(-atan2(difmat[2][0], difmat[2][2]))); #endif curBone->roll = (float)-atan2(difmat[2][0], difmat[2][2]); diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c index 33aeb2df926..8889c419c35 100644 --- a/source/blender/editors/interface/interface_draw.c +++ b/source/blender/editors/interface/interface_draw.c @@ -959,13 +959,13 @@ static float polar_to_y(float center, float diam, float ampli, float angle) return center + diam * ampli * sinf(angle); } -static void vectorscope_draw_target(float centerx, float centery, float diam, float r, float g, float b) +static void vectorscope_draw_target(float centerx, float centery, float diam, const float colf[3]) { float y,u,v; float tangle=0.f, tampli; float dangle, dampli, dangle2, dampli2; - rgb_to_yuv(r,g,b, &y, &u, &v); + rgb_to_yuv(colf[0], colf[1], colf[2], &y, &u, &v); if (u>0 && v>=0) tangle=atanf(v/u); else if (u>0 && v<0) tangle= atanf(v/u) + 2.0f * (float)M_PI; else if (u<0) tangle=atanf(v/u) + (float)M_PI; @@ -975,7 +975,7 @@ static void vectorscope_draw_target(float centerx, float centery, float diam, fl /* small target vary by 2.5 degree and 2.5 IRE unit */ glColor4f(1.0f, 1.0f, 1.0, 0.12f); - dangle= 2.5f*(float)M_PI/180.0f; + dangle= DEG2RADF(2.5f); dampli= 2.5f/200.0f; glBegin(GL_LINE_STRIP); glVertex2f(polar_to_x(centerx,diam,tampli+dampli,tangle+dangle), polar_to_y(centery,diam,tampli+dampli,tangle+dangle)); @@ -986,9 +986,9 @@ static void vectorscope_draw_target(float centerx, float centery, float diam, fl glEnd(); /* big target vary by 10 degree and 20% amplitude */ glColor4f(1.0f, 1.0f, 1.0, 0.12f); - dangle= 10.0f*(float)M_PI/180.0f; + dangle= DEG2RADF(10.0f); dampli= 0.2f*tampli; - dangle2= 5.0f*(float)M_PI/180.0f; + dangle2= DEG2RADF(5.0f); dampli2= 0.5f*dampli; glBegin(GL_LINE_STRIP); glVertex2f(polar_to_x(centerx,diam,tampli+dampli-dampli2,tangle+dangle), polar_to_y(centery,diam,tampli+dampli-dampli2,tangle+dangle)); @@ -1014,13 +1014,13 @@ static void vectorscope_draw_target(float centerx, float centery, float diam, fl void ui_draw_but_VECTORSCOPE(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol), rcti *recti) { + const float skin_rad= DEG2RADF(123.0f); /* angle in radians of the skin tone line */ Scopes *scopes = (Scopes *)but->poin; rctf rect; int i, j; - int skina= 123; /* angle in degree of the skin tone line */ float w, h, centerx, centery, diam; float alpha; - float colors[6][3]={{.75,0,0},{.75,.75,0},{0,.75,0},{0,.75,.75},{0,0,.75},{.75,0,.75}}; + const float colors[6][3]={{.75,0,0},{.75,.75,0},{0,.75,0},{0,.75,.75},{0,0,.75},{.75,0,.75}}; GLint scissor[4]; rect.xmin = (float)recti->xmin+1; @@ -1056,19 +1056,19 @@ void ui_draw_but_VECTORSCOPE(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wco for(j=0; j<5; j++) { glBegin(GL_LINE_STRIP); for(i=0; i<=360; i=i+15) { - float a= i*M_PI/180.0; - float r= (j+1)/10.0f; - glVertex2f( polar_to_x(centerx,diam,r,a), polar_to_y(centery,diam,r,a)); + const float a= DEG2RADF((float)i); + const float r= (j+1)/10.0f; + glVertex2f(polar_to_x(centerx,diam,r,a), polar_to_y(centery,diam,r,a)); } glEnd(); } /* skin tone line */ glColor4f(1.f, 0.4f, 0.f, 0.2f); - fdrawline( polar_to_x(centerx, diam, 0.5f, skina*M_PI/180.0), polar_to_y(centery,diam,0.5,skina*M_PI/180.0), - polar_to_x(centerx, diam, 0.1f, skina*M_PI/180.0), polar_to_y(centery,diam,0.1,skina*M_PI/180.0)); + fdrawline(polar_to_x(centerx, diam, 0.5f, skin_rad), polar_to_y(centery,diam,0.5,skin_rad), + polar_to_x(centerx, diam, 0.1f, skin_rad), polar_to_y(centery,diam,0.1,skin_rad)); /* saturation points */ for(i=0; i<6; i++) - vectorscope_draw_target(centerx, centery, diam, colors[i][0], colors[i][1], colors[i][2]); + vectorscope_draw_target(centerx, centery, diam, colors[i]); if (scopes->ok && scopes->vecscope != NULL) { /* pixel point cloud */ diff --git a/source/blender/editors/sculpt_paint/paint_stroke.c b/source/blender/editors/sculpt_paint/paint_stroke.c index 73a6e4fad20..767001ff163 100644 --- a/source/blender/editors/sculpt_paint/paint_stroke.c +++ b/source/blender/editors/sculpt_paint/paint_stroke.c @@ -447,9 +447,9 @@ static void paint_draw_alpha_overlay(Sculpt *sd, Brush *brush, if(brush->mtex.brush_map_mode == MTEX_MAP_MODE_FIXED) { /* brush rotation */ glTranslatef(0.5, 0.5, 0); - glRotatef((double)((brush->flag & BRUSH_RAKE) ? - sd->last_angle : sd->special_rotation) * (180.0/M_PI), - 0.0, 0.0, 1.0); + glRotatef((double)RAD2DEGF((brush->flag & BRUSH_RAKE) ? + sd->last_angle : sd->special_rotation), + 0.0, 0.0, 1.0); glTranslatef(-0.5f, -0.5f, 0); /* scale based on tablet pressure */ diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index af9c7ef3c85..0e8e6cdfee1 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -5401,8 +5401,7 @@ static void draw_forcefield(Scene *scene, Object *ob, RegionView3D *rv3d) unit_m4(tmat); - radius=(pd->flag&PFIELD_USEMAXR)?pd->maxrad:1.0f; - radius*=(float)M_PI/180.0f; + radius= DEG2RADF((pd->flag&PFIELD_USEMAXR) ? pd->maxrad : 1.0f); distance=(pd->flag&PFIELD_USEMAX)?pd->maxdist:0.0f; if(pd->flag & (PFIELD_USEMAX|PFIELD_USEMAXR)){ @@ -5411,8 +5410,7 @@ static void draw_forcefield(Scene *scene, Object *ob, RegionView3D *rv3d) drawcone(vec, distance * sinf(radius),-distance * cosf(radius),tmat); } - radius=(pd->flag&PFIELD_USEMINR)?pd->minrad:1.0f; - radius*=(float)M_PI/180.0f; + radius= DEG2RADF((pd->flag&PFIELD_USEMINR) ? pd->minrad : 1.0f); distance=(pd->flag&PFIELD_USEMIN)?pd->mindist:0.0f; if(pd->flag & (PFIELD_USEMIN|PFIELD_USEMINR)){ diff --git a/source/blender/editors/space_view3d/view3d_buttons.c b/source/blender/editors/space_view3d/view3d_buttons.c index 50c587194b7..6c69e816b30 100644 --- a/source/blender/editors/space_view3d/view3d_buttons.c +++ b/source/blender/editors/space_view3d/view3d_buttons.c @@ -887,9 +887,9 @@ static void v3d_posearmature_buts(uiLayout *layout, Object *ob) quat_to_eul( tfp->ob_eul,pchan->quat); else copy_v3_v3(tfp->ob_eul, pchan->eul); - tfp->ob_eul[0]*= 180.0/M_PI; - tfp->ob_eul[1]*= 180.0/M_PI; - tfp->ob_eul[2]*= 180.0/M_PI; + tfp->ob_eul[0]*= RAD2DEGF(1.0f); + tfp->ob_eul[1]*= RAD2DEGF(1.0f); + tfp->ob_eul[2]*= RAD2DEGF(1.0f); uiDefBut(block, LABEL, 0, "Location:", 0, 240, 100, 20, 0, 0, 0, 0, 0, ""); uiBlockBeginAlign(block); @@ -1097,9 +1097,9 @@ static void do_view3d_region_buttons(bContext *C, void *UNUSED(index), int event if (!pchan) return; /* make a copy to eul[3], to allow TAB on buttons to work */ - eul[0]= (float)M_PI*tfp->ob_eul[0]/180.0f; - eul[1]= (float)M_PI*tfp->ob_eul[1]/180.0f; - eul[2]= (float)M_PI*tfp->ob_eul[2]/180.0f; + eul[0]= DEG2RADF(tfp->ob_eul[0]); + eul[1]= DEG2RADF(tfp->ob_eul[1]); + eul[2]= DEG2RADF(tfp->ob_eul[2]); if (pchan->rotmode == ROT_MODE_AXISANGLE) { float quat[4]; diff --git a/source/blender/editors/uvedit/uvedit_draw.c b/source/blender/editors/uvedit/uvedit_draw.c index 453bea0969b..d5a94c9b56a 100644 --- a/source/blender/editors/uvedit/uvedit_draw.c +++ b/source/blender/editors/uvedit/uvedit_draw.c @@ -275,7 +275,7 @@ static void draw_uvs_stretch(SpaceImage *sima, Scene *scene, EditMesh *em, MTFac VECSUB2D(av4, tf_uv[2], tf_uv[3]); normalize_v2(av4); /* This is the correct angle however we are only comparing angles - * uvang1 = 90-((angle_normalized_v2v2(av1, av2) * 180.0/M_PI)-90);*/ + * uvang1 = 90-((angle_normalized_v2v2(av1, av2) * RAD2DEGF(1.0f))-90);*/ uvang1 = angle_normalized_v2v2(av1, av2); uvang2 = angle_normalized_v2v2(av2, av3); uvang3 = angle_normalized_v2v2(av3, av4); @@ -288,7 +288,7 @@ static void draw_uvs_stretch(SpaceImage *sima, Scene *scene, EditMesh *em, MTFac VECSUB(av4, efa->v3->co, efa->v4->co); normalize_v3(av4); /* This is the correct angle however we are only comparing angles - * ang1 = 90-((angle_normalized_v3v3(av1, av2) * 180.0/M_PI)-90);*/ + * ang1 = 90-((angle_normalized_v3v3(av1, av2) * RAD2DEGF(1.0f))-90);*/ ang1 = angle_normalized_v3v3(av1, av2); ang2 = angle_normalized_v3v3(av2, av3); ang3 = angle_normalized_v3v3(av3, av4); diff --git a/source/blender/render/intern/source/convertblender.c b/source/blender/render/intern/source/convertblender.c index 934894f63b6..ba7af235acc 100644 --- a/source/blender/render/intern/source/convertblender.c +++ b/source/blender/render/intern/source/convertblender.c @@ -822,7 +822,7 @@ static void autosmooth(Render *UNUSED(re), ObjectRen *obr, float mat[][4], int d if(obr->totvert==0) return; asverts= MEM_callocN(sizeof(ASvert)*obr->totvert, "all smooth verts"); - thresh= cosf((float)M_PI*(0.5f+(float)degr)/180.0f ); + thresh= cosf(DEG2RADF((0.5f + (float)degr))); /* step zero: give faces normals of original mesh, if this is provided */ @@ -1717,7 +1717,7 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem if(part->draw & PART_DRAW_REN_ADAPT) { sd.adapt = 1; sd.adapt_pix = (float)part->adapt_pix; - sd.adapt_angle = cos((float)part->adapt_angle * (float)(M_PI / 180.0)); + sd.adapt_angle = cosf(DEG2RADF((float)part->adapt_angle)); } if(re->r.renderer==R_INTERN && part->draw&PART_DRAW_REN_STRAND) { @@ -1728,7 +1728,7 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem strandbuf->winx= re->winx; strandbuf->winy= re->winy; strandbuf->maxdepth= 2; - strandbuf->adaptcos= cos((float)part->adapt_angle*(float)(M_PI/180.0)); + strandbuf->adaptcos= cosf(DEG2RADF((float)part->adapt_angle)); strandbuf->overrideuv= sd.override_uv; strandbuf->minwidth= ma->strand_min; diff --git a/source/gameengine/Ketsji/KX_Dome.cpp b/source/gameengine/Ketsji/KX_Dome.cpp index 00c5e5803a8..f0ea6f15ffe 100644 --- a/source/gameengine/Ketsji/KX_Dome.cpp +++ b/source/gameengine/Ketsji/KX_Dome.cpp @@ -561,7 +561,7 @@ void KX_Dome::CreateMeshDome180(void) int i,j; float uv_ratio = (float)(m_buffersize-1) / m_imagesize; - m_radangle = m_angle * M_PI/180.0;//calculates the radians angle, used for flattening + m_radangle = DEG2RADF(m_angle); //calculates the radians angle, used for flattening //creating faces for the env mapcube 180deg Dome // Top Face - just a triangle |