[GRASS-dev] symbol rotation is go
Hamish
hamish_nospam at yahoo.com
Wed May 2 02:01:01 EDT 2007
Glynn Clements wrote:
> > I have just added a new libgis function: G_rotate_around_pt() in
> > 6.3cvs.
> > (make distclean, yet again)
> >
> > It rotates a point around a given center coord by a given angle.
>
> I would suggest an alternate version:
>
> void G_rotate_around_point(double X0, double Y0, double *X1, double *Y1, double angle) {
> double dx = *X1 - X0;
> double dy = *X1 - X0;
> double c = cos(D2R(angle));
> double s = sin(D2R(angle));
> double dx1 = dx * c - dy * s;
> double dy1 = dx * s + dy * c;
>
> *X1 = X0 + dx1;
> *Y1 = Y0 + dy1;
> }
Hi,
committed, with a minor fix:
-double dy = *X1 - X0;
+double dy = *Y1 - Y0;
thanks,
Hamish
More information about the grass-dev
mailing list