Ronan Dejhero - 1 year ago 99

Android Question

I have a vertex (Which i will not be showing/rendering in the scene)

`float vertex[] = {`

1.0f, 1.0f, 1.0f,

};

And i have a mesh, which i have translated and rotated using:

`Matrix.translateM(World.mModelMatrix, tmOffset, globalPositionX, globalPositionY, globalPositionZ);`

Matrix.rotateM(World.mModelMatrix, rmOffset, globalRotationZ, 0, 0, 1);

Matrix.rotateM(World.mModelMatrix, rmOffset, globalRotationY, 0, 1, 0);

Matrix.rotateM(World.mModelMatrix, rmOffset, globalRotationX, 1, 0, 0);

How can apply those translations and rotations to the vertex, and get its global position (x,y,z) after?

Recommended for you: Get network issues from **WhatsUp Gold**. **Not end users.**

Answer Source

Use the `Matrix.multiplyMV`

method:

```
float vertex[] = { 1.0f, 1.0f, 1.0f, 1.0f };
float result[] = { 0.0f, 0.0f, 0.0f, 0.0f };
Matrix.multiplyMV(result, 0, matrix, 0, vertex, 0);
```

Note, that you will have to add a homogeneous coordinate to your vector to make it work.

Recommended from our users: **Dynamic Network Monitoring from WhatsUp Gold from IPSwitch**. ** Free Download**