float rand(float n){return fract(sin(n) * 43758.5453123);}
float noise(float p){
float fl = floor(p);
float fc = fract(p);
return mix(rand(fl), rand(fl + 1.0), fc);
}
- Parameter: Folder
- Folder Type: Multiparm Block
- ...
- Folder Type: Multiparm Block
function int[] folderListParam(string sizeChannel; string targetChannel) {
int size = chi(sizeChannel);
int params[];
for (int i = 0; i < size; i++) {
params[i] = chi(targetChannel + itoa(i + 1));
This file contains hidden or 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 vector[] outerTangents(vector circle1Pos, circle2Pos; | |
float circle1Radius, circle2Radius) { | |
float hypotenuse = distance(circle1Pos, circle2Pos); | |
float shortEdgeLen = circle1Radius - circle2Radius; | |
// xz | |
float rad = atan2(circle2Pos.z - circle1Pos.z, circle2Pos.x - circle1Pos.x) | |
+ acos(shortEdgeLen/hypotenuse); | |
vector circle1OuterTangent1 = set( |
This file contains hidden or 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 vector[] innerTangents(vector circle1Pos, circle2Pos; | |
float circle1Radius, circle2Radius) { | |
float hypotenuse = distance(circle1Pos, circle2Pos); | |
float shortEdgeLen = circle1Radius + circle2Radius; | |
float rad = atan2(circle2Pos.z - circle1Pos.z, circle2Pos.x - circle1Pos.x) | |
+ asin(shortEdgeLen/hypotenuse) - PI/2; | |
vector circle1InnerTangent1 = set( | |
circle1Pos.x + circle1Radius * cos(rad), | |
circle1Pos.y, |
This file contains hidden or 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 int[] arcFrom2Points(vector centerPos; float radius; int totalPoints; | |
vector startPos, endPos; | |
string direction) { | |
float threshold = 0.01; | |
if(radius < threshold) { | |
return{}; | |
} |
This file contains hidden or 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
// http://paulbourke.net/geometry/circlesphere/ Intersection of two circles | |
function vector intersectionTwoCiclesLeft(vector p0, p1; float radius0, radius1) { | |
float d = distance(p0, p1); | |
float a = (radius0 * radius0 - radius1 * radius1 + d * d) / (2*d); | |
float h = sqrt(radius0 * radius0 - a * a); | |
vector p2 = p0 + a * (p1 - p0) / d; | |
// xz | |
return set( |
This file contains hidden or 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 float sidesToIncircleRadius(float A, B, C) { | |
float s = (A + B + C) / 2; | |
float area = sqrt(s * (s-A) * (s-B) * (s-C)); | |
float radius = area / s; | |
return radius; | |
} | |
// https://www.mathopenref.com/coordincenter.html | |
function void drawInnCircle(vector pA, pB, pC; int totalPoints) { | |
// 頂点A,B,Cに対向する辺の長さ |
This file contains hidden or 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
// 接線 : https://examist.jp/mathematics/plane-figure/tyouten-setten/ | |
function void drawContactTriangle(vector pA, pB, pC) { | |
float lenA = distance(pB, pC); | |
float lenB = distance(pA, pC); | |
float lenC = distance(pA, pB); | |
float x = (lenA + (-lenB - lenC)) / -2; | |
vector contactPos0 = pA + normalize(pC - pA) * x; | |
int contactPtN0 = addpoint(0, contactPos0); | |
setpointgroup(0, "contactPoints", contactPtN0, 1); |
This file contains hidden or 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
{ | |
"version": 5, | |
"configurePresets": [ | |
{ | |
"name": "default", | |
"hidden": true, | |
"generator": "Visual Studio 17 2022", | |
"binaryDir": "${sourceDir}/build", | |
"architecture": { | |
"value": "x64", |