Package mikera.vectorz

Examples of mikera.vectorz.Vector3


 
  public VectorMatrixM3(int rowCount) {
    super(rowCount,3);
    rowData=new Vector3[rowCount];
    for (int i=0; i<rowCount; i++) {
      rowData[i]=new Vector3();
    }
  }
View Full Code Here


  }
 
  @Override
  public double calculateElement(int i, AVector inputVector) {
    assert(i<rows);
    Vector3 row=rowData[i];
    return row.dotProduct(inputVector);
  }
View Full Code Here

    dest.set(1,((m10*x)+(m11*y)+(m12*z)+tr1));
    dest.set(2,((m20*x)+(m21*y)+(m22*z)+tr2));
  }
 
  public void transform(Vector3 source, Vector3 dest) {
    Vector3 s=source;
    dest.x=((m00*s.x)+(m01*s.y)+(m02*s.z)+tr0);
    dest.y=((m10*s.x)+(m11*s.y)+(m12*s.z)+tr1);
    dest.z=((m20*s.x)+(m21*s.y)+(m22*s.z)+tr2);
  }
 
View Full Code Here

    dest.y=((m10*s.x)+(m11*s.y)+(m12*s.z)+tr1);
    dest.z=((m20*s.x)+(m21*s.y)+(m22*s.z)+tr2);
  }
 
  public void transformInPlace(Vector3 dest) {
    Vector3 s=dest;
    double tx=((m00*s.x)+(m01*s.y)+(m02*s.z)+tr0);
    double ty=((m10*s.x)+(m11*s.y)+(m12*s.z)+tr1);
    double tz=((m20*s.x)+(m21*s.y)+(m22*s.z)+tr2);
    s.x=tx; s.y=ty; s.z=tz;
  }
View Full Code Here

import mikera.vectorz.Vector3;

public class BasicVectorUsage {

  public static void main(String[] args) {
    Vector3 v=Vector3.of(1.0,2.0,3.0);   
    System.out.println(v);
   
    v.normalise();   
    System.out.println(v);
   
    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

*/

public class PerformanceBenchmark extends SimpleBenchmark {
 
  public void timeVector3Addition(int runs) {
    Vector3 v=Vector3.of(1,2,3);
    Vector3 v2=Vector3.of(1,2,3);
    for (int i=0; i<runs; i++) {
      v.add(v2);
    }
  }
View Full Code Here

      v.add(v2);
    }
  }
 
  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

    }
    r=v.get(0);
  }
 
  public void timeVector3Addition(int runs) {
    Vector3 v=Vector3.of(1,2,3);
    for (int i=0; i<runs; i++) {
      Vector3 v2=vector3s[i&15];
      v2.set(0,v.get(0)+v2.get(0));
    }
    r=v.get(0);
  }
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

      r.set(m.transform(v));
    }   
  }
 
  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

TOP

Related Classes of mikera.vectorz.Vector3

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.