sphere's not being drawn to scale??

17 views
Skip to first unread message

lenore...@7hills.org

unread,
Sep 1, 2017, 3:16:17 PM9/1/17
to Glowscript Users

I'm creating two spheres with the following code.

var Rball = sphere({pos:vec(0.0,0.0,0.0), v:vec(0.0,0.0,0.0), color:color.red, radius:radii})
var Bball = sphere({pos:vec(0.0,2.01*radii,0.0), v:vec(0.0,0.0,0.0), color:color.blue, radius:radii})

Depending on what value I assign to radii, the spheres show up as overlapping, almost touching or separated by a diameter or more but they should always be just about touching.  The apparent size of the spheres (relative to a fixed-size box also in the scene) does not vary with the value of radii.  How do I get spheres to be drawn to scale?  I have a feeling I've seen something about this in the past, but I can't remember what.

Bruce Sherwood

unread,
Sep 1, 2017, 4:32:11 PM9/1/17
to Glowscript Users, lenore...@7hills.org
The fact that you use the keyword "var" means that you must be writing your programs in JavaScript, in which case the sphere object does not have a radius attribute. This doesn't give an error, because JavaScript objects, like Python objects, permit the addition of new attributes on the fly. You need to use "size" to adjust the size of your JavaScript spheres.


Bruce Sherwood

unread,
Sep 1, 2017, 4:37:20 PM9/1/17
to Glowscript Users, lenore...@7hills.org
Reply all
Reply to author
Forward
Message has been deleted
0 new messages