Skip to content

Commit 22c5f9f

Browse files
committed
AnalogModelBase: Renamed variables and added comments for clarity.
This code caused some misunderstanding, so it was tuned to be less misleading.
1 parent a90c883 commit 22c5f9f

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

src/inet/physicallayer/wireless/common/base/packetlevel/AnalogModelBase.cc

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,10 @@ double AnalogModelBase::computeAntennaGain(const IAntennaGain *antennaGain, cons
1818
if (antennaGain->getMinGain() == antennaGain->getMaxGain())
1919
return antennaGain->getMinGain();
2020
else {
21-
auto direction = Quaternion::rotationFromTo(Coord::X_AXIS, endPosition - startPosition);
22-
auto antennaLocalDirection = Quaternion(startOrientation).inverse() * direction;
23-
return antennaGain->computeGain(antennaLocalDirection);
21+
Coord direction = endPosition - startPosition;
22+
Quaternion r1 = Quaternion::rotationFromTo(Coord::X_AXIS, direction); // rotation from X axis to the reception direction in the global coordinate system
23+
Quaternion r2 = Quaternion(startOrientation).inverse() * r1; // rotation from X axis to the reception direction in the antenna's local coordinate system
24+
return antennaGain->computeGain(r2);
2425
}
2526
}
2627

0 commit comments

Comments
 (0)