6
$\begingroup$

By reading that CirclePoints gives the positions of n points equally spaced around the unit circle, I understood that :

Graphics[{Green, Polygon[CirclePoints[4]]}] 

is equivalent to drawing a polygon into a circumscribed circle of radius 1 and centered as 0, 0.

I don't understand what CirclePoints with a real number does:

look at the picture:

Graphics[{Red, Polygon[CirclePoints[4.434335]], Green, 
  Polygon[CirclePoints[4]]}]

enter image description here

What is the meaning of placing "4.434335" points around the unit circle ?How do they come equally spaced ?

Look at the red polygon, they are not equally spaced, but I don't understand how the perimeter of the inner circle would be split.

$\endgroup$
  • $\begingroup$ This is off-topic but the answers suggested me this comment. It is fascinating to see a phase transition between polygons. The first n-1 vertexes are placed at equal distance by dividing the radiant of the circle; last vertex will be set upon the "remaining" angle respect to itself and first vertex. So for limit of the real number towards the next integer digit, next polygon pops up. E.g. Area[Polygon[CirclePoints[3]]], Area[Polygon[myCirclePoints[3.99999]]], Area[Polygon[myCirclePoints[3.9999999999]]] converge towards 1.0000, then Area[Polygon[myCirclePoints[4]]] "jumps" to 2.0 $\endgroup$ – user305883 Oct 15 '18 at 7:51
5
$\begingroup$

The details section of the documentation says the following:

  • In CirclePoints[n], n does not have to be an exact integer. The angles between successive vectors are always $\frac{2\pi}{n}$.
  • If the angle $\theta_1$ is not given, it is assumed to be $\pi/n - \pi/2$, ...

($\theta_1$ is the starting angle.)

Here is a simple implementation to test this:

circlePoints[n_] := Module[{start, diff},
  start = Pi/n - Pi/2;
  diff = 2 Pi/n;
  Table[{Cos[start + i diff], Sin[start + i diff]}, {i, 0, Floor[n] - 1}]
  ]

Graphics[{
  Green,
  Polygon[CirclePoints[4.434335]],
  FaceForm[Transparent],
  EdgeForm[{Red, Thick}],
  Polygon[circlePoints[4.434335]]
  }]

Mathematica graphics

How do they come equally spaced?

The key here is that successive vectors are equally spaced. The angle between the first and last vectors is not the same as the other angles unless $n$ is an integer.

$\endgroup$
  • $\begingroup$ Does RegularPolygon[] have the same behavior? $\endgroup$ – J. M. is away Oct 14 '18 at 1:25
  • $\begingroup$ @J.M.issomewhatokay. Yes $\endgroup$ – C. E. Oct 14 '18 at 6:22
  • $\begingroup$ @C.E. thank you for the explanation. So can I summarise the reason is that the diff angle ( 2Pi/n , that sets distance between the points) can be split in equal parts only if n is integer - otherwise you ll have the remaining angle, between first and last vector, will result different. $\endgroup$ – user305883 Oct 15 '18 at 7:29
  • $\begingroup$ @user305883 yes, that's correct. $\endgroup$ – C. E. Oct 15 '18 at 7:49
5
$\begingroup$

here is how CirclePoints work

enter image description here

try this..

Graphics[{Point@CirclePoints[40.99]}]

enter image description here

the above misses a point
see this one

Graphics[{Point@CirclePoints[41]}]

enter image description here

now

Graphics[{Point@CirclePoints[4.43]}]   

enter image description here

misses the fifth point...
this one

Graphics[{Point@CirclePoints[5]}]   

enter image description here

$\endgroup$
  • 1
    $\begingroup$ thank you for your time! I personally liked and found useful the visual example to show what the function does. I consulted META meta.stackexchange.com/questions/5234/… and think that to mark as correct answer it lack explanation of what the function does. $\endgroup$ – user305883 Oct 15 '18 at 7:16
  • 1
    $\begingroup$ that's ok! I'm glad that I found a way to visualize the problem and wanted to share. Thank's for you kind words $\endgroup$ – J42161217 Oct 15 '18 at 10:24
  • $\begingroup$ thank you @J42161217 - I found visual examples often very very useful to understand concepts. $\endgroup$ – user305883 Oct 15 '18 at 11:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.