Package jinngine.geometry

Examples of jinngine.geometry.Box


    // start jinngine
    scene = new DefaultScene(new SAP2(), new NonsmoothNonlinearConjugateGradient(44), new DisabledDeactivationPolicy());
    scene.setTimestep(0.1);
   
    // add boxes to bound the world
    Body floor = new Body("floor", new Box(1500,20,1500));
    floor.setPosition(new Vector3(0,-30,0));
    floor.setFixed(true);
   
    Body back = new Body( "back", new Box(200,200,20));   
    back.setPosition(new Vector3(0,0,-55));
    back.setFixed(true);

    Body front = new Body( "front", new Box(200,200,20));   
    front.setPosition(new Vector3(0,0,-7));
    front.setFixed(true);

    Body left = new Body( "left", new Box(20,200,200));   
    left.setPosition(new Vector3(-35,0,0));
    left.setFixed(true);

    Body right = new Body( "right", new Box(20,200,200));   
    right.setPosition(new Vector3(10,0,0));
    right.setFixed(true);   
   
    Box boxgeometry = new Box(6,6,6);
    Body box = new Body( "box", boxgeometry );
    box.setPosition(new Vector3(-10,-11,-25));
       
    // add all to scene
    scene.addBody(floor);
View Full Code Here


    // start jinngine
    scene = new DefaultScene(new SAP2(), new NonsmoothNonlinearConjugateGradient(44), new DisabledDeactivationPolicy());
    scene.setTimestep(0.1);
   
    // add boxes to bound the world
    Body floor = new Body("floor", new Box(1500,20,1500));
    floor.setPosition(new Vector3(0,-30,0));
    floor.setFixed(true);
   
    Body back = new Body( "back", new Box(200,200,20));   
    back.setPosition(new Vector3(0,0,-55));
    back.setFixed(true);

    Body front = new Body( "front", new Box(200,200,20));   
    front.setPosition(new Vector3(0,0,-7));
    front.setFixed(true);

    Body left = new Body( "left", new Box(20,200,200));   
    left.setPosition(new Vector3(-35,0,0));
    left.setFixed(true);

    Body right = new Body( "right", new Box(20,200,200));   
    right.setPosition(new Vector3(10,0,0));
    right.setFixed(true);
   
    // create capsules
    UniformCapsule capgeo = new UniformCapsule(2,6);
    Body cap = new Body( "cap", capgeo );
    cap.setPosition(new Vector3(-10,-11,-25));

    UniformCapsule capgeo2 = new UniformCapsule(1.8,5);
    Body cap2 = new Body( "cap2", capgeo2 );
    cap2.setPosition(new Vector3(-10,-11,-25));

    UniformCapsule capgeo3 = new UniformCapsule(1.0,4);
    Body cap3 = new Body( "cap3", capgeo3 );
    cap3.setPosition(new Vector3(-10,-11,-25));

    UniformCapsule capgeo4 = new UniformCapsule(1.6,2);
    Body cap4 = new Body( "cap3", capgeo4 );
    cap4.setPosition(new Vector3(-10,-11,-25));

    // create a box
    Box boxgeometry = new Box(6,3,3);
    Body box = new Body( "box", boxgeometry );
    box.setPosition(new Vector3(-3,-11,-25));
   
    // add all to scene
    scene.addBody(floor);
View Full Code Here

    // start jinngine
    scene = new DefaultScene(new SAP2(), new NonsmoothNonlinearConjugateGradient(75), new DefaultDeactivationPolicy());
    scene.setTimestep(0.1);
   
    // add boxes to bound the world
    Body floor = new Body("floor", new Box(1500,20,1500));
    floor.setPosition(new Vector3(0,-30,0));
    floor.setFixed(true);
   
    Body back = new Body( "back", new Box(200,200,20));   
    back.setPosition(new Vector3(0,0,-55));
    back.setFixed(true);

    Body front = new Body( "front", new Box(200,200,20));   
    front.setPosition(new Vector3(0,0,-7));
    front.setFixed(true);

    Body left = new Body( "left", new Box(20,200,200));   
    left.setPosition(new Vector3(-35,0,0));
    left.setFixed(true);

    Body right = new Body( "right", new Box(20,200,200));   
    right.setPosition(new Vector3(10,0,0));
    right.setFixed(true);
   
    // head
    Geometry headgeometry = new Box(1,1,1);
    Body head = new Body( "head", headgeometry );
    head.setPosition(new Vector3(-5,-9.5,-25));

    // torso1
    Geometry torso1geometry = new Box(1.7,1,1.7);
    Body torso1 = new Body( "torso1", torso1geometry );
    torso1.setPosition(new Vector3(-5,-11,-25));

    Constraint neck = new UniversalJoint(head,torso1,new Vector3(-5,-10,-25), new Vector3(0,0,1), new Vector3(1,0,0));
    scene.addConstraint(neck);

    // torso2
    Geometry torso2geometry = new Box(1.5,1,1.5);
    Body torso2 = new Body( "torso2", torso2geometry );
    torso2.setPosition(new Vector3(-5,-12.5,-25));

    UniversalJoint spine = new UniversalJoint(torso1,torso2,new Vector3(-5,-12,-25), new Vector3(0,0,1), new Vector3(1,0,0));
    spine.getFirstAxisControler().setLimits(-0.2, 0.2);
    spine.getSecondAxisControler().setLimits(-0.2, 0.2);
    scene.addConstraint(spine);

    // torso3
    Geometry torso3geometry = new Box(1.2,1,1.2);
    Body torso3 = new Body( "torso3", torso3geometry );
    torso3.setPosition(new Vector3(-5,-14,-25));

    UniversalJoint spine2 = new UniversalJoint(torso2,torso3,new Vector3(-5,-13,-25), new Vector3(0,0,1), new Vector3(1,0,0));
    spine2.getFirstAxisControler().setLimits(-0.2, 0.2);
    spine2.getSecondAxisControler().setLimits(-0.2, 0.2);
    scene.addConstraint(spine2);

    // upper left arm
    Geometry upleftarmgeometry = new Box(0.5,2,0.5);
    Body upleftarm = new Body( "upleftarm", upleftarmgeometry );
    upleftarm.setPosition(new Vector3(-3.5,-12,-25));
   
    UniversalJoint leftshoulder = new UniversalJoint(torso1,upleftarm, new Vector3(-3.5,-11,-25), new Vector3(0,0,1), new Vector3(0,1,0));
    leftshoulder.getFirstAxisControler().setLimits(-0.5, 0.5);
    leftshoulder.getSecondAxisControler().setLimits(-0.5, 0.5);
    leftshoulder.getFirstAxisControler().setFrictionMagnitude(0.01);
    leftshoulder.getSecondAxisControler().setFrictionMagnitude(0.01);
    scene.addConstraint(leftshoulder);

    // upper right arm
    Geometry uprightarmgeometry = new Box(0.5,2,0.5);
    Body uprightarm = new Body( "uprightarm", uprightarmgeometry );
    uprightarm.setPosition(new Vector3(-6.5,-12,-25));
   
    UniversalJoint rightshoulder = new UniversalJoint(torso1,uprightarm, new Vector3(-6.5,-11,-25), new Vector3(0,0,1), new Vector3(0,1,0));
    rightshoulder.getFirstAxisControler().setLimits(-1.5, 1.5);
    rightshoulder.getSecondAxisControler().setLimits(-1.5, 1.5);
    rightshoulder.getFirstAxisControler().setFrictionMagnitude(0.01);
    rightshoulder.getSecondAxisControler().setFrictionMagnitude(0.01);
    scene.addConstraint(rightshoulder);
   
    // lower left arm
    Geometry lowerleftarmgeometry = new Box(0.5,1.5,0.5);
    Body lowerleftarm = new Body( "lowerleftarm", lowerleftarmgeometry );
    lowerleftarm.setPosition(new Vector3(-3.5,-14,-25));
   
    UniversalJoint leftelbow = new UniversalJoint(upleftarm, lowerleftarm, new Vector3(-3.5,-13.25,-25), new Vector3(1,0,0), new Vector3(0,1,0));
    leftelbow.getFirstAxisControler().setLimits(-0.0, 0.0);
    leftelbow.getSecondAxisControler().setLimits(-1.5, 1.5);
    leftelbow.getFirstAxisControler().setFrictionMagnitude(0.01);
    leftelbow.getSecondAxisControler().setFrictionMagnitude(0.01);
    scene.addConstraint(leftelbow);

    // lower right arm
    Geometry lowerrightarmgeometry = new Box(0.5,1.5,0.5);
    Body lowerrightarm = new Body( "lowerrightarm", lowerrightarmgeometry );
    lowerrightarm.setPosition(new Vector3(-6.5,-14,-25));
   
    UniversalJoint rightelbow = new UniversalJoint(uprightarm, lowerrightarm, new Vector3(-6.5,-13.25,-25), new Vector3(1,0,0), new Vector3(0,1,0));
    rightelbow.getFirstAxisControler().setLimits(-0.0, 0.0);
    rightelbow.getSecondAxisControler().setLimits(-1.5, 1.5);
    rightelbow.getFirstAxisControler().setFrictionMagnitude(0.01);
    rightelbow.getSecondAxisControler().setFrictionMagnitude(0.01);
    scene.addConstraint(rightelbow);

    // left thigh
    Geometry leftthighgeometry = new Box(0.5,1.5,0.5);
    Body leftthigh = new Body( "leftthigh", leftthighgeometry );
    leftthigh.setPosition(new Vector3(-5.5,-15.5,-25));

    UniversalJoint lefthip = new UniversalJoint(torso3, leftthigh, new Vector3(-5.5,-14,-25), new Vector3(1,0,0), new Vector3(0,0,1));
    lefthip.getFirstAxisControler().setLimits(-0.5, 0.5);
    lefthip.getSecondAxisControler().setLimits(-0.5, 0.5);
    lefthip.getFirstAxisControler().setFrictionMagnitude(0.01);
    lefthip.getSecondAxisControler().setFrictionMagnitude(0.01);
    scene.addConstraint(lefthip);

    // left taiba
    Geometry lefttaibageometry = new Box(0.5,1.5,0.5);
    Body lefttaiba = new Body( "lefttaiba", lefttaibageometry );
    lefttaiba.setPosition(new Vector3(-5.5,-17.5,-25));

    UniversalJoint lefttknee = new UniversalJoint(leftthigh, lefttaiba, new Vector3(-5.5,-16,-25), new Vector3(1,0,0), new Vector3(0,0,1));
    lefttknee.getFirstAxisControler().setLimits(-0.5, 0.5);
    lefttknee.getSecondAxisControler().setLimits(0, 0);
    lefttknee.getFirstAxisControler().setFrictionMagnitude(0.01);
    lefttknee.getSecondAxisControler().setFrictionMagnitude(0.01);
    scene.addConstraint(lefttknee);

   
    // right thigh
    Geometry rightthighgeometry = new Box(0.5,1.5,0.5);
    Body rightthigh = new Body( "rightthigh", rightthighgeometry );
    rightthigh.setPosition(new Vector3(-4.0,-15.5,-25));

    UniversalJoint righthip = new UniversalJoint(torso3, rightthigh, new Vector3(-4.0,-14,-25), new Vector3(1,0,0), new Vector3(0,0,1));
    righthip.getFirstAxisControler().setLimits(-0.5, 0.5);
    righthip.getSecondAxisControler().setLimits(-0.5, 0.5);
    righthip.getFirstAxisControler().setFrictionMagnitude(0.01);
    righthip.getSecondAxisControler().setFrictionMagnitude(0.01);
    scene.addConstraint(righthip);

    // right taiba
    Geometry righttaibageometry = new Box(0.5,1.5,0.5);
    Body righttaiba = new Body( "righttaiba", righttaibageometry );
    righttaiba.setPosition(new Vector3(-4.0,-17.5,-25));

    UniversalJoint righttknee = new UniversalJoint(rightthigh, righttaiba, new Vector3(-4.0,-16,-25), new Vector3(1,0,0), new Vector3(0,0,1));
    righttknee.getFirstAxisControler().setLimits(-0.5, 0.5);
View Full Code Here

    // start jinngine
    scene = new DefaultScene();
    scene.setTimestep(0.1);
   
    // add boxes to bound the world
    Body floor = new Body("floor", new Box(1500,20,1500));
    floor.setPosition(new Vector3(0,-30,0));
    floor.setFixed(true);
   
    Body back = new Body( "back", new Box(200,200,20));   
    back.setPosition(new Vector3(0,0,-55));
    back.setFixed(true);

    Body front = new Body( "front", new Box(200,200,20));   
    front.setPosition(new Vector3(0,0,-7));
    front.setFixed(true);

    Body left = new Body( "left", new Box(20,200,200));   
    left.setPosition(new Vector3(-35,0,0));
    left.setFixed(true);

    Body right = new Body( "right", new Box(20,200,200));   
    right.setPosition(new Vector3(10,0,0));
    right.setFixed(true);
   
    // create a box
    Box boxgeometry = new Box(2,2,2);
    Body box = new Body( "box", boxgeometry );
    box.setPosition(new Vector3(-10,-11,-25));
       
    // add all to scene
    scene.addBody(floor);
View Full Code Here

    // vertex lists
    final List<Vector3> result = new ArrayList<Vector3>();
    final List<Vector3> expect = new ArrayList<Vector3>();
   
    // setup box geometries
    final Box box1 = new Box(1,1,1);   
    box1.setEnvelope(1);
    final Box box2 = new Box(1,1,1);
    box2.setEnvelope(1);

    // attach geometries to bodies (to we can change the transform of the
    // boxes by changing the transform of the bodies)
    final Body body1 = new Body("box1", box1);   
    final Body body2 = new Body("box2", box2);
View Full Code Here

   */
  public void testRay4() {
    RayCast raycast = new RayCast();
   
    // setup cube geometry
    Box box = new Box(1,1,1);
    Body b1 = new Body("default", box);

    // select a point (5,1,0) and the raydirection (-1,0,0)
    Vector3 point = new Vector3(0, 5, 0);
    Vector3 direction = new Vector3(0,-1,0);
View Full Code Here

   */
  public void testRay5() {
    RayCast raycast = new RayCast();
   
    // setup cube geometry
    Box box = new Box(1,1,1);
    Body b1 = new Body("default", box);

    // select a point (5,1,0) and the raydirection (-1,0,0)
    Vector3 point = new Vector3(2, 5, 9);
    Vector3 direction = new Vector3(0.5,0.5,0.5).sub(point);
View Full Code Here

   
  }
 
  private final double[] pointsFromGeometry( Geometry g ) {
    if ( g instanceof Box ) {
      Box b = (Box)g;     
      Vector3 dims = b.getDimentions();
      double[] points =
        new double[] {
          dims.x*0.5,  dims.y*0.5,  dims.z*0.5,
          dims.x*-0.5, dims.y*0.5,  dims.z*0.5,
          dims.x*0.5,  dims.y*-0.5, dims.z*0.5,
 
View Full Code Here

  public void testSweepAndPrune1() {
   
    double epsilon = 1e-15;
   
    //create two cubes
    Box box1 = new Box(1,1,1);
    @SuppressWarnings("unused")
    Body b1 = new Body("Box 1", box1);
    Box box2 = new Box(1,1,1);
    Body b2 = new Body("Box 2", box2);
   
    // set the envelope size (or collision margin)
    final double env = 1.0;
    box1.setEnvelope(env);
    box2.setEnvelope(env);
   
   
    BroadphaseCollisionDetection.Handler handler = new Handler() {
      public void overlap(Pair<Geometry> pair) {
      }
View Full Code Here

TOP

Related Classes of jinngine.geometry.Box

Copyright © 2018 www.massapicom. 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.