gleTwistExtrusion(3GLE)

πŸ’– gleTwistExtrusion β€” it's giving twisted, bestie

okay so this is gleTwistExtrusion(3GLE), a page from the GLE manual (yes, section 3GLE, we're fancy like that ✨). It's the one where you take a lil 2D contour and yeet it along a 3D path while twisting it as you go. Spiral-core. Main character energy fr.


✨ NAME ✨

gleTwistExtrusion β€” extrude an arbitrary 2D contour along an arbitrary 3D path, and specify local rotations (aka twists) while you do it πŸ’…


🌸 SYNTAX 🌸

void gleTwistExtrusion (int ncp,
                gleDouble contour[][2],
                gleDouble cont_normal[][2],
                gleDouble up[3],
                int npoints,
                gleDouble point_array[][3],
                float color_array[][3],
                gleDouble twist_array[]);

copy that exactly, no cap, don't get creative with it 🫢


πŸŽ€ ARGUMENTS πŸŽ€

  • ncp β€” the number of contour points. count them. be honest.
  • contour β€” the 2D contour itself πŸ¦‹
  • cont_normal β€” the 2D contour normals
  • up β€” the up vector for the contour
  • npoints β€” numpoints in the poly-line
  • point_array β€” the polyline vertices
  • color_array β€” colors at the polyline verts 🌈
  • twist_array β€” contour twists, measured in degrees

πŸ’… DESCRIPTION πŸ’…

So here's the tea: you extrude an arbitrary 2D contour along an arbitrary 3D path, and you also get to specify local rotations (twists). As the contour gets extruded, it gets twisted by however much you put in the array called twist_array. Those angles are measured in degrees, and the rotation happens about the origin of the contour coordinate system</span>. periodt.

The argument contour specifies the 2D contour that's getting extruded, while point_array specifies the path you're extruding it along. The vector up defines the orientation of the contour's y-axis in real 3D space. slay.

⚠️ okay important, bestie, listen: neither the very first segment nor the very last segment are drawn. Those two end segments exist only to define the angle of the join at the very ends of the polyline. so the math is mathing like this: to draw one segment, you must specify three. To draw two segments, you must specify four, etc. it's giving "off by two" but it's on purpose 😭

The normal array may be NULL. If it is, normal vectors will NOT be automatically generated, and honestly? the object will look terrible when lit. πŸ’€ like, glow-down of the century.

The color array may be NULL. If it's NULL, the current color is used. If it's not NULL, the glColor3f() routine is used to set the color β€” which means if you specify the glColorMaterial() subroutine before this primitive, you can use it to set diffuse, specular, ambient, etc. colors. iconic behavior, we love options πŸ‘‘


πŸ¦‹ SEE ALSO πŸ¦‹

  • gleExtrusion
  • gleSuperExtrusion

go read those too, they're the sister pages, the trio is unmatched πŸ’œ


πŸ‘‘ AUTHOR πŸ‘‘

Linas Vepstas (linas@linas.org) β€” the actual legend who wrote this. thank you for your service 🫑


okay that's the whole page!! GLE 3.0, gleTwistExtrusion(3GLE) β€” mwah, go twist something pretty πŸ’–βœ¨πŸŽ€