geoslegend / winforms-geplugin-control-library

Automatically exported from code.google.com/p/winforms-geplugin-control-library
GNU General Public License v3.0
0 stars 0 forks source link

Maths.Destination does not seem to work #17

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. When I use Maths.Destination to calculate a point I end up on the other 
side of the planet

What is the expected output? What do you see instead?
I enter data to move from Niagara Falls 100 metres north but I end up in 
France

What version of the product are you using? On what operating system?
Running on vista 64

Please provide any additional information below.
Heres the code;

      GEHitTestResultCoClass result = this._ge.getView().hitTest
(this._selectedArea.Center.X, this._ge.UNITS_PIXELS, 
this._selectedArea.Center.Y, this._ge.UNITS_PIXELS, 
this._ge.HIT_TEST_GLOBE);
      IKmlPoint point = this._ge.createPoint("");
      point.setLatitude(result.getLatitude());
      point.setLongitude(result.getLongitude());
      IKmlPoint destination = Maths.Destination(point, 0, 100);
      GEHelpers.LookAt(this._ge, destination.getLatitude(), 
destination.getLongitude());

Original issue reported on code.google.com by robert.s...@lacota.com on 31 Oct 2009 at 2:09

GoogleCodeExporter commented 8 years ago
I seem to have found the problem;
In this line;
 result.setLatLng(
                phi2.ConvertRadiansToDegrees(),
                Math.Atan2(Math.Sin(heading_rad) * sin_angularDistance * Math.Cos
(phi2), cos_angularDistance - sin_phi1 * 
Math.Sin(phi2)).ConvertRadiansToDegrees() + 
origin.getLongitude());

The statement origin.getLongitude() returns zero. For some reason it loses its 
value. If I capture the value in a double at the top of the method and use 
that, it 
seems to work.

Original comment by robert.s...@lacota.com on 31 Oct 2009 at 12:42

GoogleCodeExporter commented 8 years ago
The error here is caused by the same problem as Issue 18.
The line;

IKmlPoint result = origin;

is changing the origin object

Original comment by robert.s...@lacota.com on 1 Nov 2009 at 6:20

GoogleCodeExporter commented 8 years ago
Yes, I will amend the methods that return point objects to accept a plug-in 
object as a 
parameter so that a new 'result' point can be created. Thanks for pointing that 
out.

F.

Original comment by fraser.c...@gmail.com on 1 Nov 2009 at 6:59

GoogleCodeExporter commented 8 years ago

Original comment by fraser.c...@gmail.com on 3 Nov 2009 at 4:48