Difference between revisions of "gc:drawArc"
m (Text replace - "</u> ||" to "</center></u> ||") |
m (Made sure this looks the same as gc:fillArc, which had some places with more enters. And added a See Also to gc:fillArc) |
||
(3 intermediate revisions by 2 users not shown) | |||
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 turns over ''turnAngle'' degrees.<br /> | ||
+ | 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'''( | + | gc:'''drawArc'''(x, y, width, height, start angle, turn angle) |
{| class="wikitable" | {| class="wikitable" | ||
Line 9: | Line 17: | ||
! Parameter !! Type !! Description | ! Parameter !! Type !! Description | ||
|- | |- | ||
− | | <u><center> | + | | <u><center>x</center></u> || number || The x-coordinate of the upper-left point |
+ | |- | ||
+ | | <u><center>y</center></u> || number || The x-coordinate of the upper-left point | ||
+ | |- | ||
+ | | <u><center>width</center></u> || number || Width of the rectangle containing the arc | ||
|- | |- | ||
− | | <u><center> | + | | <u><center>height</center></u> || number || Height of the rectangle containing the arc |
+ | |||
|- | |- | ||
− | | <u><center> | + | | <u><center>start angle</center></u> || number || The starting angle of the arc |
+ | |||
|- | |- | ||
− | | <u><center> | + | | <u><center>turning angle</center></u> || number || The angle over which the arc turns |
|} | |} | ||
− | == | + | In this syntax ''turnAngle'' can be negative. This means the arc will be drawn clockwise, whereas a positive number results in an arc turning counterclockwise. (Standard mathematical practice as well.) |
− | <syntaxhighlight></syntaxhighlight> | + | |
+ | == Examples == | ||
+ | <syntaxhighlight>gc:drawArc(10, 10, 20, 30, 0, 120)</syntaxhighlight> | ||
+ | The syntax above draws an arc from the right to the point turned 120 degrees. | ||
+ | <br /><br /> | ||
+ | <syntaxhighlight>gc:drawArc(50, 50, 25, 25, 90, 180)</syntaxhighlight> | ||
+ | The syntax above draws a semicircle from the top to the bottom, turning counterclockwise while doing so. Resulting in the semicircle being on the left side. | ||
+ | <syntaxhighlight>gc:drawArc(50, 50, 25, 25, 90, -180)</syntaxhighlight> | ||
+ | The syntax above draws a semicircle as well. Again from the top to the bottom. This time however, the routine will turn the arc clockwise, resulting in the semicircle being on the right side. | ||
+ | |||
+ | == Good to know == | ||
+ | |||
+ | To draw a circle, the width and height must be equal length and the turning angle must be 360. If width and height are different lengths, this routine will draw an oval. It is standard procedure to set the starting angle at 0 degrees. However, this is not necessary. | ||
+ | |||
+ | |||
+ | Any number over 360 set for ''startAngle'' will roll back to be within the domain of [0,360]. | ||
+ | |||
+ | Any number over 360 set for ''turnAngle'' will have no influence. All numbers higher than 360 will result in a circle. | ||
+ | |||
+ | == See Also == | ||
+ | [[gc:fillArc]] | ||
<br /><br /> | <br /><br /> | ||
[[Category:gc]] | [[Category:gc]] |
Latest revision as of 10:36, 13 February 2019
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 turns over turnAngle degrees.
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, turn angle)
Parameter | Type | Description |
---|---|---|
number | The x-coordinate of the upper-left point | |
number | The x-coordinate of the upper-left point | |
number | Width of the rectangle containing the arc | |
number | Height of the rectangle containing the arc | |
number | The starting angle of the arc | |
number | The angle over which the arc turns |
In this syntax turnAngle can be negative. This means the arc will be drawn clockwise, whereas a positive number results in an arc turning counterclockwise. (Standard mathematical practice as well.)
Examples
gc:drawArc(10, 10, 20, 30, 0, 120)
The syntax above draws an arc from the right to the point turned 120 degrees.
gc:drawArc(50, 50, 25, 25, 90, 180)
The syntax above draws a semicircle from the top to the bottom, turning counterclockwise while doing so. Resulting in the semicircle being on the left side.
gc:drawArc(50, 50, 25, 25, 90, -180)
The syntax above draws a semicircle as well. Again from the top to the bottom. This time however, the routine will turn the arc clockwise, resulting in the semicircle being on the right side.
Good to know
To draw a circle, the width and height must be equal length and the turning angle must be 360. If width and height are different lengths, this routine will draw an oval. It is standard procedure to set the starting angle at 0 degrees. However, this is not necessary.
Any number over 360 set for startAngle will roll back to be within the domain of [0,360].
Any number over 360 set for turnAngle will have no influence. All numbers higher than 360 will result in a circle.
See Also