f. Set Angle Type

<< Click to Display Table of Contents >>

Navigation:  Tutorials > Tutorial 09 - Setting Graphics Context >

f. Set Angle Type

This section shows how to set a different angle type using the SetAngleType() command.

 

 

Command Prototype

 

uint16_t SetAngleType(int16_t AngleType)

 

Parameters

Description

AngleType

DEGREES or FURMANS

 

 

Code

 

 

void setup()

{

/* Initialize CleO - needs to be done only once */

 CleO.begin();

 

 /* Start building a screen frame */

 CleO.Start();

 

 CleO.LineColor(LIGHT_GREEN);

 CleO.LineWidth(5);

 

/* Draw a line with default angle type - 0 degree */

 CleO.StringExt(FONT_MEDIUM, 10, 50, LIGHT_GREEN, TL, 0, 0, "Default Angle");

 CleO.StringExt(FONT_SANS_2, 10, 100, LIGHT_GREEN, TL, 0, 0, "0 Degree");

 CleO.LineXY(250, 25, 100);

 

 /* Draw a line with 120 degree */

 CleO.SetAngleType(DEGREES);

 CleO.StringExt(FONT_MEDIUM, 150, 220, LIGHT_GREEN, TL, 0, 0, "120 Degree");

 CleO.LineAngle(120);

 CleO.LineXY(100, 250, 100);

 

 CleO.StringExt(FONT_SANS_2, 75, 320, LIGHT_GREEN, TL, 0, 0, "180 Degree");

 CleO.StringExt(FONT_MEDIUM, 75, 350, LIGHT_GREEN, TL, 0, 0, "32760 FURMANS");

 CleO.StringExt(FONT_SANS_0, 90, 400, LIGHT_GREEN, TL, 0, 0,

 "1 degree is approx. 182 FURMANS");

 

/* Change angle unit */

 CleO.SetAngleType(FURMANS);

 

 /* 1 degree is approximately 182 Furmans */

 CleO.LineAngle(180 * 182);

 CleO.LineXY(25, 425, 100);

 

/* Display completed screen frame */

 CleO.Show();

}

 

void loop() {}

 

 

Description

 

The above code snippet first draws a line with 0 degrees at (250,25) and subsequently with 120 degrees at (100,250).

Later, the angle type is changed to FURMANS using the SetAngleType() command and then a line is drawn at (25,425).

Furman is a metric used for measuring the angles regarding 16-bit precision. 1 degree is approximately 182 units in Furmans. For example, 30 degrees is "30 * 65536 / 360" Furmans.

 

 

Output

 

Here is the output displayed upon executing the above code snippet -

 

SetAngleType