From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

convert coordinate system

Hello, 

I have searched the internet and this forum for a quick and resource-efficeint way to do this but I cant find anything. Essentailly I want to convert an array of 3D data in spherical coordinates to an array of 3D data in different spherical coordinates. There seems to be a way to convert between spherical and XYZ, but not from one spherical to another spherical.

The input data set is like this

 

Phi | Theta  |  dBi

0        -180        x

0        -179        x

.             .           x

180    180        x

 

and how I want to convert it should look like this:

 

Azimuth | Tilt  |   dBi

0              -90         x

0              -89         x

.                  .           x

360         90          x

 

Thanks

0 Kudos
Message 1 of 23
(4,154 Views)

What are the conversion rules?

0 Kudos
Message 2 of 23
(4,145 Views)

What do you mean by rules? The format that I am ultimately trying to get is 3D Atoll format for Forsk's Atoll software.

0 Kudos
Message 3 of 23
(4,139 Views)

Well, you only have 2 coordinates, so doing 3D is a bit difficult. 😄 Are you just dealing with directions, ignoring distances and rotations around the vector?

 

The first coordinate seems to convert 0...180 to 0..360 so a simple multiplication by two would do it.

The second coordinate seems to covert -180..180 to -90..90, so a simple division by two would work.

I don't know the meaning of x in your table.

 

Your need to clarify your problem. I am not familiar with the 2D atoll format. Do you have a website link?

What is the coordinate system before conversion (e.g. euler angles, etc.).

0 Kudos
Message 4 of 23
(4,115 Views)

Hi,

   Just a guess:

 

Tilt = Phi - 90

Azimuth = Theta + 180

0 Kudos
Message 5 of 23
(4,094 Views)

Sounds to me that you may be talking about Rotation Matrices or Rotation Vectors.  Given an orientation of a Cartesian coordinate system (given by theta1 and phi1) and another orientation (given by theta2 and phi2), there is a (unique) single rotation (theta3, phi3) that can take the first coordinate system into the second.  Put another way, you can get from one orientation by a rotation about a single axis.

 

Does this sound like what you are trying to do?

 

BS

0 Kudos
Message 6 of 23
(4,072 Views)

Actually, since its spherical coordinates, it is 3D. The files I am working with are antenna pattern files which are ususally measured in spherical coordinates (2 axis of rotation), commonly called 4-pi steradians. The problem I'm having is I need to basically re-label the columns and have the pattern data match the new location so that it is still an antenna pattern and not random junk. The first column, phi, goes from 0 to 180. At each phi, the is an entire theta set going from -180 to +180, Thats how it can be 3D with only 2 coordinates. I have included a picture of the anechoic chamber's coordinate system for reference.

 

What I want to do is instead of going phi 0 - 180 with each theta going -180 - +180, is phi 0 - 360 with each theta going -90 - +90. 

 

x is a place holder for the antennas gain in dBi.

 

I have also attached sample files of data.

 

Hopefully I havn't fully confused everyone, Spherical coordinates are a hard thing.

0 Kudos
Message 7 of 23
(4,035 Views)

You clearly do not understand Spherical Polar Coordinates.  The thing that makes it 3D is that the third component is Radius, which in your context is a constant, 1.  

 

Assume a Cartesian (X-Y-Z) coordinate system oriented using the usual Right Hand Rule convention (make the XY plane horizontal, with X "forward", Y "to the left", and Z "up", so that if you curl your right hand fingers as though moving the X axis into the Y axis, your thumb points to the Z axis.  Consider a point on the surface of the unit sphere (this takes only 2 coordinates, as we've "frozen" the radius).  Project it onto the XY plane and onto the Z axis.  What you call Theta is the angle that the component projected onto the XY plane makes with the X axis, and what you call Phi is the angle it makes with the +Z axis (actually, you don't have to define it this way, but this is the "usual" definition).

 

An easy way to see how these angles arise is to consider what you need to do to place the +Z axis on an arbitrary point on the surface of a sphere.  Let's pretend it's a Globe, and describe this point by "Latitude" (a circle parallel to the equator) and "Longitude" (great circles that pass through both poles).  Let's begin by rotating about the Y axis (using the right-hand rule, so a small rotation will yield a +X component) until our Latitude is correct.  Now rotate about the Z axis until you are at the right longitude.

 

Rotations about the X-Y-Z coordinate axes are simple matrix transformations, and a Y rotation followed by a Z rotation is a simple matrix multiplication.  Just Do the Math, it's really very simple.

 

BS

0 Kudos
Message 8 of 23
(3,993 Views)

Hi,

   Here is my second try. I'm going to call the old coordinates (p, t) and the new coordinates (p', t'). Your goal is to find a map from (p, t) to (p', t'), that preserves distances. In other words the distance between any two points in the (p, t) domain is the same as the distance between the two points which result from applying the map into the (p', t') domain. I think it has to be a piecewise map.

 

(0 < p < 180) && (-90 < t < 90)

p' = p

t' = t

 

(0 < p < 180) && (-180 < t < -90)

p' = p + 180

t' = -(t + 180)

 

(0 < p < 180) && (90 < t < 180)

p' = p + 180

t' = 180 - t

 

It's not that straightforward, at least to me. Its possible I mixed up the theta direction for the last two. I'll try to check at some point. Attached is the vi for converting, a screenshot and your "original example" after conversion. See if it works for you 😉

Download All
0 Kudos
Message 9 of 23
(3,965 Views)

Here is the data...

0 Kudos
Message 10 of 23
(3,961 Views)