Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to create some kind of demo that rushes through a tunnel.

I have made a random path generator that creates smooth looking paths in 3D space (just some 3D points)

Now I would like to create polies that form a tunnel around that path.

To give an example, let us assume that the path only extends towards the Z axis. (so path_pos.x and path_pos.y will remain 0)

then I could define the positions of the vertices as:

x = path_pos.x + cos(t)*radius;

y = path_pos.y + sin(t)*radius;

z = path_pos.z;

However, as mentioned before, I would like the polies to form a smooth tunnel around that path, and the path rotates to the x and y axis as it progresses.

This means that we have to adjust the formula, else it would start looking deformed, and the radius of the tunnel would be depending on the angles between the path points...

(See the given image, the small green circles represent the path points, and the red lines represent circles on which I have to define the points of the polies) (first image is the problem rendered with 3dsmax, second and third are images made with paint to represent the problem more mathematically)


top view: (check first comment below) The Pitch and Yaw of the path can happen simultaneously.

As we can see from the image, the x and y component from path_pos2 could actually be the same than the ones from path_pos1, with a different Z component for every point in the circle.

I could define the following:

z = path_pos.z + ( ( cot( (anglebetween([p1,p2],[p2,p3])/2 ) * (radius*2) ) *
( (radius*2)/(radius+(y-p2.y)) ) );

But I think this is only the case because the line(path_pos1,path_pos2) is parallel to the Z axis.

When the path starts making 'rotations'/'turns', both around x(pitches) and y(yaws) axis, I'm not sure how to define the points around the pathpoint that should form an ellipse, so that the radius of the tunnel would remain the same (except in the actual corners, for efficiency).

I really hope this doesn't sound like a shitstorm, I tried my best to explain... Could anyone please help? :)

share|cite|improve this question
up vote 1 down vote accepted

I think the term under which you should search is sphere sweep (or swept sphere). Here is an example from POV-ray:
(Image from this link.)

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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