Click here to Skip to main content
15,881,766 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
To get line of intersection of two planes,firstly,i take cross product of normal of planes ,doing this i get line vector which is parallel to line of intersection of two planes.By solving two linear equations formed by normals of plane,i get one of point coordinate as '-infinity'.so please suggest me valid value for this '-infinity' coz i have to show this point on screen.
normal1-->(-0.0034999,0.0,-2.493929)-->One[]
normal2-->(-1.0,0.0,-83.38241)-->Two[]

Following is function used to solve above equation

C#
public static void Solve2LinearEqnsWith2Unknowns(double[] One, double[] Two,
                                                      out double X, out double Y)
     {
         double term1 = (One[0] * Two[2]) - (Two[0] * One[2]);
         double term2 = (One[0] * Two[1]) - (Two[0] * One[1]);

         try
         {
                     
             Y = term1 / term2;

             if (One[0] == 0)
                 X = (Two[2] - (Two[1] * Y)) / Two[0];
             else
                 X = (One[2] - (One[1] * Y)) / One[0];

                 Y = double.IsNaN(Y) ? 0 : Y;
                 X = double.IsNaN(X) ? 0 : X;
         }
         catch (DivideByZeroException exc)
         {
             throw new DivideByZeroException(exc.Message);
         }
     }
Posted
Updated 9-Jun-15 23:03pm
v2
Comments
Richard MacCutchan 10-Jun-15 5:51am    
-infinity is obviously not a valid answer for the point to lie on the planes. Check your calculations.
Anup6 10-Jun-15 6:11am    
I am checking for values as given in my question.I get y as '-infinity'.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900