Package org.ode4j.math

Examples of org.ode4j.math.DVector3


 
  private static DVector3 getRandomVector (Random r, double minValue, double maxValue) {
    double x = ((int) ((minValue+r.nextDouble()*(maxValue-minValue)) * 1000)) / 1000.;
    double y = ((int) ((minValue+r.nextDouble()*(maxValue-minValue)) * 1000)) / 1000.;
    double z = ((int) ((minValue+r.nextDouble()*(maxValue-minValue)) * 1000)) / 1000.;
    return new DVector3(x,y,z);
  }
View Full Code Here


    return "defaultmaster-fr.rocket";
  }

  @Override
  public void runBeforeSimulation(RocketEnv env, ParCollection params) {
    env.setGravity(new DVector3(0, 0, -2.1));
    env.setMu(0.0000001);
    int maxX = params.getParValueInt("numX");
    int maxY = params.getParValueInt("numY");
    int maxZ = params.getParValueInt("numZ");
    double facX = 1.1;
View Full Code Here

    double z = ((int) ((minValue+r.nextDouble()*(maxValue-minValue)) * 1000)) / 1000.;
    return new DVector3(x,y,z);
  }
 
  private static BodyPart createRandomBodyPart (Random r) {
    DVector3 size = getRandomVector(r, .5, 2);
    DVector3 relPos = getRandomVector(r, -1, 1);
    double max = Math.max(relPos.get0(), relPos.get1());
    max = Math.max(max, relPos.get2());
    relPos = new DVector3(
        ((int)(relPos.get0()/max*1000))/1000.,
        ((int)(relPos.get1()/max*1000))/1000.,
        ((int)(relPos.get2()/max*1000))/1000.
        );
    return new BodyPart(size, relPos);
  }
View Full Code Here

  @Override
  public void runDuringSimulation(RocketEnv env, Wink currentSimTime,
      ParCollection params) {
    env.step(currentSimTime);
    RocketAgent rocket = (RocketAgent) env.getAgent(0);
    DVector3 pos = rocket.getPosition().clone();
    VideoPluginLWJGL.setCameraToLookAtPositionFromSpecifiedDistance(pos.get0(), pos.get1(), pos.get2(), 15);
  }
View Full Code Here

    return true;
  }
 
  @Override
  public DVector3 getPosition() {
    DVector3 vec = null;
    return vec;
  }
View Full Code Here

      joints[i].setParamFMax(TORQUE);
      joints[i].setParamVel(0);
    }
   
    lastPos = new DVector3(getPosition());
  }
View Full Code Here

    double delta[] = new double[3];
    for (int i = 0; i < 3; i ++) {
      delta[i] = getPosition().get(i) - lastPos.get(i);
    }
    lastPos.set(getPosition());
    return new DVector3(delta[0],delta[1],delta[2]);
  }
View Full Code Here

    super(id, env, params);
   
    DMass mass = OdeHelper.createMass();
    DBody body = OdeHelper.createBody(env.getWorld());
    body.setPosition(position);
    DVector3 size = new DVector3(1,1,1);
    mass.setBox(1, size.get0(), size.get1(), size.get2());
    body.setMass(mass);
    DGeom geom = OdeHelper.createBox(size.get0(), size.get1(), size.get2());
    geom.setBody(body);
    env.getSpace().add(geom);
   
    bodies.add(body);
    geoms.add(geom);
View Full Code Here

    return true;
  }
 
  @Override
  public DVector3 getPosition() {
    DVector3 vec = null;
    return vec;
  }
View Full Code Here

    super(id, env, params);
   
    this.distance = radius * distancefactor;
   
    double initialOffset = -1.*gridSize/2. * distance;
    DVector3 initialPos = new DVector3(initialOffset, initialOffset, 2.5);
   
   
//    int bodycounter = 0;

    bodyMatrix = new DBody[gridSize][gridSize];
    geomMatrix = new DGeom[gridSize][gridSize];
       
    int numberOfJoints = (gridSize)*(gridSize-1) + (gridSize-1)*(gridSize);// + (width-1)*(height-1)*2;
    DUniversalJoint[] joints2 = new DUniversalJoint[numberOfJoints];
   
    // place spheres
    for (int x = 0; x < gridSize; x++) {
      for (int y = 0; y < gridSize; y++) {
        bodyMatrix[x][y] = OdeHelper.createBody(env.getWorld());
        bodies.add(bodyMatrix[x][y]);
        bodyMatrix[x][y].setPosition(initialPos.get0()+x*distance,
            initialPos.get1() + y * distance,
            initialPos.get2());
        DMass mass = OdeHelper.createMass();
        mass.setSphereTotal(sphereMass, radius);
        masses.add(mass);
        bodyMatrix[x][y].setMass(mass);
        geomMatrix[x][y] = OdeHelper.createSphere(env.getSpace(),
View Full Code Here

TOP

Related Classes of org.ode4j.math.DVector3

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.