Skip to content

Instantly share code, notes, and snippets.

View thu0x31's full-sized avatar
🦕
Yee

T_H_U thu0x31

🦕
Yee
View GitHub Profile
@thu0x31
thu0x31 / CMakePresets.json
Last active September 24, 2023 06:29
Houdini HDK CGAL CMakePresets.json
{
"version": 5,
"configurePresets": [
{
"name": "default",
"hidden": true,
"generator": "Visual Studio 17 2022",
"binaryDir": "${sourceDir}/build",
"architecture": {
"value": "x64",
@thu0x31
thu0x31 / contactTriangle.vfl
Last active May 24, 2022 22:50
contactTriangle
// 接線 : 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);
@thu0x31
thu0x31 / Inncircle.vfl
Last active May 24, 2022 22:50
Inncircle
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に対向する辺の長さ
@thu0x31
thu0x31 / intersectionTwoCiclesLeft.vfl
Last active May 24, 2022 22:50
intersectionTwoCicles vex
// 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(
@thu0x31
thu0x31 / arcFrom2Points.vfl
Created May 21, 2022 17:05
arcFrom2Points vex
function int[] arcFrom2Points(vector centerPos; float radius; int totalPoints;
vector startPos, endPos;
string direction) {
float threshold = 0.01;
if(radius < threshold) {
return{};
}
@thu0x31
thu0x31 / innerTangents.vfl
Created May 21, 2022 17:04
innerTangents vex
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,
@thu0x31
thu0x31 / outerTangents.vfl
Created May 21, 2022 17:03
OuterTangents vex
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(
@thu0x31
thu0x31 / Houdini vex Multiparm Block to array.md
Last active June 25, 2021 10:44
Houdini vex Multiparm Block to array.md
  • Parameter: Folder
    • 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));
@thu0x31
thu0x31 / GLSL-Noise.md
Created April 24, 2020 16:11 — forked from patriciogonzalezvivo/GLSL-Noise.md
GLSL Noise Algorithms

Generic 1,2,3 Noise

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);
}