# plane formula, relative offset's to world space?

This topic is 3084 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

hello, i'm trying to generate a plane shape by specifying the formula a+b+c+d=0, and a size value.

i.e: a standard 2D plane is: z+d=0(0x+0y+1z+d=0), now then, if i wanted to pull a square out of that plane, i'd simply specify 4 x/y values in the 4 quadrants, now then, this works fine and dandy in 2D because i know that the plane is facing forward, and only the x/y values can give me the shape i want from the plane, however what if the plane is say: .5y+.5z+d=0?, i want to still specify a 4 x/y points along the plane, but how would i translate those relative x/y points to world space?

sorry if this doesn't make much sense, i tried to explain it the best i could, and most of the material i found on the web has to do with distances and intercepts to a plane, but not how to specify points on the plane.

anywho, here's my current working code:

void CreatePlane(SPEVector4 Plane, float Size, SPEObject *Obj){	SPEVector4 P; memcpy(P, Plane, sizeof(SPEVector4));	Normalize(P);	SPEVertice *Verts = new SPEVertice[4];	Verts[0].x = (P[1]*Size+P[2]*Size);//+P[3];	Verts[0].y = (P[0]*Size+P[2]*Size);//+P[3];	Verts[0].z = (P[0]*Size+P[1]*Size);//+P[3];	Verts[1].x = (P[1]*Size+P[2]*Size);//+P[3];	Verts[1].y = (-P[0]*Size+P[2]*Size);//+P[3];	Verts[1].z = (-P[0]*Size+P[1]*Size);//+P[3];	Verts[2].x = (-P[1]*Size+P[2]*Size);//+P[3];	Verts[2].y = (-P[0]*Size+P[2]*Size);//+P[3];	Verts[2].z = (-P[0]*Size-P[1]*Size);//+P[3];	Verts[3].x = (-P[1]*Size+P[2]*Size);//+P[3];	Verts[3].y = (P[0]*Size+P[2]*Size);//+P[3];	Verts[3].z = (P[0]*Size-P[1]*Size);//+P[3];        ...	return;}

that doesn't work, i tried some things, but just couldn't figure it out, and i don't know the right words to google for something like this.

##### Share on other sites
Quote:
 hello, i'm trying to generate a plane shape by specifying the formula a+b+c+d=0, and a size value.
Hm, I'll take a guess at what you mean here. Do you mean you want to generate the vertices of a square or rectangle that lies in a specified plane, and has a specified position and dimensions?

The term 'plane shape' could probably use some clarification. I suppose a plane is a shape technically (an unbounded shape), but it's not something you can really directly represent graphically. Also, a+b+c+d=0 is not the equation of a plane; do you perhaps mean ax+by+cz+d=0?

If you could state more specifically what it is you're wanting to do, that would probably make it easier for us to help.

##### Share on other sites
yes, you hit it right on the head, sorry about the formula being a bit off, i want to generate the point's of a square/rectangle that is found along a specified plane, basically if i want to find say an x of 10 along the plane, i want to know the world space of that relative x offset along the plane.

##### Share on other sites
To expand on what jyk said, you can specify a planar shape by its plane and some other information, but it's not a great way to do it. The beautiful thing about a plane, and the reason you can describe it just as Ax+By+Cz+D=0, is that it is invariant under tangent rotation and translation. That is, a plane which is parallel to the ground doesn't have any idea which way "north" is, and it doesn't know where your house is. Shift it over a few miles, turn it 45 degrees, and it's still the same plane. You need more tools of description if you want to talk about "where".

If you have a plane and want to make a figure on that plane, you need a basis, which is to say you need an origin and you need some axes. The plane normal will give you one axis, and you can use (-A*D, -B*D, -C*D) as your origin, but that still leaves you short a couple of axes. So the first thing you need is an outside, world-space vector that you know isn't normal to the plane; project it onto the plane and normalize it to get a tangent, use the cross product to get a third vector (the "bitangent"), and now you have your basis. This allows you to talk about "where" on the plane: Naming your origin point O, and your normal, tangent, and bitangent N, T, and B, a point on the plane expressed in plane coordinates u,v has world-space position O + uT + vB. Any such u,v will describe a point on the plane, and a shape described by u,v values which are "rectangular" in the normal sense of the word will be a rectangle in world-space.

1. 1
2. 2
3. 3
Rutin
15
4. 4
5. 5

• 13
• 26
• 10
• 11
• 9
• ### Forum Statistics

• Total Topics
633728
• Total Posts
3013577
×

## Important Information

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!