How vector caption rotate, position and orientation adjust with vector rotation?

Math123 shared this question 3 years ago
Answered

Pls see attached and suggest better solution with vector and line rotation.

1. Caption : Rotate with vector angle.

2. Position of Caption : always above the vector.

3. Orientation : Orientation of text always correct not inverted.

Best Answer
photo

here my solution

see instructions inside the attachment

Comments (31)

photo
1

Hello Team. Any suggestion?

photo
2

No easy task!

I will gladly answer questions about specific objects (purpose, why, how)

photo
1

Because in project when a tangent vector is moving along different curves and there are components of also moving captions mixed up. and not easy to visualized.

Similarly when we add vectors in many cases every time caption is needed to drag in proper position with their own vectors. So it make project difficult to understand. Every caption mixed up.

It caption stick at the upper side of vector and fixed its position . caption rotating as vector rotating and orientation is correct not invert. It is highly helpful to visualize and understand the situation.

photo
1

Great......!!!! Thanks rami. You solved the problem. It is really helpful.

photo
1

Hello rami,

I found that you used " mod(angle(v)+90 , 180) - 90 " which equivalent in angle in radian.

I wonder why you used such complicated definition for angle radian, pixX & pixY.

Also pixX , pixY found approximately equvalent to " sqrt(x(corner1)^2+y(corner1)^2)) " and use same formula for pixY with corner4

photo
1

Otherwise the text1 (where the angle is needed) could hang upside down.

not tested alternative: alpha= Angle(v)-If(90°<Angel(v)<270°,180°,0°)

If alpha is used in commands, it makes no difference whether rad or deg.

photo
1

rami, there are always so many vectors in the project . Is it possible to make one (object / command etc..) from all of this, in which whenever i made a vector only one command work for other vector as well according to their caption and vector angle.


Otherwise for every vector it become very complicated.

It is suggested (idea) pls create this option in new version of GGB.

photo
1

Yes, but is much more complex. I want not explain now.

Maybe (not sure) it's possible to make a user custom tool.

What you can do: make a big command for pntTxt1' replace dirTop and displaceTxt1 whit the definition of this 2 objects.(implicit instead explicit)

photo
1

I test user custom tool with corner of text.

Sorry it's not possible to make a user custom tool.

How many vectos you have?

photo
1

rami thanks for the support, It is difficult for me to understand the definition. Pls make command for every vector.

photo
1

Tell (much) more on your project. So I can think about alternatives.

And: how many vectors you have?

photo
1

rami, there are so many projects where vectors are needed to explain. like vector addition, components of vector, tangent vector along the cures etc... vectors are very frequently used. if you can make something tool or command where i can put caption for every new vector. It will be easy to handle.

Otherwise vector caption mixed with each other.

photo
1

hm...

Questions:

  1. Always and only vectors or also Segments or something else with rotated labeling?
  2. Are there interactions between the rotated objects and the student, so that the text must change (content, position)?
  3. Will the Student create new objects that will have rotated text?
  4. Is the label always/automatically given by the object?
  5. Anything else worth mentioning?

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

Quote: if you can make something tool or command where i can put caption for every new vector.

Not sure, but i think: no

photo
1

I'll be gone for three hours.

photo
1

Questions:

  1. Always and only vectors or also Segments or something else with rotated labeling? (Vector is enough. If it also work for segment it gives me higher flexibility).
  2. Are there interactions between the rotated objects and the student, so that the text must change (content, position)? (Every time if we insert a new object , it prompt for caption which is rotated.)
  3. Will the Student create new objects that will have rotated text? ( If it is easy yes.)
  4. Is the label always/automatically given by the object? (Yes. )
  5. Anything else worth mentioning? (If anything else specially needed will inform you.)

photo
1

OK.

Please stop by tomorrow. Maybe I'll have a solution by then.

photo
photo
2

here my solution

see instructions inside the attachment

photo
1

Thanks rami, This is really awesome . It make more easy if input box is created for each object on click object for name, values .Which work on object which is on click or anything.


Pls make this tool in new GGB version. It is helpful for every user.

photo
2

Quote: Pls make this tool in new GGB version.

I think (not 100% sure): works also in GGB6 (I did a little testing)

-----------

Quote: Which work on object which is on click or anything

????

It is possible to establish further object-specific scripts in the script onClick that have nothing to do with the rotated caption. (It is no problem if Execute(cap1.......) is executed multiple times.)

photo
1

This is great rami. This is very easy to handle and work for every project whenever needed .

Give your expertise to me. So i can write anything on GGB whatever i wanted to without disturbing you and your team. But you are highly supportive thanks.

photo
1

I'm just a normal single user, like you. And I'm not part of a team either.

My problem is I know too much about GGB. This makes it difficult to "invent" new, unfamiliar problems/challenges. With your level of knowledge it is easier for you to want something that is maybe possible or at least should be possible. This creates an interesting synergy for me, even if it is sometimes exhausting for both sides.

On the other hand, I can see that it is often difficult for you to understand my ideas for solutions. There is only one way to avoid this: ask, ask, ask ...

If you want to learn more about GGB, I can only help if you ask very specific questions.

To ask good questions you have to analyze existing code (very time intensive). And/or you have to invent your own examples for single commands (e.g. all iteration commands), code and test them. But, to put it very pointedly, from my selfish point of view, it's more interesting for me if you stay naive towards GGB, so that the synergy remains as great as possible. Or to put it more subtly: take your time. :wink:

photo
1

rami are you GGB employ or just user?

Great offer to learn GGB from you. So, i start to learn. Pls explain cap1 and cap2 and how this work with OnClick script.

If found cap1 has list with 3 elements { , , }

and cap2 has lisr with 2 elements { , }

Also how you think about multiple commands to nested in one single command.

photo
1

I am a user, not an employee of GGB.

.

Quote: Pls explain cap1 and cap2

This question is not specific enough. It's not possible to anser to this with 10 or less sentence.

The first thing you need to understand is the principle of script lists. Search the GGB manual and ask questions (about the principle). Try to make (our own) examples with a practical application (including parameters).

Script-lists is a very powerful tool!! One of the best!!

.

Nested commands.

It is a question of balance between few objects in the algebra view and readable object definitions.

In cap2 I intentionally nested all so that only one object is created. This object-definition is no longer readable for me either. It would be necessary to display the object definition manually in a tree structure (as documentation).

In general, I believe that the readability of code has a very high priority (but not always).

.

Note: I'll be gone for three hours. (Practically always at this time)

photo
1

Hmm.. You are user . So, why you used GGB intensively and you find interest in GGB. Like i teach students and i like to animate things . I believe we humans are physiology and psychology bounded to what we see . We understand better that's why i like to animate and i found GGB is best for me.

What about you.? and how you learned and knew about too much about GGB.

I always tried to read nested long commands you written in projects.

photo
1

Because I'm having fun. Not to possess but to create. It closely resembles a game (for example chess). For myself the result is not useful not to use and does not increase my self-esteem (maybe very rarely).

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


To read nested commands make a reverse-engeniering in this way (Example cap2)

Forget what you see here below and try it yourself.


e52c665d87623ec659f65c2cba85a809

photo
1

In your absence i have spent time to explore your sequence. I am keenly interested in learning GGB. and what other software's you are expert?

I wonder what are you doing professionally.

What is %0 , %1 , %2 in your sequence. Also the what is purpose of using % within text?

photo
2

I was (in the past) a computer scientist and had a lot fun with it. Now I'm retired.

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


%0 (I think you can't find in the manual): In a spezific script by a spezific object &0 ist used instead the name of the object. This is usefull, when you have scripts in many object where only the name of the object is change.

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

%1, %2: I quote myself

The first thing you need to understand is the principle of script lists. Search in the GGB manual and ask questions (about the principle). Try to make (our own) examples with a practical application (including parameters).

script-lists: search with Execute()

But this was my way in the beginning. Its up to you to find your way to get knowledge and experience..

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

And you must also understand the applet Textrotation01 (at begin of this thread)

It is near equal to cap1 and cap2 but in another (more easy to read) implementation.

You start with this but later (I think) you stop it. But: Its up to you to find your way to get knowledge and experience.

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

photo
1

"I was (in the past) a computer scientist and had a lot fun with it. Now I'm retired."

In which language and software's you are expert in. You retired means you have a lot of lot of experienced.

and why you choose GGB.. How many years you are using GGB?

I have seen execute command, which execute commands list which is text .

photo
2

Thanks rami your file is excellent and helpful.

photo
photo
2

version 02 is also able to work in Graphic-View-2.

An object with a rotated caption must be in either Graphic View 1 or 2.

So not in both at once.

What has changed essentially is which objects must be created or copied in advance.Also the call of the script list has changed slightly.

However, it is worth reading through the instructions again.

photo
1

sorry, there was a bug (in cap0)

and I changed construction-protocol-sequence, the buttonCap0 (only for more nice) and instruction (very small)

© 2023 International GeoGebra Institute