Package eas.simulation.spatial.sim2D.physicalSimulation.physicsEngine.net.phys2d.math

Examples of eas.simulation.spatial.sim2D.physicalSimulation.physicsEngine.net.phys2d.math.Vector2f.sub()


    if(collideSide==COLLIDE_NONE)
      return;
   
    Vector2f dv = new Vector2f(body2.getVelocity());
    dv.add(MathUtil.cross(body2.getAngularVelocity(),r2));
    dv.sub(body1.getVelocity());
    dv.sub(MathUtil.cross(body1.getAngularVelocity(),r1));
    float reln = dv.dot(ndp);
    reln = restitute-reln;
    float P = reln/K;
    float newImpulse;
View Full Code Here


      return;
   
    Vector2f dv = new Vector2f(body2.getVelocity());
    dv.add(MathUtil.cross(body2.getAngularVelocity(),r2));
    dv.sub(body1.getVelocity());
    dv.sub(MathUtil.cross(body1.getAngularVelocity(),r1));
    float reln = dv.dot(ndp);
    reln = restitute-reln;
    float P = reln/K;
    float newImpulse;
    if(collideSide==COLLIDE_MIN){
View Full Code Here

    Vector2f p1 = new Vector2f(body1.getPosition());
    p1.add(r1);
    Vector2f p2 = new Vector2f(body2.getPosition());
    p2.add(r2);
    Vector2f dp = new Vector2f(p2);
    dp.sub(p1);
   
    Vector2f dv = new Vector2f(body2.getVelocity());
    dv.add(MathUtil.cross(body2.getAngularVelocity(),r2));
    dv.sub(body1.getVelocity());
    dv.sub(MathUtil.cross(body1.getAngularVelocity(),r1));
View Full Code Here

    Vector2f dp = new Vector2f(p2);
    dp.sub(p1);
   
    Vector2f dv = new Vector2f(body2.getVelocity());
    dv.add(MathUtil.cross(body2.getAngularVelocity(),r2));
    dv.sub(body1.getVelocity());
    dv.sub(MathUtil.cross(body1.getAngularVelocity(),r1));
     
    ndp = new Vector2f(dp);
    ndp.normalise();
   
View Full Code Here

    dp.sub(p1);
   
    Vector2f dv = new Vector2f(body2.getVelocity());
    dv.add(MathUtil.cross(body2.getAngularVelocity(),r2));
    dv.sub(body1.getVelocity());
    dv.sub(MathUtil.cross(body1.getAngularVelocity(),r1));
     
    ndp = new Vector2f(dp);
    ndp.normalise();
   
    restitute = -restitutionConstant*dv.dot(ndp);
 
View Full Code Here

      vertsA[1] = tmp;
    }
   
    // we use the line's normal for our sweepline projection
    Vector2f normal = new Vector2f(vertsA[1]);
    normal.sub(vertsA[0]);
    normal.set(normal.y, -normal.x);
    EdgeSweep sweep = new EdgeSweep(normal);
    sweep.insert(0, true, vertsA[0].dot(normal));
    sweep.insert(0, true, vertsA[1].dot(normal));
    sweep.addVerticesToSweep(false, vertsB);
View Full Code Here

   * @param vertsB The polygon's vertices
   */
  public void setLineEndContact(Contact contact, Intersection intersection, Vector2f[] vertsA, Vector2f[] vertsB) {
    Vector2f separation = new Vector2f(intersection.position);
    if ( intersection.isIngoing )
      separation.sub(vertsA[1]);
    else
      separation.sub(vertsA[0]);
   
    float depthA = 0;//separation.length();
   
View Full Code Here

  public void setLineEndContact(Contact contact, Intersection intersection, Vector2f[] vertsA, Vector2f[] vertsB) {
    Vector2f separation = new Vector2f(intersection.position);
    if ( intersection.isIngoing )
      separation.sub(vertsA[1]);
    else
      separation.sub(vertsA[0]);
   
    float depthA = 0;//separation.length();
   
    contact.setSeparation(-depthA);
    contact.setNormal(MathUtil.getNormal(vertsB[(intersection.edgeB + 1) % vertsB.length], vertsB[intersection.edgeB]));
View Full Code Here

      if ( dis2 < r2 ) {
        Vector2f pt = new Vector2f();
       
        line.getClosestPoint(bodyB.getPosition(), pt);
        Vector2f normal = new Vector2f(bodyB.getPosition());
        normal.sub(pt);
        float sep = circle.getRadius() - normal.length();
        normal.normalise();
       
        contacts[noContacts].setSeparation(-sep);
        contacts[noContacts].setPosition(pt);
View Full Code Here

   * @param circlePos The position (center) of the circle
   * @return The list of edges that can collide with the circle
   */
  protected int[][] getCollisionCandidates(Vector2f[] vertsA, ROVector2f centroid, float radius, ROVector2f circlePos) {
    Vector2f sweepDir = new Vector2f(centroid);
    sweepDir.sub(circlePos);
    sweepDir.normalise(); //TODO: this normalization might not be necessary
   
    EdgeSweep sweep = new EdgeSweep(sweepDir);//vertsA[0], true, true, dist);
   
    sweep.addVerticesToSweep(true, vertsA);
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.