Hi James,

   There is a bug in v1.1 which did not compute the bounding box

as expected. Using v1.2beta2 it works fine. The following is return.

Bounding box: Lower=0.0 0.0 0.0 Upper=76.26190185546875 17.0 0.20000000298023224


Thanks.

- Kelvin

------------
Java 3D Team
Sun Microsystems Inc.

>X-Unix-From: [EMAIL PROTECTED]  Tue Apr 18 12:57:55 2000
>X-Sender: [EMAIL PROTECTED]
>Mime-Version: 1.0
>Date: Tue, 18 Apr 2000 14:43:17 -0500
>From: James <[EMAIL PROTECTED]>
>Subject: [JAVA3D] How do I get the bounds?
>To: [EMAIL PROTECTED]
>
>Hello,
>
>I sent this earlier, but got no response. Hopefully some Java3d wizards out
>there will help me out :)
>
>I'm trying to get the size of the 3d text I'm placing on the screen,
>however, everytime I call getLower or getUpper, it returns 0. Any help
>would would be appreciated. The code is simply as follows:
>
>Font3D f3d = new Font3D(new Font(fontName, fontStyle, fontSize), new
>FontExtrusion());
>Text3D txt = new Text3D(f3d, text.toString());
>txt.setCapability(txt.ALLOW_BOUNDING_BOX_READ);
>
>Shape3D sh = new Shape3D();
>sh.setGeometry(txt);
>
>objTrans.addChild(sh);
>
>BoundingBox bb = new BoundingBox();
>txt.getBoundingBox(bb);
>System.out.println(bb);
>
>The output is: Bounding Box: Lower=0.0 0.0 0.0 Upper=0.0 0.0 0.0
>
>Any ideas?
>Regards,
>James
>
>===========================================================================
>To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
>of the message "signoff JAVA3D-INTEREST".  For general help, send email to
>[EMAIL PROTECTED] and include in the body of the message "help".
import java.awt.*;
import javax.media.j3d.*;

public class Test {


    public static void main(String[] args) {

        Font3D f3d = new Font3D(new Font("Serif",  Font.BOLD, 12), new
                                FontExtrusion());

        Text3D txt = new Text3D(f3d, "Hello World");
        txt.setCapability(txt.ALLOW_BOUNDING_BOX_READ);

        Shape3D sh = new Shape3D();
        sh.setGeometry(txt);

        Group objTrans = new Group();
        objTrans.addChild(sh);

        BoundingBox bb = new BoundingBox();
        txt.getBoundingBox(bb);
        System.out.println(bb);


    }

}

Reply via email to