Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Plot line between two points on ellipsoid

Subject: Plot line between two points on ellipsoid

From: Els

Date: 16 May, 2010 15:47:03

Message: 1 of 12

I have two points on the surface of my ellipsoid. I calculated the distance between them with the Vincenty formula. But now I want to plot this distance on the ellipsoid distance as a line as well. For a sphere this is easy, but I do not know how to do it for an ellipsoid.

Subject: Plot line between two points on ellipsoid

From: us

Date: 16 May, 2010 15:54:04

Message: 2 of 12

"Els " <y.e.t.reeuwijk@student.utwente.nl> wrote in message <hsp41n$28e$1@fred.mathworks.com>...
> I have two points on the surface of my ellipsoid. I calculated the distance between them with the Vincenty formula. But now I want to plot this distance on the ellipsoid distance as a line as well. For a sphere this is easy, but I do not know how to do it for an ellipsoid.

huh...
what's the difference - technically, not conceptually(?)...

     help line; % <- will do it...

us

Subject: Plot line between two points on ellipsoid

From: Mark Shore

Date: 16 May, 2010 16:00:06

Message: 3 of 12

"Els " <y.e.t.reeuwijk@student.utwente.nl> wrote in message <hsp41n$28e$1@fred.mathworks.com>...
> I have two points on the surface of my ellipsoid. I calculated the distance between them with the Vincenty formula. But now I want to plot this distance on the ellipsoid distance as a line as well. For a sphere this is easy, but I do not know how to do it for an ellipsoid.

This is likely to be a fairly difficult problem to solve exactly, and I can't offer help. But, if you are using an Earth model (with 1/f ~ 298.257) then for plotting purposes an arc on a sphere will be almost indistinguishable from the true arc on the ellipsoid.

Subject: Plot line between two points on ellipsoid

From: Els

Date: 16 May, 2010 16:09:04

Message: 4 of 12

This is indeed the problem, because I am using a small ellipsoid, which does not look like the earth. Now I just copied the formulas I used from the times I used a simple sphere, and it looks really crap.

@ us, plotting a line is not the difficulty here. It is the formula behind it, probably being an integral I am curious about.

Subject: Plot line between two points on ellipsoid

From: us

Date: 16 May, 2010 16:17:04

Message: 5 of 12

"Els " <y.e.t.reeuwijk@student.utwente.nl> wrote in message <hsp5b0$3se$1@fred.mathworks.com>...
> This is indeed the problem, because I am using a small ellipsoid, which does not look like the earth. Now I just copied the formulas I used from the times I used a simple sphere, and it looks really crap.
>
> @ us, plotting a line is not the difficulty here. It is the formula behind it, probably being an integral I am curious about.

yes, i realize that i misunderstood your problem...
sorry for confusion...

us

Subject: Plot line between two points on ellipsoid

From: Mark Shore

Date: 16 May, 2010 16:21:03

Message: 6 of 12

"Els " <y.e.t.reeuwijk@student.utwente.nl> wrote in message <hsp5b0$3se$1@fred.mathworks.com>...
> This is indeed the problem, because I am using a small ellipsoid, which does not look like the earth. Now I just copied the formulas I used from the times I used a simple sphere, and it looks really crap.
>
> @ us, plotting a line is not the difficulty here. It is the formula behind it, probably being an integral I am curious about.

Ah, I thought that might be the case. Roger Stafford's comment on one of your earlier posts probably applies then, and you will have a problem of (at least) moderate difficulty. Possibly you can locate an analytical or numerical solution for points along the geodesic between the endpoints, but I'm not familiar with one.

Subject: Plot line between two points on ellipsoid

From: Bruno Luong

Date: 16 May, 2010 16:34:03

Message: 7 of 12

"Els " <y.e.t.reeuwijk@student.utwente.nl> wrote in message <hsp5b0$3se$1@fred.mathworks.com>...
>
> @ us, plotting a line is not the difficulty here. It is the formula behind it, probably being an integral I am curious about.

To avoid confusion please don't call it a line, it's a geodesic.

Have you look more closely to Vincenty's paper? If he derives an analytical expression of the distance, it must have the formula for the path as well. I have a hard time to believe the distance formula comes alone.

Otherwise, I would suggest two numerical techniques:

1) try to use geodesic ode equation together with BVP4C(.)
2) Use for example a spline parametrization of your curve with the constraints forcing the knots to belong to the ellipsoid, and and minimize the length by optimization technique such as FMINCON.

Bruno

Subject: Plot line between two points on ellipsoid

From: Mark Shore

Date: 16 May, 2010 18:02:03

Message: 8 of 12

"Bruno Luong" <b.luong@fogale.findmycountry> wrote in message <hsp6pr$g8d$1@fred.mathworks.com>...
> "Els " <y.e.t.reeuwijk@student.utwente.nl> wrote in message <hsp5b0$3se$1@fred.mathworks.com>...
> >
> > @ us, plotting a line is not the difficulty here. It is the formula behind it, probably being an integral I am curious about.
>
> To avoid confusion please don't call it a line, it's a geodesic.
>
> Have you look more closely to Vincenty's paper? If he derives an analytical expression of the distance, it must have the formula for the path as well. I have a hard time to believe the distance formula comes alone.
>
> Otherwise, I would suggest two numerical techniques:
>
> 1) try to use geodesic ode equation together with BVP4C(.)
> 2) Use for example a spline parametrization of your curve with the constraints forcing the knots to belong to the ellipsoid, and and minimize the length by optimization technique such as FMINCON.
>
> Bruno

The Vincenty paper uses an iterative algorithm and it would be hard to extract intermediate points.

However, a more recent and accurate implementation of another algorithm can be found at http://sourceforge.net/projects/geographiclib/ or see specifically http://geographiclib.sourceforge.net/html/utilities.html#geod . Files iinclude C++ source code (not useful to me, but maybe to others), and the command line program includes the option of calculating the coordinates of intermediate points along the geodesic. Documentation could definitely be better.

Subject: Plot line between two points on ellipsoid

From: Els

Date: 16 May, 2010 18:11:03

Message: 9 of 12

Unfortunately I can't read the C++ code either, but it looks rather promising. Actually it is exactly what I am looking for. If I just knew the algorithm behind it, I can make it work.

Subject: Plot line between two points on ellipsoid

From: Mark Shore

Date: 16 May, 2010 19:05:04

Message: 10 of 12

"Els " <y.e.t.reeuwijk@student.utwente.nl> wrote in message <hspcfn$nlm$1@fred.mathworks.com>...
> Unfortunately I can't read the C++ code either, but it looks rather promising. Actually it is exactly what I am looking for. If I just knew the algorithm behind it, I can make it work.

I may have been a little premature saying the documentation. There is a lot there, just not readily accessible.

Much is based on an 1826 paper by Bessel and recently translated from German as "The calculation of longitude and latitude from geodesic measurements". A preprint is available at http://arxiv.org/PS_cache/arxiv/pdf/0908/0908.1824v2.pdf

Additional material is from an 1880 German text on geodesy by F. R. Helmert, which - unsurprisingly - is not online.

Subject: Plot line between two points on ellipsoid

From: Roger Stafford

Date: 17 May, 2010 02:35:05

Message: 11 of 12

"Els " <y.e.t.reeuwijk@student.utwente.nl> wrote in message <hsp41n$28e$1@fred.mathworks.com>...
> I have two points on the surface of my ellipsoid. I calculated the distance between them with the Vincenty formula. But now I want to plot this distance on the ellipsoid distance as a line as well. For a sphere this is easy, but I do not know how to do it for an ellipsoid.
- - - - - - - - -
  Correct me if I am wrong, but the impression I get is that Vincenty's formulae make the assumption that the ellipsoid in question is an oblate spheroid, meaning that two of its semi-axes are of equal length, since he was primarily interested in the earth considered as an ellipsoid and the geodesics thereupon. See: "Vincenty's formulae" at:

 http://en.wikipedia.org/wiki/Vincenty's_formulae

  Els, I believe you implied you wanted to deal with a general ellipsoid with all differing semi-axes when you said, "I am using a small ellipsoid, which does not look like the earth."

  On checking I found an interesting article at:

 http://mathworld.wolfram.com/EllipsoidGeodesic.html

that makes no such assumption. It states that an ellipsoidal geodesic can be expressed in the form of their eqs. (8) and (9) which together could constitute a pair of not very frightening-looking differential equations involving a two confocal ellipsoidal coordinates as explained in:

 http://mathworld.wolfram.com/ConfocalEllipsoidalCoordinates.html ,

rather than more conventional coordinates. The independent variable would be the arc length along the geodesic, so that would fall out naturally. This seems like a fascinating possibility. There is an arbitrary constant present which they call 'theta' which presumably corresponds to the infinitely many possible closed geodesics possible on an ellipsoid through each point. The task would be to start at one point using that point's pair of confocal coordinates, and so adjust theta that you will eventually arrive at the other desired point with its particular pair of confocal coordinates.

  Unfortunately the author of this article was very short on details so it would require quite a bit of study to see if there could be a useful algorithm lurking therein.

Roger Stafford

Subject: Plot line between two points on ellipsoid

From: Els

Date: 17 May, 2010 09:38:03

Message: 12 of 12

In my ellipsoid the radii in the x and y direction are equal and the radii in the z-direction differs. This makes that it looks like the earth, because of the shape, but not because of the size. So I thought that Vincenty's formula could work in my case. But if you think different, then I will look into it more. But the theory you are implying sounds logical, taking theta as an variable.

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us