(Fwd) SPEC: Proposal for Generalized Cylinder primitive

Chris Marrin ([email protected])
Mon, 5 Jun 1995 16:32:56 -0700


The mention of a Torus primitive made me think about a node created by a
member of the Inventor team. It is called Generalized Cylinder. To use
it you define 4 vertex lists: profileCoords, crossSectionCoords,
spineCoords, and twistCoords. A shape is generated from the coordinate
lists as follows:

- crossSectionCoords provides a 2D cross section of the shape
- The cross section follows the path given by the spineCoords (at point
in the spine the cross section is tangent to the spine).
- At each point along the spine the cross section is scaled by the 2D
profile in profileCoords
- The cross section is twisted at each vertex of the spine by the
corresponding value in twistCoords (in radians)

This allows you to create extrusions (crossSection provides 2D shape,
extrudes along profile), surface of rotation or lathing (specify a
circular shape for crossSection, profile gives edge shape), or path based
object such as picture frames (define a rectangle in spineCoords, and
define the edge of the frame with a crossSection).

A torus is just a circle for the crossSection and a circle for the spine.
Admittedly this is not a mathmatically correct torus since you're just
approximating a circle with a coordinate list, but it does a very fine job
for our purposes. And it can be easily decimated by the author for LOD
purposes by removing points from the various point lists.

Playing with the coordinates enough can generate an amazing variety of
shapes. All the current primitives in VRML can be simulated quite well
(just to show it's flexibility. I would not suggest replacing them).

The spineCoords are not restricted to 2D points so nice 3D shapes such as
springs and tentacles are possible.

We will put the source for this node into the public domain if adopted to
overcome the issues of implementation. It outputs a FaceSet,
TriangleStripSet or QuadStripSet so it should work well with underlying
VRML primitives regardless of the direction we take.

For the format, I propose the following:

-----------------------

PARTS
SIDES The sides of the shape
TOP The top surface (cross section scaled by 1st profile vertex)
BOTTOM The bottom surface (cross section scaled by by last profile
vertex)
ALL All parts

GeneralizedCylinder {
crossSection # MFVec2f
spine # MFVec3f
profile # MFVec2f
twist # MFFloat
parts # SFBitMask
}

---------------------------

As for the details of the implementation (for those of you into normals
and backface culling):

Order of resulting faces will be according to the right hand rule with
respect to the spine. A counter clockwise cross section will result in
counter clockwise ordering of the faces. Setting shape hints to
COUNTERCLOCKWISE and SOLID will cause the outer surface to be visible. A
hint of CLOCKWISE (or a clockwise ordering of the cross section) will
cause the inner surface to be visible.

Textures would be applied similarly to a cylinder, wrapped around the
sides with a reasonable top and bottom orientation. Texture transform can
change all this. Also, the PER_PART or PER_PART_INDEXED material bindings
are allowed to change materials on the sides, top and bottom individually.

Comments?

-- 
chris marrin      Silicon      http://www.sgi.com/Products/WebFORCE/WebSpace
(415) 390-5367    Graphics     http://reality.sgi.com/employees/cmarrin/
[email protected]   Inc.         
         "As a general rule, don't solve puzzles that open portals to Hell."