PDA

View Full Version : Hard question on a simple quad



Freelancer
02-10-2004, 07:07 AM
Hi everyone!

One problem I've got. I know how to make an indexed array for of triangles a quad, which "lies" horizontally.
But - I failed to construct a quad like:

Quad(VECTOR3D normal, float intercept)

i.e. I want to make an array of triangles, where each of them has the normal of "normal", and the whole quad stands "intercept" units from the origin.

Any ideas?

Thanks in advance,

Freelancer.

Relic
02-10-2004, 07:27 AM
Maybe because that has required but not sufficienttly detailed parameters?

Assuming "intercept" is in the direction of "normal", then you have a nice plane equation:
n.x * x + n.y * y + n.z * z - intercept = 0
Choose any four x,y,z triples which solve this and you got a quad.
Maybe pick one x,y,z on the plane which is "diameter" away from the footpoint (normal * intercept) and rotate that 90 degree around normal to get the second, mirror those two at the footpoint and you have a nice square.
If you give an "up" vector, you could also build it aligned to something.