No More Retake

3DCG屋さん向けTips&Referenceサイト

メニュー

Houdiniレシピ:トロコイド曲線

前回、Attribute Wrangle(SOP)でPointを追加する方法をやりましたが、
今回はその亜種です。

唐突ですが、トロコイドというものをご存知でしょうか?
サイクロイドともいうそうですが、Wiki曰く、
円を、ある曲線(円や直線はその特殊な場合)にそってすべらないように転がしたとき、その円の内部または外部の定点が描く曲線」だそうです。

言葉だとよくわからないですねw
こういうヤツです。

PointWrangle_gif05

円の半径を変えていくと、いろんな模様が出来ます。
こういう曲線を描く、スピログラフという定規があるらしいですね。

pointwrangle_jpg

Wikiに数式が載ってるのでHoudini上で実装してみましょう。

c94a25ab532cb5c0b2ff725761a116a4

rc・・・赤い円の半径
rm・・・緑の円の半径
rd・・・描画半径

前回の記事で、Wrangleを使ったpointの作成方法をやったので、今回もそれを使います。
Pointの配置に上記の式を用いてみます。

VEX Expressionはこんな感じになりました。

float theta = radians(ch("theta"));
float interval = ch("interval");
float rc = ch("rc");
float rm = ch("rm");
float rd = ch("rd");

for(float i=0; i<theta; i=i+interval){
     float x = (rc - rm)*cos(i) + rd*cos((rc-rm)/rm*i);
     float z = (rc - rm)*sin(i) - rd*sin((rc-rm)/rm*i);
     addpoint(geoself(), set(x, 0, z));
}

円の半径等はパラメータとして予め用意してから、それを参照してます。
これで出来上がりです。
PointWrangle_06

こういった曲線の面白いところはパラメータをグリグリ変えると、作られる模様もどんどん変わること。

PointWrangle_gif06

今回はトロコイド曲線を作ってみましたが、数式で作れる図形はいっぱいありそうです。
例えば、super formulaなんてものもあます。きっと探せば他にもあるはずです。

今日はここまで!
変なところがあればご指摘を。
では、また次回!

サンプルファイルはこちら

「おまけ1」

アレンジ!!
PointWrangle_gif08

「おまけ2」
記事作成時のボツVer.
これはこれで。
式の+と-を変えたやつです。

PointWrangle_gif04




[おまけ3]

Houdiniのvimeoページんとこに、まんま同じのが載ってましたわ。
くっ、しかも2カ月前に。
次からは、ネタかぶってないかリサーチしよう。
ネタかぶった

関連記事

  1. おにぎり大好き 2017.05.18 9:31pm

    おまけ2のコードもらえませんか?
    どうしても動く円が書けないのでお願いします。

    • 0
    • 0
    • kitagawa 2017.05.18 10:30pm

      おまけ2のコードには、動く円の記述はないですよ。
      図の赤と緑の円は、分かりやすくするためにSOPでCircleをその位置に配置してるだけです。

      コードで書いているのは白い曲線部分のみで、このページに記載してあるものとほとんど同じです。
      違いは、9行目。式の前半部分と後半部分の繋ぎの-が+になったものです。
      float z = (rc – rm)*sin(i) + rd*sin((rc-rm)/rm*i);

      • 0
      • 0

このサイトについて

3DCG Tipsサイト。Houdiniの記事が多めです。

RSS

follow us in feedly

Archives

  • 2024 (1)
  • 2023 (2)
  • 2022 (9)
  • 2021 (14)
  • 2020 (46)
  • 2019 (17)
  • 2018 (33)
  • 2017 (29)
  • 2016 (36)
  • 2015 (64)
  • 2014 (54)
  • 2013 (60)
  • 2012 (55)

スポンサードリンク

言語切り替え

  • English (United States)
  • 日本語

スポンサードリンク

言語切り替え

  • English (United States)
  • 日本語

Houdiniを使えるようになる本


Warning: file_get_contents(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed in /usr/home/nomorere/nomoreretake.net/wordpress/wp-content/themes/n1-custom/functions/social.php on line 132

Warning: file_get_contents(): Failed to enable crypto in /usr/home/nomorere/nomoreretake.net/wordpress/wp-content/themes/n1-custom/functions/social.php on line 132

Warning: file_get_contents(http://api.facebook.com/restserver.php?method=links.getStats&urls=http%3A%2F%2Fnomoreretake.net%2F2015%2F08%2F16%2Fhoudini_trochoid%2F): failed to open stream: operation failed in /usr/home/nomorere/nomoreretake.net/wordpress/wp-content/themes/n1-custom/functions/social.php on line 132

Warning: file_get_contents(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed in /usr/home/nomorere/nomoreretake.net/wordpress/wp-content/themes/n1-custom/functions/social.php on line 132

Warning: file_get_contents(): Failed to enable crypto in /usr/home/nomorere/nomoreretake.net/wordpress/wp-content/themes/n1-custom/functions/social.php on line 132

Warning: file_get_contents(http://api.b.st-hatena.com/entry.count?url=http%3A%2F%2Fnomoreretake.net%2F2015%2F08%2F16%2Fhoudini_trochoid%2F): failed to open stream: operation failed in /usr/home/nomorere/nomoreretake.net/wordpress/wp-content/themes/n1-custom/functions/social.php on line 132