# the plane and axes.

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

## Recommended Posts

the plane and axes.
I have some points that lie in a plane.
I have a trasformation matrix that rotate these points and the plane.
these points are 2d points with a 0 in z component.
I must calculate the 2d rotation on the the plane from 2 points before and after the trasformation with an arctan2 or wih some other methods.
The problem is that the rotation may be in xy plane or in yz plane or in xz plane.
Naturally if i'm in xy plane i must take the xy coords, if i'm in xz plane i must take xz coords.

Is possible from a plane extract what are the coords to consider?
how?

thanks.

##### Share on other sites
You could get the information, whether your plane is in xy, xz or yz, from the normal of the plane, if that's what you're asking for.
Suppose you have the plane equation: ax+by+cz+d=0, where (a,b,c) is the normalized plane normal, and d is the nearest distance from the plane to the origin.

You then might want to check the normal ( a,b,c ).
E.g.:
if ( fabs( fabs( a ) - 1.0f) < EPS ) then plane is in yz
if ( fabs( fabs( b ) - 1.0f) < EPS ) then plane is in xz
if ( fabs( fabs( c ) - 1.0f) < EPS ) then plane is in xy

Hope that helps.

##### Share on other sites
I see the formula, but what is EPS? a small value?

because i have this normalized normal:

 Normal = {0; -0.8;-05} 

with your formula i can't find any plane if EPS is = 0.0001 for example.

Where i'm wrong?
I wish understand more , where is the d (distance from the origin), and how i can calculate it?

I sorry for my english.

very thanks.

##### Share on other sites
Yes, EPS is supposed to be a very small value greater than zero: e.g. 10^-6 = 0.000001
A bigger value is also sufficient in your case.

First, I fear your normal is not normalized. A normalized normal should have a length of 1.
When you compute the length of your normal you get:

length( normal ) = length ( {0,-0.8;-0.5} ) = sqrt( 0 + 0.64 + 0.25 ) = sqrt ( 0.89 ) < 1

,so you need to normalize your normal like:

normal.x /= length(normal)
normal.y /= length(normal)
normal.z /= length(normal)

( though checking for zero, not dividing by zero )

When you then have the normalized normal of your plane, you need at least one additional point on the plane.
And you said you have a bunch of points sitting in the plane.

Just take one, say p.
Now compute d of the plane equation like: (scalar product of normal with p)

d = normal.x*p.x + normal.y*p.y + normal.z*p.z

then you have all you need:

a = normal.x
b = normal.y
c = normal.z

then you have your plane eq.

a*x + b*y + c*z + d = 0

All x,y,z for which this equation is true, is sitting on this plane as well.
So, if your a,b,c and d are correct you can test your plane equation with your point p, which you took for computing the distance d.

##### Share on other sites
very thanks.
Sorry for my english an my ignorance in mathematics.
but how is related the distance d with the planes in that i is?
recapping:
i have the plane equation:

 d = normal.x*p.x + normal.y*p.y + normal.z*p.z 

i have the normal of the plane
i have the point
after calculating :
i have the normal and the point p then i can extract d:

 d = normal.x*p.x + normal.y*p.y + normal.z*p.z 

now i have d for a point and a normal, the normal is the same for all the points in the plane.
but how d is related with the plane in which are?
what is the geometric represetation of this equation ?
how i can visualizing this?

if ( fabs( fabs( a ) - 1.0f) < EPS ) then plane is in yz
if ( fabs( fabs( b ) - 1.0f) < EPS ) then plane is in xz
if ( fabs( fabs( c ) - 1.0f) < EPS ) then plane is in xy
[/quote]

and where is d in these equations?

##### Share on other sites
Thanks I went ahead to thinking .
I'm read on 3d math primer for graphics ... the plane equation.
but my problems are
1)A plane can be not aligned to any axis?
2)
I have
a = normal.x
b = normal.y
c = normal.z

the d calculated with a point

a*x + b*y + c*z + d = 0

what i must substitute and calculate in this equation?

set the value of y
set the value of z
and calculate the x ?
...
set the value of y
set the value of x
and calculate the z ?
....
ecc...

is this the method?

I'm sorry but i'm a newbe in math
thanks.

##### Share on other sites
You calculate a,b,c,d and substitute x,y,z with the values you want to check.

##### Share on other sites
thanks, i understand.
I calculate from the normal vector and the first point, the distance, then i substitute the point with 0 0 1 (x axis) or 0 1 0(y axis) ecc.....
All works fine, the problem is that i can have for example a normal like 0 0,7 0,7(from a rotation of 45°) in this case the plane's function is 0 only for an axis , in this case i think that i must project an axis into another for find the x/y(in two dimension) coords and test the angle of rotation with for example atan2(y',x') - atan2(y,x) where y' x' and x y are the coords of the same point before and after i apply the rotation matrix.
Is correct do the projection?
I read that the projection is a reduction operation then i can find the values always in 2 dimension then apply the atan2 for find the correct angle of rotation on the axis.

but how?

very thanks.

##### Share on other sites
Actually, you need to plugin position vectors to x,y,z in the same coordinate system your plane is defined, not directional vectors as you did with (0,0,1) and (0,1,0).

But I'm not sure what you're actually looking for... maybe you can clarify a bit more, what information you actually have given, and what you need to calculate.

Thanks.

##### Share on other sites

i have a rotation matrix and some points on a plane .

The rotation matrix is applied to the plane and on points.

My goal is to calculate rotation matrix on the plane with the difference from rotated plane(and rotated points multiplied for the rotation matrix) and not rotated plane, with:

angle = atan2(RotPlane'.y,RotPlane'.x)- atan2(RotPlane.y,RotPlane.x) or other methods.
where RotPlane' is the 2d rotated vector and RotPlane is the 2d non rotated vector
my problem is that the rotation matrix rotate around the center of profile(in the normal direction) but also on the x y axes.

now i find in what plane i'm ; but there is a problem with rotate plane on xy the coords for calculate the angle of rotation of the profile are not correct , see the plane rotated and normal rotated :you see that i can't calculate the angle of rotation with atan2 because the values are in 3 dimension and not in 2.

I think that i can project a coord (y for example) on the x plane and find a 2d value.

is possible?
Or, is possible to go on the plane coords and next calculate the angle , but how? multiply the xyz axis for the matrix rotation?
I'm not understand
thanks.

sorry for my english

• ### What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

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

• Total Topics
634090
• Total Posts
3015432
×