[Xastir] Ellipse Area Objects
Lynn W. Deffenbaugh (Mr)
ldeffenb at homeside.to
Sat Apr 2 00:16:40 EDT 2011
Greetings to the xastir developers,
As some of you might remember, I've been working to implement area
objects in APRSISCE/32 and received some valuable example test files and
screen shots of what they're supposed to look like (see link below) from
Curt. However, it was noted that Bob had not yet documented what
ellipses are supposed to look like, so I skipped them for a while (and
made them look like boxes just to be different).
Well, tonight I decided to just implement them as an elliptical shape
inside of what would have been the box shape. This means that they can
be wide or tall, but not angled from the baseline because there's
nothing in the area object spec to accomplish that.
I though you all might like to know so that maybe at least two APRS
clients will render them the same.
Lynn (D) - KJ4ERJ - Author of APRSISCE for Windows Mobile and Win32
PS. To keep circles round, I average the x and y offsets and use that
as the radius. The code I use to do that along with my ellipse code are
below if anyone finds it useful.
xastir's rendering: http://wetnet.net/~we7u/example_objects3.png
APRSISCE/32's: http://tinyurl.com/APRSIS32-examples3
Tyy/Cxx where yOff is yy*yy/1500 and xOff is xx*xx/1500
APRS->lat/lon are the object's actual location.
I purposely make rough-stepped circles (20 degrees) for performance on
Windows Mobile
case 5: // Color-filled circle
ml->Filled = TRUE;
case 0: // Open Circle
{ double a, radius = (xOff+yOff)/2;
double step = 20;
int p;
Closed = TRUE;
ml->Count = (int)((360.0/step)+1);
ml->Points = (MULTILINE_POINT_S
*)malloc(sizeof(*ml->Points)*(ml->Count+1)); /* +1 for possible
closure */
for (p=0, a=0; a<360+step; p++, a+=step)
{ ml->Points[p].Lat = APRS->lat - radius * sin(DegToRad(a));
ml->Points[p].Lon = APRS->lon + radius * cos(DegToRad(a));
}
break;
}
case 7: // Color-filled ellipse
ml->Filled = TRUE;
case 2: // Open ellipse
{ double t;
double step = 20;
int p;
Closed = TRUE;
ml->Count = (int)((360.0/step)+1);
ml->Points = (MULTILINE_POINT_S
*)malloc(sizeof(*ml->Points)*(ml->Count+1)); /* +1 for possible
closure */
for (p=0, t=0; t<360+step; p++, t+=step)
{ double rads = DegToRad(t);
if (yOff > xOff)
{ ml->Points[p].Lat = APRS->lat + yOff*sin(rads);
ml->Points[p].Lon = APRS->lon + xOff*cos(rads);
} else
{ ml->Points[p].Lat = APRS->lat + yOff*cos(rads);
ml->Points[p].Lon = APRS->lon + xOff*sin(rads);
}
}
break;
}
More information about the Xastir
mailing list