Just wonderin if anyone can share how they convert from radians to degress or even compass points?
Ta
Just wonderin if anyone can share how they convert from radians to degress or even compass points?
if (heading <= 22.5) {
txt += HEADING_N;
} else if (heading < 67.5) {
txt += HEADING_NE;
} else if (heading <= 112.5) {
txt += HEADING_E;
} else if (heading < 157.5) {
txt += HEADING_SE;
} else if (heading <= 202.5) {
txt += HEADING_S;
} else if (heading < 247.5) {
txt += HEADING_SW;
} else if (heading <= 292.5) {
txt += HEADING_W;
} else if (heading < 337.5) {
txt += HEADING_NW;
} else {
txt += HEADING_N;
}
var screenWidth = dc.getWidth();
var screenHeight = dc.getHeight();
for(var degree=0;degree<360;degree+=30){
dc.drawText(screenWidth/2+5+(screenWidth/2-5)*Math.cos((degree-90)*Math.PI/180)
, screenHeight/2-10+(screenHeight/2-10)*Math.sin((degree-90)*Math.PI/180)
, Graphics.FONT_SMALL, degree.toString(), Graphics.TEXT_JUSTIFY_CENTER);
}