Question

I'm teaching myself computer graphics using Computer Graphics Through OpenGL by Sumanta Guha. I seem to have hit a small blocker when it comes to one of the exercises.

It asks the reader to "plump" a Toroidal Helix with n coils. By this, it means to render a 3D pipe in the shape of a toroidal helix that loops around n times. I was able to devise the parametric equations for the toroidal helix curve, but am having trouble with the maths to solve for the parametric equations of the 3D pipe.

The parametric equations for a toroidal helix curve is as follows:

The torus being wrapped around has inner radius (the hole in the centre of the "doughnut") R and outer radius r.

Given a parameter t, on the range [-PI, PI]

x = (R + r*cos(n*t)) * cos(t)
y = (R + r*cos(n*t)) * sin(t)
z = r*sin(n*t)

Obviously we will need another parameter and another radius for the actual pipe.

Any ideas on how to start solving this problem? I've banged my head against it a little and haven't been able to.

Thanks!

Était-ce utile?

La solution

For each point p(t) on your helix you need to create a circle of vertices. Compute the tangent to the curve by finding p(t+d), for some small value of d. Normalise the vector p(t)->p(t+d) - this is the normal of the plane on which the vertices of your pipe will lie.

Project the vector from p(t) to the origin onto this plane. The first vertex in the circle should lie on this projection, with the rest advancing in rotation around the plane normal. This will provide a consistent direction for each circle so that you can stitch the vertices together into triangles.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top