Skip to main content
gamedev.net
🔒 Locked 🎮 Unity

transform between two planes

Started by moeron Dec 19, 2006 at 6:50 AM 4 replies 1.2k views
Original Post
moeron
moeron
I'm trying to find a way to calculate the transform necessary to map one plane to another. I can't seem to find a tutorial that walks me through this process. Could anyone point me in the right direction?

Transform CalcTM( Plane const &one, Plane const &two ){
  Transform tm;
  // I need to solve for tm such that
  // tm * one = two
  return( tm );
}
moe.ron
Zakwayda
Zakwayda
There isn't a unique transform, per se, from one plane to another, but you could find the transform between two coordinate systems aligned with two planes easily enough.

Perhaps you could describe in more detail what it is exactly that you're trying to do (that is, why do you need the transform).
moeron
moeron
I need to take a surface and turn it into a rectangle light. The rectangle light is not described by the common ways of describing a plane (normal and origin, 3 points, etc) its described by a transform and a u_size and v_size.

// I know my u_size and v_size..it would just be half of the length/width// so I know that my result plane can be described as this// but I need to find out the transform that maps my original plane to my// desired plane.Plane desired_plane( Point(-usize,-vsize,0.0),		     Point(usize, -vsize,0.0),		     Point(usize,vsize,0.0)              );Transform required_transform;// so I need to find what transform// maps the surface's plane to a plane// that can be described in terms of a u_size and v_size// required_transform * original_plane = desred_plane
moe.ron
Zakwayda
Zakwayda
Hm, still not enough info - the rectangle can be rotated arbitrarily with respect to the target plane normal, so there's no single transform that will do what you want.

Also, I'm not quite clear on whether you just need to rotate the rectangle into alignment with the plane, or whether translation (positioning of the rectangle) is involved as well.

If there is some constraint that can be applied (e.g. two of the rectangle edges should be parallel to the ground plane, or something like that), a solution can easily be devised. Some more info about the problem would be helpful though (perhaps a description of what precisely you need this for).
moeron
moeron
I just need to represent a plane by only providing a u_size and v_size. An SDK I'm working with describes rectangle lights as a u_size and v_size with a transform. So I need to take a plane that is described in one fashion (origin and normal) and describe it in another(u_size, v_size). I don't know if there are any constraints - I don't believe there are because the rectangle can be positioned in any way.

I was able to do this in the previous application I went to because that application provided a means of calculating a transform between two planes for me. This time I need to do it myself. I suppose I need to ask the authors of the previous software if they had any constraints acting on the planes as they did the transform. So far they haven't responded to me though, which is why I posted here.

Thanks for trying - I can't provide more information unfortunately because I am not sure really how to clarify what I'm trying to do further. Thanks again.
moe.ron
Zakwayda
Zakwayda
Quote:
Original post by moeron
I was able to do this in the previous application I went to because that application provided a means of calculating a transform between two planes for me.
Well, I think there must have been more to it than that. In any case, if you just need a rotation that will orient a quad that is axis-aligned in local space with a given plane, that's easy enough to do: just compute an axis-angle rotation from the cross product of the quad's local-space normal and the plane normal.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.