Cool!!! new stuff I didn't know about. Thanks.

On Wed, Feb 2, 2011 at 12:13 AM, JKurtock <[email protected]> wrote:

> Or you can let Mr. Google compute the heading from the pair of
> latlngs.
> http://code.google.com/apis/maps/documentation/javascript/geometry.html
>
> On Feb 1, 7:00 pm, Robert Poor <[email protected]> wrote:
> > Martin:
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > On Tue, Feb 1, 2011 at 18:43, Martin <[email protected]> wrote:
> > > Try this:
> >
> > > function getAngle(from, to){
> > >  function wrapAngle(angle){
> > >  if (angle>=360) {
> > >   angle-=360;
> > >  } else if (angle<0){
> > >   angle+=360;
> > >  }
> > >  return angle;
> > >  }
> > >  var DEGREE_PER_RADIAN=57.2957795, RADIAN_PER_DEGREE=0.017453;
> > >  var dLat=to.lat()-from.lat(), dLng=to.lng()-from.lng();
> > >  var yaw=Math.atan2(dLng*Math.cos(to.lat()*RADIAN_PER_DEGREE),
> > > dLat)*DEGREE_PER_RADIAN;
> > >  return wrapAngle(yaw);
> > > }
> >
> > > 'from' and 'to' are both LatLng objects.
> >
> > > Martin.
> >
> > yaw looks like a simplified version of the forward azimuth algo on the
> > previously cited movable_type site (no?).
> >
> > But now I am curious: what purpose is wrapAngle() serving?  It is always
> the
> > case that -PI <= Math.atan2() <= PI -- does the Google StreetViewPov
> class
> > really care if you give it a negative heading?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google Maps JavaScript API v3" group.
> To post to this group, send email to
> [email protected].
> To unsubscribe from this group, send email to
> [email protected]<google-maps-js-api-v3%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/google-maps-js-api-v3?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Maps JavaScript API v3" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-maps-js-api-v3?hl=en.

Reply via email to