Last active
May 24, 2022 22:50
-
-
Save thu0x31/25d72b5ee5fd429b911c997ac930ce4c to your computer and use it in GitHub Desktop.
Revisions
-
thu0x31 revised this gist
May 21, 2022 . 2 changed files with 15 additions and 0 deletions.There are no files selected for viewing
File renamed without changes.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,15 @@ // http://paulbourke.net/geometry/circlesphere/ Intersection of two circles function vector intersectionTwoCiclesRight(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( p2.x + h*(p1.z - p0.z)/d, p2.y, p2.z - h*(p1.x - p0.x)/d ); } -
thu0x31 created this gist
May 21, 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,15 @@ // 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( p2.x - h*(p1.z - p0.z)/d, p2.y, p2.z + h*(p1.x - p0.x)/d ); }