[this post may or may not be categorized correctly]
I am in the process of making a 3D graphing utility in ICE C for the TI-84 CE. It can do limited graphing, but at least it displays something that makes some sense. Please review my code to make comments, suggestions, and anything else you might want to say as it nears completion (Please keep in mind that this is one of my first real projects in ICE). Thanks! (also please tell me how to take a screenshot of an ice program while it is running)
EDIT: I hope someday to have it graph the complex plane
<http://sc.cemetech.net/?hash=flG8hpva75MC9gh1gKc3ZgBZGUMd>
[i]GRAPH3D
0->XD
0->YD
50->X
50->Y
50->Z
173->CONSTC
Begin)
SetDraw(1)
FillScreen(255)
Blit(1)
Call EVAL
FillScreen(255)
Call BOUTLINE
Call FOUTLINE
Call GRAPH
Call FOUTLINE
Blit(1)
Repeat getKey(15)
End
det(1)
Return
Lbl EVAL
Alloc(100*100*3)->A
For(Z,0,99)
FillScreen(255)
PrintStringXY("Calculating...",5,5)
SetTextXY(5,15)
PrintUInt(Z,3)
PrintString(" percent")
Blit(1)
For(X,0,99)
X-50->X
[i](sin(X*256/100)*25/256)+(cos(Z*256/100)*25/256)+50->{A+(X+(Z*100))*3}
16777216-(16777216-(X*X)/25)+50-(Z*Z/32)->{A+(X+50+(Z*100))*3}
[i](X*X/25+50)-Z/4
[i]->{A+(X+50+(Z*100))*3}
X+50->X
End
End
Return
Lbl FOUTLINE
SetColor(0)
Line(160,220,160+(CONSTC/2),220-50)
Line(160,120,160+(CONSTC/2),120-50)
Line(160,220,160-(CONSTC/2),220-50)
Line(160,120,160-(CONSTC/2),120-50)
Line(160-(CONSTC/2),120-50,160-(CONSTC/2),120+50
Line(160+(CONSTC/2),120-50,160+(CONSTC/2),120+50
Line(160,120,160,120+100)
Line(160,20,160+(CONSTC/2),20+50)
Line(160,20,160-(CONSTC/2),20+50)
Return
Lbl BOUTLINE
Line(160,20,160,220)
Line(160-(CONSTC/2),20+50,160+(CONSTC/2),220-50)
Line(160-(CONSTC/2),220-50,160+(CONSTC/2),20+50)
Return
Lbl GRAPH
For(Z,0,99)
For(X,0,99)
{A+(X+(Z*100))*3}->YA
If (YA<150)
If X<100
{A+(X+1+(Z*100))*3}->YB
Else
YA->YB
End
If Z<100
{A+(X+((Z+1)*100))*3}->YC
Else
YA->YC
End
SetColor((Z*8/100)+144)
If not(XD) and not(YD)
SetPixel((160-(CONSTC/2)+(CONSTC/2*X/100)+(CONSTC/2*Z/100)),(220-50-YA-(50*X/100)+(50*Z/100)))
End
If XD
Line((160-(CONSTC/2)+(CONSTC/2*X/100)+(CONSTC/2*Z/100)),(220-50-YA-(50*X/100)+(50*Z/100)),(160-(CONSTC/2)+(CONSTC/2*(X+1)/100)+(CONSTC/2*Z/100)),(220-50-YB-(50*(X+1)/100)+(50*Z/100)))
End
If YD
Line((160-(CONSTC/2)+(CONSTC/2*X/100)+(CONSTC/2*Z/100)),(220-50-YA-(50*X/100)+(50*Z/100)),(160-(CONSTC/2)+(CONSTC/2*X/100)+(CONSTC/2*(Z+1)/100)),(220-50-YC-(50*X/100)+(50*(Z+1)/100)))
End
End
End
Blit(1)
If getKey(15)
Return
End
End
Return