Jump to content
  • Advertisement

donvreug

Member
  • Content Count

    11
  • Joined

  • Last visited

Community Reputation

114 Neutral

About donvreug

  • Rank
    Member

Personal Information

  • Interests
    Programming
  1. Ok I apologise for that.  It was Buckeye who suggested I post here though as he thought some of you guys might be able to help.
  2. At work we use various applications that each use different rotation conventions. I am trying to write an application that will provide the angles for all of the different 'conventions' in one place to make life easier for people moving from one application to the next. And yes it does get messy and mistakes can easily be made, hence why I am trying to make it easier for people.
  3. I am trying to find a solution to a problem such that   Given an initial coordinate system comprised of 3 orthogonal axes X, Y, Z, where Z is up, Y is North and X is East. Given a rotation definition (A) which describes successive rotations about each axes. Given the rotation angles for each axes produce a rotated coordinate system. For a rotation definition (B) which describes successive rotations about each axes, find the rotation angles that produce the same coordinate system as produced by rotation definition A.   For example:   If rotation definition A is defined by 3 successive rotations around Z, then Y and then X, all defined positive counter-clockwise from East to North, i.e. (+Z +Y +X), and whose angles are bounded by -180 and + 180 degrees.   And if rotation definition B is defined by 3 successive rotations around Z, then X, and then Z again, the first rotation being defined positive clockwise from North to East (i.e. Azimuth or A), the second one positive counter-clockwise from East to North and the third one positive clockwise from East to North, i.e. (A +X, -Z).  The first rotation angles are bounded by 0 to 360 degrees, while the second and third are bounded by -180 to + 180 degrees.   Find the rotation angles for definition B that produce the same result as definition A.   I am hoping to utilise a general algorithm into which I input the two rotation definitions and angles for the first definition.   I hope my description makes sense.  I have included some images to help visualise the problem.   The first image shows rotation definition A with angles 90, 10 and 20 and a visualisation of a 3D reference plane produced by the rotations.   The second image shows rotation definition B with the angles required to produce the same 3D reference plane.  It is these angles I wish to calculate.   Thanks in advance.
  4. Thanks.  I can resolve part of the problem with some simple maths and conditions on angle ranges when the rotation conventions are not too dissimilar.   I find this approach lacking somewhat and was hoping to utilise a general algorithm with which to attack the problem.  As part of that I expected to have to specify the individual rotation axes and direction of rotation, i.e. clockwise / counter-clockwise.  Unfortunately my knowledge of matrix maths is not sufficient to the task.  So I am interested in investigating any approach you might feel has merit. I Thankyou for your efforts to date and in the future.   I will however post on the maths forum to see if anyone else has some insights.
  5. This forms part of a process aimed at estimating a mean value into a specific location (a box or more accurately the centroid of that box) by selecting a subset of data from a larger set of data using a 'search' ellipsoid.  This is repeated for many boxes.  So ultimately we produce a 'model' consisting of many boxes each containing the localised average values from the surrounding data set.   We use various software packages in this process and they differ in how they define the orientation of this ellipsoid.  As we move from one package to another we need to know what the corresponding rotation angles are to ensure the ellipsoid has the correct orientation.  From the images you'll see a reference plane and the vector u (or an ellipse with the long axis in the same direction as the vector u).   The aim of the application I am writing is to calculate and display the rotation angles for each rotation convention given one of them.  That is let the user enter the angles for any one convention and all of the others are calculated and displayed.   So your final problem definition '1' is correct.   I hope this makes things a little clearer.
  6. Thanks for the tip on adding files.   The first two images are from one of the software applications we use.   This first image shows the rotations defined in the "mathematician" convention, i.e. +Z +Y +X, all positive counter-clockwise.   The second image shows the rotations defined by the "geologist plane" convention, i.e. A +X -Z, The first rotation being defined positive clockwise from North to East (Azimuth), the second one positive counter-clockwise about X and the third one positive clockwise about Z (A+X-Z).   The third image is the application I am writing.  It shows the same rotation angles as the mathematician convention, but ignore all the other angles as they are not correct yet.   Your point about whether they are in fact just one coordinate system may be valid, or is a new coordinate system defined by the resulting rotations?   
  7. I apologise if I am not using the correct terminology.  I am talking about a coordinate system defined by 3 orthogonal vectors X, Y, Z and an origin.  Z in all cases is up, Y is North and X is East.  The origin is shared by each coordinate system.  What I have available to me are descriptions of the rotation conventions used in each coordinate system and angles of rotation about each axes which define a reference plane.   What I want to do is given the rotation angles in one coordinate system, determine the rotation angles of the second coordinate system that defines the same reference plane.   Successive rotations occur around the current axis orientation. So if we initially have X, Y, Z axes.  The first rotation is about Z.  So we now have X1, Y1, Z1 (Z1 = Z).  The second rotation is about Y1. We now have X2, Y2, Z2 (Y2 = Y1).  The third rotation is about X2.  So the final axes will be X3, Y3, Z3 (X3 = X2).   If I could figure out how to post an image I would.  I think that would make it clear.
  8. Yes that is what I am attempting to do.   I suspect where I am going wrong is in defining the matrix from system 1 to system 2.   So ignoring my code snippet...   If system 1 is defined by 3 successive rotations around Z, then Y, then X, all defined positive counter-clockwise from East to North (+Z+Y+X). Angles are bounded by -180 and +180 degrees.   and system 2 is defined by 3 successive rotations around Z, then X, then Z again, the first one being defined positive clockwise from North to East (Azimuth), the second one counter-clockwise from East to North and the third one clockwise from East to North (A+X-Z). The first angle is bounded by 0 and +360 degrees. The second and third are bounded by -180 and +180 degrees.   How do I go about finding the transformation matrix?
  9. Thanks for the response.  This is not a homework question.  It's been quite a while since I was at school.      The problem is work related. We use a number of software applications that each use their own rotation convention.  I am writing an application that will display the rotation angles for each software application on the one form, together with visualisation of the rotation.   I posted my question on this forum because it appeared to have people who were discussing graphics programming at a deep mathematical and technical level, as opposed to MSDN forums which don't have much deep graphics programming discussions.   I have found many examples of rotating points or vectors around axes but few changing the rotation system.  Those that I have found discuss the maths but don't provide coded examples.   I was hoping to gain insight into how to approach such problems and the algorithms employed to resolve them, as well as practical examples.   I have a code snippet (C# and Direct3D) that goes some way to solving the issue in 2D but is not quite there in 3D. // initialise matrices Matrix u1, v1, w1, u2, v2, w2, base1, base2, invert2, cob; // gslib: A-Y+X u1 = Matrix.RotationZ(deg2rad(90.0 - rot1)); // A v1 = Matrix.RotationY(deg2rad(-rot2)); // -Y w1 = Matrix.RotationX(deg2rad(rot3)); // +X base1 = Matrix.Multiply(Matrix.Multiply(w1, v1), u1); // initialise vectors Vector4 r1, r2; // assign values to v1 //r1.X = deg2rad(rot1); //r1.Y = deg2rad(rot2); //r1.Z = deg2rad(rot3); //r1.W = 0; r1.X = (float)Math.Atan2((double)base1.M11, (double)base1.M12); // looks ok r1.Y = (float)Math.Atan2((double)base1.M21, (double)base1.M22); // wrong r1.Z = (float)Math.Asin((double)base1.M23); // wrong r1.W = (float)Math.Asin((double)base1.M44); // ? // geologist plane: A+X-Z u2 = Matrix.RotationZ(deg2rad(90 - rot1)); v2 = Matrix.RotationX(deg2rad(rot2)); w2 = Matrix.RotationZ(deg2rad(-rot3)); base2 = Matrix.Multiply(Matrix.Multiply(w2, v2), u2); // invert matrix invert2 = Matrix.Invert(base2); // multiply source matrix with inverted matrix cob = Matrix.Multiply(invert2, base1); // multiply cob with v1 to get v2 r2 = Vector4.Transform(r1, cob); // initialise vector components double i, j, k; // assign vector components i = rad2deg((double)r2.X); j = rad2deg((double)r2.Y); k = rad2deg((double)r2.Z); //i = (i < 0) ? (i + 360) % 360 : i; i = (i + 360) % 360; // return vector components return new IsatisGeoPlane(i, j, k); I am not even sure this is the right way to go about solving the problem.   So if anyone has insight into how to go about this or can see where I am going wrong I'd be grateful for the assistance.
  10. Hi, I'm new to graphics rotations and am trying to solve the following problem.    I have an initial rotation system defined by: The rotation (or the direction) is defined by 3 successive rotations around Z, then Y, then X, all defined positive counter-clockwise from East to North (+Z+Y+X). Angles are bounded by -180 and +180 deg.   And I'd like to determine the rotation angles in a second system defined by: The rotation (or the direction) is defined by 3 successive rotations around Z, then X, then Z again, the first one being defined positive clockwise from North to East (Azimuth), the second one counter-clockwise from East to North and the third one clockwise from East to North (A+X-Z). Angles are bounded by 0 and +360 deg. When this convention is used to define a plane, the last angle defines a reference direction. The two first angles are equivalent to (azimuth, dip).   I presume this may be accomplished by a change of basis but I am still trying to come to grips with how to do that.   So if I enter in the first system rotation angles of 90, 0, -20 how do I find these angles expressed in the second system?   I am using DirectX/Direct3D.   Thanks for your help.
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!