Renamed find_circle_tangents() to circle_point_tangents()

This commit is contained in:
Revar Desmera 2020-05-23 19:22:44 -07:00
parent 00ee79aacf
commit 9c2cf53b2d
3 changed files with 8 additions and 8 deletions

View file

@ -1070,9 +1070,9 @@ function find_circle_3points(pt1, pt2, pt3) =
// Function: find_circle_tangents() // Function: circle_point_tangents()
// Usage: // Usage:
// tangents = find_circle_tangents(r|d, cp, pt); // tangents = circle_point_tangents(r|d, cp, pt);
// Description: // Description:
// Given a circle and a point outside that circle, finds the tangent point(s) on the circle for a // Given a circle and a point outside that circle, finds the tangent point(s) on the circle for a
// line passing through the point. Returns list of zero or more sublists of [ANG, TANGPT] // line passing through the point. Returns list of zero or more sublists of [ANG, TANGPT]
@ -1083,12 +1083,12 @@ function find_circle_3points(pt1, pt2, pt3) =
// pt = The coordinates of the external point. // pt = The coordinates of the external point.
// Example(2D): // Example(2D):
// cp = [-10,-10]; r = 30; pt = [30,10]; // cp = [-10,-10]; r = 30; pt = [30,10];
// tanpts = subindex(find_circle_tangents(r=r, cp=cp, pt=pt),1); // tanpts = subindex(circle_point_tangents(r=r, cp=cp, pt=pt),1);
// color("yellow") translate(cp) circle(r=r); // color("yellow") translate(cp) circle(r=r);
// color("cyan") for(tp=tanpts) {stroke([tp,pt]); stroke([tp,cp]);} // color("cyan") for(tp=tanpts) {stroke([tp,pt]); stroke([tp,cp]);}
// color("red") move_copies(tanpts) circle(d=3,$fn=12); // color("red") move_copies(tanpts) circle(d=3,$fn=12);
// color("blue") move_copies([cp,pt]) circle(d=3,$fn=12); // color("blue") move_copies([cp,pt]) circle(d=3,$fn=12);
function find_circle_tangents(r, d, cp, pt) = function circle_point_tangents(r, d, cp, pt) =
assert(is_num(r) || is_num(d)) assert(is_num(r) || is_num(d))
assert(is_vector(cp)) assert(is_vector(cp))
assert(is_vector(pt)) assert(is_vector(pt))

View file

@ -294,8 +294,8 @@ module test_find_circle_3points() {
test_find_circle_3points(); test_find_circle_3points();
module test_find_circle_tangents() { module test_circle_point_tangents() {
tangs = find_circle_tangents(r=50,cp=[0,0],pt=[50*sqrt(2),0]); tangs = circle_point_tangents(r=50,cp=[0,0],pt=[50*sqrt(2),0]);
assert(approx(subindex(tangs,0), [45,-45])); assert(approx(subindex(tangs,0), [45,-45]));
expected = [for (ang=subindex(tangs,0)) polar_to_xy(50,ang)]; expected = [for (ang=subindex(tangs,0)) polar_to_xy(50,ang)];
got = subindex(tangs,1); got = subindex(tangs,1);
@ -304,7 +304,7 @@ module test_find_circle_tangents() {
assert(approx(flatten(got), flatten(expected))); assert(approx(flatten(got), flatten(expected)));
} }
} }
test_find_circle_tangents(); test_circle_point_tangents();
module test_tri_calc() { module test_tri_calc() {

View file

@ -8,7 +8,7 @@
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
BOSL_VERSION = [2,0,321]; BOSL_VERSION = [2,0,322];
// Section: BOSL Library Version Functions // Section: BOSL Library Version Functions