Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Not clear what point is in anim_rotate_around( angle , point) #471

Open
ArbitRandomUser opened this issue Mar 16, 2022 · 3 comments
Open
Labels
bug Something isn't working documentation Improvements or additions to documentation

Comments

@ArbitRandomUser
Copy link
Contributor

ArbitRandomUser commented Mar 16, 2022

Describe the bug
The docstring for anim_rotate_around describes

help?> ?anim_rotate_around
search: anim_rotate_around

  anim_rotate_around

  Animate the rotation of the attached object (see act!) around a point. Similiar function: anim_rotate to rotate or spin an object

  Example
  ≡≡≡≡≡≡≡≡≡

  Background(1:100, ground)
  obj = Object((args...) -> rect(O, 50, 50, :fill), Point(100, 0))
  act!(obj, Action(1:50, anim_rotate_around(2π, O)))

  Options
  ≡≡≡≡≡≡≡≡≡

    •  anim_rotate_around(ta::Real, p) define the end angle of the rotation + the rotation center.

    •  anim_rotate_around(fa::Real, ta::Real, p) define the from and end angle + the rotation center.

julia> 

However it is not clear what the rotation center is

To Reproduce

  1. Julia Version (i.e. output of julia -v): 1.7.2

  2. Operating system (Mac, Linux, Windows): Linux

  3. Javis version (i.e output of ] status Javis in the REPL) [78b212ba] Javis v0.8.0 ~/Javis.jl

  4. Minimum working code example that led to bug: (above)

using Javis
using Animations

video=Video(150,150)
nframes=100
ext=30
Background(1:nframes+ext, (args...)-> background("white"))

obj = Object(1:nframes+ext,(args...)-> box(O,10,20,:stroke),O+1 )
obj2 = Object(1:nframes+ext,(args...)-> circle(O+50,5,:fill) )
act!(obj, Action(1:nframes÷2 , anim_translate(O+50)))
act!(obj, Action(nframes÷2+1:nframes, anim_rotate_around(2π,O)  ))

render(video, pathname="test.gif")

Expected Behavior and Actual Behavior

what O in anim_rotate_around( 2π, O) should be better documented.
If intended to be a position relative to the canvas then this is a bug .
or it should be documented that the Point is relative to the objects current position.

Screenshots

test

@ArbitRandomUser ArbitRandomUser added the bug Something isn't working label Mar 16, 2022
@Wikunia
Copy link
Member

Wikunia commented Mar 17, 2022

It was intended to work like this:


obj = Object(1:nframes+ext,(args...)-> box(O,10,20,:stroke),O+10)
obj2 = Object(1:nframes+ext,(args...)-> circle(O,5,:fill), O )
act!(obj, Action(nframes÷2+1:nframes, anim_rotate_around(2π,O)  ))

But you use anim_translate before which doesn't update the start position which is used in anim_rotate_around. I think that would be a proper fix.

Then we make it clear in the documentation that one should use the position of each object in such a way that one draws it at the origin but it's shifted to the start position. That way rotation works as we know exactly where each object is.

@Wikunia Wikunia added the documentation Improvements or additions to documentation label Mar 17, 2022
@ArbitRandomUser
Copy link
Contributor Author

ArbitRandomUser commented Mar 17, 2022

i'm a little confused , if anim_translate doesnt update the start position,
and anim_rotate_around(ang,p) rotates around around point p relative to start position
then anim_rotate_around( 2\pi , O) should rotate around the start point (O+1 in my example)

@Wikunia
Copy link
Member

Wikunia commented Mar 17, 2022

From Zulip but to have it here for everyone:
"Nope it rotates around the difference in the positions of the two. So it thinks it is at O+1 and should rotate around O. therefore it rotates with a radius of 1 around O-1 from where it is."

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants