1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-08-28 08:50:30 +02:00

refactored

This commit is contained in:
Justin Lin
2017-05-19 08:22:36 +08:00
parent 4e4c06b860
commit 251c119d76
2 changed files with 11 additions and 11 deletions

View File

@@ -0,0 +1,8 @@
function __angy_angz(p1, p2) =
let(
dx = p2[0] - p1[0],
dy = p2[1] - p1[1],
dz = p2[2] - p1[2],
za = atan2(dy, dx),
ya = atan2(dz, sqrt(pow(dx, 2) + pow(dy, 2)))
) [ya, za];

View File

@@ -12,20 +12,12 @@
include <__private__/__to3d.scad>;
include <__private__/__to2d.scad>;
include <__private__/__angy_angz.scad>;
function _ya_za(p1, p2) =
let(
dx = p2[0] - p1[0],
dy = p2[1] - p1[1],
dz = p2[2] - p1[2],
za = atan2(dy, dx),
ya = atan2(dz, sqrt(pow(dx, 2) + pow(dy, 2)))
) [ya, za];
function _corner_ctrl_pts(round_d, p1, p2, p3) =
let(
_ya_za_1 = _ya_za(p1, p2),
_ya_za_2 = _ya_za(p3, p2),
_ya_za_1 = __angy_angz(p1, p2),
_ya_za_2 = __angy_angz(p3, p2),
dz1 = sin(_ya_za_1[0]) * round_d,
dxy1 = cos(_ya_za_1[0]) * round_d,