Package com.flansmod.common.vector

Examples of com.flansmod.common.vector.Matrix4f


        {
          //Now Lerp by wheelSpringStrength and work out the new positions   
          float newLength = currentWheelLength + dLength * type.wheelSpringStrength;
          Vector3f rotateAround = Vector3f.cross(targetWheelPos, currentWheelPos, null);
         
          Matrix4f mat = new Matrix4f();
          mat.m00 = currentWheelPos.x;
          mat.m10 = currentWheelPos.y;
          mat.m20 = currentWheelPos.z;
          mat.rotate(dAngle * type.wheelSpringStrength, rotateAround);
         
          axes.rotateGlobal(-dAngle * type.wheelSpringStrength, rotateAround);
                   
          Vector3f newWheelPos = new Vector3f(mat.m00, mat.m10, mat.m20);
          newWheelPos.normalise().scale(newLength);
View Full Code Here


public class RotatedAxes
{
  public RotatedAxes()
  {
    //Load identity
    rotationMatrix = new Matrix4f();
  }
View Full Code Here

 
  //Find a global vector in terms of this basis.
  public Vector3f findGlobalVectorLocally(Vector3f in)
  {
    //Create a new matrix and use the first column to store the vector we are rotating
    Matrix4f mat = new Matrix4f();
    mat.m00 = in.x;
    mat.m10 = in.y;
    mat.m20 = in.z;
    //Do the rotations used to obtain this basis in reverse
    mat.rotate(-rotationYaw * 3.14159265F / 180F, new Vector3f(0F, 1F, 0F));
    mat.rotate(-rotationPitch * 3.14159265F / 180F, new Vector3f(0F, 0F, 1F));
    mat.rotate(-rotationRoll * 3.14159265F / 180F, new Vector3f(1F, 0F, 0F));
    return new Vector3f(mat.m00, mat.m10, mat.m20);
  }
View Full Code Here

 
  //Find a local vector in terms of the global axes.
  public Vector3f findLocalVectorGlobally(Vector3f in)
  {
    //Create a new matrix and use the first column to store the vector we are rotating
    Matrix4f mat = new Matrix4f();
    mat.m00 = in.x;
    mat.m10 = in.y;
    mat.m20 = in.z;
    //Do the rotations used to obtain this basis
    mat.rotate(rotationRoll * 3.14159265F / 180F, new Vector3f(1F, 0F, 0F));
    mat.rotate(rotationPitch * 3.14159265F / 180F, new Vector3f(0F, 0F, 1F));
    mat.rotate(rotationYaw * 3.14159265F / 180F, new Vector3f(0F, 1F, 0F));
    return new Vector3f(mat.m00, mat.m10, mat.m20);
  }
View Full Code Here

  }

  private void convertAnglesToMatrix()
  {
    //Re-load the identity
    rotationMatrix = new Matrix4f();
    rotationMatrix.rotate(rotationRoll * 3.14159265F / 180F, new Vector3f(1F, 0F, 0F));
    rotationMatrix.rotate(rotationPitch * 3.14159265F / 180F, new Vector3f(0F, 0F, 1F));
    rotationMatrix.rotate(rotationYaw * 3.14159265F / 180F, new Vector3f(0F, 1F, 0F));
    convertMatrixToAngles();
  }
View Full Code Here

  }
 
  public RotatedAxes findLocalAxesGlobally(RotatedAxes in)
  {
    //Take the input matrix
    Matrix4f mat = new Matrix4f();
    mat.load(in.getMatrix());
    //Perform the rotations to convert from this local set of axes to the global axes
    mat.rotate(rotationRoll * 3.14159265F / 180F, new Vector3f(1F, 0F, 0F));
    mat.rotate(rotationPitch * 3.14159265F / 180F, new Vector3f(0F, 0F, 1F));
    mat.rotate(rotationYaw * 3.14159265F / 180F, new Vector3f(0F, 1F, 0F));
    //Return the globalised matrix
    return new RotatedAxes(mat);
  }
View Full Code Here

TOP

Related Classes of com.flansmod.common.vector.Matrix4f

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.