Subject:
|
RE: Quad intersections
|
Newsgroups:
|
lugnet.cad.dev
|
Date:
|
Mon, 5 Apr 1999 07:25:41 GMT
|
Viewed:
|
773 times
|
| |
| |
Hi Steve,
I've been lurking for a while and thought your post was interesting enough
to figure it out. I brushed off my Calculus text book, and after a page and
a half of algebra, and remembering what determinants and cross products are
all about I believe that I have the answer.
The formula for a plane can be expressed as:
ax + by + cz = d, where a, b, c, and d are all constants.
Given 3 points (x0, y0, z0) (x1, y1, z1) (x2, y2, z2)
a = y0*z1 - y0*z2 - y1*z0 + y1*z2 + y2*z0 - y2*z1
b = - x0*z1 + x0*z2 + x1*z0 - x1*z2 - x2*z0 + x2*z1
c = x0*y1 - x0*y2 - x1*y0 + x1*y2 + x2*y0 - x2*y1
d = a*x0 + b*y0 + c*z0
Note for d you can substitue any of the 3 points (by definition they all
have to give the same answer).
Now that you know a, b, c, d and assuming that you're given x and z, then:
by = d - ax - cz
and
y = d/b - ax/b - cz/b
The fourth point on the quad is redundant, although you can check it by
plugging it into the formula for the plane and verifying that ax3 + by3 +
cz3 is within some small epsilon of d (the small epsilon is to account for
floating point round off errors).
Of course, now that you've found y, you probably need to verify that (x, y,
z) actually falls within the given quad (as they say in the textbooks, this
is an exercise left for the reader).
If anyone is interested in a more detailed derivation, I'd be happy to share
the gory details.
---
Dave Hylands Email: DHylands@creo.com 3700 Gilmore Way
Principal Software Developer Tel: (604) 451-2700 x2329 Burnaby B.C.
Creo Products Inc. Fax: (604) 437-9891 Canada V5G 4M1
-----Original Message-----
From: blisses@worldnet.att.net [mailto:blisses@worldnet.att.net]
Sent: Friday, April 02, 1999 7:16 PM
To: lugnet.cad.dev@lugnet.com
Subject: Quad intersections
Can anyone explain how to intersect a quad? I'm sure I can figure it out
on my own, but if someone knows of some straightforward formulae, I'd be
very appreciative.
Since this is for LDraw, I've got the following situation:
Conditions:
- Four points to make a quad (or, to be simpler, 3 points to make a
triangle).
- Two components for another point (probably X and Z, but it doesn't really
matter which two).
Needed:
- Value for third component.
TIA for any help!
Steve
|
|
Message has 2 Replies: | | Re: Quad intersections
|
| Dave, Thank you very much! This will help me on some parts-work I was avoiding, just because I didn't want to figure out these intersections. I'm planning on uploading a spreadsheet with some basic interpolation and intersection templates. Do you (...) (26 years ago, 5-Apr-99, to lugnet.cad.dev)
| | | Re: Quad intersections
|
| Based on Dave's formulae, I have been able to calculate the intersection of a plane (given three points) and a line (given two points). How do I then determine whether the point of intersection falls within a quad (as in Dave's "exercise left for (...) (26 years ago, 16-Apr-99, to lugnet.cad.dev)
|
5 Messages in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|