Archived

This topic is now archived and is closed to further replies.

Intersection of 3 Planes

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

Recommended Posts

First of all , Hi What i am trying to do is to get the intersection point among 3 Planes . The data type i use for all variables/member variables is double. So , after processing , i get intersection points that have a X , Y , Z value like this : -1.#IND00 or 1.#ND00 the intersection formula i use is : input to intersection are 3 Planes , described as a Normal and Distance from origin . OutVec = ( Math3D_VecOp_Cross( inPlane2.m_Normal , inPlane3.m_Normal) ) * inPlane1.m_D + ( Math3D_VecOp_Cross( inPlane3.m_Normal , inPlane1.m_Normal) ) * inPlane2.m_D + ( Math3D_VecOp_Cross( inPlane1.m_Normal , inPlane2.m_Normal) ) * inPlane3.m_D / denom; do you see any problems / have any clues ?

Share on other sites
There are a few questions you have to answer before you actually
start calculating the intersection point:

1) are the planes co-planar ? if so, you have either no intersection at all or all planes are the same.

2) are at 2 planes co-planar ? if so, you get no intersection point, but a line.

3) are the planes intersecting at a single point ? first, you calculate the intersection line of two of the planes. the result is a line. if this line is co-linear to the direction-vectors of the last plane, the line either lies in the plane or it is parallel to it. if it is not co-linear, you can calculate the intersection point of the line and the plane.

hope this helps

Share on other sites
thanks , i do check whether the planes are parallel by comparing the denom to epsilon and -epsilon. Anything wrong with my code ? Also , what strange value is that for a double : "-1.#IND00" , anyone knows what it indicates ?

[edited by - MrNeedHelp on August 16, 2003 1:57:43 PM]

Share on other sites
That''s not the value of the number but what google shows.I believe it means "wrong indirection".I might flag division by zero too.

"Tonight we strike,there is thunder in the sky,together we''ll fight,some of us will die,but they''ll always remember that we''ve made a stand and many will die by hand!" - ManOwaR

Share on other sites
All what you need

  Point3d common_point(plane p1, plane p2, plane p3){    Matrix3d matrix = new Matrix3d();    matrix.setColumn(0, p1.normal);    matrix.setColumn(1, p2.normal);    matrix.setColumn(2, p3.normal);    double determinant = 1d/matrix.determinant(),           dot_1       = p1.normal.dot(p1.a_point),           dot_2       = p2.normal.dot(p2.a_point),           dot_3       = p3.normal.dot(p3.a_point);    Vector3d cross_1_2 = new Vector3d(),             cross_2_3 = new Vector3d(),             cross_3_1 = new Vector3d();    cross_1_2.cross(p1.normal,p2.normal);    cross_2_3.cross(p2.normal,p3.normal);    cross_3_1.cross(p3.normal,p1.normal);    cross_2_3.scale(dot_1);    cross_1_2.scale(dot_3);    cross_3_1.scale(dot_2);    Vector3d set_point  = new Vector3d(cross_1_2);    set_point.add(cross_3_1);    set_point.add(cross_2_3);    set_point.scale(determinant);    return new Point3d(set_point);  }

I''m a java3D/JOGL programmer so all my stuff is written in java

Share on other sites
quote:
Original post by MrNeedHelp
OutVec = ( Math3D_VecOp_Cross( inPlane2.m_Normal , inPlane3.m_Normal) ) * inPlane1.m_D +
( Math3D_VecOp_Cross( inPlane3.m_Normal , inPlane1.m_Normal) ) * inPlane2.m_D +
( Math3D_VecOp_Cross( inPlane1.m_Normal , inPlane2.m_Normal) ) * inPlane3.m_D
/ denom;

I don''t know where that formula comes from, but can''t you solve it as a 3x3 matrix problem, with gaussian elimination? Each plane equation is one line of your matrix:
Ax + By + Cz = -D

Cédric

Share on other sites
-1.#IND00 usually means divide by 0 or square-root of a negative number or something along those lines.

Share on other sites
Now, just as a note I am not sure this works. I think it works if I remember my math right but to be honest I already used too much time writing this down =P I need to get back to work.

The lines with the numbers 1, 2, 3 represent the three plane equations I am using to solve the problem and their progression throughout it.

1 A1x+B1y+c1z=-D1
2 A2x+B2y+c2z=-D2 - 1*A2/A1
3 A3x+B3y+c3z=-D3 - 1*A3/A1

InvA1 = 1/A1
Scale = A2*InvA1
2B2 = (B2-B1*(Scale))
2C2 = (C2-C1*(Scale))
2D2 = (D2-D1*(Scale))

Scale = A3*InvA1
2B3 = (B3-B1*(Scale))
2C3 = (C3-C1*(Scale))
2D3 = (D3-D1*(Scale))

1 A1x+B1y+C1z=-D1
2 2B2y+2C2z=-2D2
3 2B3y+2C3z=-2D3 - 2*2B2/2B3

Inv2B2 = 1/2B2
Scale = 2B3*Inv2b2
3C3 = (2C3-2C2*(Scale))
3D3 = (3D3-2D2*(Scale))

1 A1x+ B1y+ C1z= -D1
2 2B2y+2C2z=-2D2
3 3C3z=-3D3

z = (-3D3/3C3)
y = ((-2D2-2C2z)*Inv2B2)
x = (-D1-B1y-C1z)*InvA1;

You would need to of course make sure that A1 and 2B2 would not be zero.

For A1 you need to wisely pick plane 1 where its A is not zero, if you cannot find a plane that satisfies this then they dont all intersect at a point.

For 2B2 you need to make sure that B2 != -B1*(A2/A1)

I cant think of any elegant solutions to this off the top of my head since it once again involves plane ones equation, but theres only 6 possible combinations to satisfy both requirements so .. *shrugs*

If I counted correctly thats only
div 3
mult 13
subt 11

but that doesnt include anything needed to figure out which planes to use for which eqn

Sorry I didnt have more time to check it.

// Full Sail Student with a passion for games
// This post in no way indicates my being awake when writing it

Share on other sites
This value is also known as NaN : Not a Number.

It is the result of invalid operations, like 0/0, infinity-infinity...

A ''simple'' division by zero would yield an infinite result, which is a ''number''.

[ Start Here ! | How To Ask Smart Questions | Recommended C++ Books | C++ FAQ Lite | Function Ptrs | CppTips Archive ]
[ Header Files | File Format Docs | LNK2001 | C++ STL Doc | STLPort | Free C++ IDE | Boost C++ Lib | MSVC6 Lib Fixes ]

Share on other sites
thanks all , but , what formula should i use to have a function where my input is 3 planes and the output is 1 point . Pls dont post matrix math , it must be something similar to the original formula i posted ! a code exaple would be very helpful too , thanks all for your great help!

1. 1
Rutin
32
2. 2
3. 3
4. 4
5. 5

• 11
• 13
• 87
• 11
• 10
• Forum Statistics

• Total Topics
632973
• Total Posts
3009617
• Who's Online (See full list)

There are no registered users currently online

×