Difference between revisions of "gc:drawArc"

From Inspired-Lua Wiki
Jump to navigation Jump to search
m (Text replace - "</u> ||" to "</center></u> ||")
Line 1: Line 1:
 +
__NOTOC__
 +
 
gc:'''drawArc''' is a function that is part of [[:Category:gc|gc]] (Graphics Context).  
 
gc:'''drawArc''' is a function that is part of [[:Category:gc|gc]] (Graphics Context).  
 +
 
 +
 +
Draws an arc in the rectangle with upper left corner (x,y) and pixel ''width'' and ''height''. The arc is drawn beginning at ''startAngle'' degrees and ending at ''endAngle''.
 +
Zero degrees points to the right and 90 degrees points up (standard mathematical practice but worth mentioning since the y axis is inverted).   
 +
 
{{Since|3.0}}
 
{{Since|3.0}}
  
 
== Syntax  ==
 
== Syntax  ==
'''drawArc'''(arg1, arg2, arg3 [,arg4])  
+
gc:'''drawArc'''(x, y, width, height, start angle, finish angle)  
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 9: Line 16:
 
! Parameter !! Type !! Description
 
! Parameter !! Type !! Description
 
|-
 
|-
| <u><center>arg1</center></u> || TypeOfArg1 || Description of arg1
+
| <u><center>x</center></u> || number || The x-coordinate of the upper-left point
 
|-
 
|-
| <u><center>arg2</center></u> || TypeOfArg2 || Description of arg2
+
| <u><center>y</center></u> || number || The x-coordinate of the upper-left point
 
|-
 
|-
| <u><center>arg3</center></u> || TypeOfArg3 || Description of arg3
+
| <u><center>width</center></u> || number || Width of the rectangle containing the arc
 
|-
 
|-
| <u><center>arg4</center></u> || TypeOfArg4 || Description of arg4
+
| <u><center>height</center></u> || number || Height of the rectangle containing the arc
 +
 
 +
|-
 +
| <u><center>start angle</center></u> || number || start angle
 +
 
 +
|-
 +
| <u><center>finish angle</center></u> || number || finish angle
 
|}
 
|}
  
 
== Example  ==
 
== Example  ==
<syntaxhighlight></syntaxhighlight>
+
<syntaxhighlight>gc:drawArc(10, 10, 20, 30, 0, 120)</syntaxhighlight>
 +
 
 +
== Good to know ==
 +
 
 +
To draw a circle, the width and height must be equal length and the start and end angles must be 0 and 360. If width and height are different lengths, this routine will draw an oval.
  
 
<br /><br />
 
<br /><br />
  
 
[[Category:gc]]
 
[[Category:gc]]

Revision as of 16:53, 11 July 2011


gc:drawArc is a function that is part of gc (Graphics Context).


Draws an arc in the rectangle with upper left corner (x,y) and pixel width and height. The arc is drawn beginning at startAngle degrees and ending at endAngle. Zero degrees points to the right and 90 degrees points up (standard mathematical practice but worth mentioning since the y axis is inverted).

This has been introduced in TI-Nspire OS 3.0 (Changes).


Syntax

gc:drawArc(x, y, width, height, start angle, finish angle)

Parameter Type Description
x
number The x-coordinate of the upper-left point
y
number The x-coordinate of the upper-left point
width
number Width of the rectangle containing the arc
height
number Height of the rectangle containing the arc
start angle
number start angle
finish angle
number finish angle

Example

gc:drawArc(10, 10, 20, 30, 0, 120)

Good to know

To draw a circle, the width and height must be equal length and the start and end angles must be 0 and 360. If width and height are different lengths, this routine will draw an oval.