# extrude along an arbitrary vector?

I have arbitrary orthogonal vectors float X, Y, Z;
where X is the vector that I want to extrude a polygon that is in Y, Z coordinates.
For example, I have a polygon (-.25,3; 2,3; 2,2.5; .25,2.5; .25,-2.5, 2,-2.5, 2,-3; -.25,-3)
which I want to extrude along the arbitrary (not global) X axis with a length L
The origin of this extrusion is at (x, y, z), where (x, y, z) are in global coordinates.

Presumably, all that I need is the appropriate glRotate command, but I can’t figure out how to get that directly from the X, Y & Z vectors.

[QUOTE=wmelgaard;1287340]
Presumably, all that I need is the appropriate glRotate command, but I can’t figure out how to get that directly from the X, Y & Z vectors.[/QUOTE]
glRotate() generates an orthonormal matrix, but there’s no requirement that X,Y,Z are orthonormal.

You probably want glMultMatrix(), with X, Y, Z and the origin forming the columns and the fourth row being [0,0,0,1].

Translation along the X axis by distance L corresponds to following that with glTranslate(L,0,0).

That works
For my example, polygon in Y-Z plane, extruding in X; origin at GLfloat x,y,z:

``````GLfloat matrix;
glPushMatrix();
glTranslatef(x, y, z);
matrix = Y; matrix = Y; matrix = Y; matrix = 0.0;
matrix = Z; matrix = Z; matrix = Z; matrix = 0.0;
matrix = X; matrix = X; matrix = X; matrix = 0.0;
matrix = 0; matrix = 0; matrix = 0; matrix = 1.0;
glMultMatrix(matrix);