Improved documentation of compound

18 views
Skip to first unread message

Bruce Sherwood

unread,
Dec 16, 2017, 3:49:20 PM12/16/17
to VPython-users
The text below has been added to the Help at glowscript.org on compound objects. In the next release of VPython 7 there will be an informative error message when the vertex limit is exceeded. (The error message is already given in GlowScript VPython.)

Limitation on the number of objects to compound: In the WebGL 3D graphics library that is used by VPython, a compound cannot have more than 65536 (2**16) vertexes (pos, normal, color), due to WebGL using 16-bit integers to reference the vertexes. For example, a box object has 8*3 = 24 vertex objects, because each corner requires three vertex objects, all with the same positions but with three different normals. That means that a list of boxes to compound must not contain more than int(65536/24) = 2730 boxes. A cylinder, in order to have smooth sides, requires 206 vertexes, so a list of cylinders to compound must not contain more than int(65536/206) = 318 cylinders. If you need to compound more than 2730 boxes, a way to deal with the limitation is to make several compounds, each with less than 2730 boxes (and it may be convenient to store these compounds in a list). You can compound a list of compound objects, but the total number of vertexes cannot exceed the limit.


Currently here are the number of vertexes in each of the basic objects: box 24, cylinder 206, sphere 991, pyramid 16, cone 604, ring 1280. Consequently, at present the limits on the number of objects that can be compounded are these (if all the objects are boxes, or cylinders, etc.): box 2730, cylinder 318, sphere 66, pyramid 4096, cone 108, ring 51.





Reply all
Reply to author
Forward
0 new messages