Last active
May 24, 2022 22:50
-
-
Save thu0x31/9a6ddb0a453a8dfc25c1694b63717f08 to your computer and use it in GitHub Desktop.
Revisions
-
thu0x31 renamed this gist
May 23, 2022 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
thu0x31 created this gist
May 23, 2022 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,19 @@ // 接線 : 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); vector contactPos1 = pA + normalize(pB - pA) * x; int contactPtN1 = addpoint(0, contactPos1); setpointgroup(0, "contactPoints", contactPtN1, 1); vector contactPos2 = pC + normalize(pB - pC) * (lenB - x); int contactPtN2 = addpoint(0, contactPos2); setpointgroup(0, "contactPoints", contactPtN2, 1); }