TI-BASIC:Shaded Triangle

From Learn @ Cemetech
Revision as of 22:10, 24 February 2016 by Maintenance script (talk | contribs) (Automated @@ correction)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search


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