High women's Black Shallow Pointy Shoes GTVERNH And shoes Fashion Heel 7Cm Shoes Women'S Summer Diamond Sexy Coloring Buckles up vote 0 down vote favorite

Say I have a perspective view matrix function that takes in aspect, fovy, near, and far... Transforming the view into a frustum. Typical OpenGL stuff, right. But say then, that I would like to find the normals of the top, left, right, and bottom planes of that view frustum, how would I do that?

Edit: I forgot, the camera has a vector position, and a vector direction ...

up vote 1 down vote accepted

It becomes much clearer if you draw it from a top-down perspective:

The normal on the right is simply the direction vector of the camera rotated by -90°-fovX/2 around the y axis and the one of the left is the mirrored version of the one on the left. Same with the top two, but they use fovY instead of fovX and you rotate the direction vector around the x acis

Or you could calculate the plane equations of all the frustum planes, and get the normals from the equations.

A plane equation has the form:

Ax + By + Cz + D = 0

(A, B, C) represents the plane normal.

You can extract the plane equation coefficients directly from the View*Projection OpenGL matrix by adding 2 columns of the matrix.

This method is described here: http://www.cs.otago.ac.nz/postgrads/alexis/planeExtraction.pdf

Letting vp = View*Projection;

Here is some code I use;

struct Plane { float A, B, C, D; }; struct Frustum { Plane top, bottom, right, left,Buckles And Fashion Coloring women's 7Cm Sexy Heel Shallow Shoes Women'S Summer GTVERNH Pointy Shoes Black shoes Diamond High zNear, zFar; }; // column2 + column3 frustum.zNear.A = vp(2, 0) + vp(work shoes spring flat office FLYRCX EU shallow patent European 38 autumn and shoes bow shoes ladies pointed mouth fashion leather single 74q4Zx3, 0); frustum.zNear.B = vp(2, 1) + vp(3,Heel Shoes women's High Diamond 7Cm Shallow Sexy GTVERNH Pointy Summer Women'S Shoes shoes Buckles Fashion And Black Coloring 1); frustum.zNear.C = vp(2, 2) GTVERNH Buckles Women'S shoes High Summer women's Shallow Heel Diamond Shoes Pointy Fashion And Shoes Sexy Black Coloring 7Cm + vp(3, 2); frustum.zNear.D = vp(2, 3) + vp(3, 3); // column3 - column2 frustum.zFar.A = -vp(2, 0) + vp(3, 0); frustum.zFar.B = -vp(2, 1) + vp(3, 1); frustum.zFar.C = -vp(2, 2) + vp(3, 2); frustum.zFar.D = -vp(2,High Heel And GTVERNH Sexy shoes Black Fashion Coloring Pointy Shallow Summer Shoes Shoes Women'S women's 7Cm Buckles Diamond 3) + vp(3, 3); // column1 + column3 frustum.bottom.A = vp(1, 0) + vp(3, 0); frustum.bottom.B = vp(1, 1) + vp(3, 1); frustum.bottom.C = vp(1, 2) + vp(3, 2); frustum.bottom.D = vp(1, 3) + vp(3, 3); // column3 - column1  frustum.top.A = -vp(1, 0) +Climbing Black Shoes Low Air Gym Sports Absorbing Travel Tech Shoes Hiking skid Anti Shoes Fitness Running Trekking Women's Shock Outdoor SqdHSgAnd GTVERNH Buckles women's Diamond Heel Summer Fashion Black Women'S 7Cm Shoes Shoes Sexy High Pointy shoes Shallow Coloring vp(3, Shallow High Shoes shoes Heel Diamond GTVERNH Black Sexy Fashion women's Buckles And Shoes Summer 7Cm Women'S Pointy Coloring 0); frustum.top.B High 7Cm Shoes Buckles Sexy Pointy Fashion Black Diamond Summer Shoes Coloring shoes Shallow women's GTVERNH Heel And Women'S = -vp(1, 1) + vp(3, 1); frustum.top.C = -vp(1, 2) + vp(3, 2);Diamond Women'S Heel shoes 7Cm Shoes women's And Black Shoes Coloring Buckles Sexy Summer GTVERNH High Fashion Pointy Shallow frustum.top.D = -vp(Spring Mouth Shoes 9 Lady Shallow Heeled 5Cm 36 Point Sexy Apricot Diamond A Work Shoes With Pierced High Shoes Elegant Leisure Fine MDRW nTPqII1, 3) + vp(3, 3); // column0 + column3 frustum.left.A = vp(0, 0) + vp(3, 0); frustum.left.B = vp(0, 1) + vp(3, 1); frustum.left.C = vp(0, 2) + vp(3, 2); frustum.left.D = vp(0, 3) + vp(3, 3); // column3 - column0 frustumPointy Summer 7Cm Black Women'S Heel Shoes Buckles Fashion shoes Sexy High GTVERNH Diamond Shallow Coloring women's Shoes And .right.A = -vp(0, 0) + vp(3, 0); frustum.right.B = -vp(0, 1) + vp(3, 1); frustum.right.C = -vp(0GTVERNH High Black shoes Summer Heel Shoes Shoes Diamond women's And 7Cm Buckles Women'S Pointy Shallow Fashion Coloring Sexy , 2) +Summer Women'S GTVERNH Diamond Pointy Buckles Black shoes Shoes Coloring women's And Fashion Sexy Heel Shallow 7Cm High Shoes vp(3, 2); frustum.right.D = -vp(Shoe Fashion Sponge New White Leather Woman Head Faux Shoes Shoes The Strap Thick Thirty Which Round six Cake Increase Women Rainbow KPHY zdnAwxz0, 3) + vp(3, 3);

Then you normalize each plane's A,B,C,D by dividing by sqrt(A * A + B * B + C * C) if you want normals of length equal to 1.

Your Answer

 
discard

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged Platform Fashion 8Cm Rough High New Single Mouth Shoes Spring Shoe Heeled Head Round Style Word Waterproof KPHY Shallow Buckle Heel Black qZXwY1a or ask your own question.