UniformDiscPositionAllocator

View: New views
3 Messages — Rating Filter:   Alert me  

UniformDiscPositionAllocator

by Nicola Baldo-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Using RandomDiscPositionAllocator it is not straightforward to achieve a
uniform distribution of nodes within the disc, basically because using a
uniformly distributed rho doesn't do the job.

Some time ago I posted a patch addressing this issue:
http://www.nsnam.org/bugzilla/show_bug.cgi?id=672

I think it would be nice and easy to have it in ns-3.7, so I am asking
for it to be reviewed.

Nicola




Re: UniformDiscPositionAllocator

by Faker Moatamri :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Nicola Baldo wrote:
> Using RandomDiscPositionAllocator it is not straightforward to achieve
> a uniform distribution of nodes within the disc, basically because
> using a uniformly distributed rho doesn't do the job.
>
First of all thanks for the patch.
The patch looks good but needs some small and very fast clarifications:

+
+/**
+ * \brief allocate positions which are uniformly distributed within a
+ * disc of a given radius.  Note that this is NOT equivalent to using
+ * a RandomDiscPositionAllocator with a uniformly-distributed rho.
+ */

Please tell the differences between them, what your new position allocator is adding.

+class UniformDiscPositionAllocator : public PositionAllocator
+{
+public:
+  static TypeId GetTypeId (void);
+  UniformDiscPositionAllocator ();
+  virtual ~UniformDiscPositionAllocator ();
+

please add some comments to explain that rho is the radius of the disc, and x and y are the coordinates of the center of the circle.

+  void SetRho (double rho);
+  void SetX (double x);
+  void SetY (double y);
+
+  virtual Vector GetNext (void) const;
+private:
+  double m_rho;
+  double m_x;
+  double m_y;
+};
+


> I think it would be nice and easy to have it in ns-3.7, so I am asking
> for it to be reviewed.
Yes sure, after those small changes you'll get +1 from me, Mathieu, what
do you think?
>
> Nicola
>
>
>


Re: UniformDiscPositionAllocator

by Mathieu Lacage :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Thu, 2009-11-05 at 11:57 +0100, Faker Moatamri wrote:

> > I think it would be nice and easy to have it in ns-3.7, so I am asking
> > for it to be reviewed.
> Yes sure, after those small changes you'll get +1 from me, Mathieu, what
> do you think?

+1

Mathieu