Take for instance the computer rendering of this implicit surface:

http://xahlee.info/surface/cayley_cubic/cayley_cubic.html

The image shows a grid on the surface. How do I calculate the connection points of this grid? I want to create a 3D mesh representation of it in other software (a video game actually).

Thanks!

up vote 0 down vote accepted

Display grid lines are almost always the isoparametric lines corresponding to some parameterization. Specifically, if the surface parameterization is $(u,v)\mapsto \mathbf S(u,v)$, then the grid lines are curves of the form $(u,v)\mapsto \mathbf S(u,v_0)$ and $(u,v)\mapsto \mathbf S(u_0,v)$, for fixed $u_0$ and $v_0$.

So, if you have some choice about the kinds of surfaces you're going to use, choose ones that are easy to parameterise (at least piecewise, anyway).

In your picture of the Cayley surface, it looks like it's parameterized by $x$ and $y$ (in each quadrant separately). So, for any given $x$ and $y$, you can "shoot" a ray in the vertical direction (parallel to the $z$-axis) and intersect it with the surface. This gives you a parameterization $(x,y)\mapsto \mathbf S(x,y)$. But this kind of intersection process is very slow, so, again, best to choose surfaces that have a nice simple parameterization, if you can.

If parameterizations are difficult to construct, then another approach is direct tesselation of the implicit surface. This won't give you grid lines, but it will give you triangles, which is probably what you need for graphics. This is a fairly well researched topic. Many people use some variant of the "marching cubes" algorithm. If you search for "tesselation" and "implicit surfaces", you will find plenty of material.

  • Is there at least a cheap way of plotting (random is OK) points that fall "within" (or under) the curve or surface? – posfan12 Aug 25 '13 at 5:06
  • Well, you can fill space with points that lie on some $xyz$ grid. Then, for each point, you can check whether it lies inside or outside the surface. If the surface equation is $f(x,y,z)=0$, then the "inside" points are ones for which $f(x,y,z) < 0$. This is cheap, and will work OK for things like ellipsoids, if you use enough points. In some ways, this is a very rudimentary version of "marching cubes". – bubba Aug 25 '13 at 9:27
  • That's what I ended up doing. One additional problem with this method is that there are a lot of "misses" where f(x,y,z) > 0 and the shape you are trying to "hit" has a low volume but a large bounding box. My script is running longer than it otherwise would as a result. – posfan12 Sep 4 '13 at 20:26

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.