x


Segment, plane intersection

Hi all,

I am working on a mesh spawning algorithm to be used for special effects, and need to calculate random segment intersections against a plane.

There's lots of info regarding this subject for other platforms, but I could find nothing about Unity and, albeit the problem is certainly trivial for those with a math background, the subject is horribly complicated for those that don't have one.

Basically, I can easily understand if a segment, formed by two points P1 and P2 intersects a plane with a simple distance calculation, but finding the exact intersection point on such plane, defined as Unity's planes through a Vector3 normal and an origin Vector3 point, is giving me unexpected results.

For example, I'm using the following formula, given d1 and d2 as float distance respectively from P1 and P2 to the plane,

Vector3 intersection = (d2*P1 + d1*P2) / (d1 + d2);

but the results I get are -never- exactly on the plane, but always slightly in front or behind it.

So I am hoping somebody knows a better formula that can give exact results instead of the approximation than the above formula seems to perform.

Thanks in advance.

more ▼

asked Feb 05 '12 at 08:29 AM

roamcel gravatar image

roamcel
1.2k 37 40 44

(comments are locked)
10|3000 characters needed characters left

0 answers: sort newest
Be the first one to answer this question
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x248
x132
x19
x7
x3

asked: Feb 05 '12 at 08:29 AM

Seen: 746 times

Last Updated: Feb 05 '12 at 08:35 AM