Package mikera.matrixx

Examples of mikera.matrixx.Matrix33


    return Transformz.createTranslation(copyOfTranslationVector());
  }
 
  @Override
  public Matrix33 copyOfMatrix() {
    return new Matrix33(m00,m01,m02,m10,m11,m12,m20,m21,m22);
  }
View Full Code Here


   
    Vector3 d=Vector3.of(10.0,0.0,0.0);   
    d.addMultiple(v, 5.0);
    System.out.println(d)
   
    Matrix33 m=Matrixx.createXAxisRotationMatrix(Math.PI);
    Vector3 rotated=m.transform(d);      // rotate 180 degrees around x axis    
    System.out.println(rotated)

  }
View Full Code Here

import mikera.matrixx.Matrixx;

public class BasicMatrixUsage {

  public static void main(String[] args) {
    Matrix33 m=new Matrix33();
   
    Matrixx.fillRandomValues(m);
    System.out.println(m);
    System.out.println(m.getTranspose());

    System.out.println();
   
    AMatrix m2=Matrixx.createRandomSquareMatrix(2);
    System.out.println(m2);
View Full Code Here

   */
  static double calculateSmallDeterminant(AMatrix m, int rc) {
    if (rc==1) return m.unsafeGet(0,0);
    if (rc==2) return m.unsafeGet(0,0)*m.unsafeGet(1,1)-m.unsafeGet(1,0)*m.unsafeGet(0,1);
    if (rc==3) {
      return new Matrix33(m).determinant();
    }
    throw new UnsupportedOperationException("Small determinant calculation on size "+rc+" not possible");
  }
View Full Code Here

  }
 
  private static AMatrix calculateSmall(AMatrix m, int rc) {
    if (rc==1) return new Matrix11(m).inverse();
    if (rc==2) return new Matrix22(m).inverse();
    if (rc==3) return new Matrix33(m).inverse();
    throw new IllegalArgumentException(ErrorMessages.incompatibleShape(m));
  }
View Full Code Here

  @Test public void testRotate() {
    Vector3 axis=new Vector3(1,0,0);
    Vector3 v=new Vector3(0,1,0);
    double angle=0.5*Math.PI;
   
    Matrix33 rotM = Matrixx.createRotationMatrix(axis, angle);
    Vector4 rotQ = Quaternions.axisAngle(axis, angle);
   
    Vector3 mv=rotM.innerProduct(v);
    Vector3 qv=Quaternions.rotate(rotQ, v);
   
    assertEquals(mv,qv);
    assertTrue(mv.epsilonEquals(qv));
  }
View Full Code Here

 
  public void timeMatrix3Rotation(int runs) {
    Vector3 axis=Vector3.of(1,2,3);
    Vector3 v=Vector3.of(Math.random(),Math.random(),Math.random());

    Matrix33 rot=Matrixx.createRotationMatrix(axis, Math.random());
    for (int i=0; i<runs; i++) {
      rot.transformInPlace(v);
    }
  }
View Full Code Here

  public static final Vector3 smallDelta=Vector3.of(0.00001,0.00001,0.00001);

 
  public void timeMatrix33Transform(int runs) {
    Vector3 v=new Vector3(1,2,3);
    Matrix33 m=new Matrix33(1,2,3,4,5,6,7,8,9);
   
    for (int i=0; i<runs; i++) {
      v.add(smallDelta);
      r.set(m.transform(v));
    }   
  }
View Full Code Here

  }
 
  public void timeMatrix33TransformInPlace(int runs) {
    Vector3 v=new Vector3(1,2,3);
    Vector3 t=new Vector3(1,2,3);
    Matrix33 m=new Matrix33(1,2,3,4,5,6,7,8,9);
   
    for (int i=0; i<runs; i++) {
      v.add(smallDelta);
      t.set(v);
      m.transformInPlace(t);
    }
   
    r.set(t);
  }
View Full Code Here

   
    r.set(t);
  }
 
  public void timeMatrix33Clone(int runs) {
    Matrix33 m=new Matrix33(1,2,3,4,5,6,7,8,9);
   
    for (int i=0; i<runs; i++) {
      m=m.clone();
    }
  }
View Full Code Here

TOP

Related Classes of mikera.matrixx.Matrix33

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.