mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-03-14 11:10:01 +01:00
extract triangle2square
This commit is contained in:
parent
3704abf382
commit
34dc0d2f3a
21
examples/triangle2square/triangle2square.scad
Normal file
21
examples/triangle2square/triangle2square.scad
Normal file
@ -0,0 +1,21 @@
|
||||
// https://www.cs.purdue.edu/homes/gnf/book2/trisqu.html
|
||||
function triangle2square(tri_side_leng) =
|
||||
let(
|
||||
p0 = [0, 0],
|
||||
p1 = tri_side_leng * [0.25, 0.4330125],
|
||||
p2 = tri_side_leng * [0.5, 0.8660255],
|
||||
p4 = tri_side_leng * [1, 0],
|
||||
p3 = tri_side_leng * [0.75, 0.4330125],
|
||||
p6 = tri_side_leng * [0.254508, 0],
|
||||
p5 = tri_side_leng * [0.754508, 0],
|
||||
p8 = tri_side_leng * [0.5380015, 0.247745],
|
||||
p7 = tri_side_leng * [0.4665065, 0.1852665],
|
||||
pieces = [
|
||||
[p0, p6, p7, p1],
|
||||
[p6, p5, p8],
|
||||
[p5, p4, p3, p8],
|
||||
[p1, p7, p3, p2]
|
||||
],
|
||||
hinged_pts = [p5, p3, p1]
|
||||
)
|
||||
[pieces, hinged_pts];
|
@ -1,5 +1,6 @@
|
||||
include <line2d.scad>;
|
||||
include <hollow_out.scad>;
|
||||
include <triangle2square.scad>;
|
||||
|
||||
tri_side_leng = 45;
|
||||
height = 6;
|
||||
@ -8,28 +9,6 @@ ring_width = 1.5;
|
||||
shaft_r = 1;
|
||||
chain_hole = "YES"; // [YES, NO]
|
||||
chain_hole_width = 2.5;
|
||||
|
||||
// https://www.cs.purdue.edu/homes/gnf/book2/trisqu.html
|
||||
function triangle2square(tri_side_leng) =
|
||||
let(
|
||||
p0 = [0, 0],
|
||||
p1 = tri_side_leng * [0.25, 0.4330125],
|
||||
p2 = tri_side_leng * [0.5, 0.8660255],
|
||||
p4 = tri_side_leng * [1, 0],
|
||||
p3 = tri_side_leng * [0.75, 0.4330125],
|
||||
p6 = tri_side_leng * [0.254508, 0],
|
||||
p5 = tri_side_leng * [0.754508, 0],
|
||||
p8 = tri_side_leng * [0.5380015, 0.247745],
|
||||
p7 = tri_side_leng * [0.4665065, 0.1852665],
|
||||
pieces = [
|
||||
[p0, p6, p7, p1],
|
||||
[p6, p5, p8],
|
||||
[p5, p4, p3, p8],
|
||||
[p1, p7, p3, p2]
|
||||
],
|
||||
hinged_pts = [p5, p3, p1]
|
||||
)
|
||||
[pieces, hinged_pts];
|
||||
|
||||
module triangle2square_pendant(tri_side_leng, height, spacing, ring_width, shaft_r) {
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user