You are on page 1of 3

ht t p: / / el ect r oni cs. henni ngkar l sen.

com ( C) 2013 Henni ng Kar l sen



UTFT_Geometry

Add-on Library for UTFT: Geometric functions

Manual


UTFT_Geomet r y l i br ar y Page 1
PREFACE:
Thi s l i br ar y i s an add- on t o UTFT and wi l l not wor k on i t s own.

Thi s l i br ar y adds some geomet r i c f unct i ons t o UTFT whi ch ar e not i ncl uded i n t he mai n l i br ar y.

You can al ways f i nd t he l at est ver si on of t he l i br ar y at
http://electronics.henningkarlsen.com/

I f you make any modi f i cat i ons or i mpr ovement s t o t he code, I woul d appr eci at e t hat you shar e
t he code wi t h me so t hat I mi ght i ncl ude i t i n t he next r el ease. I can be cont act ed t hr ough
http://electronics.henningkarlsen.com/contact.php.

For ver si on i nf or mat i on, pl ease r ef er t o version.txt.




Thi s l i br ar y i s l i censed under a CC BY-NC-SA 3.0 ( Cr eat i ve Commons At t r i but i on-
NonCommer ci al - Shar eAl i ke 3. 0 Unpor t ed) Li cense.

For mor e i nf or mat i on see: http://creativecommons.org/licenses/by-nc-sa/3.0/

UTFT_Geomet r y l i br ar y Page 2

FUNCTIONS:

UTFT_Geometry(UTFT);
The main class constructor.

Parameters: UTFT: A r ef er ence t o an al r eady cr eat ed UTFT obj ect (remember the & in front of the object name)

Usage: UTFT_Geomet r y geo( &myGLCD) ; / / St ar t an i nst ance of UTFT_Geomet r y poi nt i ng t o t he UTFT obj ect myGLCD
Notes: Remember t hat al l f unct i ons i n UTFT_Geomet r y must be cal l ed t hr ough t he UTFT_Geomet r y obj ect ( geo i n
t hi s exampl e) , whi l e al l UTFT f unct i ons st i l l must be cal l ed t hr ough t he UTFT obj ect ( myGLCD i n t hi s
exampl e)

drawTriangle(x1, y1, x2, y2, x3, y3);
Draw a triangle with the specified corners.

Parameters: x1: x- coor di nat e of t he f i r st cor ner
y1: y- coor di nat e of t he f i r st cor ner
x2: x- coor di nat e of t he second cor ner
y2: y- coor di nat e of t he second cor ner
x3: x- coor di nat e of t he t hi r d cor ner
y3: y- coor di nat e of t he t hi r d cor ner

Usage: geo. dr awTr i angl e( 159, 119, 319, 119, 319, 239) ; / / Dr aw a t r i angl e

fillTriangle(x1, y1, x2, y2, x3, y3);
Draw a filled triangle with the specified corners.

Parameters: x1: x- coor di nat e of t he f i r st cor ner
y1: y- coor di nat e of t he f i r st cor ner
x2: x- coor di nat e of t he second cor ner
y2: y- coor di nat e of t he second cor ner
x3: x- coor di nat e of t he t hi r d cor ner
y3: y- coor di nat e of t he t hi r d cor ner

Usage: geo. f i l l Tr i angl e( 159, 119, 319, 119, 319, 239) ; / / Dr aw a f i l l ed t r i angl e

drawArc(x, y, r, startAngle, endAngle[, thickness]);
Draw an arc.

Parameters: x : x- coor di nat e f or t he cent er of t he i magi nar y ci r cl e
y : y- coor di nat e f or t he cent er of t he i magi nar y ci r cl e
r : Radi us of t he i magi nar y ci r cl e
st ar t Angl e: Angl e f r omt he cent er of t he i magi nar y ci r cl e t o st ar t dr awi ng t he ar c
endAngl e : Angl e f r omt he cent er of t he i magi nar y ci r cl e t o st op dr awi ng t he ar c
t hi ckness : <optional>
Thi ckness of t he ar c i n pi xel s. Def aul t i s 1 pi xel .

Usage: geo. dr awAr c( 159, 239, 100, - 75, 75) ; / / Dr aw an ar c
Notes: 0 i s at t he t op of t he i magi nar y ci r cl e

drawPie(x, y, r, startAngle, endAngle);
Draw an arc with lines to the center of the imaginary circle.

Parameters: x : x- coor di nat e f or t he cent er of t he i magi nar y ci r cl e
y : y- coor di nat e f or t he cent er of t he i magi nar y ci r cl e
r : Radi us of t he i magi nar y ci r cl e
st ar t Angl e: Angl e f r omt he cent er of t he i magi nar y ci r cl e t o st ar t dr awi ng t he ar c
endAngl e : Angl e f r omt he cent er of t he i magi nar y ci r cl e t o st op dr awi ng t he ar c

Usage: geo. dr awPi e( 159, 50, 100, 135, 225) ; / / Dr aw a pi e shape
Notes: 0 i s at t he t op of t he i magi nar y ci r cl e

You might also like