Last active
August 21, 2018 17:57
-
-
Save FryPotato893/ae7f96a695549fc7b93d56c9fd058713 to your computer and use it in GitHub Desktop.
【Houdini】wrangleで黄金角
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Run Over を Detail で実行 | |
// ポイントの数 | |
int count = chi("count"); | |
// ポイントの半径 | |
float radius = chf("radius"); | |
// ポイントの半径減衰 | |
float radiusFalloff = chf("radiusFalloff"); | |
// ポイント毎の角度 | |
float angle = 0; | |
// 黄金比 1.618・・・ | |
float golden_ratio = (1 + sqrt(5)) / 2; | |
// 黄金角 137.507・・・ | |
float golden_angle = 360 / (1 + golden_ratio); | |
for(int n=0; n<count; n++){ | |
// 半径 | |
float rad = pow(float(n) / float(count), radiusFalloff) * radius; | |
// 角度を代入 | |
angle += radians(golden_angle); | |
// 位置の計算 | |
vector pos = set(cos(angle)*rad, 0, sin(angle)*rad); | |
// ポイント生成 | |
addpoint(geoself(), pos); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment