Login Action Required

The NinevehGL Forum uses a new concept of "socialized forum" or as we like to say "Tweet Forum".

Here is the deal:

- No new registration is required. Just sign in with your Twitter account and authorize the NinevehGL Forum.
- Once you’re in, you'll be able to "Follow a Thread", that means every time that thread receive a new post or update you'll receive a mention on your twitter.
- Besides, you can enable "Auto Share", then every new post and/or thread you make will be tweeted on your timeline. (By default, auto-share is enabled only for your threads)

Forum Rules:

1. We understand human comunication can become "hot" sometimes. So some insults and bad words ARE allowed. Just don't push too much being an asshole all the time.

2. SPAMMERS are not allowed. There are penalties for this kind of user and they can be banned forever.

3. You can report other users, if you judge necessary. An user reported many times by many people can also be banned forever. However you can also receive penalties for report deliberately for no apparent reason.

If there is a similar thread title, make sure the other one doesn't already have the answer you're looking for.

This forum uses the BBCode (Bulletin Board Code), here are some instructions:

Bold: [b]text[/b]

Italic: [i]text[/i]

Underline: [u]text[/u]

Code: [code]text[/code]

Quote:

[quote=@username]text[/quote]

[quote]text[/quote]

List:

[ul] [*]item [/ul]

[ol] [*]item [/ol]

URL:

[url]http://url.com[/url]

[url=http://url.com]text[/url]

Image:

[img]http://imageurl.com[/img]

Embed (videos, code, 3D):

[embed]http://url.com[/embed]

Welcome to the

*Forum*!

Hello, Guest.

Your current vote:

You can change your vote many times. But it's still one single vote.

Issues With Basic Rotation

Vote this thread:

Is it possible rotate mesh on Y axis without looking at other axis angles ?

Example : when

Here is the example,

In below code , mesh will rotate to**right** on Y axis.

However in below code , mesh will rotate to**left** on Y axis.

My requirement is to rotate mesh to left when the Y angle is -ve and right when Y angle is Ve

and rotate mesh to up direction when the X angle is -ve and down when X angle is Ve without looking its other axis values.

**Basic Issue:**

When mesh X axis is in 180degree angle,and user swipes left to right on iPad,mesh will always rotate right to left. because "Prvious touch location - current touch location" always give ve values.

Any Help on this is appreciated.

Thanks.

Example : when

_mesh.rotateY

is greater than Zero,mesh should rotate to right on Y axis.Here is the example,

In below code , mesh will rotate to

- (void) drawView

{

_mesh.rotateX = 0.0f;

_mesh.rotateY = 1.0f;

[_camera drawCamera];

}

However in below code , mesh will rotate to

- (void) drawView

{

_mesh.rotateX = 180.0f;

_mesh.rotateY = 1.0f;

[_camera drawCamera];

}

My requirement is to rotate mesh to left when the Y angle is -ve and right when Y angle is Ve

and rotate mesh to up direction when the X angle is -ve and down when X angle is Ve without looking its other axis values.

When mesh X axis is in 180degree angle,and user swipes left to right on iPad,mesh will always rotate right to left. because "Prvious touch location - current touch location" always give ve values.

Any Help on this is appreciated.

Thanks.

In response to: @shamsutk87

Hello buddy,

I remember to already told you this before.

NinevehGL has all the necessary methods to make full control over rotation. You can do the same thing by using many ways, choose what you like.

If you don't want to think about rotation order nor space and your intent is to make a LOCAL rotation, that means, just about the object's pivot it self, use the"rotateRelative" method:

http://nineveh.gl/docs/Classes/NGLObject3D.html#//api/name/rotateRelativeToX:toY:toZ:

This method works with small increments. So if you want at every frame increments the Y rotation locally, you can do:

Hello buddy,

I remember to already told you this before.

NinevehGL has all the necessary methods to make full control over rotation. You can do the same thing by using many ways, choose what you like.

If you don't want to think about rotation order nor space and your intent is to make a LOCAL rotation, that means, just about the object's pivot it self, use the"rotateRelative" method:

http://nineveh.gl/docs/Classes/NGLObject3D.html#//api/name/rotateRelativeToX:toY:toZ:

This method works with small increments. So if you want at every frame increments the Y rotation locally, you can do:

[myMesh rotateRelativeToX:0.0f toY:1.0f toZ:0.0f];

In response to: @dineybomfim

Yeah.Thanks.I understood it already.

However I would like to get the rotated angles from mesh. When I use

So is there any way to get the mesh rotation angle(X,Y,Z) details when using "rotateRelativeToX" method? Do I need to calculate it myself ?

Any help on this is appreciated.

Thanks again.

Yeah.Thanks.I understood it already.

However I would like to get the rotated angles from mesh. When I use

[_mesh rotateRelativeToX:increment toY:180.0f toZ:0.0f];

it does not return any angles that rotated. Simply means rotateX,rotateY,rotateZ is always zero.So is there any way to get the mesh rotation angle(X,Y,Z) details when using "rotateRelativeToX" method? Do I need to calculate it myself ?

Any help on this is appreciated.

Thanks again.

In response to: @shamsutk87

No, no, no....

If you use [_mesh rotateRelativeToX:increment toY:180.0f toZ:0.0f]; with 180.0f in Y that means everytime you're incrementing the Y rotation in 180.0f degrees...

Understand this right... this method is only for INCREMENTS, not for absolute rotation values.

Problably what you're looking for is:

Then, inside the loop, you do:

About your second question, yes, the relative methods does not update the global rotation. These are two separated things. You can retrieve the rotation matrix to know about all the relative rotations, but trust me... you'll never get exactly the value you want, because the matrix will only instruct you about 360º degrees, not about the total amount of rotation. This is the main reason because the relative rotations does not interfere in the global rotation.

No, no, no....

If you use [_mesh rotateRelativeToX:increment toY:180.0f toZ:0.0f]; with 180.0f in Y that means everytime you're incrementing the Y rotation in 180.0f degrees...

Understand this right... this method is only for INCREMENTS, not for absolute rotation values.

Problably what you're looking for is:

// right below initializing your mesh.

_myMesh.rotateY = 180.0f;

Then, inside the loop, you do:

[_mesh rotateRelativeToX:increment toY:0.0f toZ:0.0f];

About your second question, yes, the relative methods does not update the global rotation. These are two separated things. You can retrieve the rotation matrix to know about all the relative rotations, but trust me... you'll never get exactly the value you want, because the matrix will only instruct you about 360º degrees, not about the total amount of rotation. This is the main reason because the relative rotations does not interfere in the global rotation.

In response to: @dineybomfim

Oh.. I well understood first point. Thanks again.

However I'm little confused with your below point

Do you mean if the total amount of rotation is 480º, the rotation matrix only give it as 120º ?

if yes, thats okay for my purpose.

Let me know the details..

Oh.. I well understood first point. Thanks again.

However I'm little confused with your below point

the matrix will only instruct you about 360º degrees, not about the total amount of rotation.

Do you mean if the total amount of rotation is 480º, the rotation matrix only give it as 120º ?

if yes, thats okay for my purpose.

Let me know the details..

In response to: @dineybomfim

Thanks again.. I done it..

One more question, how can I retrieve the rotation matrix ? is it mesh.matrix or mesh.rotation?? if it mesh.matrix, then which values represents X,Y,Z.

The below code (rotation property ) always returning zero

Any help on this is appreciated.

Thanks.

Thanks again.. I done it..

One more question, how can I retrieve the rotation matrix ? is it mesh.matrix or mesh.rotation?? if it mesh.matrix, then which values represents X,Y,Z.

The below code (rotation property ) always returning zero

- (void)drawView

{

static float rotatey= 0.0;

rotatey ;

[self._mesh rotateRelativeToX:0 toY:rotatey toZ:0];

NGLvec3 rotation = *(self._mesh.rotation);

NSLog(@"X axis:%.2f Yaxis:%.2f Zaxis:%.2f",rotation.x,rotation.y,rotation.z);

[self._camera drawCamera];

}

Output Always: X axis:0.00 Yaxis:0.00 Zaxis:0.00

Any help on this is appreciated.

Thanks.

In response to: @shamsutk87

Hi,

No, the best matrix to get the rotation is matrixOrtho, because it's an orthogonal matrix and you'll have no problem to get what you want from there.

http://nineveh.gl/docs/Classes/NGLObject3D.html#//api/name/matrixOrtho

The rotation in matrix is not just a simple value, it's a mix of 4 values through 9 slots. So, yes, rotation X mix with Z, Y with X and Z, etc... There are formulas to get that. A simple googling about the subject will show you some ways to deal with it.

Hi,

No, the best matrix to get the rotation is matrixOrtho, because it's an orthogonal matrix and you'll have no problem to get what you want from there.

http://nineveh.gl/docs/Classes/NGLObject3D.html#//api/name/matrixOrtho

The rotation in matrix is not just a simple value, it's a mix of 4 values through 9 slots. So, yes, rotation X mix with Z, Y with X and Z, etc... There are formulas to get that. A simple googling about the subject will show you some ways to deal with it.

In response to: @dineybomfim

Hello thanks again.

I looked on to the**matrixOrtho** in detail. However still I'm unable to figureout the x,y,z rotated angles. I'm totally mess-up with the matrix values

I would like to know more details or any sample code to deal with it.

Any help on this is appreciated. thanks again.

Hello thanks again.

I looked on to the

I would like to know more details or any sample code to deal with it.

Any help on this is appreciated. thanks again.

In response to: @shamsutk87

Maybe this can help you:

http://en.wikipedia.org/wiki/Rotation_matrix#In_three_dimensions

Maybe this can help you:

http://en.wikipedia.org/wiki/Rotation_matrix#In_three_dimensions

In response to: @dineybomfim

Hello,

Here are my result of two days.

I have used the following link to calculate angle http://www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToAngle/

I have rotated 3D mesh near to 180° and I have retrieved matrixOrtho of mesh and the matrix look like as below.

Here is the code that I have used.

**Issues:**

x, y, Xangle and Yangle are returning zero.

When I have tried to calculate the x and y angles via above mentioned site (www.euclideanspace.com) ,its returning near to 120 degree (2.077159494474169 radians).

Any help on this is appreciated.

Thanks.

Hello,

Here are my result of two days.

I have used the following link to calculate angle http://www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToAngle/

I have rotated 3D mesh near to 180° and I have retrieved matrixOrtho of mesh and the matrix look like as below.

-0.97 0.00 0.00 1.00

1.00 1.00 0.00 0.00

0.00 0.00 0.00 0.00

0.00 0.00 0.00 0.00

1.00 1.00 0.00 0.00

0.00 0.00 0.00 0.00

0.00 0.00 0.00 0.00

Here is the code that I have used.

self._mesh.rotationSpace = NGLRotationSpaceWorld;

[self._mesh rotateRelativeToX:__position.y toY:__position.x toZ:0]; //relative rotation

NGLmat4 *rotationMatrix = self._mesh.matrixOrtho;

/* equation used

angle = acos(( m00 m11 m22 - 1)/2)

x = (m21 - m12)/√((m21 - m12)2 (m02 - m20)2 (m10 - m01)2)

y = (m02 - m20)/√((m21 - m12)2 (m02 - m20)2 (m10 - m01)2)

z = (m10 - m01)/√((m21 - m12)2 (m02 - m20)2 (m10 - m01)2)

/*

float angle = acos(( *rotationMatrix[0] *rotationMatrix[5] *rotationMatrix[10] - 1)/2);

float x = (*rotationMatrix[9] - *rotationMatrix[6])/sqrtf(powf((*rotationMatrix[9] -

*rotationMatrix[6]), 2) powf((*rotationMatrix[2] - *rotationMatrix[8]), 2) powf((*rotationMatrix[4] - *rotationMatrix[1]), 2));

float y = (*rotationMatrix[2] - *rotationMatrix[8])/sqrtf(powf((*rotationMatrix[9] - *rotationMatrix[6]), 2) powf((*rotationMatrix[2] - *rotationMatrix[8]),

2) powf((*rotationMatrix[4] - *rotationMatrix[1]), 2));

/* These are the macros

// Pre-calculated value of PI / 180.

#define kPI180 0.017453

// Pre-calculated value of 180 / PI.

#define k180PI 57.295780

// Converts degrees to radians.

#define degreesToRadians(x) (x * kPI180)

// Converts radians to degrees.

#define radiansToDegrees(x) (x * k180PI)

*/

float Xangle = radiansToDegrees(angle * x);

float Yangle = radiansToDegrees(angle * y);

x, y, Xangle and Yangle are returning zero.

When I have tried to calculate the x and y angles via above mentioned site (www.euclideanspace.com) ,its returning near to 120 degree (2.077159494474169 radians).

Any help on this is appreciated.

Thanks.

In response to: @shamsutk87

No again, buddy.

Seems you're not getting it.

To print NGLmat don't do it manually, use the "nglMatrixDescribe" function. It'll print the matrix in algebra notation.

The "euclideanspace" website is 100% accurate, it's great BTW. However remember that it'll instruct you in algebra notation and NinevehGL use the same approach as OpenGL, with clumn-major format using left-hand oriented.

Besides, you're redefining macros that already exist in NinevehGL.

No again, buddy.

Seems you're not getting it.

To print NGLmat don't do it manually, use the "nglMatrixDescribe" function. It'll print the matrix in algebra notation.

The "euclideanspace" website is 100% accurate, it's great BTW. However remember that it'll instruct you in algebra notation and NinevehGL use the same approach as OpenGL, with clumn-major format using left-hand oriented.

Besides, you're redefining macros that already exist in NinevehGL.

In response to: @dineybomfim

Hey,

i have still the same problems.

I get a rotation matrix as float[16].

like:

now i want to perform a simple rotation with rotateWithMatrix, like

but nothing happened. Any help?

Hey,

i have still the same problems.

I get a rotation matrix as float[16].

like:

matrix [ 0 ] = 1;

matrix [ 1 ] = 0;

matrix [ 2 ] = 0;

matrix [ 3 ] = 0;

matrix [ 4 ] = 0;

matrix [ 5 ] = 1;

matrix [ 6 ] = 0;

matrix [ 7 ] = 0;

matrix [ 8 ] = 0;

matrix [ 9 ] = 0;

matrix [ 10 ] = 1;

matrix [ 11 ] = 0;

matrix [ 12 ] = 0;

matrix [ 13 ] = 0;

matrix [ 14 ] = 0;

matrix [ 15 ] = 1;

=> | 1 0 0 0 |

| 0 1 0 0 |

| 0 0 1 0 |

| 0 0 0 1 |

now i want to perform a simple rotation with rotateWithMatrix, like

matrix [ 0 ] = 1;

matrix [ 1 ] = 0;

matrix [ 2 ] = 0;

matrix [ 3 ] = 0;

matrix [ 4 ] = 0;

matrix [ 5 ] = 0;

matrix [ 6 ] = 1;

matrix [ 7 ] = 0;

matrix [ 8 ] = 0;

matrix [ 9 ] = 1;

matrix [ 10 ] = 0;

matrix [ 11 ] = 0;

matrix [ 12 ] = 0;

matrix [ 13 ] = 0;

matrix [ 14 ] = 0;

matrix [ 15 ] = 1;

=> | 1 0 0 0 |

| 0 0 1 0 |

| 0 1 0 0 |

| 0 0 0 1 |

but nothing happened. Any help?

In response to: @matthiasneges

It seems that the rotateWithMatrix doesn't work correctly.

I test two scenarios.

First i use:

and the result is:

Allright, everything works !

But now I use the

with following definition:

And this is the result:

So, what I'm doing wrong? Or is there a bug in the method?

It seems that the rotateWithMatrix doesn't work correctly.

I test two scenarios.

First i use:

_mesh.rotate = 90;

and the result is:

2013-07-24 10:41:08.364 itmAR[12481:907] Start Matrix without any Rotation

2013-07-24 10:41:08.366 itmAR[12481:907] Describe matrix:

|1.000000 0.000000 0.000000 0.000000|

|0.000000 1.000000 0.000000 0.000000|

|0.000000 0.000000 1.000000 0.000000|

|0.000000 0.000000 0.000000 1.000000|

2013-07-24 10:41:08.371 itmAR[12481:907] Matrix after set the Rotation

2013-07-24 10:41:08.373 itmAR[12481:907] Describe matrix:

|1.000000 0.000000 0.000000 0.000000|

|0.000000 0.000026 -1.000000 0.000000|

|0.000000 1.000000 0.000026 0.000000|

|0.000000 0.000000 0.000000 1.000000|

Allright, everything works !

But now I use the

[_mesh rotateWithMatrix:matrix]

with following definition:

NGLmat4 matrix;

matrix [ 0 ] = 1;

matrix [ 1 ] = 0;

matrix [ 2 ] = 0;

matrix [ 3 ] = 0;

matrix [ 4 ] = 0;

matrix [ 5 ] = 0;

matrix [ 6 ] = 1;

matrix [ 7 ] = 0;

matrix [ 8 ] = 0;

matrix [ 9 ] = 1;

matrix [ 10 ] = 0;

matrix [ 11 ] = 0;

matrix [ 12 ] = 0;

matrix [ 13 ] = 0;

matrix [ 14 ] = 0;

matrix [ 15 ] = 1;

And this is the result:

2013-07-24 10:45:07.313 itmAR[12505:907] Input Matrix for Rotation

2013-07-24 10:45:07.316 itmAR[12505:907] Describe matrix:

|1.000000 0.000000 0.000000 0.000000|

|0.000000 0.000000 1.000000 0.000000|

|0.000000 1.000000 0.000000 0.000000|

|0.000000 0.000000 0.000000 1.000000|

2013-07-24 10:45:07.318 itmAR[12505:907] Start Matrix without any Rotation

2013-07-24 10:45:07.319 itmAR[12505:907] Describe matrix:

|1.000000 0.000000 0.000000 0.000000|

|0.000000 1.000000 0.000000 0.000000|

|0.000000 0.000000 1.000000 0.000000|

|0.000000 0.000000 0.000000 1.000000|

2013-07-24 10:45:07.321 itmAR[12505:907] Matrix after set the Rotation

2013-07-24 10:45:07.322 itmAR[12505:907] Describe matrix:

|1.000000 0.000000 0.000000 -90.000000|

|0.000000 1.000000 0.000000 0.000000|

|0.000000 0.000000 1.000000 0.000000|

|0.000000 0.000000 0.000000 1.000000|

So, what I'm doing wrong? Or is there a bug in the method?

In response to: @dineybomfim

i used a sample project from ninevehgl at the weekend and there the rotateWithMatrix methode works. The describeMatrix is the same as in my project, but the rotation work. I think the problem is the "lookAt..." property, which is set in the sample project. After comment this, the rotationWithMatrix do not work at all.

Is this the problem?

I try to create my own AR application, without using the rebase function. I post here http://nineveh.gl/community/forum/create_rebasewithmatrix_for_metaio my question, but didn't get an answer. So i want to translate, scale and rotate the mesh manually.

i used a sample project from ninevehgl at the weekend and there the rotateWithMatrix methode works. The describeMatrix is the same as in my project, but the rotation work. I think the problem is the "lookAt..." property, which is set in the sample project. After comment this, the rotationWithMatrix do not work at all.

Is this the problem?

I try to create my own AR application, without using the rebase function. I post here http://nineveh.gl/community/forum/create_rebasewithmatrix_for_metaio my question, but didn't get an answer. So i want to translate, scale and rotate the mesh manually.

In response to: @matthiasneges

This is why we ask to see the entire projects, there are dozens of other setting that could affect your final goal and when you guys came here and just talk about a specific part of the code it's hard to tell you where is the conflicting code.

If you still having any troubles, please send us the code.

This is why we ask to see the entire projects, there are dozens of other setting that could affect your final goal and when you guys came here and just talk about a specific part of the code it's hard to tell you where is the conflicting code.

If you still having any troubles, please send us the code.