# Lumpy distribution of points from Circle.PointAt(t) - Why? [Solved]

Why is the distribution of points so lumpy when I pick points around a circle parametrically? (using circle.PointAt(t); )

The math should be simple, but why does it lump the points into “groups” instead of producing even distribution? (the iteration input variable is the number of points to pick from the circle)

for (var j = 0; j < iterations; j++)
{
var i = j;

// Param for even distribution of points from around a circle
var c_t = circle.Circumference * i * 1.0 / iterations;
var pt = circle.PointAt(c_t);

param_points[i] = pt;
}


// Rolf

This is how strange it behaves when changing the number of points (“iterations”):

// Rolf

Must be something else in your code. Using just the snippet you sent it distributes as expected.

divCirc.gh (3.0 KB)

Try this one. It’s insane. Or I am. Try change iterations and look how the Polylines are messed up (point lists are not in order):

CirclePointDistribution_Forum_00.gh (664.8 KB)

// Rolf

OK, I found a way to make points line up in order: Circumference divided by 45 (?!!!), then things starts to work as expected.

@dale & @DavidRutten - This must be a bug, no? (why divide by 45?)

for (var j = 0; j < iterations; j++)
{
var i = j;

// Param for even distribution of points around a circle
var c_t = circle.Circumference / 45 * i * 1.0 / iterations;
var pt = circle.PointAt(c_t);

}


Only now it starts to look like expected when making a Polyline, proving that the points are in order:

// Rolf

I see now. The reason divide by 45 works is because that is your Radius in the example you sent. It should be divide by R not divide by 45., then it will work parametrically. You can see in Rhinocommon circles use a different calc for PointAt than say NurbsCurves. “Circles use trigonometric parameterization: t -> center + cos(t)radiusxaxis + sin(t)radiusyaxis.”

Aha…rghhh, I’ve been looking at the wrong page! This one:

ArcCurve Constructor (Circle)
Rhino 5 for Windows
Initializes a new ArcCurve instance, copying the shape of a Circle.

Parameterization will be [0;circle.Circumference]

Thanks for pointing me to the right page!

// Rolf

The PointAt() method works in the (0.0, 2\pi) range. So if you start sampling with a different frequency you start going around the circle and ending up not quite where you started. This ‘drift’ manifests itself as point clusters.

Yes, I was simply reading the wrong documentation page ( ArcCurve Constructor (Circle) ).

Anyway, now it works fine.

// Rolf