Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


DarkScience

Member Since 17 Nov 2011
Offline Last Active Jun 20 2012 08:55 PM

Posts I've Made

In Topic: Vector to Angle , and vice versa

11 June 2012 - 02:42 PM

SOLUTION
private PointF DegreesToXY( float degrees , float radius , Point origin )
  {
   PointF xy = new PointF ( );
   double radians = degrees * Math.PI / 180.0;
   double x = Math.Cos ( radians ) * radius + origin.X;
   double y = Math.Sin ( -radians ) * radius + origin.Y;
			xy.X = (float) Math.Round ( x * 1000000 ) / 1000000;
			xy.Y = (float) Math.Round ( y * 1000000 ) / 1000000;
   return xy;
  }

or
Spoiler

In Topic: Vector to Angle , and vice versa

11 June 2012 - 01:51 PM

Each of your posts say you want to go back again. Only one direction makes sense.


What ???

You can project one unit along your orientation to find a 'forward' normal. That is a matter of simple trig.


Thats what i'm asking how to do. I've been getting an output which i posted here.

first set

Spoiler


second set
Spoiler


PYR are in degrees in second set...

Seems to be a slight inaccuracy. I cant get it working properly even though from what i know second set should work fine.

Ignore the Z = nonsense. Its just a placeholder.

EDIT The issue is that when X or Y is suppose to be full (-1 ,0, 1) they are but the other number is 6.E~~~ (first set)

EDIT AGAIN:

Remember that 6.12303176911189E-17 is 0.00000000000000006 (I may have even missed a zero there!) so it is a very, very small deviation.


That's the issue i was having, now that i know what it is i can fix it. So my calculations are correct. Just a issue that i must work around.


Also as to the -1 rating. Thanks. It means alot to me.

In Topic: Vector to Angle , and vice versa

11 June 2012 - 01:46 PM

Oh and Alarvo http://en.wikipedia.org/wiki/Angle

In Topic: Vector to Angle , and vice versa

11 June 2012 - 01:43 PM

Alvaro is correct: a triplet of pitch, yaw and roll (Euler angles) represents a 3D orientation. An euclidean 3D vector can at most represent a direction in 3D space (plus a magnitude). That direction can be e.g. an axis of rotation, or a look-at direction, but it does not capture a full 3D orientation.

If representing an axis of rotation with a 3D euclidean vector, one needs to add in a single scalar (the angle of rotation about that axis) to make it a complete representation of a 3D orientation. This is commonly called an axis-angle representation of an orientation. If you are looking to convert an axis-angle representation to a 3D rotation matrix (and then to an Euler triplet), see e.g. MathGeoLib's float3x3::RotateAxisAngle function (boils down to Quat::SetFromAxisAngle).

If representing a look-at direction with a 3D euclidean vector, one needs to add in the concept of a 'up' vector (also called a 'world up' or a 'scene up' vector, a fixed vector specifying the upwards direction convention in the scene), or a single scalar 'roll' (being equivalent to above axis-angle) to make it a complete representation of a 3D orientation. This orientation however cannot have any roll, if the up vector is kept static. If you are looking how to turn a look-at direction vector into a 3D orientation, see e.g. MathGeoLib's float3x3::LookAt.

To convert a rotation matrix to pitch-yaw-roll components (Euler angles), see e.g. MathGeoLib's float3x3::ToEuler*** conversion functions.


Alvaro is incorrect. I explained that im looking for the direction not the absolute full 3d orientation. He should of figured given the deffinition of Angle. Alvaro thanks for this stressful encounter. Go to hell.

clb thanks for an actual reply to my inquiry. Though go to hell for saying "Alvaro is correct".

Sorry i thought he would understand that i'm trying to get a Angle not a Position or Vector.

In Topic: Vector to Angle , and vice versa

11 June 2012 - 01:41 PM


The goal is to convert Pitch , Yaw , Roll to X , Y , Z and then back.
So Angle( 0 , 0 , 0 ) would be in XYZ ( 0 , 1 , 0 ).
So Angle( 0 , 90 , 0 ) would be in XYZ ( 1 , 0 , 0 ).
So Angle( 0 , 180 , 0 ) would be in XYZ ( 0 , -1 , 0 ).
So Angle( 0 , 270, 0 ) would be in XYZ ( -1 , -1 , 0 ).
So Angle( 0 , 360, 0 ) would be in XYZ ( 0 , 1 , 0 ).

Your numbers don't make sense. How can (0,270,0) be (-1,-1,0) ?

Perhaps it is time for to go find a primer on 3D mathematics?


As for converting between them, it looks like you want to project one unit along the forward vector of the orientation and find that position.
As for reversing it, there are infinitely many orientations that can generate the forward vector.


Sorry wrote that in a hurry to represent the directions in relation to x,y,z not the proper numbers.

PARTNERS