Example usage for javax.media.j3d BoundingBox BoundingBox

List of usage examples for javax.media.j3d BoundingBox BoundingBox

Introduction

In this page you can find the example usage for javax.media.j3d BoundingBox BoundingBox.

Prototype

public BoundingBox(Point3d lower, Point3d upper) 

Source Link

Document

Constructs and initializes a BoundingBox given min,max in x,y,z.

Usage

From source file:BoundsTest.java

Group createColorCubes() {
    Group group = new Group();

    // defaults//w w  w  .  j a va2s.c o m
    ColorCube cube1 = new ColorCube(1.0);
    group.addChild(cube1);

    // explicitly set the bounds (box)
    ColorCube cube2 = new ColorCube(2.0);
    cube2.setBoundsAutoCompute(false);
    Bounds bounds = new BoundingBox(new Point3d(-2, -2, -2), new Point3d(2, 2, 2));
    cube2.setBounds(bounds);
    cube2.setCollisionBounds(bounds);
    group.addChild(cube2);

    // (sphere)
    ColorCube cube3 = new ColorCube(4.0);
    cube3.setBoundsAutoCompute(false);
    bounds = new BoundingSphere(new Point3d(0, 0, 0), 4);
    cube3.setBounds(bounds);
    cube3.setCollisionBounds(bounds);
    group.addChild(cube3);

    // auto compute, manual collision
    ColorCube cube4 = new ColorCube(6.0);
    cube4.setBoundsAutoCompute(true);
    bounds = new BoundingBox(new Point3d(-10, -10, -10), new Point3d(10, 10, 10));
    cube4.setCollisionBounds(bounds);
    group.addChild(cube4);

    // auto compute both
    ColorCube cube5 = new ColorCube(6.0);
    cube5.setBoundsAutoCompute(true);
    group.addChild(cube5);

    return group;
}