# Using endTransform with an affine matrix?

**URL:** <https://community.cesium.com/t/using-endtransform-with-an-affine-matrix/3839>\
**Category:** CesiumJS\
**Created:** [March 9, 2016, 10:49am UTC](https://community.cesium.com/t/using-endtransform-with-an-affine-matrix/3839 "2016-03-09T10:49:40Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Yonatan\_Kra](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/yonatan_kra/32/2298_2.png) [@Yonatan\_Kra](https://community.cesium.com/u/Yonatan_Kra)\
**Post date:** [March 9, 2016, 10:49am UTC](https://community.cesium.com/t/using-endtransform-with-an-affine-matrix/3839/1 "2016-03-09T10:49:40Z")

</div>

So far I’ve used an affine matrix in the frustum to change my rendered frame pixel wide in the method “update”.  
This is an ugly hack shortcut that looks somewhat like:

if (defined(window.changeMatrix)){  
var resultNewArr = ;  
for (var i = 0; i \< 16; i++) {  
resultNewArr[i] = window.affineMatrix[i];  
}  
var newMatrix = Matrix4.fromArray(resultNewArr);

```
            Matrix4.multiply( newMatrix, frustum._perspectiveMatrix,frustum._perspectiveMatrix);
            Matrix4.multiply(newMatrix, frustum._infinitePerspective, frustum._infinitePerspective);
        }

```

``

(added right after line: [https://github.com/AnalyticalGraphicsInc/cesium/blob/1.19/Source/Scene/PerspectiveOffCenterFrustum.js#L132](https://github.com/AnalyticalGraphicsInc/cesium/blob/1.19/Source/Scene/PerspectiveOffCenterFrustum.js#L132)).

I’ve noticed that the “endTransform” was added to the “setView” method and I thought this might be used to achieve my end goal in a “cleaner” way.

The end goal is nicely put here:

[https://groups.google.com/forum/embed/?place=forum/cesium-dev&showsearch=true&showpopout=true&hideforumtitle=true&fragments=true&parenturl=http%3A%2F%2Fcesiumjs.org%2Fforum.html#!searchin/cesium-dev/affine/cesium-dev/u\_lKmwrkkGE/qrrwuDGsEQAJ](https://groups.google.com/forum/embed/?place=forum/cesium-dev&showsearch=true&showpopout=true&hideforumtitle=true&fragments=true&parenturl=http%3A%2F%2Fcesiumjs.org%2Fforum.html#!searchin/cesium-dev/affine/cesium-dev/u_lKmwrkkGE/qrrwuDGsEQAJ)

Assuming I have my affine matrix the same way (as a Matrix4 _newMatrix_), can I use the endTransform in some way in order to achieve the same effect? Another question, which I was unable to find the answer to is, what is the relation (if any) between the _camera.transform_ (which is the endTransform as far as I can tell from the code) and the _frustum.projectionMatrix_ (which is what I change in the _frustum.update_ method)?
