Skip to content

Instantly share code, notes, and snippets.

@taikomatsu
Created June 6, 2019 16:25
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save taikomatsu/220229e8e0705a5c266dca244ee5afb9 to your computer and use it in GitHub Desktop.
Save taikomatsu/220229e8e0705a5c266dca244ee5afb9 to your computer and use it in GitHub Desktop.
carve each curves
// carveする値。ここにバラバラの値を入れればバラバラにcarveも可能。
float carve = fit(f@Frame, 1, 24, 1, 0);
int pts[] = primpoints(0, i@primnum);
// carve後のcurveのポイントを保持する配列
int newpts[] = {};
foreach (int pt; pts) {
float u = point(0, "curveu", pt);
// carveの向きはここの条件やcarveの変化を変えればOK
if (u<carve)
removepoint(0, pt);
else
append(newpts, pt);
}
// 新しくcurveを作成する。
int pr = addprim(0, "polyline", pts);
// もしコピーしたいprim attrなどがある場合はこの辺でこんな感じで処理。
// setprimattrib(0, "myattr", pr, f@myattr);
// 元々のcurveは消しておく
removeprim(0, i@primnum, 1);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment