/** * Gets the view-to-pixel transform. * @return the view-to-pixel transform. */ public Matrix44 getViewToPixel() { return getCubeToPixel().timesEquals(_viewToCube); }
/** * Gets the local-to-pixel transform. * @return the local-to-pixel transform. */ public Matrix44 getLocalToPixel() { return getWorldToPixel().timesEquals(_localToWorld); }
/** * Gets the world-to-pixel transform. * @return the world-to-pixel transform. */ public Matrix44 getWorldToPixel() { return getViewToPixel().timesEquals(_worldToView); }
/** * Gets the local-to-cube transform. * @return the local-to-cube transform. */ public Matrix44 getLocalToCube() { return getWorldToCube().timesEquals(_localToWorld); }
/** * Gets the local-to-view transform. * @return the local-to-view transform. */ public Matrix44 getLocalToView() { return getWorldToView().timesEquals(_localToWorld); }
/** * Gets the world-to-cube transform. * @return the world-to-cube transform. */ public Matrix44 getWorldToCube() { return getViewToCube().timesEquals(_worldToView); }
/** * Saves the local-to-world transform before appending a transform. * The specified transform matrix is post-multiplied with the current * local-to-world transform, such that the specified transform is applied * first when transforming local coordinates to world coordinates. * @param transform the transform to append. */ public void pushLocalToWorld(Matrix44 transform) { _localToWorldStack.push(new Matrix44(_localToWorld)); _localToWorld.timesEquals(transform); }
cubeToPixel.timesEquals(Matrix44.translate(0.5*w,0.5*h,0.5)); cubeToPixel.timesEquals(Matrix44.scale(0.5*w,-0.5*h,0.5)); canvas.setCubeToPixel(cubeToPixel); _unitSphereToView.timesEquals(Matrix44.translate(0,0,-distance)); _unitSphereToView.timesEquals(Matrix44.rotateX(_elevation)); _unitSphereToView.timesEquals(Matrix44.rotateY(-_azimuth)); _unitSphereToView.timesEquals(Matrix44.scale(_scale,_scale,_scale)); _unitSphereToView.timesEquals(Matrix44.translate(_translate)); double sz = s*as.z; if (ao==AxesOrientation.XRIGHT_YUP_ZOUT) { _worldToUnitSphere.timesEquals(Matrix44.identity()); } else if (ao==AxesOrientation.XRIGHT_YOUT_ZDOWN) { _worldToUnitSphere.timesEquals(Matrix44.rotateX(90.0)); } else if (ao==AxesOrientation.XRIGHT_YIN_ZDOWN) { _worldToUnitSphere.timesEquals(Matrix44.rotateX(90.0)); sy = -sy; } else if (ao==AxesOrientation.XOUT_YRIGHT_ZUP) { _worldToUnitSphere.timesEquals(Matrix44.rotateY(-90.0)); _worldToUnitSphere.timesEquals(Matrix44.rotateX(-90.0)); } else if (ao==AxesOrientation.XDOWN_YRIGHT_ZOUT) { _worldToUnitSphere.timesEquals(Matrix44.rotateZ(-90.0)); } else if (ao==AxesOrientation.XUP_YLEFT_ZOUT) { _worldToUnitSphere.timesEquals(Matrix44.rotateZ(90.0)); } else if (ao==AxesOrientation.XUP_YRIGHT_ZOUT) { _worldToUnitSphere.timesEquals(Matrix44.rotateZ(90.0)); sy = -sy;
public void testMatrix() { int ntrial = 10; for (int itrial=0; itrial<ntrial; ++itrial) { Matrix44 i = Matrix44.identity(); Matrix44 a = randomMatrix44(); Matrix44 at = a.transpose(); assertEquals(a,at.transpose()); Matrix44 ai = a.inverse(); assertEquals(a,ai.inverse()); assertEquals(i,a.times(ai)); assertEquals(i,a.transpose().timesTranspose(ai)); assertEquals(i,a.transposeTimes(ai.transpose())); Matrix44 ac = new Matrix44(a); assertEquals(i,ac.timesEquals(ai)); ac = new Matrix44(a); assertEquals(i,ac.transposeEquals().timesTranspose(ai)); ac = new Matrix44(a); assertEquals(i,ac.transposeTimesEquals(ai.transpose())); } }