Item #1:
When using the search/replace function in the PIDE, a copy of the "replacement text" is inserted at the current cursor location. All substitutions are correctly carried out as expected.
Item #2:
I am using the following code block:
The calling sequence is:
CalcDist(OldLat$,OldLon$,lat$,lon$,&dist$,&theta$);
A trace of teh internal variables during execution shows:
lat1=-27.435718 lon1=153.180938 lat2=-27.519052 lon2=153.097605
radlat1=2.042035 radlon1=2.670354 radlat2=2.042035 radlon2=2.670354
x1=-5054.481740 y1=2575.387081 z1=-2890.424493 x2=-5054.481740 x2=2575.387081 x2=-2890.424493
d=0
theta=0
NOTE:
while lat1 DOES NOT EQUAL lat2 the calculated values for radlat1 and radlat2 ARE EQUAL.
Any clues as to whats going wrong?
When using the search/replace function in the PIDE, a copy of the "replacement text" is inserted at the current cursor location. All substitutions are correctly carried out as expected.
Item #2:
I am using the following code block:
- Code:
proc CalcDist(lat1$,lon1$,lat2$,lon2$,dist$,theta$)
local (Pi$,radlat1$,radlon1$,radlat2$,radlon2$);
local (er$,x1$,y1$,z1$,x2$,y2$,z2$,d$);
memo_addline(memo1$,"lat1="+lat1$+" "+
"lon1="+lon1$+" "+
"lat2="+lat2$+" "+
"lon2="+lon2$);
dist$ = 0.0; theta$ = 0.0;
Pi$ = 3.1415926535897932;
radlat1$ = (Pi$*abs(lat1$))/180.0;
radlon1$ = (Pi$*abs(lon1$))/180.0;
if (lat1$ >= 0)
radlat1$ = (Pi$/2.0)-radlat1$;
else
radlat1$ = (Pi$/2.0)+radlat1$;
end;
if (lon1$ < 0) radlon1$ = (Pi$*2)-radlon1$; end;
radlat2$ = (Pi$*abs(lat2$))/180.0;
radlon2$ = (Pi$*abs(lon2$))/180.0;
if (lat2$ >= 0)
radlat2$ = (Pi$/2.0)-radlat2$;
else
radlat2$ = (Pi$/2.0)+radlat2$;
end;
if (lon2$ < 0) radlon2$ = (Pi$*2)-radlon2$; end;
memo_addline(memo1$,"radlat1="+radlat1$+" "+
"radlon1="+radlon1$+" "+
"radlat2="+radlat2$+" "+
"radlon2="+radlon2$);
er$ = 6366.707;
x1$ = er$ * cos(radlon1$)*sin(radlat1$);
y1$ = er$ * sin(radlon1$)*sin(radlat1$);
z1$ = er$ * cos(radlat1$);
x2$ = er$ * cos(radlon2$)*sin(radlat2$);
y2$ = er$ * sin(radlon2$)*sin(radlat2$);
z2$ = er$ * cos(radlat2$);
memo_addline(memo1$,"x1="+x1$+" "+
"y1="+y1$+" "+
"z1="+z1$+" "+
"x2="+x2$+" "+
"x2="+y2$+" "+
"x2="+z2$);
d$ = sqrt(((x1$-x2$)*(x1$-x2$))+((y1$-y2$)*(y1$-y2$))+((z1$-z2$)*(z1$-z2$)));
memo_addline(memo1$,"d="+d$);
theta$ = acos(((er$*er$)+(er$*er$)-(d$*d$))/(2*er$*er$));
dist$ = (theta$*er$);
theta$ = (180.0/Pi$)*theta$;
memo_addline(memo1$,"theta="+theta$+" dist* = "+dist$);
end;
The calling sequence is:
CalcDist(OldLat$,OldLon$,lat$,lon$,&dist$,&theta$);
A trace of teh internal variables during execution shows:
lat1=-27.435718 lon1=153.180938 lat2=-27.519052 lon2=153.097605
radlat1=2.042035 radlon1=2.670354 radlat2=2.042035 radlon2=2.670354
x1=-5054.481740 y1=2575.387081 z1=-2890.424493 x2=-5054.481740 x2=2575.387081 x2=-2890.424493
d=0
theta=0
NOTE:
while lat1 DOES NOT EQUAL lat2 the calculated values for radlat1 and radlat2 ARE EQUAL.
Any clues as to whats going wrong?