1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | global proc string createCurveSphere( // カーブ名を返す float $subdiv , // 粗さ:4,8,12,24,36(,360) float $radius ) // 球の半径 { float $div = 360.0/ $subdiv ; vector $pos []; float $x , $y ; // xy for ( $i =0; $i <= $subdiv ; $i ++ ) { $x = cosd( $i * $div ); $y = sind( $i * $div ); $pos [size( $pos )] = << $x , $y , 0.0 >> * $radius ; // yz if ( 270 == ( $i * $div ) ) { for ( $j =0; $j <= $subdiv ; $j ++ ) { $x = cosd( $j * $div + 270 ); $y = sind( $j * $div + 270 ); $pos [size( $pos )] = << 0.0, $y , $x >> * $radius ; } } } // xz for ( $i =1; $i <= $subdiv ; $i ++ ) { $x = cosd( $i * $div ); $y = sind( $i * $div ); $pos [size( $pos )] = << $x , 0.0, $y >> * $radius ; } return createCurveObject( $pos ); } |
createCurveSphere( 24,5 );で、ikHandleで使うような球体のカーブオブジェクト。
createCurveSphere( 4,5 );で、poleVectorで使うような八面体のカーブオブジェクトになります。
応用で、
{ string $crv =createCurveSphere( 4,5 ); select -r ( $crv + ".ep[7]" ) ( $crv + ".ep[12] " ); doDelete; } |
とすると、ピラミッド型になります。
0 件のコメント:
コメントを投稿