Omnimaga
Calculator Community => TI Calculators => Topic started by: Ivoah on October 09, 2014, 06:48:44 pm
-
The text command is giving a domain error, can anyone help?
Degree:ClrDraw:ZInteger:AxesOff
Circle(0,0,25)
For(I,1,12)
I(360/12)->theta
25*sin(theta)->X
25*cos(theta)->Y
Pt-On(X,Y)
Text(2*Ymax-(Ymax+Y),Xmax+X,I)
End
{0,0,0}->|LH
{0,0,0}->|LM
{0,0,0}->|LS
Lbl L
getTime->L1
L1(1)-12*int(L1(1)/12)->|LH(1)
L1(2)->|LM(1)
L1(3)->|LS(1)
|LS(1)(360/60)->theta
Line(0,0,|LS(2),|LS(3),0)
20*sin(theta)->|LS(2)
20*cos(theta)->|LS(3)
Line(0,0,|LS(2),|LS(3))
|LM(1)(360/60)->theta
Line(0,0,|LM(2),|LM(3),0)
23*sin(theta)->|LM(2)
23*cos(theta)->|LM(3)
Line(0,0,|LM(2),|LM(3))
(|LH(1)*60+|LM(1))(360/720)->theta
Line(0,0,|LH(2),|LH(3),0)
10*sin(theta)->|LH(2)
10*cos(theta)->|LH(3)
Line(0,0,|LH(2),|LH(3))
Text(0,0,|LH(1))
Text(6,0,|LM(1))
Text(12,0,|LS(1))
Goto L
-
It's been in a long time since I've programmed in z80 basic, but if the Text command enforces the coordinates to be < Xmax / Ymax :
- I suppose (easily checkable) that Ymax+Y is lower than 2*Ymax, so the subtraction gives something still above Ymax, hence the domain error.
- Same for Xmax when X is positive
BTW, I don't remember if it allows for non-integer coords... ?
-
Haha! Thanks! Yeah, I guess I just needed to convert them to ints. Thanks again!
EDIT: updated http://tibasicdev.wikidot.com/text
-
For the text command, it is Text(Y,X,"
Y must be a value from 0-57 or you will get a domain error. If the X value is over 91 It won't show up on screen (0-91 will). Hope this helps.
-
Adriweb found the problem, it also has to be an integer
-
Well yea, you can't put text between pixels. With my previous post I would assume someone wouldn't try to use decimals that fall in between those ranges. :P
-
My problem was that I computed a value using sin and cos, and never converted it to an int. Line works with non int values...
-
Line isn't based on screen dimensions. Text more or less is. Pixel is based on screen dimensions as well. If you try to draw a pixel off screen you get a dimension error just like with text.
-
Yeah the only commands that has clipping are Pt-On/Off/Chg (not Pxl-On/Off/Chg), Line, Circle and the horiz/vertical commands. Everything else has to be absolutely drawn inside the screen with integer values.
-
Good to know.