Package javax.vecmath

Examples of javax.vecmath.Matrix4f


  }

  void setOrientation(Matrix3f mat) {
    if (mat == null)
      return;
    Matrix4f m = new Matrix4f();
    m.set(mat);
    matrixFractionalToCartesian.mul(m, matrixFractionalToCartesian);
    matrixCartesianToFractional.invert(matrixFractionalToCartesian);
    calcUnitcellVertices();
  }
View Full Code Here


  }
 
  private void calcUnitcellVertices() {
    if (matrixFractionalToCartesian == null)
      return;
    matrixCtoFAbsolute = new Matrix4f(matrixCartesianToFractional);
    matrixFtoCAbsolute = new Matrix4f(matrixFractionalToCartesian);
    vertices = new Point3f[8];
    for (int i = 8; --i >= 0;) {
      vertices[i] = new Point3f();
      matrixFractionalToCartesian.transform(BoxInfo.unitCubePoints[i], vertices[i]);
      //System.out.println("UNITCELL " + vertices[i] + " " + BoxInfo.unitCubePoints[i]);
View Full Code Here

        h = hallInfo = new HallInfo(hallSymbol);
      setLattice(hallInfo.latticeCode, hallInfo.isCentrosymmetric);
      addOperation(null, 0);
      addSymmetry("x,y,z", 0);
    }
    Matrix4f mat1 = new Matrix4f();
    Matrix4f operation = new Matrix4f();
    Matrix4f[] newOps = new Matrix4f[7];
    for (int i = 0; i < 7; i++)
      newOps[i] = new Matrix4f();
    // prior to Jmol 11.7.36/11.6.23 this was setting nOps within the loop
    // and setIdentity() outside the loop. That caused a multiplication of
    // operations, not a resetting of them each time.
    for (int i = 0; i < h.nRotations; i++) {
      mat1.set(h.rotationTerms[i].seitzMatrix12ths);
      int nRot = h.rotationTerms[i].order;
      // this would iterate int nOps = operationCount;
      newOps[0].setIdentity();
      int nOps = operationCount;
      for (int j = 1; j <= nRot; j++) {
        newOps[j].mul(mat1, newOps[0]);
        newOps[0].set(newOps[j]);
        for (int k = 0; k < nOps; k++) {
          operation.mul(newOps[j], operations[k]);
          SymmetryOperation.normalizeTranslation(operation);
          String xyz = SymmetryOperation.getXYZFromMatrix(operation, true, true, true);
          addSymmetry(xyz, operation);
        }
      }
View Full Code Here

          .intValue();
      if (coords == null || coords.length != dotCount * 3)
        coords = new int[dotCount * 3];
    }

    Matrix4f m4 = viewer.getMatrixtransform();
    mat.setRow(0, m4.m00, m4.m01, m4.m02);
    mat.setRow(1, m4.m10, m4.m11, m4.m12);
    mat.setRow(2, m4.m20, m4.m21, m4.m22);
    matScreenToCartesian.invert(mat);

View Full Code Here

  }

  public void toArray() {
    int dim;
    Matrix3f m3 = null;
    Matrix4f m4 = null;
    switch (tok) {
    case matrix3f:
      m3 = (Matrix3f) value;
      dim = 3;
      break;
    case matrix4f:
      m4 = (Matrix4f) value;
      dim = 4;
      break;
    default:
      return;
    }
    tok = varray;
    List o2 = new ArrayList(dim);
    for (int i = 0; i < dim; i++) {
      float[] a = new float[dim];
      if (m3 == null)
        m4.getRow(i, a);
      else
        m3.getRow(i, a);
      o2.set(i,getVariable(a));
    }
    value = o2;
View Full Code Here

    static class Matrix4fWrapper extends ValueWrapper {
  private float[] value = new float[16];

  @Override
  void set(Object value) {
      Matrix4f m = (Matrix4f)value;
      this.value[0= m.m00;
      this.value[1= m.m01;
      this.value[2= m.m02;
      this.value[3= m.m03;
      this.value[4= m.m10;
View Full Code Here

      this.value[15] = m.m33;
  }

  @Override
  Object get() {
      return new Matrix4f(value);
  }
View Full Code Here

  }

  @Override
  void set(int index, Object value) {
      int j = index * 16;
      Matrix4f m = (Matrix4f)value;

      this.value[j+0= m.m00;
      this.value[j+1= m.m01;
      this.value[j+2= m.m02;
      this.value[j+3= m.m03;
View Full Code Here

  @Override
  Object get() {
      Matrix4f[] arr = new Matrix4f[this.length];
      for (int i = 0; i < this.length; i++) {
    int j = i * 16;
                arr[i] = new Matrix4f();
    arr[i].m00 = this.value[j+0];
    arr[i].m01 = this.value[j+1];
    arr[i].m02 = this.value[j+2];
    arr[i].m03 = this.value[j+3];
    arr[i].m10 = this.value[j+4];
View Full Code Here

  }

  public void drawCylinder(float radius, float halfHeight, int upAxis) {
    glPushMatrix();
   
    Matrix4f mat = new Matrix4f();
   
    switch (upAxis) {
      case 0:
        //glRotatef(-90f, 0.0f, 1.0f, 0.0f);
        mat.rotY((float)Math.PI * -0.5f);
        mulMatrix(mat);
        glTranslatef(0.0f, 0.0f, -halfHeight);
        break;
      case 1:
        //glRotatef(-90.0f, 1.0f, 0.0f, 0.0f);
        mat.rotX((float)Math.PI * -0.5f);
        mulMatrix(mat);
        glTranslatef(0.0f, 0.0f, -halfHeight);
        break;
      case 2:
        glTranslatef(0.0f, 0.0f, -halfHeight);
        break;
      default: {
        assert (false);
      }
    }

    // The gluCylinder subroutine draws a cylinder that is oriented along the z axis.
    // The base of the cylinder is placed at z = 0; the top of the cylinder is placed at z=height.
    // Like a sphere, the cylinder is subdivided around the z axis into slices and along the z axis into stacks.

    disk.setDrawStyle(Quadric.GLU_FILL);
    disk.setNormals(Quadric.GLU_SMOOTH);
    disk.draw(gl, 0, radius, 8, 1);
   
    cylinder.setDrawStyle(Quadric.GLU_FILL);
    cylinder.setNormals(Quadric.GLU_SMOOTH);
    cylinder.draw(gl, radius, radius, 2f * halfHeight, 8, 1);
   
    glTranslatef(0f, 0f, 2f * halfHeight);
    mat.rotY(-(float)Math.PI);
    mulMatrix(mat);
    disk.draw(gl, 0, radius, 8, 1);

    glPopMatrix();
  }
View Full Code Here

TOP

Related Classes of javax.vecmath.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.