Vriety of Coordinate Systems for Graphics

 Variety of Coordinate Systems for Graphics
<Inside Casio Basic> <C.Basic>

This content is checked by fx-9860GII (OS 2.04) and fxCG20 (OS 2.00).
This is on-going project and any changes may be made.


Model

fx-9860GII and fxCG20/10


Function
  1. Casio Basic provides variety of coordinate systems; Device Coordinate System and Logical Coordinate Systems.
  2. Device Coordinate System directly corresponds to pixeles of LCD. Left top pixel is pointed by cordinate (1,1) which means (first Row, first Column). Row is in vertical direction and only discrete (natural) number 1, 2, 3, ...  is avaiable. Column is in horizontal direction and also only discrete (natural) number is available. With fx-9860GII maximum Row coordinante value is 63 and maximum Column coordinate value is 127. With fx-CG20 max Row value is 187 and max Column vaue is 379. Out of the min - max range or fractional number is set as parameter, Casio Basic returns ERROR.
  3. Device Coordinate System is automatically applied only at usage of Text, PlxOn, PxlOff, PxlChg and PixlTest commands. User cannot expressly set Device Coordinate System.
  4. There are 2 deferent ways to setup Logical Coordinate System, a Default Logical Coordinate System and ViewWindow Logical Coordinate System.
  5. UNDOCUMENTED Default Logical Coordinate System is automatically chosen when ClrGraph command runs. This coordinate system can be expressed by Xmin = -6.3, Xmax = 6.3, Xscl = 0.1, Ymin = -3.1, Ymax = 3.1 and Yscl = 0.1, where those 6 variables are automatically set with those above values. In stead of ClrGraph, following codes gives same resut; Cls:-6.3->Xmin:6.3->Xmax:-3.1->Ymin:3.1->Ymax (where -> is substitution command).
  6. Using ViewWindow command any coordinate system can be defined freely. We call this here as ViewWindow Coordinate System. In stead of ViewWindow command, setting 6 variables (Xmin, Xmax, Xscl, Ymin, Ymax and Yscl) results in same setup; 

Note
  1. Running ViewWindow 1,127,Xscl,63,1,Yscl (fx-9860GII) or ViewWindow 1,379,Xscl,187,1,Yscl (fx-CG20/10), you can set Coordinate System which is similar to Device Coordinate System. But note this coordinate system allow user to set fractional number as coordinate parameter.
  2. Default Logical Coordinate System can be set by ViewWindow -6.3,6.3,0.1,-3.1,3.1,0.1.
  3. UNDOCUMENTED When user write wrong setup by ViewWindow 0,126,0,0,63,0 instead of correct setup ViewWindow 0,127,0,0,62,0, unexpected graphics ouput may appears. See below sample code in details;  
Example 1-1: Correct result as expcted in code (fx-9860GII)
CodesResult
ClGraph
CoordOff
GridOff
AxesOff
LabelOO
ViewWindow 0,126,0,0,62,0
For 0→Y To 62
SketchDot F-Line 0,Y,126-MOD(Y,2),Y
Next
DLINE2s

Example 1-2: Unexpected horizontal line appares with wrong ViewWindow setup (fx-9860GII)
CodesResult
ClGraph
CoordOff
GridOff
AxesOff
LabelOO
ViewWindow 0,126,0,0,63,0
For 0→Y To 63
SketchDot F-Line 0,Y,126-MOD(Y,2),Y
Next
DLINE3.1s
There actually are 63 pixels in vertical direction, but 64 dots is rogically defined in vertical. Psition of all plots are calculated and rounded to be one-to-one correspondence with LCD pixels. That's why the unexpected horizontal line appears. 
 
  
With fx-CG20/10, ViewWindow 0,126,0,0,62,0 and ViewWindow 0,126,0,0,63,0 gives similar but different results.
 
Example 2-1: Correct result as expected in code (fx-CG-20/10)
CodesResult
ClrGraph
CoordOff
GridOff
AxesOff
LabelOff
ViewWindow 0,126,0,0,62,0
For 0→Y To 62
SketchDot F-Line 0,Y,126-MOD(Y,2),Y
Next
DispOK_cg20

Example 2-2: Unexpected horizontal line appares with wrong ViewWindow setup (fx-CG20/10)
CodesResult
ClrGraph
CoordOff
GridOff
AxesOff
LabelOff
ViewWindow 0,126,0,0,63,0
For 0→Y To 63
SketchDot F-Line 0,Y,126-MOD(Y,2),Y
Next
DispProblem_cg20
Logically it's same result but fxpCG20/10 has different number (187) of pixels, so the result in detailed is not same.




See also: ClrGraph, ViewWindow, Xmin, Xmax, Xscl, Ymin, Ymax, Yscl


Copyright (C) 2013 - 2016 Krtyski / egadget.blog.fc2.com  All Rights Reserved.


関連記事

テーマ : プログラム関数電卓
ジャンル : コンピュータ

コメントの投稿

非公開コメント

最新記事
最新コメント
カテゴリ
C# (3)
検索フォーム
Visitors
Online Counter
現在の閲覧者数:
プロフィール

やす (Krtyski)

Author:やす (Krtyski)
since Oct 30, 2013


プログラム関数電卓は、プログラムを作り・使ってナンボ!

実際に触って気づいたこと、自作プログラム、電卓プログラミングについて書いています

おもしろい・役に立つならクリックしてください。励みになります。
にほんブログ村 IT技術ブログ 開発言語へ
にほんブログ村


人気ブログランキングへ


FC2ブログランキングへ


写真: 「4駆で泥んこ遊び@オックスフォード郊外」

リンク
月別アーカイブ
Sitemap

全ての記事を表示する

RSSリンクの表示
最新トラックバック
ブロとも申請フォーム

この人とブロともになる

QRコード
QR