I've been working on this problem for a couple of days - and have a solution below which achieves the correct result.
However I'm looking to make this much more efficient in order to use in animation.
I'd be grateful for any pointers!
"John D'Errico" <firstname.lastname@example.org> wrote in message <email@example.com>... > "Peter Schreiber" <firstname.lastname@example.org> wrote in message <email@example.com>... > > Hi guys, > > I'm trying to find the line surface intersection in following program. For now I can > > assume that there is one and only one such intersection possible. The code works > > but I was wondering if anyone has any ideas improving the speed/performance. > > Is there something that can be vectorized or are there any other ways to improve > > speed? > > > > Ugh. Personally, that code looks like it runs like a dog > with two legs. I would completely rewrite it. > > The idea is to rotate the surface so that the line becomes > a coordinate axis. This makes the intersection a far more > trivial one. Then, identify those simplexes which MAY > possibly intersect the axis in question using either a > circumsphere or a bounding box. (I don't recall which > I used.) Now just test each potential simplex more > accurately. > > I've got some code that I can give out to compute this > intersection of a general line with any n-manifold. A surface > would qualify if you have a triangulation for it, and that > triangulation is trivial to generate for z(x,y). If there are > multiple points of intersection, all of them are generated. > A quick check shows that the code I wrote generates the > point of closest approach if the line fails to intersect the > manifold at all. > > You can do a large fraction of this in a vectorized form. > > John