c# - Flip Vertices Array -


I have an array of position corners that make 2D polygons.

  vector 2 [] _chassisConcaveVertices = {new vector 2 (5.122f, 0.572f), new vector 2 (3.518f, 0.572f), new vector 2 (3.458f, 0.169f) New vector 2 (2.553F, 0.169F), new vector 2 (2.013f, 0.414f), new vector 2 (0.992 f, 0.76 9f), new vector 2 (0.9 9 f, 1.363f), new vector 2 ( 5.122f, 1.363f)};   

Can I use algorithms to modify positions so that the resulting polygon flips? Let me repeat the polygon horizontally and vertically.

If you are flipping around point (0.0 F, 0.0F) you only deny the values Your size will be:

  vector2 [] _chassisConcaveVertices = {new vector 2 (-5.122f, -0.572f), new vector 2 (-3.518f, -0.572f), new vector 2 (- 3.458 f, -0.169 f), new vector 2 (-2.553 f, -0.169 f), new vector 2 (-2.013 f, -0.414 f), new vector 2 (-0.992 f, -0.76 9f) , New vector 2 (-0.992 f), -1.363 f), new vector 2 (-5.122 f, -1.363 f),};   

If you are flipping around a point (x, y) then for each point (x - (px - x)) or (2 * xp.x) x value And (Y - (P - Y)) or (2 * yp.y) for y values.

This explains:
. The point you want to flip is * the point you want to flip around all is the point you want to end

  x axis ^ | . - | | & Lt; - | | & Lt; - To overcome it, a * - | | & Lt; - | | & Lt; - It should be equal to O - ------- & gt; Y axis   

We say that values ​​of x are x * and o respectively (top, middle and bottom) t, m and b As you can see, the distance A = T-M and B = M-A are therefore B = M- (TM) = M-T + M = M * 2-T

To flip all the points around, you can use this principle to write an algorithm and it will give you your flip polygon!

Comments