bug 1995: avoid multiple definitions of PI
This commit is contained in:
@@ -168,7 +168,7 @@ GaussMarkovMobilityModel::DoWalk (Time delayLeft)
|
||||
if (nextPosition.x > m_bounds.xMax || nextPosition.x < m_bounds.xMin)
|
||||
{
|
||||
speed.x = -speed.x;
|
||||
m_meanDirection = 3.14159265 - m_meanDirection;
|
||||
m_meanDirection = M_PI - m_meanDirection;
|
||||
}
|
||||
|
||||
if (nextPosition.y > m_bounds.yMax || nextPosition.y < m_bounds.yMin)
|
||||
|
||||
@@ -29,8 +29,6 @@ namespace ns3 {
|
||||
|
||||
NS_LOG_COMPONENT_DEFINE ("RandomDirection2dMobilityModel");
|
||||
|
||||
const double RandomDirection2dMobilityModel::PI = 3.14159265358979323846;
|
||||
|
||||
NS_OBJECT_ENSURE_REGISTERED (RandomDirection2dMobilityModel);
|
||||
|
||||
|
||||
@@ -78,7 +76,7 @@ RandomDirection2dMobilityModel::DoInitialize (void)
|
||||
void
|
||||
RandomDirection2dMobilityModel::DoInitializePrivate (void)
|
||||
{
|
||||
double direction = m_direction->GetValue (0, 2 * PI);
|
||||
double direction = m_direction->GetValue (0, 2 * M_PI);
|
||||
SetDirectionAndSpeed (direction);
|
||||
}
|
||||
|
||||
@@ -115,20 +113,20 @@ RandomDirection2dMobilityModel::SetDirectionAndSpeed (double direction)
|
||||
void
|
||||
RandomDirection2dMobilityModel::ResetDirectionAndSpeed (void)
|
||||
{
|
||||
double direction = m_direction->GetValue (0, PI);
|
||||
double direction = m_direction->GetValue (0, M_PI);
|
||||
|
||||
m_helper.UpdateWithBounds (m_bounds);
|
||||
Vector position = m_helper.GetCurrentPosition ();
|
||||
switch (m_bounds.GetClosestSide (position))
|
||||
{
|
||||
case Rectangle::RIGHT:
|
||||
direction += PI / 2;
|
||||
direction += M_PI / 2;
|
||||
break;
|
||||
case Rectangle::LEFT:
|
||||
direction += -PI / 2;
|
||||
direction += -M_PI / 2;
|
||||
break;
|
||||
case Rectangle::TOP:
|
||||
direction += PI;
|
||||
direction += M_PI;
|
||||
break;
|
||||
case Rectangle::BOTTOM:
|
||||
direction += 0.0;
|
||||
|
||||
@@ -60,7 +60,6 @@ private:
|
||||
virtual Vector DoGetVelocity (void) const;
|
||||
virtual int64_t DoAssignStreams (int64_t);
|
||||
|
||||
static const double PI;
|
||||
Ptr<UniformRandomVariable> m_direction;
|
||||
Rectangle m_bounds;
|
||||
Ptr<RandomVariableStream> m_speed;
|
||||
|
||||
@@ -35,7 +35,7 @@ double
|
||||
DsssErrorRateModel::DqpskFunction (double x)
|
||||
{
|
||||
NS_LOG_FUNCTION_NOARGS ();
|
||||
return ((std::sqrt (2.0) + 1.0) / std::sqrt (8.0 * 3.1415926 * std::sqrt (2.0)))
|
||||
return ((std::sqrt (2.0) + 1.0) / std::sqrt (8.0 * M_PI * std::sqrt (2.0)))
|
||||
* (1.0 / std::sqrt (x)) * std::exp ( -(2.0 - std::sqrt (2.0)) * x);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user