unit GLRevolutionMeshObject;
{
TGLRevolutionMeshObject
A class used to build revolution onjects with features, such as shafts /
columms, or with some work freeform.
Each section leaves an index value to the last ring of Vertices made.
Callable routines should have the option to use previous ring, mainly
for use with rounded features where the normals are the same for both
edges of the feature.
If previous ring is not used at a given Z then dup points will be
generated, generally with a differing normal, which creates a hard edge.
Hopefully this will create a topologically correct mesh, with minimum
number of vertices.
Setting FaceGroups[0]).Mode to fgmmQuads will generate quad faces.
The default is triangular faces.
Mesh density can be radially increased/decreased through
MakeTransitionFiner and MakeTransitionCoarser. This is a stateful change
which will keep the new density until another call is made.
NOTE: mesh density changing can only be used with triangular meshes.
Revolutions should be built from the 'top' down. Top for solid rotations
means highest point that meets the Z axis. See Drilled hole example.
For shelled ojects such as a tube, top is the lowest Z point and the inside
of the shelled rotation is generated first.
Edges are stored with an index to the first ring and the ring size.
This ring and the next ring should have congruent vertices. But this will
allow only one ring to be used if we need to collapse the edges for export,
reducing the risk of holes at the edge vertices. Plus we can dispay them
for debugging :) where we forget to set a UsePrevious to True.
TODO
Add in Tex coords obviously only one is needed as the conic will
use either u or v for the wrap round, and the other specified in the call
to build the section? More thought required but basically not of interest
for my immediate needs.
Optimisation Techniques Used.
Sine and cosine calls removed from any inner loop by using predefined
x,y 2D unit vectors.
Z components and normals are optimised by taking into account the fact that
any affine vector rotated around the Z axis will have the same z value.
So if we calculate that once in 2D space on a major axis, the x.z plane
for instance, the y component of the 2D unit vector becomes the z part
of the unit 3D vector and the x component becomes a scaling factor to
use with the predefined xy unit vector array.
Added bonus to the above approach is we are calculating unit vector
normals. No need to call normalise on the Normals saving a sqrt call
per vertex.