circle3d dimensions are treated as half dimensions


#1

See the script below. Note how in order for the rectangle3d and circle3d overlays to have the same width and height you need to set the size property of the circle3d to half that of the size property for the rectangle3d.

Is this really desiable? Shouldn’t the circle3d overlay use the same “full width and height” dimensions as the rectangle3d?

Note: JavaScript synonoums for “size” are “dimensions” and “scale”. Subproperties may be either “x” and “y” or “width” and “height”.

var rectangle3d,
    circle3d;

function setUp() {

    var WHITE = { red: 255, blue: 255, green: 255 },
        RED = { red: 255, blue: 0, green: 0 },
        ZERO_ROTATION = { x: 0, y: 0, z: 0, w: 1 },
        position;

    rotation = ZERO_ROTATION;
    position = Vec3.sum(MyAvatar.position, { x: 0, y: 0, z: -4 });

    rectangle3d = Overlays.addOverlay("rectangle3d", {
        size: { x: 1.0, y: 0.5 },
        color: RED,
        alpha: 1.0,
        solid: true,
        visible: true,
        position: Vec3.sum(position, { x: 0, y: 0, z: -0.001 }),
        rotation: rotation
    });

    circle3d = Overlays.addOverlay("circle3d", {
        size: { x: 0.5, y: 0.25 },
        color: WHITE,
        alpha: 1.0,
        solid: true,
        visible: true,
        position: position,
        rotation: rotation
    });

}

function tearDown() {
    Overlays.deleteOverlay(rectangle3d);
    Overlays.deleteOverlay(circle3d);
}

setUp();
Script.scriptEnding.connect(tearDown);

#2

Any thoughts on this @huffman @Atlante45 @ZappoMan?


#3

Screensnap…


#4

Maybe there was a reason to do it this way, but if not, I agree the circle3d overlay should be rendering at half that size (consistent with rectangle3d).


#5

Interestingly, it appears that circle3d overlays are not used anywhere in the JavaScript examples or Interface code. So I propose that I update circle3d to use the configured size as its full width and height. (In addition to making the properties’ usage more intuitive, it will simplify the overlay intersection calculations I’m working on.)


#6

I’ve modified the circle3d overlay rendering to draw the circles such that their specified dimensions are the circle’s overall width and height (rather than half their width and height). This is included in the code for Worklist #20282, currently in QA.