🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Is a flip method some kind of rotation?

Started by
6 comments, last by Gnollrunner 5 years, 11 months ago

Lets say i want to flip a set of 3d polyhedra. Lets say Flip Y.

Instead of some complex voodo involved wouldn't one just rotate by 180 degrees around X axis? Will this provide same result as standsrd flip, because i have no idea how to flip a set of objects... 

Advertisement

Not sure what the standard flip is but my gut feeling (and I could be wrong) is you want to scale Y by  -1.  Rotating can never actually change an object, just it's orientation.

It's more kind the other way around: You can express any rotation of a vector by reflecting it about a given plane (this is why quaternions store the cosine of just one half of the rotation angle). With reflection i mean flipping or mirroring not sure which term is right.

So you can also flip that single vector by rotation and you're not so wrong.

But for a whole model with multiple points the difference between flip and rotation shows up. Usually you negate one (or two) axis to flip the model.

1 hour ago, Gnollrunner said:

Not sure what the standard flip is but my gut feeling (and I could be wrong) is you want to scale Y by  -1.  Rotating can never actually change an object, just it's orientation.

That is more of a mirror than a flip. But it will flip the normals. :)

🙂🙂🙂🙂🙂<←The tone posse, ready for action.

2 hours ago, fleabay said:

That is more of a mirror than a flip. But it will flip the normals. :)

True, That is why 3D software usually have a "recalculate normals" option. A simple trick would be to mirror it and to invert the normal in the same direction.

As you say it seems that i need to use a mirror term, ok so lets say i want to mirror Y, 

Now i do sth like this:

Calculate geometric center of a shape that consist of x objects

through all selected objects i negate y coordinate of each vertex v.y = -v.y;

Then i calculate geometric center of this shape and calculate a vector from new center to old center - then i translate new shape, however this doesnt fit, shape moves around instead of being in one place this is what i want to fix.

https://imgur.com/a/rowSQAW

 

In 1 you see which object i want to mirror

In 2 you see the result

In 3 is what i want to achieve

This must be something simple like some one easy subtraction of a vector however cant see this for now.

In this case I would think that you would just want to take the average of Y min and Y max for the object you are flipping,  and flip around that line. For instance you could translate all points in said object by  subtracting  (YMax + YMin) / 2.0, and then go ahead and do your v.y = -v.y and and then translate back the other way by adding (YMax+ YMin) / 2.0.

This topic is closed to new replies.

Advertisement