35 include <primitives.scad>;
104 (x[0] - y[0]) * (x[0] - y[0])
105 + (x[1] - y[1]) * (x[1] - y[1])
110 (x[0] - y[0]) * (x[0] - y[0])
111 + (x[1] - y[1]) * (x[1] - y[1])
112 + (x[2] - y[2]) * (x[2] - y[2])
143 ) =
all_defined([v1i, v2i]) ? ((v1t-v1i) * (v2t-v2i)) : (v1t * v2t);
183 ) =
all_defined([v1i, v2i]) ? cross((v1t-v1i), (v2t-v2i)) : cross(v1t, v2t);
228 v2t=
cross_vv( v1t=v2t, v2t=v3t, v1i=v2i, v2i=v3i ),
234 v1t=v1t, v2t=
cross_vv( v1t=v2t, v2t=v3t )
269 ) =
all_len([v1t, v2t, v1i, v2i], 2) ?
272 cross_vv( v1t=v1t, v2t=v2t, v1i=v1i, v2i=v2i ),
273 dot_vv( v1t=v1t, v2t=v2t, v1i=v1i, v2i=v2i )
275 :
all_len([v1t, v2t, v1i, v2i], 3) ?
279 dot_vv( v1t=v1t, v2t=v2t, v1i=v1i, v2i=v2i )
285 dot_vv( v1t=v1t, v2t=v2t )
291 dot_vv( v1t=v1t, v2t=v2t )
325 ) =
all_len([v1t, v2t, nvt, v1i, v2i, nvi], 3) ?
330 v1t=nvt, v2t=v1t, v3t=v2t, v1i=nvi, v2i=v1i, v3i=v2i
332 dot_vv( v1t=v1t, v2t=v2t, v1i=v1i, v2i=v2i )
392 ) = (
striple_vvv( v1t, v2t, v3t, v1i, v2i, v3i ) == 0 );
436 for ( a = [0:(360/n):359] )
437 let( v = [r*cos(a), r*sin(a)] )
438 (vr == undef) ? v : v - vr/cos(180/n) *
unit_v(vt=v)
488 ( s1*s1 + s3*s3 - (s2*s2) ) / ( 2*s1 ),
489 sqrt( s3*s3 - pow( ( s1*s1 + s3*s3 - (s2*s2) ) / ( 2*s1 ), 2 ) )
556 ) = [ (v1[0] + v2[0] + v3[0])/3, (v1[1] + v2[1] + v3[1])/3 ];
function defined_or(v, d)
Return a defined or default value.
function angle_vv(v1t, v2t, v1i, v2i)
Compute the angle between two vectors in a Euclidean 2 or 3D-space.
function all_len(v, l)
Test if all elements of a value have a given length.
function dot_vv(v1t, v2t, v1i, v2i)
Compute the dot product of two vectors.
function triangle_centroid_vp(v)
Compute the centroid (geometric center) of a triangle.
function triangle_vl2vp(v)
Compute the vertices of a plane triangle given its side lengths.
function striple_vvv(v1t, v2t, v3t, v1i, v2i, v3i)
Compute scalar triple product of two vectors in a Euclidean 3D-space.
function unit_v(vt, vi)
Compute the normalized unit vector for a 1, 2, or 3 term vector.
function triangle_inradius_vp(v)
Compute the inradius of a triangle's incircle.
function any_equal(v, cv)
Test if any element of a value equals a comparison value.
function triangle_centroid_ppp(v1, v2, v3)
Compute the centroid (geometric center) of a triangle.
function ngon_vp(n, r, vr)
Compute the vertices for an n-sided equiangular/equilateral regular polygon.
function triangle_vp2vl(v)
Compute the side lengths of a triangle given its vertices.
origin3d
The origin coordinates in 3-dimensional Euclidean space.
function triangle_incenter_ppp(v1, v2, v3)
Compute the coordinate for the triangle's incircle.
function distance_pp(p1, p2)
Compute the distance between two points in a Euclidean 1, 2, or 3D-space.
function triangle_inradius_ppp(v1, v2, v3)
Compute the inradius of a triangle's incircle.
origin2d
The origin coordinates in 2-dimensional Euclidean space.
function cross_vv(v1t, v2t, v1i, v2i)
Compute the cross product of two vectors in a Euclidean 3D-space (2D).
function triangle_ppp2vl(v1, v2, v3)
Compute the side lengths of a triangle given its vertices.
function all_defined(v)
Test if no element of a value is undefined.
function consts(l, v)
Create a vector of constant elements.
function angle_vvn(v1t, v2t, nvt, v1i, v2i, nvi)
Compute the angle between two vectors in a Euclidean 3D-space.
function triangle_incenter_vp(v)
Compute the coordinate for the triangle's incircle.
function triangle_lll2vp(s1, s2, s3)
Compute the vertices of a plane triangle given its side lengths.
function are_coplanar_vvv(v1t, v2t, v3t, v1i, v2i, v3i)
Test if three vectors are coplanar in Euclidean 3D-space.