Difference between revisions of "TI-BASIC:Shaded Triangle"

From Learn @ Cemetech
Jump to navigationJump to search
(Initial automated import)
 
(Automated @@ correction)
 
Line 1: Line 1:
 
{{Template:TI-BASIC:Routine
 
{{Template:TI-BASIC:Routine
|picture=@@
+
|picture=
 
|summary=Draws a triangle on the graph screen.
 
|summary=Draws a triangle on the graph screen.
 
|input=
 
|input=
Line 7: Line 7:
 
S - Whether it is shaded
 
S - Whether it is shaded
 
D - draw if 1, erase if 0
 
D - draw if 1, erase if 0
|output=@@
+
|output=
 
|variable=L1, L2, S, D, M, N, B, C
 
|variable=L1, L2, S, D, M, N, B, C
 
|compatibility=TI-83/84/+/SE
 
|compatibility=TI-83/84/+/SE
|author=@@
+
|author=
|authors=@@
+
|authors=
|url=@@
+
|url=
|download=@@
+
|download=
 
}}
 
}}
  

Latest revision as of 22:10, 24 February 2016


Routine Summary

Draws a triangle on the graph screen.

Inputs

L1 - X-coordinates of 3 vertices L2 - Y-coordinates of 3 vertices S - Whether it is shaded D - draw if 1, erase if 0

Outputs


Variables Used

L1, L2, S, D, M, N, B, C

Calculator Compatibility

TI-83/84/+/SE

Download

No download provided.

:If S
:Then
:SortA(L1,L2)
:If L1(2)≠L1(1)
:Then
:(L2(2)-L2(1))/(L1(2)-L1(1))→M
:L2(1)-ML1(1)→B
:(L2(3)-L2(1))/(L1(3)-L1(1))→N
:L2(1)-NL1(1)→C
:For(I,L1(1),L1(2),ΔX)
:Line(I,MI+B,I,NI+C,D)
:End
:End
:If L1(2)≠L1(3)
:Then
:(L2(3)-L2(2))/(L1(3)-L1(2))→M
:L2(3)-ML1(3)→B
:For(I,L2(2),L1(3),ΔX)
:Line(I,MI+B,I,NI+C,D)
:End
:End
:Else
:Line(L1(1),L2(1),L1(2),L2(2),D)
:Line(L1(1),L2(1),L1(3),L2(3),D)
:Line(L1(2),L2(2),L1(3),L2(3),D)
:End

This is a routine to draw a shaded triangle, with an option to draw an unshaded triangle too.

Error Conditions

Related Routines