Skip to content

Instantly share code, notes, and snippets.

import bpy
import math
import mathutils
# 影の作例に使ったOBJ用のblenderスクリプト。
# 立方体が選択されてる状態で実行。
t = math.pi * 2 / 10
omat = bpy.context.object.matrix_world
for i in range(10):
@shspage
shspage / sukimani_en.jsx
Last active April 1, 2017 07:28
Illustrator script 3つの(半径が同じ)円の隙間に円を描く
// ----------------------------------------------
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(
@shspage
shspage / sessen_test1.jsx
Created April 1, 2017 01:16
Illustrator で2円をつなぐ線を描く
// 座標や範囲を配列で表すと見にくいのでクラスのようなものにします。
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];
@shspage
shspage / sukimani_en_2.jsx
Last active April 10, 2017 21:56
Illustratorで3円に接する円を描く
// 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 = {
@shspage
shspage / test_inverse1.jsx
Created April 9, 2017 08:07
Illustrator:最背面のパス(円)に関して残りの選択パスのアンカーポイントを反転変換した座標に移動する
// 最背面のパス(円)に関して残りの選択パスの
// アンカーポイントを反転変換した座標に移動する
// --------------------------------------
var Point = function(x, y){
this.x = x;
this.y = y;
}
Point.prototype = {
// anc : PathPoint.anchor
byAnchor : function(anc){
@shspage
shspage / test_1point_and_2circles.jsx
Created April 11, 2017 11:38
Illustrator : 1点を通り2円に接する円を描く
// 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;
}
@shspage
shspage / draw_arc.jsx
Last active October 3, 2017 21:47
Illustrator : 2点をつなぐ弧を描く
// 3つのオブジェクト(前面からp1, p2, o)が選択されているとき、
// p1の中心からp2の中心へ反時計回りに弧を描く。
// o の中心を弧の中心とする。
// ----------------------------------------------
// 点
// x, y : float
var Point = function(x, y){
this.x = x;
this.y = y;
}
@shspage
shspage / PoincareDiskInversion.jsx
Created April 19, 2017 11:49
Illustrator:ポアンカレ円板上での反転関連
// PoincareDiskInversion.jsxinc
// Gist上でシンタックスハイライトするためにファイル名を~jsxにしてます
var PoincareDiskInversion;
(function(){
// ------------------------
var STROKE_WIDTH = 0.5;
var STROKE_GRAY_VALUE = 100;
var MARK_RADIUS = 2;
// 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)
@shspage
shspage / area.png
Last active February 28, 2018 13:30
area.png