Re: [問題] 請問如何畫出函數圖形
※ 引述《pp10086 (<(_ _)>)》之銘言:
: 然後請我們畫出在xy坐標上的圖形
: 可以請大大給我們一些概念嗎?
: 不用解答 只是給一些思考方向
: 謝謝<(_ _)>
: 我打算是用把點都計算出來 再連起來 那那個圖
: 是用awt嗎? 抱歉我只看得懂這個orz
先把你要畫的點都計算出來就對了,剩下的就只是畫出座標軸,跟取相對位置。
可以用Frame或applet,透過paint(Graphics g)方法去畫。
剩下的自己google或找關鍵字囉 加油 :)
這是可能會用到的method http://0rz.net/fe1bW
----
也有另一種作法是我常用再做consolo圖的, 用一個二維陣列[30][30] ;
把對應的點去小數以後改值.....不過這樣的點看起來就會有點不準
像這個是我用來畫sin圖形用的
int[][] map=new int[32][64];
for(int i=0;i<64;i++){
map[(int)Math.round((Math.sin(i*Math.PI/16.0)+1)*10)][i]=1;
}
for(int i=0;i<map.length;i++){
for(int j=0;j<map[i].length;j++){
System.out.print( map[i][j]==1? "*":" ");
}
System.out.println("");
}
--
String temp="relax"; | Life just like programing
while(buringlife) String.forgot(temp); | to be right or wrong
while(sleeping) brain.setMemoryOut(); | need not to say
stack.push(life.running); | the complier will
stack.push(scouting.buck()); | answer your life
stack.push(bowling.pratice()); | Bone everything
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.138.240.57
※ 編輯: TonyQ 來自: 140.138.240.57 (04/07 02:17)
討論串 (同標題文章)
本文引述了以下文章的的內容:
完整討論串 (本文為第 2 之 3 篇):
java 近期熱門文章
PTT數位生活區 即時熱門文章