Aligning text outside a variable number of equidistant points in a circle

FelipeDefensor shared this question 2 years ago
Answered

Hi!


I'm trying to label equidistant points that partition a circle in a way that the labels are aligned with the points and outside the circle. But as the text anchor is always its left-bottom corner, the text in the right side of the circle stays on the outside as it should, but the text on the left side overlaps with the circle.

The number of points is variable (it depends on some operations involving the two sliders CI_{1} and C1_2{2}), so I can't just set a fixed position to the each text element.

Any ideas?

Comments (16)

photo
2

try this:

R = Append(Sequence(Text(l1(i + 1), M2'(i) + (-1.1, 0)), i, 1, n), Text(l1(1), M2'(n) + (-1.1, 0)))

photo
1

Thanks! The alignment is still not quite as I was looking for, but it's a lot better. When the values of the CI sliders are changed the optimal x and y to be added seem to change a little bit, so I created sliders to fine tune them.

photo
photo
1

Thanks for the reply! Rotating the elements might indeed help with the alignment, but having them flip all the way around will make reading them difficult. Maybe rotating them differently based on where they are in the circle, like in the attachment? I'm not sure how to implement that idea, though.

photo
2

You could make a list like this and then add in Element(list,n) to the rotation


list = {0,0,0,180°,180°,180°,180°}

photo
1

Ok! Going to give it a try.

photo
photo
2

Since Verion 5.0.601 resp. 6.0.601 the text command has an (undocumented ?) extension.

The last two parameters mean

Text(.......,<Xvalue{left=1,center=0, right=-1}>, <Yvalue{top=1,center=0, bottom=-1}>)

This can be used to automatically align a text() to a point.

See example (with rotated text)https://www.geogebra.org/m/dgqdfzme

photo
1

That looks promising! I'll see what I can do with that.

photo
photo
1

Ok, so I was able to rotate the elements and they actually look pretty good. I still haven't configured the angle list so they don't flip completely, but that shouldn't be a problem. I've ran into another issue, though: when I first open the file, the text is center aligned with the points of the outer circle, as (I believe) they should be, however if I change the value of the sliders the alignment gets messed up (or so it seems to me). Even if I get the sliders back to the original value the center alignment is not regained.


Am I missing something here?

photo
1

I discovered by accident that changing the zoom after the slider change reverts the alignment back to normal. It's very inconvenient to do so every time, though.

photo
1

please send the GGB file

And say which GGB program you use.

photo
1

Sure! Here it goes. I'm using Geogebra 5.

photo
2

The AutoUpdate with timeout (i) was missing.

I have it added and documented.

photo
1

Right! Thanks! I figure there is no way to make the update instantaneous, right? Even if I set the speed of the i animation to something large (like 999999) there is still a brief moment when I can actually see the objects in the wrong alignment. I'm guessing it's probably because my computer is taking that split second to make the needed calculations.

photo
1

Yes (but not a problem of your computer), actually it should also work without AutoUpdate. Even an UpdateConstruction() in l3 (in your construction) does not lead to the goal. I think it is a restriction of the last (new) 2 parameters of Text() maybe a bug and the AutoUpdate with timeout (i) is a workaround.

photo
1

Oh, hope that will be fixed in the future, then. Thank you very much for your help! :)

photo
© 2023 International GeoGebra Institute