Geometry: problem with defining the vertices of a tunnel around a given path

In summary, the conversation discusses the creation of a demo that features a tunnel with a smooth path generated in 3D space. The problem arises when trying to make the tunnel form around the path, especially when the path rotates around the x and y axes. The suggested solution is to create one object with equidistant points in a plane, and then sweep the plane around in 3D space while applying rotations to it. This will result in a smoother and more accurate tunnel shape. The conversation also mentions the possibility of gimbal lock and the need to carefully represent and apply rotations in order to avoid this issue.
  • #1
Xcrypt
21
0
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)

images: http://www.dropbox.com/gallery/22326841/1/Tunnel_Problem?h=293d6eAs 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 garbagestorm, I tried my best to explain...
Could anyone please help? :)
 
Last edited:
Physics news on Phys.org
  • #2
I think you'd be better off not trying to do it in two steps, i.e. creating the points on the path first, then trying to create the tunnel. Instead, think about one object, which is your center point, surrounded by some number of points equidistant from it and in all lying in the same plane. So for example the point (0,0,0) together with points (cos(k), sin(k), 0) where k goes in steps from 0 to 2pi. That all lives in the x-y plane.

Now to make your path, you want to sweep this plane around in 3D space. If you move the whole plane rigidly and in discrete steps, you'll get what you have now, which is a problem: the tunnel's cross section will become elliptical whenever the motion is not parallel to the z-axis. The last thing you will need to do is to rotate the plane so that it's always perpendicular to the motion vector. All you have to do is apply your "pitches" and "yaws" to the whole plane (which represents the cross-section of your tunnel) instead of just the center point (representing the path of travel). Bonus: you can apply "rolls", too, just by adding an offset to your angle k which you smoothly vary. In fact it will just be that the tunnel wall is twisted, but from the inside I bet it'll be indistinguishable from https://www.google.com/search?q=do+a+barrel+roll".

You might want to be careful about how you represent your rotations and apply them to your plane, however: look at the "gimbal lock" article (and the "see also" section for a good alternative) on Wikipedia.

Or it could be that for a demo, gimbal lock won't be apparent at all.
 
Last edited by a moderator:

FAQ: Geometry: problem with defining the vertices of a tunnel around a given path

1. What is the definition of a vertex in geometry?

A vertex in geometry is a point where two or more lines or edges meet to form a corner or angle.

2. How do you define the vertices of a tunnel around a given path?

The vertices of a tunnel around a given path can be defined as the points where the tunnel intersects with the path at each change in direction or angle.

3. Can a tunnel have more than two vertices?

Yes, a tunnel can have multiple vertices depending on the complexity of the path it is built around. For example, a tunnel with multiple curves or turns will have more than two vertices.

4. Is there a specific formula for calculating the vertices of a tunnel?

There is no specific formula for calculating the vertices of a tunnel, as it will vary depending on the shape and dimensions of the tunnel and the path it is built around. However, the vertices can be determined by identifying the points where the tunnel and the path intersect.

5. Can the vertices of a tunnel be changed after it has been built?

Yes, the vertices of a tunnel can be changed after it has been built, but it would require significant reconstruction and may not be feasible or cost-effective. It is important to carefully plan and define the vertices before building the tunnel.

Similar threads

Back
Top