mirror of
https://github.com/BelfrySCAD/BOSL2.git
synced 2025-01-01 09:49:45 +00:00
Updated code to use xyz_to_spherical()
This commit is contained in:
parent
c2dba6c404
commit
f92d2fe15d
1 changed files with 4 additions and 10 deletions
14
paths.scad
14
paths.scad
|
@ -68,17 +68,11 @@ module modulated_circle(r=40, sines=[10])
|
||||||
// xspread(3) circle(3, $fn=32);
|
// xspread(3) circle(3, $fn=32);
|
||||||
// }
|
// }
|
||||||
module extrude_from_to(pt1, pt2, convexity=undef, twist=undef, scale=undef, slices=undef) {
|
module extrude_from_to(pt1, pt2, convexity=undef, twist=undef, scale=undef, slices=undef) {
|
||||||
delta = pt2 - pt1;
|
rtp = xyz_to_spherical(pt2-pt1);
|
||||||
dist2d = norm([delta[0], delta[1], 0]);
|
|
||||||
dist3d = norm(delta);
|
|
||||||
theta = atan2(delta[1], delta[0]);
|
|
||||||
phi = atan2(delta[2], dist2d);
|
|
||||||
translate(pt1) {
|
translate(pt1) {
|
||||||
rotate([0, -phi, theta]) {
|
rotate([0, rtp[2], rtp[1]]) {
|
||||||
yrot(90) {
|
linear_extrude(height=rtp[0], convexity=convexity, center=false, slices=slices, twist=twist, scale=scale) {
|
||||||
linear_extrude(height=dist3d, convexity=convexity, center=false, slices=slices, twist=twist, scale=scale) {
|
children();
|
||||||
children();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue