ホーム » コンピュータ » processingでsin,cos…

システム

最近の投稿

  • この一週間の必需品
    6/22頃からの風邪の症状。鼻水と喉の痛みがあって、鼻スプレーと喉スプレーでだましだましの2週間。 […]
  • あづぃ…
    2F廊下温度35℃、WBGT30℃越え。 […]
  • gemini-cli 便利
    Gemini をコマンドラインから使えるツール gemini-cli が公開されている。 […]
  • LINE bot が動いていない… 月当たり最大数オーバー
    我が家では、以前より 自宅専用の LINE bot を動かしていて、サーバからの通知に使っていた。 […]
  • rkhunter の設定
    卒研のセキュリティの説明の中で rkhunter を紹介。説明してたら、自宅サーバにはサーバ機以降後に […]

アーカイブ

カテゴリー

processingでsin,cos…

子供がProcessingでプログラミングを始めているようだし、 三角関数の授業も苦労しているようなので、 理解を助ける意味も込めて簡単なグラフィックス演習

float xwidth = 720 ;
float yheight = 300 ;
float radius = 100 ;
void setup() {
size( 720 , 300 ) ;
background( 255 , 255 , 255 ) ;
}
void draw() {
for( float th = 0 ; th < xwidth ; th++ ) {
float ys = radius * sin( th / 180 * PI ) ;
float yc = radius * cos( th / 180 * PI ) ;
float yt = radius * tan( th / 180 * PI ) ;
stroke( 255 , 0 , 0 ) ;
point( th , yheight / 2 - ys ) ;
stroke( 0 , 255 , 0 ) ;
point( th , yheight / 2 - yc ) ;
stroke( 0 , 0 , 255 ) ;
point( th , yheight / 2 - yt ) ;
}
}

Google 検索

My Google   Yahoo

Microsoft

ファンサイト