Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Flipping a polygon animation  (Read 2602 times)

0 Members and 1 Guest are viewing this topic.

Kojay

  • Full Member
  • ***
  • Posts: 104
    • View Profile
Flipping a polygon animation
« on: March 25, 2013, 12:42:43 am »
Hello,

I wish to animate the flip of a polygon (say, reflect it across the y axis): I 'd like to show it "sticking out" of the screen as it is flipped. This borders on 3d, however I don't want to actually use opengl simply for this. On the other hand, the polygon may be freely rotated, so I cannot prepare still images for the animation.

Any pointers as to what would be the best approach/tools would be appreciated.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: Flipping a polygon animation
« Reply #1 on: March 25, 2013, 02:09:18 am »
Just use OpenGL and 3D. It's just not worth trying to create a pseudo 3D renderer and if you're in 3D you can place things directly as you want them to be.

If you don't think it's worth it, you might want to give more information on what you're doing. ;)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Kojay

  • Full Member
  • ***
  • Posts: 104
    • View Profile
Re: Flipping a polygon animation
« Reply #2 on: March 25, 2013, 04:19:41 pm »
Thanks for reply. So far, nothing else in the program requires more than SFML offers.

The goal currently is to illustrate how permutations act on a polygon whose vertices are labelled 1,...,n. Here's a screenshot in fact:

https://dl.dropbox.com/u/105214643/aan_pic.jpg

Rotations are easy, but I 'd like the reflections to be a little bit more animated than an instant flip. I suppose I might go for opengl anyway, in preparation of displaying polyhedra too. Any other ideas would still be welcome though.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Flipping a polygon animation
« Reply #3 on: March 25, 2013, 04:31:23 pm »
Quote
I wish to animate the flip of a polygon (say, reflect it across the y axis)
In 2D, thus viewed from the top, this animation has no perspective, so it's easy to fake with a 2D API. All you have to do is to animate the X scale factor from 1 to -1.
Laurent Gomila - SFML developer

Kojay

  • Full Member
  • ***
  • Posts: 104
    • View Profile
Re: Flipping a polygon animation
« Reply #4 on: April 03, 2013, 09:06:56 am »
Thanks. Isn't this the same as so called orthographic projection? Probably looks convincing enough anyway.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Flipping a polygon animation
« Reply #5 on: April 03, 2013, 09:25:10 am »
Quote
Isn't this the same as so called orthographic projection?
Yes.
Laurent Gomila - SFML developer