2

I am trying to find the intersection point of a curve and a 3D surface with no luck. The surface is in the shape of a cone, and the curve is hyperbolic, as are shown in the figure. CONE AND THE CURVE

This simulates a ray hits a certain surface. I tried to use bisection method, but it doesn't seem to work. then I tried newton's algorithm, but the results are still not good.

Is there any other good algorithms out there which are suitable for solving this kind of problem?

stgatilov
  • 5,333
  • 31
  • 54
user49114
  • 23
  • 1
  • 3
  • 1
    I don't understand really: do you have two curves to intersect in 3D space? Do you know that curves almost surely do not intersect in 3D if they are positioned randomly? Or you need to intersect some hyperbolic curve with a conic surface? – stgatilov Dec 28 '15 at 04:54
  • @ stgatilov, I only use one curve to intersect with a surface, and I know the functions of the curve and the surface already. what i wanted to do is to find the intersection point, that's all. just a root-finding problem. In 2D, bisection method is very useful and simple. but in 3D, I think bisection method is not valid anymore(due to the complexity of the function). – user49114 Dec 28 '15 at 05:07
  • You might want to look at the interval Newton method - see [wikipedia - interval arithmetic](https://en.wikipedia.org/wiki/Interval_arithmetic). I've *not* got so far as trying this myself, but it seems to be basically a robust and reliable version of the basic Newton method - capable of guaranteeing to find all roots IIRC, even in the presence of floating point rounding errors, which are often the cause of "mathematically correct" methods failing in practice. –  Dec 28 '15 at 18:27
  • What do you call an hyperbolic curve ? Do you mean a hyperbola ? If yes, this is a planar curve and you can recast the question as the intersection of two conics, in 2D. Your drawing even seems to show that the curve belongs to the cone ! –  Dec 28 '15 at 21:36
  • @ stgatilov thank you – user49114 Dec 29 '15 at 00:56
  • @ Steve314, thank you. I will try it again. – user49114 Dec 29 '15 at 00:57
  • @ Yves Daoust, Thank you and yes,hypobola, My drawing is bad, sorry.The conical surface is an oblique one, that caused a lot of my problems. – user49114 Dec 29 '15 at 01:00

2 Answers2

1

With the curve given in parametric form

x = fx(t)
y = fy(t)
z = fz(t)

and the surface by one equation of the form

g(x,y,z) = 0

just plug in the curve functions and bisection should work:

g(fx(t), fy(t), fz(t)) = 0

The only problem is to find suitable starting points t1 and t2 where g has opposite sign.

Henry
  • 42,982
  • 7
  • 68
  • 84
0

Problem

You are searching for a curve-surface intersection algorithm. Note that both curves and surfaces can be represented in either implicit form or in parametric form. Surface in implicit form is defined by equation F(x, y, z) = 0, which is a quadratic polynomial of x, y, z in case of conic surface. Surface in parametric form is defined by point-valued function S(u, v) of its parameters (e.g. you can use distance along cone axis and polar angle as parameters of conical surface). Curve is usually described only in parametric form, as a function C(t) with parameter t, which could be quadratic for a hyperbolic curve.

Implicit surface

The simplest cases of all is to treat your problem as an intersection of parametric curve against implicit surface. In this case you can write down a single equation q(t) = F(C(t)) = 0 with single variable t. Of course, Newton's iteration is not guaranteed to find all solutions in general case, bisection can only surely find one solution if you find two points with different sign of q(t).

In your case q(t) is a quartic polynomial (after putting quadratic curve parametrization into quadratic surface equation). It can be theoretically solved with Ferrari's analytic formula, but I strongly advise against it, because it is quite unstable numerically. You can apply any popular polynomial solver here, like Jenkins-Traub algorithm or eigenvalues algorithm for companion matrix (also see this question). You can also use methods of interval mathematics: for example, you can recursively subdivide the domain interval of parameter t into smaller pieces, while pruning all the pieces that surely do not contain zeros (interval arithmetic would help you to detect such pieces).

Parametric surface

Now we can move on to the case when both the curve and the surface are represented parametrically. I do not know any solutions that could benefit from the fact the your surface is conical and your curve is hyperbolic, so you have to apply the general curve-surface intersection algorithm. Alternatively, you can fit an implicitly-defined cone into your parametric surface, then use the solution above for quartic polynomial roots.

A lot of reliable general intersection algorithms are based on the subdivision method (which is actually interval mathematics again). The general idea is to continiously divide the curve and the surface into smaller and smaller pieces. The pairs of pieces which surely do not intersect are dropped as soon as possible. At the end you'll have a set of small piece pairs, tightly bounding your intersection points. Yoy might want to run Newton's iteration from them in order to make intersection points precise.

Here is the outline of a sample algorithm:

  1. Start with a single curve piece (the whole input curve) and a single surface piece (whole surface), and one potentially intersection pair (PIP) of these pieces.
  2. Subdivide each curve piece into two halves (by parameter), subdivide each surface piece into four quadrants (by both parameters).
  3. For each old PIP check all 8 pairs of curve half vs surface quadrant. If they surely do not intersect, forget them. If they can intersect, save them as a new PIP.
  4. Unless all pieces are small enough, repeat from step 2 with new pieces and PIP-s.

For each pair of curve piece and surface piece, you have to check whether they can potentially intersect, which can be easily done by checking their axis-aligned bounding boxes. Also, you can represent your curves and surfaces as NURBS, in which case you can use convex hulls as tighter bounding volumes.

Generally, there are tons of variations and improvements of this algorithms. I advise the following literature for deeper knowledge:

  • Shape interrogation for computer-aided design and manufacturing.
    1. chapter 4: for root solvers
    2. section 5.7: for curve-surface intersection
  • PhD of Michael Hohmeyer.
    1. section 4.5: for curve-surface intersection
    2. sections 4.1 and 4.2: for convex hulls intersection (if you are brave enough).

Bottom line

If you are seeking for a simple and working solution, and you are sure that hyperbolas and cones are the only things you have to worry about, then you'd better use implicit definition of cone and solve quartic equation with some standard numerical algorithm from a good library available to you.

Community
  • 1
  • 1
stgatilov
  • 5,333
  • 31
  • 54
  • Thank you so much, my cone is an oblique cone, so I wrote it in a parametric from, and that's why I find the bisection method is kinda difficult to use here. – user49114 Dec 29 '15 at 01:09
  • @user49114: I believe any oblique circular cone is an ordinary elliptic cone. Moreover, you can directly write it down as a quadratic implicit surface. Imagine that apex point it located at the origin, base plane is parallel to Oxy plane, base circle has center point *P0 = (x0, y0, z0)* and radius *r*. Denote `t = z/z0`, then the equation should be `(x - x0*t)^2 + (y - y0*t)^2 = (r * t)^2`, which is obviously quadratic by *x, y, z*. – stgatilov Dec 29 '15 at 04:29