Effacer les filtres
Effacer les filtres

Angle between two planes on the X=0, Y=0 and Z=0 planes

5 vues (au cours des 30 derniers jours)
Meghana Dinesh
Meghana Dinesh le 26 Déc 2014
Modifié(e) : Matt J le 27 Déc 2014
Hi,
I am plotting two planes using the code mentioned here. I am using Plane fit by Adrien Leygue to find planes (best fit plane given 2 sets of points in 3D) and plot (using affine_fit.m and demo.m)
With these two planes, I want to find the angle between these two planes as seen from the YZ, XZ and XY planes.
In order to do this, I first take one plane and measure what angle it makes when it intersects the YZ, ZX and XY planes individually. (I get 3 angles Angle_XYi, Angle_YZi, Angle_ZXi ) _Basically, when my plane intersects say, the XY plane, it forms a line. I am finding the angle using: atand((y2-y1)/(x2-x1)) . This will be Angle_XYi .
Similarly for YZ and XZ planes, I obtain angles Angle_YZi, Angle_ZXi.
I do this individually for both planes, obtaining Angle_XYii, Angle_YZii, Angle_ZXii for plane2.
I simply take their differences to get the required angles:
Angle1 = Angle_XYi - Angle_XYii
Angle2 = Angle_YZi - Angle_YZii
Angle3 = Angle_ZXi - Angle_ZXii
Angle1 is my angle computed, to indicate that this is the angle between the two lines, formed by the two planes upon intersecting with the XY plane. Similarly Angle2 and Angle3 is found.
The first plane is plot using Points_plane1 and the second plane using Points_plane2.
I have attached the two sets of points Points_plane1 and Points_plane2, along with my code.
The output of my code is Angle1 = -0.1382, Angle2 = -2.1913, Angle3 = -0.0079.
When I visually inspected my plots (after plotting both the planes in a single figure), I got different angles. For example, I made Y= 0 (by simply rotating the plot in 3D such that only XZ plane is seen).
Next, I calculated the angle using atand((y2-y1)/(x2-x1)).
For the red plane, I got: atand((160-134)/(175-(-100))) = 5.4 degrees. (I reiterate, on manual visual inspection I got these points)
while for blue plane: atand((95-85)/(130-(-160))) = 1.9 degrees.
I know this is not an accurate method, but this is how I am veryfying at present, just to know if I'm heading towards the right direction. The difference should be around 3.4 degrees. This is not what I'm getting as Angle3 from the code.
Where am I going wrong? How else should I calculate the angles I want?
All the files referred to are here : https://www.dropbox.com/sh/zn1sz41z2qw7pxz/AAB0335ZLjwM73V5k2ogIA3ta?dl=0

Réponse acceptée

Matt J
Matt J le 26 Déc 2014
Modifié(e) : Matt J le 26 Déc 2014
Hard to answer, because it's unclear (to me) what it is you're trying to compute. Your 2 given planes, with normals N1 and N2, intersect the XY plane in 2 lines. Is it the angle between these lines that you want? If so, that angle is,
Nxy=[0 0 1]; %unit normal to XY plane
N1=N1/norm(N1); %make sure all normals are unit vectors
N2=N2/norm(N2);
Angle_XY=acosd(dot(cross(N1,Nxy), cross(N2,Nxy))); %the result
Same sort of thing for the XZ and YZ planes.
  2 commentaires
Meghana Dinesh
Meghana Dinesh le 27 Déc 2014
Modifié(e) : Meghana Dinesh le 27 Déc 2014
Hi Matt J,
Yes, the angle between these two lines is exactly what I want.
I tried out your code. I got different results, compared to mine.
Angle_XY = 89.856117248535160;
Angle_XZ = 5.374141216278076;
Angle_YZ = 6.248585224151611;
These angles seem to be more practical compared to the results I was getting, thanks for that.
This is what I used:
N1 = n_1;
N2 = n_2;
Nxy=[0 0 1]; %unit normal to XY plane
N1=N1/norm(N1); %make sure all normals are unit vectors
N2=N2/norm(N2);
Angle_XY=acosd(dot(cross(N1,Nxy), cross(N2,Nxy))); % result
Nxz=[0 1 0]; %unit normal to XZ plane
Angle_XZ=acosd(dot(cross(N1,Nxz), cross(N2,Nxz))); % result
Nyz=[1 0 0]; %unit normal to YZ plane
Angle_YZ=acosd(dot(cross(N1,Nyz), cross(N2,Nyz))); % result
Two planes have normal vectors n_1 and n_2 (which I get from Plane fit by Adrien Leygue). These two planes intersect the XY Plane and form two lines respectively. The angle between these two lines is Angle_XY. This is what I want.
Similarly with YZ and ZX planes.
I did not completely understand how you ended up with Angle_XY=acosd(dot(cross(N1,Nxy), cross(N2,Nxy))) . Where do you suggest I look to know more?
Also, is there a way I can find out the direction or rotation? ( Among the two planes, one is the reference plane which is fixed. Using Angle_XY=acosd(dot(cross(N1,Nxy), cross(N2,Nxy))) , I calculate the angle of rotation. But how can I get the direction of rotation? )
Matt J
Matt J le 27 Déc 2014
Modifié(e) : Matt J le 27 Déc 2014
I did not completely understand how you ended up with...
The line formed by the intersection of 2 planes with unit normals Na and Nb, has a unit Direction Vector, v, given by
v=cross(Na,Nb);
This is the unique (up to a sign) direction vector that is perpendicular to both Na and Nb, which it must be in order for the line to lie in both planes. Given 2 lines with unit direction vectors v1 and v2, the angle between the lines is the angle between their direction vectors, which is
angle=acosd(dot(v1,v2));
Also, is there a way I can find out the direction or rotation?
Given 2 direction vectors v1 and v2 separated by an angle theta, you can either rotate v1 toward v2 counter-clockwise about the axis cross(v1,v2) or rotate v2 toward v1 counter-clockwise about cross(v2,v1).

Connectez-vous pour commenter.

Plus de réponses (0)

Produits

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by