com.jogamp.opengl.math.Quaternion.toMatrix()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(6.8k)|赞(0)|评价(0)|浏览(106)

本文整理了Java中com.jogamp.opengl.math.Quaternion.toMatrix方法的一些代码示例,展示了Quaternion.toMatrix的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Quaternion.toMatrix方法的具体详情如下:
包路径:com.jogamp.opengl.math.Quaternion
类名称:Quaternion
方法名:toMatrix

Quaternion.toMatrix介绍

[英]Transform this quaternion to a normalized 4x4 column matrix representing the rotation.

Implementation Details:

  • makes identity matrix if #magnitudeSquared() is FloatUtil#isZero(float,float) using FloatUtil#EPSILON
    [中]将此四元数转换为表示旋转的规格化4x4列矩阵。
    实施细节:
    *如果#magnitudeSquared()为FloatUtil#为零(float,float),则使用FloatUtil#EPSILON生成单位矩阵

代码示例

代码示例来源:origin: org.jogamp.jogl/jogl-all-noawt

/**
 * Rotate the current matrix with the given {@link Quaternion}'s rotation {@link Quaternion#toMatrix(float[], int) matrix representation}.
 */
public final void rotate(final Quaternion quat) {
  multMatrix(quat.toMatrix(mat4Tmp1, 0));
}

代码示例来源:origin: org.jogamp.jogl/jogl

/**
 * Rotate the current matrix with the given {@link Quaternion}'s rotation {@link Quaternion#toMatrix(float[], int) matrix representation}.
 */
public final void rotate(final Quaternion quat) {
  multMatrix(quat.toMatrix(mat4Tmp1, 0));
}

代码示例来源:origin: ch.unibas.cs.gravis/scalismo-native-stub

/**
 * Rotate the current matrix with the given {@link Quaternion}'s rotation {@link Quaternion#toMatrix(float[], int) matrix representation}.
 */
public final void glRotate(final Quaternion quat) {
  glMultMatrixf(quat.toMatrix(mat4Tmp1, 0), 0);
}

代码示例来源:origin: org.jogamp.jogl/jogl

/**
 * Rotate the current matrix with the given {@link Quaternion}'s rotation {@link Quaternion#toMatrix(float[], int) matrix representation}.
 */
public final void glRotate(final Quaternion quat) {
  glMultMatrixf(quat.toMatrix(mat4Tmp1, 0), 0);
}

代码示例来源:origin: org.jogamp.jogl/jogl-all-noawt

/**
 * Rotate the current matrix with the given {@link Quaternion}'s rotation {@link Quaternion#toMatrix(float[], int) matrix representation}.
 */
public final void glRotate(final Quaternion quat) {
  glMultMatrixf(quat.toMatrix(mat4Tmp1, 0), 0);
}

代码示例来源:origin: ch.unibas.cs.gravis/scalismo-native-stub

/**
 * Rotate the current matrix with the given {@link Quaternion}'s rotation {@link Quaternion#toMatrix(float[], int) matrix representation}.
 */
public final void rotate(final Quaternion quat) {
  multMatrix(quat.toMatrix(mat4Tmp1, 0));
}

代码示例来源:origin: net.clearvolume/cleargl

public GLMatrix mult(final Quaternion pQuaternion) {
  final float[] lQuaternionMatrix = pQuaternion.toMatrix(scratch,
      0);
  FloatUtil.multMatrix(mMatrix, lQuaternionMatrix);
  return this;
}

代码示例来源:origin: net.clearvolume/cleargl

public static GLMatrix fromQuaternion(final Quaternion q) {
  final float[] rotationMatrix = new float[16];
  q.toMatrix(rotationMatrix, 0);
  return new GLMatrix(rotationMatrix);
}

代码示例来源:origin: ch.unibas.cs.gravis/scalismo-native-stub

/**
 * Load the current matrix with the values of the given {@link Quaternion}'s rotation {@link Quaternion#toMatrix(float[], int) matrix representation}.
 */
public final void glLoadMatrix(final Quaternion quat) {
  if(matrixMode==GL_MODELVIEW) {
    quat.toMatrix(matrixArray, mMv_offset);
    matrixMv.reset();
    dirtyBits |= DIRTY_INVERSE_MODELVIEW | DIRTY_INVERSE_TRANSPOSED_MODELVIEW | DIRTY_FRUSTUM ;
    modifiedBits |= MODIFIED_MODELVIEW;
  } else if(matrixMode==GL_PROJECTION) {
    quat.toMatrix(matrixArray, mP_offset);
    matrixP.reset();
    dirtyBits |= DIRTY_FRUSTUM ;
    modifiedBits |= MODIFIED_PROJECTION;
  } else if(matrixMode==GL.GL_TEXTURE) {
    quat.toMatrix(matrixArray, mTex_offset);
    matrixTex.reset();
    modifiedBits |= MODIFIED_TEXTURE;
  }
}

代码示例来源:origin: org.jogamp.jogl/jogl-all-noawt

/**
 * Load the current matrix with the values of the given {@link Quaternion}'s rotation {@link Quaternion#toMatrix(float[], int) matrix representation}.
 */
public final void glLoadMatrix(final Quaternion quat) {
  if(matrixMode==GL_MODELVIEW) {
    quat.toMatrix(matrixArray, mMv_offset);
    matrixMv.reset();
    dirtyBits |= DIRTY_INVERSE_MODELVIEW | DIRTY_INVERSE_TRANSPOSED_MODELVIEW | DIRTY_FRUSTUM ;
    modifiedBits |= MODIFIED_MODELVIEW;
  } else if(matrixMode==GL_PROJECTION) {
    quat.toMatrix(matrixArray, mP_offset);
    matrixP.reset();
    dirtyBits |= DIRTY_FRUSTUM ;
    modifiedBits |= MODIFIED_PROJECTION;
  } else if(matrixMode==GL.GL_TEXTURE) {
    quat.toMatrix(matrixArray, mTex_offset);
    matrixTex.reset();
    modifiedBits |= MODIFIED_TEXTURE;
  }
}

代码示例来源:origin: org.jogamp.jogl/jogl

/**
 * Load the current matrix with the values of the given {@link Quaternion}'s rotation {@link Quaternion#toMatrix(float[], int) matrix representation}.
 */
public final void glLoadMatrix(final Quaternion quat) {
  if(matrixMode==GL_MODELVIEW) {
    quat.toMatrix(matrixArray, mMv_offset);
    matrixMv.reset();
    dirtyBits |= DIRTY_INVERSE_MODELVIEW | DIRTY_INVERSE_TRANSPOSED_MODELVIEW | DIRTY_FRUSTUM ;
    modifiedBits |= MODIFIED_MODELVIEW;
  } else if(matrixMode==GL_PROJECTION) {
    quat.toMatrix(matrixArray, mP_offset);
    matrixP.reset();
    dirtyBits |= DIRTY_FRUSTUM ;
    modifiedBits |= MODIFIED_PROJECTION;
  } else if(matrixMode==GL.GL_TEXTURE) {
    quat.toMatrix(matrixArray, mTex_offset);
    matrixTex.reset();
    modifiedBits |= MODIFIED_TEXTURE;
  }
}

代码示例来源:origin: org.jogamp.jogl/jogl-all-noawt

/**
 * Extracts this quaternion's <i>orthogonal</i> rotation axes.
 *
 * @param xAxis vector representing the <i>orthogonal</i> x-axis of the coordinate system.
 * @param yAxis vector representing the <i>orthogonal</i> y-axis of the coordinate system.
 * @param zAxis vector representing the <i>orthogonal</i> z-axis of the coordinate system.
 * @param tmpMat4 temporary float[4] matrix, used to transform this quaternion to a matrix.
 */
public void toAxes(final float[] xAxis, final float[] yAxis, final float[] zAxis, final float[] tmpMat4) {
  toMatrix(tmpMat4, 0);
  FloatUtil.copyMatrixColumn(tmpMat4, 0, 2, zAxis, 0);
  FloatUtil.copyMatrixColumn(tmpMat4, 0, 1, yAxis, 0);
  FloatUtil.copyMatrixColumn(tmpMat4, 0, 0, xAxis, 0);
}

代码示例来源:origin: ch.unibas.cs.gravis/scalismo-native-stub

/**
 * Extracts this quaternion's <i>orthogonal</i> rotation axes.
 *
 * @param xAxis vector representing the <i>orthogonal</i> x-axis of the coordinate system.
 * @param yAxis vector representing the <i>orthogonal</i> y-axis of the coordinate system.
 * @param zAxis vector representing the <i>orthogonal</i> z-axis of the coordinate system.
 * @param tmpMat4 temporary float[4] matrix, used to transform this quaternion to a matrix.
 */
public void toAxes(final float[] xAxis, final float[] yAxis, final float[] zAxis, final float[] tmpMat4) {
  toMatrix(tmpMat4, 0);
  FloatUtil.copyMatrixColumn(tmpMat4, 0, 2, zAxis, 0);
  FloatUtil.copyMatrixColumn(tmpMat4, 0, 1, yAxis, 0);
  FloatUtil.copyMatrixColumn(tmpMat4, 0, 0, xAxis, 0);
}

代码示例来源:origin: org.jogamp.jogl/jogl

/**
 * Extracts this quaternion's <i>orthogonal</i> rotation axes.
 *
 * @param xAxis vector representing the <i>orthogonal</i> x-axis of the coordinate system.
 * @param yAxis vector representing the <i>orthogonal</i> y-axis of the coordinate system.
 * @param zAxis vector representing the <i>orthogonal</i> z-axis of the coordinate system.
 * @param tmpMat4 temporary float[4] matrix, used to transform this quaternion to a matrix.
 */
public void toAxes(final float[] xAxis, final float[] yAxis, final float[] zAxis, final float[] tmpMat4) {
  toMatrix(tmpMat4, 0);
  FloatUtil.copyMatrixColumn(tmpMat4, 0, 2, zAxis, 0);
  FloatUtil.copyMatrixColumn(tmpMat4, 0, 1, yAxis, 0);
  FloatUtil.copyMatrixColumn(tmpMat4, 0, 0, xAxis, 0);
}

相关文章