• Create Account

## How to to transform a polygon to its mirror image

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

3 replies to this topic

### #1jenny_wui  Members

Posted 18 March 2014 - 08:19 PM

Hello, I am processing video frame and in each frame generating some small polygonal model. As in picture, our right side is shown as left side and vice versa. But I would like to keep the right side of person as right side in picture and same while generating polygonal model. I know it involves some matrix transformation. Could anyone provide me suggestion about how to proceed?

### #2L. Spiro  Members

Posted 18 March 2014 - 09:15 PM

Flip about any given axis by inverting the axis.

1 0 0 0    -1 0 0 0
0 1 0 0 --\ 0 1 0 0
0 0 1 0 --/ 0 0 1 0
0 0 0 1     0 0 0 1

This flips around the X axis.

To create the world matrix for the mirrored object, apply row-major matrices in the following order:

AboveMatrix * OriginalWorldMatrix * MirrorTranslateMatrix = MirrorWorldMatrix

Culling must be reversed when flipping a single axis (CW -> CCW and CCW -> CW).

L. Spiro

Edited by L. Spiro, 19 March 2014 - 04:39 AM.

### #3jenny_wui  Members

Posted 19 March 2014 - 11:14 AM

Thank you very much for the suggestion. Suppose when we display image, we paste the image along the texture coordinates i.e. 00, 01, 11, 10. Now how to map the texture so that image is displayed as mirror image in a plane.

Thanks

### #4haegarr  Members

Posted 19 March 2014 - 11:45 AM

Texture co-ordinates are interpolated any way, so if (u,v) sequence (0,0), (0,1), (1,1), (1,0) denotes the left-to-right texel ordering then (1,0), (1,1), (0,1), (0,0) denotes the right-to-left texel ordering. When the vertex positions are left as they are, then the image will be displayed mirrored over x.

EDIT: Notice that you can leave the vertex positions where they are and change the belonging texture co-ordinates as shown above, or else change the vertex positions (e.g. as shown by L. Spiro) the but without changing the value of belonging texture-cordinates. If you do both, i.e. mirror the positions and change the texture co-ordinates, then the resulting image will visually not change because you've mirrored forth and back.

Edited by haegarr, 19 March 2014 - 11:51 AM.

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.