COMPGROUPS.NET | Search | Post Question | Groups | Stream | About | Register

### Drawing a cylinder along an arbitrary axis with gluCylinder

• Email
• Follow

```Hey all,

I want to draw a cylinder (using glyCylinder) so that it spans two points p1
and p2, and am having trouble with it somewhere. The gluCylinder method draws
the geometry so that it starts at (0,0,0) and goes to (0,0,h) where h is the
height of the cylinder in this case. So, I have to transform those coordinates
into the ones I want by using the model-view matrix.

So, first off, I can translate the coordinate system so that I am going from 0
to pd = p2 - p1. That's easy enough.

However, rotating the system is more complicated. I know that I can get the
angles that describe the vector pd by doing atan2( pd.y, pd.x) and things like
that. However, how do I compose those angles into the quaterian-style
rotations that I need so that (0, 0, h) transforms to the vector pd?

Thanks.

Dave
```
 0

See related articles to this posting

0 Replies
432 Views

Similar Articles

12/7/2013 11:22:05 AM
[PageSpeed]