123 s3 = sqrt( s1*s1 + s2*s2 - 2*s1*s2*cos(a3) )
157 s1 = s3 * sin( a1 ) / sin( a3 ),
158 s2 = s3 * sin( a2 ) / sin( a3 )
192 s2 = s1 * sin( a2 ) / sin( a1 ),
193 s3 = s1 * sin( a3 ) / sin( a1 )
237 let(x = (-s1*s1 + s2*s2 + s3*s3) / (2*s2))
238 [x, sqrt(s3*s3 - x*x)]
244 : let(y = (-s1*s1 + s2*s2 + s3*s3) / (2*s3))
245 [sqrt(s2*s2 - y*y), y]
247 (cw ==
true) ? [v1, v2, v3] : [v1, v3, v2];
274 (s ==
false) ? abs(sa) : sa;
304 e = (d == 0) ? min(len(v1), len(v2), len(v3)) : d
306 [
for (i=[0:e-1]) (v1[i] + v2[i] + v3[i])/3 ];
336 ( (v1[0] * d1 + v2[0] * d2 + v3[0] * d3) / (d3 + d1 + d2) ),
337 ( (v1[1] * d1 + v2[1] * d2 + v3[1] * d3) / (d3 + d1 + d2) )
366 sqrt( ((-d3+d1+d2) * (+d3-d1+d2) * (+d3+d1-d2)) / (d3+d1+d2) ) / 2;
399 (v == 1) ? [ ((-d1*v1[0]+d2*v2[0]+d3*v3[0])/(-d1+d2+d3)),
400 ((-d1*v1[1]+d2*v2[1]+d3*v3[1])/(-d1+d2+d3)) ]
401 : (v == 2) ? [ ((+d1*v1[0]-d2*v2[0]+d3*v3[0])/(+d1-d2+d3)),
402 ((+d1*v1[1]-d2*v2[1]+d3*v3[1])/(+d1-d2+d3)) ]
403 : (v == 3) ? [ ((+d1*v1[0]+d2*v2[0]-d3*v3[0])/(+d1+d2-d3)),
404 ((+d1*v1[1]+d2*v2[1]-d3*v3[1])/(+d1+d2-d3)) ]
436 (v == 1) ? sqrt(s * (s-d2) * (s-d3) / (s-d1))
437 : (v == 2) ? sqrt(s * (s-d1) * (s-d3) / (s-d2))
438 : (v == 3) ? sqrt(s * (s-d1) * (s-d2) / (s-d3))
470 s2a = sin( 2 *
angle_ll([v1, v3], [v1, v2]) ),
471 s2b = sin( 2 *
angle_ll([v2, v1], [v2, v3]) ),
472 s2c = sin( 2 *
angle_ll([v3, v2], [v3, v1]) ),
474 e = (d == 0) ? min(len(v1), len(v2), len(v3)) : d
476 [
for (i=[0:e-1]) (v1[i]*s2a + v2[i]*s2b + v3[i]*s2c) / (s2a+s2b+s2c) ];
532 d = ((v2[1]-v3[1]) * (v1[0]-v3[0]) + (v3[0]-v2[0]) * (v1[1]-v3[1]))
537 a = ((v2[1]-v3[1]) * ( p[0]-v3[0]) + (v3[0]-v2[0]) * ( p[1]-v3[1])) / d
542 b = ((v3[1]-v1[1]) * ( p[0]-v3[0]) + (v1[0]-v3[0]) * ( p[1]-v3[1])) / d
584 im = sqrt( pow(
distance_pp(c[1], rc),2) - pow(r,2) ),
585 t1 = c[1] + im *
unit_l([c[1], c[0]]),
586 t2 = c[1] + im *
unit_l([c[1], c[2]])
x_axis_ci
<integer> The coordinate axis index for the Euclidean space x-axis.
origin2d
<point-2d> The origin point coordinate in 2d Euclidean space.
function angle_ll(l1, l2, s=true)
Compute the angle between two lines or vectors in a 3d or 2d-space.
function is_left_ppp(p1, p2, p3)
Test if a point is left, on, or right of an infinite line in a 2d-space.
function unit_l(l)
Compute the normalized unit vector of a line or vector.
function distance_pp(p1, p2)
Compute the distance between two points.
function triangle2d_vround3_tangents(c, r)
Compute the rounding tangent coordinates for a given radius of a triangle vertex in 2D.
function triangle_sas2sss(v)
Compute the side lengths of a triangle given two sides and the included angle.
function triangle_asa2sss(v)
Compute the side lengths of a triangle given a side and two adjacent angles.
function triangle2d_is_cw(c)
Test the vertex ordering, or orientation, of a triangle in 2D.
function triangle_centroid(c, d=2)
Compute the centroid of a triangle.
function triangle_aas2sss(v)
Compute the side lengths of a triangle given a side, one adjacent and the opposite angle.
function triangle_circumcenter(c, d=2)
Compute the coordinate of a triangle's circumcenter.
function triangle2d_inradius(c)
Compute the inradius of a triangle's incircle in 2D.
function triangle2d_excenter(c, v=1)
Compute the center coordinate of a triangle's excircle in 2D.
function triangle2d_is_pit(c, p)
Test if a point is inside a triangle in 2d.
function triangle2d_vround3_center(c, r)
Compute the rounding center coordinate for a given radius of a triangle vertex in 2D.
function triangle2d_area(c, s=false)
Compute the area of a triangle given its vertex coordinates in 2D.
function triangle2d_sss2ppp(v, a=x_axis_ci, cw=true)
Compute a set of vertex coordinates for a triangle given its side lengths in 2D.
function triangle_ppp2sss(c)
Compute the side lengths of a triangle given its vertex coordinates.
function triangle2d_exradius(c, v=1)
Compute the exradius of a triangle's excircle in 2D.
function triangle2d_incenter(c)
Compute the center coordinate of a triangle's incircle in 2D.