Examples of Box


Examples of com.nr.cg.Box

    // Test setouterbox in 2D
    Point lo2=new Point(0.0,0.0),hi2=new Point(1.0,1.0);
    qotree2.setouterbox(lo2,hi2);

    // Test qobox in 2D
    Box b2=new Box(2);
    b2=qotree2.qobox(1);
//    System.out.printf(dist(b2.lo,lo2));
    localflag = dist(b2.lo,lo2) > sbeps;
    globalflag = globalflag || localflag;
    if (localflag) {
      fail("*** Qotree,2D: Outer box lower corner improperly set");
     
    }

//    System.out.printf(dist(b2.hi,hi2));
    localflag = dist(b2.hi,hi2) > sbeps;
    globalflag = globalflag || localflag;
    if (localflag) {
      fail("*** Qotree,2D: Outer box upper corner improperly set");
     
    }

    Point half=new Point(hi2.x[0]/2.0,hi2.x[1]/2.0);

    b2=qotree2.qobox(2);
//    System.out.printf(dist(b2.hi,half));
    localflag = dist(b2.hi,half) > sbeps;
    globalflag = globalflag || localflag;
    if (localflag) {
      fail("*** Qotree,2D: Box 2 upper corner should be in center of outer box");
     
    }

    b2=qotree2.qobox(5);
//    System.out.printf(dist(b2.lo,half));
    localflag = dist(b2.lo,half) > sbeps;
    globalflag = globalflag || localflag;
    if (localflag) {
      fail("*** Qotree,2D: Box 5 lower corner should be in center of outer box");
     
    }

    // Test qowhichbox in 2D
    Sphcirc s2 = new Sphcirc(2);
    s2.center=new Point(5.5/16.0,10.5/16.0);
    int ans[]={1,4,15,239};
    for (i=0;i<4;i++) {
      s2.radius=0.25/pow(2.0,i);
      nbox=qotree2.qowhichbox(s2);
//      System.out.printf(s2.radius << " %f\n", nbox);

      localflag = (nbox != ans[i]);
      globalflag = globalflag || localflag;
      if (localflag) {
        fail("*** Qotree,2D: Method qowhichbox() identified wrong box for specified circle");
       
      }
    }

    // Test qostore in 2D
    s2.center=new Point(5.5/16.0,10.5/16.0);
    for (i=0;i<4;i++) {
      s2.radius=0.25/pow(2.0,i);
      nbox=qotree2.qostore(s2);
//      System.out.println("box: %f\n", nbox);

      localflag = (nbox != ans[i]);
      globalflag = globalflag || localflag;
      if (localflag) {
        fail("*** Qotree,2D: Method qostore() stored specified circle in wrong box");
       
      }
    }

    // Test qoerase in 2D
    s2.center=new Point(5.5/16.0,10.5/16.0);
    for (i=0;i<4;i++) {
      s2.radius=0.25/pow(2.0,i);
      nbox=qotree2.qoerase(s2);
//      System.out.printf(nbox);

      localflag = (nbox != ans[i]);
      globalflag = globalflag || localflag;
      if (localflag) {
        fail("*** Qotree,2D: Method qoerase() removed circle from wrong box");
       
      }
    }

    // Store 16 circles in the tree
    s2.center=new Point(5.5/16.0,10.5/16.0);
    for (i=0;i<4;i++) {
      s2.radius=0.25/pow(2.0,i);
      qotree2.qostore(s2);
    }
    s2.center=new Point(10.5/16.0,10.5/16.0);
    for (i=0;i<4;i++) {
      s2.radius=0.25/pow(2.0,i);
      qotree2.qostore(s2);
    }
    s2.center=new Point(10.5/16.0,5.5/16.0);
    for (i=0;i<4;i++) {
      s2.radius=0.25/pow(2.0,i);
      qotree2.qostore(s2);
    }
    s2.center=new Point(5.5/16.0,5.5/16.0);
    for (i=0;i<4;i++) {
      s2.radius=0.25/pow(2.0,i);
      qotree2.qostore(s2);
    }

    // Test qoget in 2D
    Sphcirc[]list2=new Sphcirc[N];
    nlist=qotree2.qoget(1,list2,N);
    System.out.println(nlist);
    for (i=0;i<nlist;i++)
      System.out.printf( "%f %f  %f\n", list2[i].center.x[0], list2[i].center.x[1] , list2[i].radius);

    localflag = (nlist != 4);
    globalflag = globalflag || localflag;
    if (localflag) {
      fail("*** Qotree,2D: Method qoget() found the wrong number of circles in Box 1");
     
    }

    localflag=false;
    for (i=0;i<nlist;i++) {
      nbox=qotree2.qowhichbox(list2[i]);
      localflag = localflag || (nbox != 1);
    }
    globalflag = globalflag || localflag;
    if (localflag) {
      fail("*** Qotree,2D: Method qoget() returned a circle that is not in Box 1");
     
    }
   
    // Test qodump in 2D
    int[] klist2=new int[N];
    nlist=qotree2.qodump(klist2,list2,N);
//    System.out.printf(nlist);

    localflag = (nlist != 16);
    globalflag = globalflag || localflag;
    if (localflag) {
      fail("*** Qotree,2D: Method qodump() did not find all 16 circles in the tree");
     
    }
   
    // Test qocontainspt in 2D
    Point p2=new Point(5.5/16.0,10.5/16.0);
    nlist=qotree2.qocontainspt(p2,list2,N);
//    System.out.printf(nlist);

    localflag = (nlist != 4);
    globalflag = globalflag || localflag;
    if (localflag) {
      fail("*** Qotree,2D: Method qodump() did not find all 4 circles with the given point");
     
    }

    for (i=0;i<nlist;i++) {
      localflag = dist(p2,list2[i].center) > list2[i].radius;
      globalflag = globalflag || localflag;
      if (localflag) {
        fail("*** Qotree,2D: Method qodump() returned a circle that does not contain the given point");
       
      }
    }

    // Test qocollides in 2D
    s2.center=new Point(0.75,0.75);
    s2.radius=0.10;
    nlist=qotree2.qocollides(s2,list2,N);
//    System.out.printf(nlist);

    localflag = (nlist != 3);
    globalflag = globalflag || localflag;
    if (localflag) {
      fail("*** Qotree,2D: Method qocollides() did not find 3 circles that collide with target");
     
    }

    for (i=0;i<nlist;i++) {
      localflag = (dist(list2[i].center,s2.center) > list2[i].radius+s2.radius);
      globalflag = globalflag || localflag;
      if (localflag) {
        fail("*** Qotree,2D: Incorrect collision detection by method qocollides()");
       
      }  
    }

    // Test Qotree in 3D
    Qotree qotree3=new Qotree(3,N,N,5);

    // Test setouterbox in 3D
    Point lo3=new Point(0.0,0.0,0.0),hi3=new Point(1.0,1.0,1.0);
    qotree3.setouterbox(lo3,hi3);

    // Test qobox in 3D
    Box b3=new Box(3);
    b3=qotree3.qobox(1);
//    System.out.printf(dist(b3.lo,lo3));
    localflag = dist(b3.lo,lo3) > sbeps;
    globalflag = globalflag || localflag;
    if (localflag) {
View Full Code Here

Examples of com.sun.j3d.utils.geometry.Box

        else if(_primitiveClass==Cone.class){
            _result=new Cone(_radius, _height, genFlag,
                    _divisions, _heightDivisions, null);
        }
        else if(_primitiveClass==Box.class){
            _result=new Box(_radius, _height, _depth, genFlag, null, 6);
        }
        else {
            try {
                _result=_primitiveClass.newInstance();
            } catch (InstantiationException e1) {
View Full Code Here

Examples of com.sun.media.imageioimpl.plugins.jpeg2000.Box

                    break;
                default:
                    if (metadata != null) {
                        byte[] data = new byte[length];
                        in.readFully(data, 0, length);
                        metadata.addNode(new Box(length + 8,
                                                 box,
                                                 longLength,
                                                 data));
                    }
                }
View Full Code Here

Examples of de.lessvoid.nifty.layout.Box

    currentScreen.resetLayout();
    currentScreen.layoutLayers();
  }

  private void updateLayoutPart(final LayoutPart layoutPart, final int width, final int height) {
    Box box = layoutPart.getBox();
    box.setWidth(width);
    box.setHeight(height);
    BoxConstraints boxConstraints = layoutPart.getBoxConstraints();
    boxConstraints.setWidth(new SizeValue(width + "px"));
    boxConstraints.setHeight(new SizeValue(height + "px"));
  }
View Full Code Here

Examples of def_classes.Box

 
  /**
   * Returns the current view of the display
   */
  public Box getCurrentView() {
    return new Box();
  }
View Full Code Here

Examples of eas.simulation.spatial.sim2D.physicalSimulation.physicsEngine.net.phys2d.raw.shapes.Box

  @Override
    public int collide(Contact[] contacts, PhysicsAgent2D<?> bodyA, PhysicsAgent2D<?> bodyB) {
    int numContacts = 0;
   
    Line line = (Line) bodyA.getBodyShape();
    Box box = (Box) bodyB.getBodyShape();
   
    Vector2f lineVec = new Vector2f(line.getDX(), line.getDY());
    lineVec.normalise()
    Vector2f axis = new Vector2f(-line.getDY(), line.getDX());
    axis.normalise();
   
    Vector2f res = new Vector2f();
    line.getStart().projectOntoUnit(axis, res);
    float linePos = getProp(res,axis);
   
    Vector2f c = MathUtil.sub(bodyB.getPosition(),bodyA.getPosition());
    c.projectOntoUnit(axis,res);
    float centre = getProp(res, axis);
   
    Vector2f[] pts = box.getPoints(bodyB.getPosition(), bodyB.getRotation());
    float[] tangent = new float[4];
    float[] proj = new float[4];
   
    int outOfRange = 0;
   
View Full Code Here

Examples of edu.cmu.cs.stage3.math.Box

  }
  public Box getBoundingBox( ReferenceFrame asSeenBy, HowMuch howMuch, boolean ignoreHidden ) {
    if( asSeenBy==null ) {
      asSeenBy = this;
    }
    Box box = new Box( null, null );
    updateBoundingBox( box, asSeenBy, howMuch, ignoreHidden );
    return box;
  }
View Full Code Here

Examples of edu.vt.rt.datastructures.util.Box

  @Override
  public boolean add(E value) {
    DirectoryManager locator = HyFlow.getLocator();
    IDContainer<ImmutableHashMap<E, E>> container = (IDContainer<ImmutableHashMap<E, E>>) locator.open(containerID, "r");
    final ImmutableHashMap<E, E> map = container.getItem();
    Box found = new Box(null);
    final ImmutableHashMap<E, E> newMap = map.put(value, value, found);
    if (found.value != null) {
      return false;
    }
    container = (IDContainer<ImmutableHashMap<E, E>>) locator.open(containerID, "w");
View Full Code Here

Examples of gov.nasa.worldwind.geom.Box

        if (this.coordBuffer == null)
            return null;

        // Compute a bounding box around the vertices in this shape.
        this.coordBuffer.rewind();
        Box box = Box.computeBoundingBox(new BufferWrapper.FloatBufferWrapper(this.coordBuffer),
            ColladaAbstractGeometry.COORDS_PER_VERTEX);

        Matrix matrix = this.computeRenderMatrix(dc);

        // Compute the corners of the bounding box and transform with the active transform matrix.
        List<Vec4> extrema = new ArrayList<Vec4>();
        Vec4[] corners = box.getCorners();
        for (Vec4 corner : corners)
        {
            extrema.add(corner.transformBy4(matrix));
        }
View Full Code Here

Examples of gov.nasa.worldwind.render.Box

        {
        }

        public RigidShape createShape(WorldWindow wwd, boolean fitShapeToViewport)
        {
            RigidShape shape = new Box();
            shape.setAttributes(getDefaultAttributes());
            shape.setValue(AVKey.DISPLAY_NAME, getNextName(toString()));
            this.initializeShape(wwd, shape, fitShapeToViewport);

            return shape;
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.