### how to get the rotatexyz degree info from a line(segment) in 3d

Sorry, maybe i was not clear

How can i use an line(segment) as a path to move a model alone this path in 3D? Is there somewhere an example or something simulare to look at? Because i do not get it working.

The line(segment) as a path moves also.

I hope somebody can help me because i become crasy of this problem.

Regards,

Bitter

Hi,

Ok, thanks!

But in that artikel they say that ‘Fortunately you’ll often only need the cosine of the angle between 2 vectors and not the angle itself, so the expensive step of calculating the inverse cosine can be skipped.’ – see below –

So how do i calculate the inverse cosine? I have checked on that same website and on internet but … ? My ? still lightning.

The only way i have find on the internet is how to measure the angles in a triangle.

> sin-1(lenght of one side/lenght of second side) = angle in degree

But i have to do this for 15 lines in a 3d environment constantly because this lines are also moving so the x,y,z angles are also constantly changing.

Is there not a way to get this x,y,z degrees from a line in 3d out of the jit.gl.sketch object directly?

Thanks & regards, Bitter

———-

The Dot Product

The dot product between two vectors

A * B = Ax*Bx + Ay*By + Az*Bz

If A and B are unit vectors then the dot product is the cosine of the angle between them, so the angle itself can be calculated by taking the inverse cosine of the dot product:

theta = invcos (A * B)

Fortunately you’ll often only need the cosine of the angle between 2 vectors and not the angle itself, so the expensive step of calculating the inverse cosine can be skipped.

———-

On Jan 16, 2007, at 4:39 AM, bart wrote:

> So how do i calculate the inverse cosine? I have checked on that

> same website and on internet but … ? My ? still lightning.

> The only way i have find on the internet is how to measure the

> angles in a triangle.

Keep in mind with your line in 3D space there are several triangles

you can use if you consider the axis lines as part of the triangles.

> Is there not a way to get this x,y,z degrees from a line in 3d out

> of the jit.gl.sketch object directly?

Sorry, but there is not. You typically need to study geometry (and

linear algebra) if you wish to program 3D graphics.

-Joshua

Hi,

> Keep in mind with your line in 3D space there are several triangles you can use if you consider the axis lines as part of the triangles.

Yes, i know but maybe there was a faster simply way to do this.

> Sorry, but there is not. You typically need to study geometry (and

linear algebra) if you wish to program 3D graphics.

Ok, i will refresh my geometry part of my brain. :)

> -Joshua

Thanks,

Bart

Forums > Jitter