Problem while writing function

Short answer; you can’t.

Long answer and a new hope; you can create (or at very least approximate) curves associated with explicit functions. That is, a curve whose locus is in the form (x, f(x)) or more generally (x(t), y(t)) where t is called the parameter and x(t) and y(t) are the functions which map the parameter value onto x and y coordinates respectively.

For example, to draw the standard sine wave, substitute these function: x(t)=t, y(t)=\text{sin}(t).

Your function is not explicit, it’s implicit. Meaning the locus of the curve isn’t parametrised, but defined as the set of all points whose x and y coordinates satisfy a certain equality.

What you can do is test for a specific point whether it’s on the curve or not, but there’s no good way of finding these points, let alone find them in the correct order.

Your possible options going forwards are:

  1. Convert your function into an explicit one. This is sometimes possible, sometimes not. It’s never easy in my experience.
  2. Convert your function directly into a Nurbs curve. Technically Nurbs curves can exactly represent conic sections, no approximation required. But I’m not sure how to do this, well beyond my pay grade. You can consider asking the math-heads in the rhino developer category.
  3. Approximate your curve by creating a flat mesh grid, evaluating your function value at each mesh vertex, assign the result to the z-coordinate, and ultimately intersect your mesh at z=0.0. I’ve taken this approach before and it works, but yields a polyline approximation of the actual curve.
5 Likes