The VRML drinking glass constructor code provides a set of classes and interfaces (pure abstract classes):
radius()return the glass' extensions;
profile()is a method that returns the glass radius calculated from the glass' z coordinate.
EpGlassProfilewith the ISO 3591-1977 glass measurements.
getpoints(buf, scale)that calculates the vertices of a circle's regular polygon representation.
static hint(n)returns a hint on the up-rounded optimal number of vertices for faster
The main code implements
which writes a VRML 1.0 representation of the GlassProfile to ostream
It generates a Coordinate3 entity with a number of trapezii depending
on the chosen resolution.
The glass will be seamless since the circle points are not doubly
Note: The program is free software; you can redistribute it and/or modify it. It is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
VRML samples: ISO glass and Bordeaux glass
More info on the
ISO 3591-1977 glass.
Screen shots from a VRML viewer: #1, #2.
1 Quick measurements have shown that using template based <iostream> output operations roughly doubles the performance of the drinking glass constructor on a typical win32 based system (using dynamic libc).
In the CirclePoints model, setting the number of vertices to a multiple
of eight enables
getpoints() to transform a calculated
point to seven symmetrical points and use additional eight
The algorithm uses four lines of symmetry in this case.
However, the less symmetrical cases are also handled.
Keywords: VRML glass, VRML drinking glass, virtual reality modeling language, VRML, VRML 1.0, world/vrml, x-world/x-vrml, circle points mathematics, circle mathematics, source code, C++