33 include <../constants.scad>;
115 ) = (s ==
"c") ?
"cartesian"
116 : (s ==
"p") ?
"polar"
117 : (s ==
"y") ?
"cylindrical"
118 : (s ==
"s") ?
"spherical"
132 function coordinate_c_to
136 ) = (to ==
"c") ? ( c )
141 r = sqrt(pow(c.x,2) + pow(c.y,2)),
142 aa = atan2(c.y, c.x),
151 r = sqrt(pow(c.x,2) + pow(c.y,2)),
152 aa = atan2(c.y, c.x),
154 z = (c.z !=undef) ? c.z : 0
162 r = sqrt(pow(c.x,2) + pow(c.y,2) + pow(c.z,2)),
163 aa = atan2(c.y, c.x),
182 function coordinate_to_c
186 ) = (from ==
"c") ? ( c )
202 z = (c[2] != undef) ? c[2] : 0
210 x = c[0]*sin(c[2])*cos(c[1]),
211 y = c[0]*sin(c[2])*sin(c[1]),
234 ) = coordinate_c_to( coordinate_to_c( c, from ), to );
coordinates_positive_angles
When converting to angular measures add 360 to negative angles.
function coordinates_pc(p, r, t=false)
Radially scale and convert a list of 2d polar coordinates to cartesian.
function coordinates_csc(c, r, t=false)
Radially scale a list of 3d cartesian coordinates.
function convert_coordinate(c, from=base_coordinates, to=base_coordinates)
Convert point from one coordinate system to another.
function coordinates_name(s=base_coordinates)
Return the name of the given coordinate system identifier.
base_coordinates
The base coordinate system.
function coordinates_cpc(c, r, t=false)
Radially scale a list of 2d cartesian coordinates.
function coordinates_sc(s, r, t=false)
Radially scale and convert a list of 3d spherical coordinates to cartesian.