Angle between two planes on the X=0, Y=0 and Z=0 planes
9 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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
0 Commenti
Risposta accettata
Matt J
il 26 Dic 2014
Modificato: Matt J
il 26 Dic 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 Commenti
Matt J
il 27 Dic 2014
Modificato: Matt J
il 27 Dic 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).
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Spline Postprocessing in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!