#### Archived

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

# Lines Intersecting planes

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

## Recommended Posts

I have two points in 3d space. They lie on opposite sides of a plane. Now, I also have some math stuff in there to calculate the point of intersection along the line formed by the two points and the plane. However, the resulting points dont end up being on the plane in most cases, but they are pretty darn close. All this is because floats dont have infinite precssision (doh! . Does anyone know if there is a way to work around this WITHOUT making the plane "thick"? If the plane is thick, a polygon intersecting the plane that is split in two might change the geometry that it is a part of. Meaning that geometry might not look the same. A cube might no longer actualy be a cube.

##### Share on other sites
a) use doubles instead of floats to get more precision.

b) You could use an own data format to calculate with rational numbers a/b:
struct rational{ long a; unsigned long b;}

where a contains also the sign (you could also make b signed instead of a).
TRy to divide a and b by a (positive) integer with a % integer == b % integer == 0.
To determine which is the biggest integer you can do this with, use following algorithm (use only the amount of the signed var):
unsigned long BiggestDivisor(unsigned long a, unsigned long b){ while (a!=b) { if (a>b) a -= b; else b -= a; } return a;}

If the precision is not high enough, you could use "very big integers" which are described in "Help with HUGE numbers!?!"(General and Game Programming Discussion, last post 16 April) for a and b.

GA

##### Share on other sites
... and try to divide a and b by an integer after each operation!

GA

• 40
• 15
• 10
• 23
• 19