doxygen a couple of missing functions. Add acouple of more comments to existing mobility models
--- a/src/mobility/random-walk-2d-mobility-model.h Wed Jun 04 11:59:31 2008 -0700
+++ b/src/mobility/random-walk-2d-mobility-model.h Wed Jun 04 12:29:07 2008 -0700
@@ -37,8 +37,10 @@
* Each instance moves with a speed and direction choosen at random
* with the user-provided random variables until
* either a fixed distance has been walked or until a fixed amount
- * of time.
- *
+ * of time. If we hit one of the boundaries (specified by a rectangle),
+ * of the model, we rebound on the boundary with a reflexive angle
+ * and speed. This model is often identified as a brownian motion
+ * model.
*/
class RandomWalk2dMobilityModel : public MobilityModel
{
--- a/src/mobility/random-waypoint-mobility-model.h Wed Jun 04 11:59:31 2008 -0700
+++ b/src/mobility/random-waypoint-mobility-model.h Wed Jun 04 12:29:07 2008 -0700
@@ -38,7 +38,8 @@
*
* The implementation of this model is not 2d-specific. i.e. if you provide
* a 3d random waypoint position model to this mobility model, the model
- * will still work.
+ * will still work. There is no 3d position allocator for now but it should
+ * be trivial to add one.
*/
class RandomWaypointMobilityModel : public MobilityModel
{
--- a/src/mobility/rectangle.cc Wed Jun 04 11:59:31 2008 -0700
+++ b/src/mobility/rectangle.cc Wed Jun 04 12:29:07 2008 -0700
@@ -86,6 +86,7 @@
Vector
Rectangle::CalculateIntersection (const Vector ¤t, const Vector &speed) const
{
+ NS_ASSERT (IsInside (current));
double xMaxY = current.y + (this->xMax - current.x) / speed.x * speed.y;
double xMinY = current.y + (this->xMin - current.x) / speed.x * speed.y;
double yMaxX = current.x + (this->yMax - current.y) / speed.y * speed.x;
--- a/src/mobility/rectangle.h Wed Jun 04 11:59:31 2008 -0700
+++ b/src/mobility/rectangle.h Wed Jun 04 12:29:07 2008 -0700
@@ -53,13 +53,42 @@
* Create a zero-sized rectangle located at coordinates (0.0,0.0)
*/
Rectangle ();
+ /**
+ * \param position the position to test.
+ * \returns true if the input position is located within the rectangle,
+ * false otherwise.
+ *
+ * This method compares only the x and y coordinates of the input position.
+ * It ignores the z coordinate.
+ */
bool IsInside (const Vector &position) const;
+ /**
+ * \param position the position to test.
+ * \returns the side of the rectangle the input position is closest to.
+ *
+ * This method compares only the x and y coordinates of the input position.
+ * It ignores the z coordinate.
+ */
Side GetClosestSide (const Vector &position) const;
+ /**
+ * \param current the current position
+ * \param speed the current speed
+ * \returns the intersection point between the rectangle and the current+speed vector.
+ *
+ * This method assumes that the current position is located _inside_
+ * the rectangle and checks for this with an assert.
+ * This method compares only the x and y coordinates of the input position
+ * and speed. It ignores the z coordinate.
+ */
Vector CalculateIntersection (const Vector ¤t, const Vector &speed) const;
+ /* The x coordinate of the left bound of the rectangle */
double xMin;
+ /* The x coordinate of the right bound of the rectangle */
double xMax;
+ /* The y coordinate of the bottom bound of the rectangle */
double yMin;
+ /* The y coordinate of the top bound of the rectangle */
double yMax;
};
--- a/src/mobility/vector.h Wed Jun 04 11:59:31 2008 -0700
+++ b/src/mobility/vector.h Wed Jun 04 12:29:07 2008 -0700
@@ -59,6 +59,11 @@
double z;
};
+/**
+ * \param a one point
+ * \param b another point
+ * \returns the cartesian distance between a and b.
+ */
double CalculateDistance (const Vector &a, const Vector &b);
/**