HP Forums
Drawing Commands: TI Nspire CX II - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: Not HP Calculators (/forum-7.html)
+--- Forum: Not remotely HP Calculators (/forum-9.html)
+--- Thread: Drawing Commands: TI Nspire CX II (/thread-13304.html)



Drawing Commands: TI Nspire CX II - Eddie W. Shore - 07-19-2019 04:17 PM

Blog post: http://edspi31415.blogspot.com/2019/07/ti-nspire-cx-ii-and-ti-nspire-cx-ii-cas.html

The CX II adds drawing commands to the TI Nspire programming language which includes:

Clear (blank to clear the entire screen), (x, y, width, height)

DrawArc x, y, width, height, startAngle, sweepAngle

DrawCircle x, y, radius

DrawLine x1, y1, x2, y2

DrawPoly (see plotdemo2 for further details)

DrawRect upper_x_pixel, upper_y_pixel, width, height

DrawText x, y, string/text/expression

FillArc x, y, width, height, startAngle, sweepAngle

FillCircle x, y, radius

FillPoly (see plotdemo2 for further details)

FillRect upper_x_pixel, upper_y_pixel, width, height

getPlatform() (returns dt for desktop, hh for handheld, ios for the iOS App)

PaintBuffer (buffers the paint screen)

PlotXY x, y, shape (13 shapes available: 1 for dot, 5 for cross, 6 for plus, 8, for medium dot)

SetColor red, green, blue (sets the Nspire's color pen)

SetPen thickness, style (1 thin, 2 medium, 3 thick; 1 smooth, 2, dotted, 3 dashed)

SetWidnow xMin, xMax, yMin, yMax (establishes drawing area - use this command to switch coordinates to Cartesian)

UseBuffer (tells the Nspire to use an off screen to draw objects, then use
PaintBuffer to call them back up)


RE: Drawing Commands: TI Nspire CX II - toml_12953 - 07-19-2019 06:08 PM

(07-19-2019 04:17 PM)Eddie W. Shore Wrote:  Blog post: http://edspi31415.blogspot.com/2019/07/ti-nspire-cx-ii-and-ti-nspire-cx-ii-cas.html

The CX II adds drawing commands to the TI Nspire programming language which includes:

I posted a CX II program to draw a hat some time back. I do like the CX II but I still wish it had a method to grab a section of the screen and put it down somewhere else (BitBlit) Maybe in a future OS version...


Code:
Define hat()=
Prgm
:SetWindow 0,319,0,199
:FillRect 0,0,319,199
:p:=160: q:=100
:xp:=144: xr:=1.5*3.1415927
:yp:=56: yr:=1: zp:=64
:xf:=((xr)/(xp)): yf:=((yp)/(yr)): zf:=((xr)/(zp))
:For zi,−q,q-1
:  If zi≥−zp and zi≤zp Then
:    zt:=((zi*xp)/(zp)): zz:=zi
:    xl:=int(0.5+√(xp*xp-zt*zt))
:    For xi,−xl,xl
:      xt:=√(xi*xi+zt*zt)*xf: xx:=xi
:      yy:=(sin(xt)+0.4*sin(3*xt))*yf
:      x1:=xx+zz+p
:      y1:=yy-zz+q
:      SetColor 0,255,0
:      PlotXY x1,y1,7
:      If y1≠0 Then
:        SetColor 0,0,0
:        DrawLine x1,y1-1,x1,0
:      EndIf
:    EndFor
:  EndIf
:EndFor
:EndPrgm