inline void MatrixAngles(const matrix3x4 &matrix, Angle &angles) { Vector forward, left, up; forward[0] = matrix[0][0]; forward[1] = matrix[1][0]; forward[2] = matrix[2][0]; left[0] = matrix[0][1]; left[1] = matrix[1][1]; left[2] = matrix[2][1]; up[2] = matrix[2][2]; float len2d = forward.Length2D(); if (len2d > 0.001f) { angles.x = Rad2Deg(Atan(-forward.z, len2d)); angles.y = Rad2Deg(Atan(forward.y, forward.x)); angles.z = Rad2Deg(Atan(left.z, up.z)); } else { angles.x = Rad2Deg(Atan(-forward.z, len2d)); angles.y = Rad2Deg(Atan(-left.x, left.y)); angles.z = 0.f; } }
void FullStateSenderPlayerV5::sendPlayer( const Player & p ) { const float quantize_step = .001; char side = ( p.side() == LEFT ? 'l' : 'r' ); serializer().serializeFSPlayerBegin( transport(), side, p.unum(), false, // goalie info not sent 0, // player type info not sent Quantize( p.pos().x, quantize_step ), //pos_x Quantize( p.pos().y, quantize_step ), //pos_y Quantize( p.vel().x, quantize_step ), //vel_x Quantize( p.vel().y, quantize_step ), //vel_y Quantize( Rad2Deg( p.angleBodyCommitted() ), quantize_step ), Quantize( Rad2Deg( p.angleNeckCommitted() ), quantize_step ) ); //neck_angle serializer().serializeFSPlayerStamina( transport(), int( p.stamina() ), Quantize( p.effort(), .0001 ), Quantize( p.recovery(), .0001 ), p.staminaCapacity() ); serializer().serializeFSPlayerEnd( transport() ); }
void FullStateSenderPlayerV8::sendPlayer( const Player & p ) { char side = ( p.team()->side() == LEFT ? 'l' : 'r' ); serializer().serializeFSPlayerBegin( transport(), side, p.unum(), p.isGoalie(), p.playerTypeId(), p.pos().x, p.pos().y, p.vel().x, p.vel().y, Rad2Deg( p.angleBodyCommitted() ), Rad2Deg( p.angleNeckCommitted() ) ); if ( p.arm().isPointing() ) { rcss::geom::Vector2D arm_vec; p.arm().getRelDest( rcss::geom::Vector2D( p.pos().x, p.pos().y ), p.angleBodyCommitted() + p.angleNeckCommitted(), arm_vec ); serializer().serializeFSPlayerArm( transport(), arm_vec.getMag(), arm_vec.getHead() ); } serializer().serializeFSPlayerStamina( transport(), p.stamina(), p.effort(), p.recovery(), p.staminaCapacity() ); serializer().serializeFSPlayerEnd( transport() ); }
void GraphicCamera::Init(){ Vec3d axis_origin, update_pos; Vec3d tmp, tmp1, tmp2; default_position = pos_; default_aim = aim_; default_up = up_; // the angle around x axis update_pos = pos_ - aim_; axis_origin.x() = update_pos.x(); double dist = (axis_origin - update_pos).Norm(); tmp1.x() = update_pos.x(); tmp1.z() = dist; tmp = update_pos.Normalize(); tmp1 = tmp1.Normalize(); current_elev = Rad2Deg(acos(tmp * tmp1)); // the angle around y axis axis_origin = {0, update_pos.y(), 0}; dist = (axis_origin - update_pos).Norm(); tmp2 = {0, update_pos.y(), dist}; tmp2 = tmp2.Normalize(); current_azim = 360.0 - Rad2Deg(acos(tmp2 * tmp)); default_azim = current_azim; default_elev = current_elev; }
real CalcAngularDistanceInRadians(real angle1InDegrees, real angle2InDegrees) { real angle = CalcAngularDistanceInDegrees( Rad2Deg(angle1InDegrees), Rad2Deg(angle2InDegrees) ); return Deg2Rad(angle); }
void PerspectiveCamera::SetPositionLookAt(const Vector3d& vPos, const Vector3d& vLookAt) { Vector3d vDir = vLookAt - vPos; if (vDir.Length() < 1e-6) vDir = Vector3d(0.0, 0.0, 1.0); double dAngleDirection = Rad2Deg(atan2(vDir.X(), -vDir.Z())); double dAngleUp = Rad2Deg(atan2(vDir.Y(), -vDir.Z())); SetPosition(vPos, dAngleDirection, dAngleUp); }
TEST(TestSuite, testCaseRpy) { //std::cout << "Check row versus column major matrice\n"; // TestRpy(0.1, 0, 0); double r = 90, p = 0, y = 90; printf(" IN: %f %f %f\n", r, p, y); tf::Matrix3x3 m = GetTfRotationMatrix(Deg2Rad(r), Deg2Rad(p), Deg2Rad(y)); GetRPY(m, r, p, y); printf("OUT: %f %f %f\n", Rad2Deg(r), Rad2Deg(p), Rad2Deg(y)); tf::Vector3 xaxis, zaxis; GetHighland(m, xaxis, zaxis); printf("%f %f %f\n", xaxis.getX(), xaxis.getY(), xaxis.getZ()); printf("%f %f %f\n", zaxis.getX(), zaxis.getY(), zaxis.getZ()); }
void GoToPoint::call() { double dis_to_point; double dir_to_point; Vector2D agent_p = m_world->me().pos; double ang_permisible; double turn_parameter; Vector2D velocidad; double dash_parameter; double const dash_power_rate = 0.006, effort = 0.8; double const inertia_moment = 5.0; dis_to_point = (m_target - agent_p).mag(); dir_to_point = Rad2Deg( atan2( m_target.y - agent_p.y , m_target.x - agent_p.x) ); if( dis_to_point > m_radius ) // El agente no ha llegado al punto { ang_permisible = Rad2Deg( atan2( m_radius , dis_to_point ) ); turn_parameter = dir_to_point - m_world->me().angleDeg(); turn_parameter = entre180( turn_parameter ); velocidad.x = m_world->me().speed_amount; velocidad.y = m_world->me().speed_dir; if( ang_permisible < turn_parameter * 0.1 || dis_to_point > 25.0 ) ang_permisible = 25.0; if( fabs(turn_parameter) > ang_permisible ) // el agente no esta bien alineado al punto { velocidad = Vector2D::fromPolar( velocidad.x, Deg2Rad(velocidad.y) ); turn_parameter = turn_parameter *(1.0 + inertia_moment*velocidad.mag() ); turn_parameter = entre180( turn_parameter ); m_command->append_turn( turn_parameter ); } else { velocidad = Vector2D::fromPolar( velocidad.x, Deg2Rad(velocidad.y - m_world->me().angleDeg()) ); dash_parameter = ( dis_to_point - velocidad.x ) / ( dash_power_rate * effort ); if( dash_parameter > 100.0) dash_parameter = 100.0; if( m_dash_override ) m_command->append_dash( m_dash_power ); else m_command->append_dash( dash_parameter ); } } else { // El agente llegó al punto } }
void cxy_icp_kinematic_chain<_Scalar>::getResidual(MatrixX1& residual) { long rows = cxy_config::n_num_*getModelPointSize(); //long cols = cxy_config::joint_DoFs; if (rows != residual.rows()) { residual.resize(rows, 1); } residual.setZero(); _Scalar res_sum = 0.0; int row = 0; for (int ii = 0; ii < points_.size(); ++ii) { /* * TODO add other jacobian residual */ row = ii*config_->n_num_; points_[ii]->computePointResidual(residual.block(row, 0, cxy_config::n_num_, 1)); float tmp = residual(row); res_sum += residual(row); } fout_res_<<"x = "<<std::endl; fout_res_<<Rad2Deg(x_)<<std::endl; fout_res_<<"res = "<<std::endl; fout_res_<<residual<<std::endl; res_sum = res_sum / getModelPointSize(); std::cout<<"residual = "<<res_sum<<std::endl; }
template<> const ClassAccessors& GetAccessors<PlatformRig::DefaultShadowFrustumSettings>() { using Obj = PlatformRig::DefaultShadowFrustumSettings; static ClassAccessors props(typeid(Obj).hash_code()); static bool init = false; if (!init) { props.Add(u("FrustumCount"), DefaultGet(Obj, _frustumCount), [](Obj& obj, unsigned value) { obj._frustumCount = Clamp(value, 1u, SceneEngine::MaxShadowTexturesPerLight); }); props.Add(u("MaxDistanceFromCamera"), DefaultGet(Obj, _maxDistanceFromCamera), DefaultSet(Obj, _maxDistanceFromCamera)); props.Add(u("FrustumSizeFactor"), DefaultGet(Obj, _frustumSizeFactor), DefaultSet(Obj, _frustumSizeFactor)); props.Add(u("FocusDistance"), DefaultGet(Obj, _focusDistance), DefaultSet(Obj, _focusDistance)); props.Add(u("Flags"), DefaultGet(Obj, _flags), DefaultSet(Obj, _flags)); props.Add(u("TextureSize"), DefaultGet(Obj, _textureSize), [](Obj& obj, unsigned value) { obj._textureSize = 1<<(IntegerLog2(value-1)+1); }); // ceil to a power of two props.Add(u("SingleSidedSlopeScaledBias"), DefaultGet(Obj, _slopeScaledBias), DefaultSet(Obj, _slopeScaledBias)); props.Add(u("SingleSidedDepthBiasClamp"), DefaultGet(Obj, _depthBiasClamp), DefaultSet(Obj, _depthBiasClamp)); props.Add(u("SingleSidedRasterDepthBias"), DefaultGet(Obj, _rasterDepthBias), DefaultSet(Obj, _rasterDepthBias)); props.Add(u("DoubleSidedSlopeScaledBias"), DefaultGet(Obj, _dsSlopeScaledBias), DefaultSet(Obj, _dsSlopeScaledBias)); props.Add(u("DoubleSidedDepthBiasClamp"), DefaultGet(Obj, _dsDepthBiasClamp), DefaultSet(Obj, _dsDepthBiasClamp)); props.Add(u("DoubleSidedRasterDepthBias"), DefaultGet(Obj, _dsRasterDepthBias), DefaultSet(Obj, _dsRasterDepthBias)); props.Add(u("WorldSpaceResolveBias"), DefaultGet(Obj, _worldSpaceResolveBias), DefaultSet(Obj, _worldSpaceResolveBias)); props.Add(u("BlurAngleDegrees"), [](const Obj& obj) { return Rad2Deg(XlATan(obj._tanBlurAngle)); }, [](Obj& obj, float value) { obj._tanBlurAngle = XlTan(Deg2Rad(value)); } ); props.Add(u("MinBlurSearch"), DefaultGet(Obj, _minBlurSearch), DefaultSet(Obj, _minBlurSearch)); props.Add(u("MaxBlurSearch"), DefaultGet(Obj, _maxBlurSearch), DefaultSet(Obj, _maxBlurSearch)); init = true; } return props; }
/*! This function returns the principal value of the arc tangent of y/x in degrees using the signs of both arguments to determine the quadrant of the return value. For this the built-in 'atan2' function is used which returns this value in radians. \param x a float value \param y a float value \return the arc tangent of *y/x* in degrees taking the signs of x and y into account */ AngDeg atan2Deg( float y, float x ) { if( fabs( y ) < EPSILON && fabs( x ) < EPSILON ) return ( 0.0 ); return ( Rad2Deg( atan2( y, x ) ) ); }
void RunWithBall::call() { double ang_to_point; Vector2D aux; Vector2D pos = m_world->me().pos; Vector2D ball = m_world->estBallPosition(); double disBall = m_world->bitacoraBalon.begin()->dis; if ( disBall <= m_radius ) { ang_to_point = Rad2Deg( atan2( m_target.y- pos.y, m_target.x - pos.x) ); // Este m_pass_distance es similar a lo que queremos que adelante la pelota, // para valores grandes la adelanta mucho. aux = Vector2D::fromPolar( m_pass_distance, Deg2Rad( ang_to_point ) ); m_pass_to_point->setDesiredVel( m_ball_final_vel ); m_pass_to_point->setTarget( pos + aux ); m_pass_to_point->call(); } else { m_go_to_point->setDashOverride( false ); m_go_to_point->setRadius( m_radius ); m_go_to_point->setTarget( ball ); m_go_to_point->call(); } }
double atan2Deg( double x, double y ) { if( fabs( x ) < EPSILON && fabs( y ) < EPSILON ) return ( 0.0 ); return ( Rad2Deg( atan2( x, y ) ) ); }
void UdpClient::drawToMap() { Point pos = getPosition(); fptype angle = getRunDirection(); glPointSize(3.0); glColor3f(1.0, 0.0, 0.0); // red glPushMatrix(); // modeling transformation glTranslatef(pos.x, pos.y, 0); glRotatef(Rad2Deg(angle), 0.0, 0.0, 1.0); // draw a point indicating orienteer's position glBegin(GL_POINTS); glVertex2f(0.0, 0.0); glEnd(); // draw a line showing the direction of view glBegin(GL_LINES); glVertex2f(0.0, 0.0); glVertex2f(0.0, 10.0); glEnd(); glPopMatrix(); }
AngDeg acosDeg( float x ){ if( x >= 1 ) return ( 0.0 ); else if( x <= -1 ) return ( 180.0 ); return ( Rad2Deg( acos( x ) ) ); }
AngDeg asinDeg( float x ){ if( x >= 1 ) return ( 90.0 ); else if ( x <= -1 ) return ( -90.0 ); return ( Rad2Deg( asin( x ) ) ); }
YOCTO_PROGRAM_START() { #include "main-core.cpp" double zeta = L.Get<double>("zeta"); double alpha_deg = L.Get<double>("alpha"); double alpha = Deg2Rad(alpha_deg); std::cerr << "alpha=" << alpha_deg << std::endl; B.SaveLens("lens.dat", zeta); { ios::wcstream fp("profile.dat"); ios::wcstream rp("results.dat"); for(double theta_deg = 1; theta_deg <= 179; theta_deg += 1) { const double theta = Deg2Rad(theta_deg); const double ans = B.profile(alpha,theta,zeta,&fp,false); fp << "\n"; rp("%g %g %g\n", theta_deg, ans, sin(B.param[BRIDGE_A])); } } bool isFlat = false; { ios::wcstream fp("theta_opt.dat"); const double theta = B.find_theta(alpha,zeta,isFlat); std::cerr << "THETA=" << Rad2Deg(theta) << std::endl; if(theta<=0) { std::cerr << "No Bridge" << std::endl; fp("%g %g\n", B.start_u, B.start_v); } else { if(isFlat) { for(double xx=0;xx<=1.0;xx+=0.1) { fp("%g %g\n", B.start_u+xx, B.start_v); } } else { (void) B.profile(alpha, theta,zeta,&fp); } const double shift = B.compute_shift(alpha, theta, zeta); std::cerr << "shift=" << shift << std::endl; } } }
void FreezeBall::call() { const BodySensor & body = m_world->gameData().sensor_handler.last_sense; const ServerParam & param = m_world->gameData().game_parameter.server_param; double pow_needed; double angle_needed; Vector2D zero_vel(0.0, 0.0); Vector2D p = m_world->me().pos; // Posición del agente double theta = m_world->me().angleDeg(); // Orientación del agente Vector2D vn = m_world->estBallVelocity(); Vector2D bn = m_world->estBallPosition(); Vector2D pv = Vector2D::fromPolar( body.speed_amount, Deg2Rad( body.speed_direction + theta ) ); Vector2D pn_bn; // vector de bn a pn Vector2D pn = p + pv; //Posición del agente en el siguiente ciclo pn_bn = pn-bn; double dist = pn_bn.mag(); double dir_diff = std::abs( entre180( theta - Rad2Deg( pn_bn.angle() ) ) ); double f = 1 - 0.25*(dir_diff/180.0) -0.25*(dist/param.kickable_margin); if( f == 0.0 ) f = 0.001; if( vn.x == 0.0 && vn.y == 0.0 ) { pow_needed = 0.0; angle_needed = 0.0; } else { pow_needed = vn.mag() / ( param.kick_power_rate * f ) ; angle_needed = entre180( Rad2Deg( std::atan2( vn.y, vn.x ) ) + 180 - theta); } m_command->append_kick( pow_needed, angle_needed ); }
double DoArcCos(double CoSine) { double ArcCoSine; ArcCoSine = (double)acosf(CoSine); #ifdef DEG ArcCoSine = Rad2Deg(ArcCoSine); #endif return ArcCoSine; }
double DoArcSin(double Sine) { double ArcSine; ArcSine = (double)asinf(Sine); #ifdef DEG ArcSine = Rad2Deg(ArcSine); #endif return ArcSine; }
TEST(TestSuite, testCase1) { ASSERT_EQ(1, 1) << "Vectors 1 and 1 not equal"; //TestMatrixDominance(); double r, p, y; //tf::Matrix3x3 m = GetTfRotationMatrix(tf::Vector3(0, 0, 1), tf::Vector3(1, 0, 0)); tf::Matrix3x3 m = GetTfRotationMatrix(tf::Vector3(0, 0.1, 0), tf::Vector3(0, 0, 0)); m.getRPY(r, p, y); // std::cout << "TF Set/GetRPY Roll pitch yaw = (-180., -90., 0.)" << Rad2Deg(r) << ":" << Rad2Deg(p) << ":" << Rad2Deg(y) << std::endl; std::cout << "TF Set/GetRPY Roll pitch yaw = ([0,.1,0][0,0,0].)" << Rad2Deg(r) << ":" << Rad2Deg(p) << ":" << Rad2Deg(y) << std::endl; }
double DoArcTan(double Tan) { double ArcTan; ArcTan = (double)atanf(Tan); #ifdef DEG ArcTan = Rad2Deg(ArcTan); #endif return ArcTan; }
inline void VectorAngles(const Vector &vec, Angle &angles) { if (vec.x == 0.0f && vec.y == 0.0f) { if (vec.z > 0.0f) { angles.x = -90.0f; } else { angles.x = 90.0f; } } else { angles.x = Rad2Deg(Atan(-vec.z, vec.Length2D())); angles.y = Rad2Deg(Atan(vec.y, vec.x)); } }
YOCTO_PROGRAM_START() { #include "main-core.cpp" #if 0 double zeta = Lua::Config::Get<lua_Number>(L, "zeta" ); double theta_deg = Lua::Config::Get<lua_Number>(L,"theta"); double theta = Deg2Rad(theta_deg); std::cerr << "theta=" << theta_deg << std::endl; B.SaveLens("lens.dat", zeta); { ios::wcstream fp("profile.dat"); ios::wcstream rp("results.dat"); for(double alpha_deg=1;alpha_deg<=90; alpha_deg += 0.2) { const double ans = B.profile(Deg2Rad(alpha_deg), theta, zeta, &fp); rp("%g %g\n",alpha_deg,ans); fp << "\n"; } } bool isFlat = false; { ios::wcstream fp("alpha_opt.dat"); const double alpha = B.find_alpha(theta,zeta,isFlat); std::cerr << "ALPHA=" << Rad2Deg(alpha) << std::endl; if(alpha<=0) { std::cerr << "No Bridge" << std::endl; fp("%g %g\n", B.start_u, B.start_v); } else { if(isFlat) { for(double xx=0;xx<=1.0;xx+=0.1) { fp("%g %g\n", B.start_u+xx, B.start_v); } } else { (void) B.profile(alpha, theta,zeta,&fp); } } } #endif }
void UdpClient::drawToTerrain() { glPushMatrix(); /* modeling transformation */ GLfloat x = (GLfloat)location.position.x; GLfloat y = (GLfloat)location.position.y; GLfloat z = (GLfloat)location.position.z; GLfloat h = Rad2Deg(location.horizontal); GLfloat v = Rad2Deg(location.vertical); #if 0 hor[index] = h; ver[index] = v; pos[index*3+0] = x; pos[index*3+1] = y; pos[index*3+2] = z; #endif glTranslatef(x, y, z); glRotatef(h, 0.0, 0.0, 1.0); glRotatef(v, 1.0, 0.0, 0.0); glScalef(0.05, 0.05, 0.05); #if 0 if (self->night) { /* draw headlight's light */ GLfloat headlight_position[] = {0.0, 0.0, 0.0, 1.0}; GLfloat headlight_direction[] = {0.0, 0.0, -1.0}; glLightfv(self->light, GL_POSITION, headlight_position); glLightfv(self->light, GL_SPOT_DIRECTION, headlight_direction); } #endif glPushAttrib(GL_POLYGON_BIT); glDisable(GL_CULL_FACE); //glutSolidSphere(3.0, 10, 10); glPopAttrib(); glPopMatrix(); }
inline void VectorAngles(const Vector &vec, const Vector &up, Angle &angles) { Vector left; Cross(up, vec, left); left.Normalize(); float len = vec.Length2D(); angles.x = Rad2Deg(Atan(-vec.z, len)); if (len > 0.001f) { angles.y = Rad2Deg(Atan(vec.y, vec.x)); angles.z = Rad2Deg(Atan(left.z, ((left.y * vec.x) - (left.x * vec.y)))); } else { angles.y = Rad2Deg(Atan(-left.x, left.y)); angles.z = 0.0f; } //NormalizeAngles(angles); }
void PassToPoint::call() { double kick_power, kick_direction; double dis_to_point; double dis_BP; double speed; double rel_angle; double mom_BP; double act_kpr; Vector2D agent_p = m_world->me().pos; Vector2D ball_p = m_world->estBallPosition(); //Distancia del jugador al punto final del balón dis_to_point = (m_target - agent_p).mag(); //Distancia del jugador al balón dis_BP = (ball_p - agent_p).mag(); speed = kickSpeedToTravel(dis_to_point, m_desired_vel); //velocidad inicial necesaria rel_angle = Rad2Deg( atan2(m_target.y - agent_p.y, m_target.x - agent_p.x) ) - m_world->me().angleDeg(); //Ángulo para kick mom_BP = Rad2Deg( atan2(ball_p.y - agent_p.y, ball_p.x - agent_p.x) ) - m_world->me().angleDeg(); //Ángulo entre posicíon del balon y jugador act_kpr = actualKickPowerRate(mom_BP, dis_BP); // Valor real del poder del kick kick_power = rint( kickPowerForSpeed(speed, act_kpr) ); if(kick_power > 100.0) kick_power = 100.0; rel_angle = entre180(rel_angle); kick_direction = rint( rel_angle ); m_command->append_kick( kick_power, kick_direction ); }
static int ReadAttr( ATTRIBUTES *a, MAP *m, BOOL readOnly) /* are the attribute only used for teh PRINT op */ { DefaultAttr(a); if (RuseAs(m, CR_REAL8)) goto failure; RgetMinVal(m, &(a->minVal)); RgetMaxVal(m, &(a->maxVal)); a->projection = MgetProjection(m); a->xUL = RgetXUL(m); a->yUL = RgetYUL(m); a->nrRows = RgetNrRows(m); a->nrCols = RgetNrCols(m); a->cellSize = RgetCellSize(m); a->version = MgetVersion(m); a->gisFileId = MgetGisFileId(m); a->byteOrder = m->main.byteOrder; a->attrTable = m->main.attrTable; if (Merrno) goto failure; if (a->version == 2 || readOnly) { /* otherwise use defaults */ a->valueScale = RgetValueScale(m); a->cellRepr = RgetCellRepr(m); a->angle = RgetAngle(m); if (a->angle < 0) a->angle = -Rad2Deg(-a->angle); else a->angle = Rad2Deg(a->angle); } return 0; failure: return 1; }
void DoCalculate(void) { switch (Operation) { case NO_OP: break; case PLUS: Terms.Result = Terms.Operand1 + Terms.Operand2; break; case MINUS: Terms.Result = Terms.Operand1 - Terms.Operand2; break; case MULTIPLY: Terms.Result = Terms.Operand1 * Terms.Operand2; break; case DIVIDE: //if(Terms.Operand2 != 0) //{ Terms.Result = Terms.Operand1 / Terms.Operand2; //} break; case SIN: Terms.Result = DoSin(Terms.Operand1); break; case COS: Terms.Result = DoCos(Terms.Operand1); break; case TAN: Terms.Result = DoTan(Terms.Operand1); break; case ARCSIN: Terms.Result = DoArcSin(Terms.Operand1); break; case ARCCOS: Terms.Result = DoArcCos(Terms.Operand1); break; case ARCTAN: Terms.Result = DoArcTan(Terms.Operand1); break; case DEG2RAD: Terms.Result = Deg2Rad(Terms.Operand1); break; case RAD2DEG: Terms.Result = Rad2Deg(Terms.Operand1); break; } return; }
void Lens:: Initialize() { triplet<double> a = { 0, 0, numeric<double>::pi }; triplet<double> s = { 0,0,0 }; if( !bracket<double>::inside(negsurf, a, s) ) { throw exception("Invalid Lens Profile!"); } minimize<double>(negsurf, a, s, 0); (double&)max_alpha = a.b; (double&)max_alpha_deg = Rad2Deg(max_alpha); (double&)max_surface = surface(max_alpha); std::cerr << "LensMaxAlpha = " << max_alpha_deg << std::endl; std::cerr << "LensMaxSurface = " << max_surface << std::endl; }