How can I center object/text box with a previously created point?

João Pedro shared this question 2 months ago
Answered

How can I center object/text box or something similar making its center coincide with a previously created point?


(Usually, the objects are located in rectangular areas, so when I'm referring it's center, I'm talking about the middle point of it's diagonals or it's centroid)


Using the "Position" tab doesn't work for me since the vertex of the object coincides with the point selected (Not the center of center of the object).


A good example would be a text box with its center at the point (2,5).

I attached a file with a workaround I found:

(https://help.geogebra.org/t...)


But that's not quite useful since I'll be doing this with a list of texts. Does anybody know a solution to this situation?

Comments (12)

photo
1

TexteT:

Properties > position:


StartPoint: \fbox{Point01_a}

FixObjet (Texet)

photo
1

If I understood what you've done, I'm supposed to manually align each text... It can be done but it's really unpractical. I'm trying to make a 360 degree protractor with each unit indicated. I'll attach the file on on the other comment.

Thanks for the help!

photo
1

Did you figure this out yet? I'm trying to do something very similar

photo
1

As said by Michael Borcherds, the release .601 would support a text alignment in code.

It works fine when I use text (or rotated text. See points C and D and text1 and text3). But when I use a list of texts, the alignment bugs out. Don't have any Idea how to solve this. Tried rami's workaroud but the Corner function was bugging out as well...

Attach your file. Maybe I can help you. (Mine is attached, showing the functioning text alignment and the faulty alignment texts list)

photo
photo
1

Quote: "I'll be doing this with a list of texts"

------------------------------------------------


With TableText() it is ensured that all elements of the list have the same size

(line1 with variable-length text in the middle plus line2 with (fix) 20 spaces).

In addition to the list, the object sampleText exists with the same size.

With sampleText a vector can be formed, which is used to move the list elements relative to the given points.

photo
1

Let me see if I understood it correctly: You've made several 3 line tables with whitespaces so you could control the textbox size. I think this might be able to work but let me post my whole problem:

I'm making a 360 degree protractor and I want to write the angles at the end of the segments. The list of points I left showing (new attached file) should be the center of the of the text boxes.

And there's more: I've planed to make each text aligned with it's segment so I need to rotate every text around it's center. This last part I think I'm able to solve with a simple rotation of the text, once it's center is aligned correctly.


Naturally, the number of divisions of the protractor is variable (n), so it's not matter of adjusting this particular setup (n = 36). That's why I need a more programmable solution.


Thanks for the help!

photo
1

Sorry for the late response. There's another problem:When I try to create a new text (to accurately position the rotated text generated), the result is it's command. I've attached another file so it will be easier to understand. Any ideas on how to overcome this?

photo
photo
3

This syntax will work in the next release (v601)

Text( <Object>, <Point>, <Boolean for Substitution of Variables>, <Boolean for LaTeX formula>, <Horizontal alignment [-1|0|1]>, <Vertical alignment [-1|0|1]> )

photo
1

Thanks for the support! I'm looking forward for this next release.

Also, adding the Boolean part made it work!

Meanwhile... I had another problem:

When I tried to use rami's workaround with your command suggestion, I've ran into a new problem: the point of the corner (command) of the box ("SampleText") wasn't able to be defined (Point "B". The file will be attached).

The list "l6" (hidden) is the solution you proposed (without alignment);

the list "l7" (hidden) serves for the creation of the TableTexts;

the list "l8" (shown) should be the one with the correct positioning but I couldn't properly translate the box because the corner problem.


PS: I know it's possible to do all this in fewer sequences commands, but for the purpose of debugging I've separated them.

photo
photo
1

Protractor with the new possibility of Text() version 601up

It's not robust and need the workaround script in l2 and autoUpd

photo
1

Thanks! I'll try to implement it later this week and I'll post an update.

photo
photo
2

My whole goal was to make a usable heading compass. I was able to do it.

https://www.geogebra.org/m/qucyawnq

© 2020 International GeoGebra Institute