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
import bpy | |
import math | |
import mathutils | |
# 影の作例に使ったOBJ用のblenderスクリプト。 | |
# 立方体が選択されてる状態で実行。 | |
t = math.pi * 2 / 10 | |
omat = bpy.context.object.matrix_world | |
for i in range(10): |
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
// ---------------------------------------------- | |
function Point(x, y){ | |
this.x = x; | |
this.y = y; | |
} | |
// ---------------------------------------------- | |
function Circle(path){ // path: PathItem(円とする) | |
var w = 0; | |
if(path.stroked) w = path.strokeWidth / 2; | |
this.center = new Point( |
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
// 座標や範囲を配列で表すと見にくいのでクラスのようなものにします。 | |
function Point(x, y){ // 点 | |
this.x = x; | |
this.y = y; | |
} | |
function Rect(bounds){ // 範囲 bounds:[left, top, right, bottom] | |
this.left = bounds[0]; | |
this.top = bounds[1]; | |
this.right = bounds[2]; | |
this.bottom = bounds[3]; |
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
// 3円に接する円を描く | |
// 円の内側に接するケースも考えるともっと場合分けする必要がある | |
// 参考:http://www.comp.tmu.ac.jp/knotNRG/texfiles/apollonius.pdf | |
// ---------------------------------------------- | |
// 点 | |
function Point(x, y){ // x, y : float | |
this.x = x; | |
this.y = y; | |
} | |
Point.prototype = { |
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
// 最背面のパス(円)に関して残りの選択パスの | |
// アンカーポイントを反転変換した座標に移動する | |
// -------------------------------------- | |
var Point = function(x, y){ | |
this.x = x; | |
this.y = y; | |
} | |
Point.prototype = { | |
// anc : PathPoint.anchor | |
byAnchor : function(anc){ |
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
// 1点を通り2円に接する円を描く | |
// (3円に接する円を描く、の改変版) | |
// 円の内側に接するケースも考えるともっと場合分けする必要がある | |
// 参考:http://www.comp.tmu.ac.jp/knotNRG/texfiles/apollonius.pdf | |
// ---------------------------------------------- | |
// 点 | |
function Point(x, y){ // x, y : float | |
this.x = x; | |
this.y = y; | |
} |
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
// 3つのオブジェクト(前面からp1, p2, o)が選択されているとき、 | |
// p1の中心からp2の中心へ反時計回りに弧を描く。 | |
// o の中心を弧の中心とする。 | |
// ---------------------------------------------- | |
// 点 | |
// x, y : float | |
var Point = function(x, y){ | |
this.x = x; | |
this.y = y; | |
} |
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
// PoincareDiskInversion.jsxinc | |
// Gist上でシンタックスハイライトするためにファイル名を~jsxにしてます | |
var PoincareDiskInversion; | |
(function(){ | |
// ------------------------ | |
var STROKE_WIDTH = 0.5; | |
var STROKE_GRAY_VALUE = 100; | |
var MARK_RADIUS = 2; | |
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
// Adobe Illustrator script | |
// 補間関数を使った図形の合成の実験。 | |
// 2つの渦巻き。描画結果は折れ線 | |
function main(){ | |
var GAIN = 4; // シグモイド関数のゲイン | |
var T_MAX = 31; // 回転角度の最大値(radian) | |
var OFFSET = 20; // 始点と原点の距離 | |
var STEP = 0.05; // 回転角度の増分 | |
var EDGE = 1.6; // スムースステップ関数, cos補間の範囲上限値(下限は-EDGE) |