New rounded-edges-algorithm.

This commit is contained in:
Shy 2024-01-19 20:17:44 +01:00
parent 7d4d4fddf9
commit 0966e4eb00
5 changed files with 147 additions and 149 deletions

View file

@ -59,10 +59,10 @@
*/ */
// Abgerundete Außenkanten. // Abgerundete Außenkanten.
rounded_edges = true; rounded_edges = false;
// Abgeschrägte Außenkanten. // Abgeschrägte Außenkanten.
beveled_edges = false; beveled_edges = true;
// Temporäre Stützstrukturen in den Bohrungen. // Temporäre Stützstrukturen in den Bohrungen.
support = false; support = false;
@ -428,44 +428,6 @@ module outer() {
import("./svg/back loops.svg"); import("./svg/back loops.svg");
} }
} }
}
/*************************************************************************
* Die Hülle. *
*************************************************************************/
module body_back() {
if (rounded_edges || beveled_edges) {
intersection() {
union () {
outer();
}
color(color_top)
minkowski() {
linear_extrude(height=1) {
import("./svg/back hull.svg");
}
$fn = $preview ? 4 : 16;
if (beveled_edges) {
// Abgeschrägte Kanten.
cylinder(h=top+space, r1=0.5, r2=(top+space)/2);
} else {
// Abgerundete Kanten.
hull() {
for (i = [1:5]) {
translate([0, 0, i - 1])
cylinder(r=sin(i * (90/5)) * 2, h=top + space);
}
}
}
}
}
} else {
outer();
}
// Stützen für die Buttons. // Stützen für die Buttons.
if (button_support) { if (button_support) {
@ -483,6 +445,47 @@ module body_back() {
} }
} }
} }
}
/*************************************************************************
* Die Hülle. *
*************************************************************************/
module body_back() {
if (rounded_edges || beveled_edges) {
difference() {
union () {
outer();
}
color(color_top)
translate([0, 0, -0.1])
minkowski() {
linear_extrude(height=0.1) {
import("./svg/back outline.svg");
}
$fn = $preview ? 4 : 8;
if (beveled_edges) {
// Abgeschrägte Kanten.
cylinder(h=4, r1=1.5, r2=0);
} else {
// Abgerundete Kanten.
// Dafür generieren wir im folgenden einen konkaven Kegel.
union() {
curve = [1.34, 1.07, 0.84, 0.63, 0.46, 0.32, 0.2, 0.11, 0.05, 0.01, 0];
for (i = [0:len(curve)-2]) {
translate([0, 0, i*0.5])
cylinder(h=0.5, r1=curve[i], r2=curve[i+1]);
}
}
}
}
}
} else {
outer();
}
// Stützen für die Analog sticks. // Stützen für die Analog sticks.
if (stick_support) { if (stick_support) {

View file

@ -47,10 +47,10 @@ include <colors.scad>;
*/ */
// Abgerundete Außenkanten. // Abgerundete Außenkanten.
rounded_edges = true; rounded_edges = false;
// Abgeschrägte Außenkanten. // Abgeschrägte Außenkanten.
beveled_edges = false; beveled_edges = true;
// Aussparungen für den linken Analog-Stick. // Aussparungen für den linken Analog-Stick.
analog_stick_l = true; analog_stick_l = true;
@ -336,26 +336,30 @@ module border_strut(width, length, height) {
module casing_front() { module casing_front() {
difference() { difference() {
if (rounded_edges || beveled_edges) { if (rounded_edges || beveled_edges) {
intersection() { difference() {
union () { union () {
outer(); outer();
} }
color(color_top) color(color_top)
translate([0, 0, -0.1])
minkowski() { minkowski() {
linear_extrude(height=1) { linear_extrude(height=0.1) {
import("./svg/front hull.svg"); import("./svg/front outline.svg");
} }
$fn = $preview ? 4 : 16;
$fn = $preview ? 4 : 8;
if (beveled_edges) { if (beveled_edges) {
// Abgeschrägte Kanten. // Abgeschrägte Kanten.
cylinder(h=top+space, r1=0.5, r2=(top+space)/2); cylinder(h=4, r1=1.5, r2=0);
} else { } else {
// Abgerundete Kanten. // Abgerundete Kanten.
hull() { // Dafür generieren wir im folgenden einen konkaven Kegel.
for (i = [1:5]) { union() {
translate([0, 0, i - 1]) curve = [1.34, 1.07, 0.84, 0.63, 0.46, 0.32, 0.2, 0.11, 0.05, 0.01, 0];
cylinder(r=sin(i * (90/5)) * 2, h=top + space); for (i = [0:len(curve)-2]) {
translate([0, 0, i*0.5])
cylinder(h=0.5, r1=curve[i], r2=curve[i+1]);
} }
} }
} }

View file

@ -1,79 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="150mm"
height="110mm"
viewBox="0 0 150 110"
version="1.1"
id="svg8"
inkscape:version="1.0.2 (e86c870879, 2021-01-15)"
sodipodi:docname="back hull.svg">
<defs
id="defs2">
<inkscape:path-effect
effect="offset"
id="path-effect2953"
is_visible="true"
lpeversion="1"
linejoin_type="miter"
unit="mm"
offset="-2"
miter_limit="4"
attempt_force_join="true"
update_on_knot_move="true" />
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="2.3139015"
inkscape:cx="283.46457"
inkscape:cy="207.87402"
inkscape:document-units="mm"
inkscape:current-layer="layer1"
inkscape:document-rotation="0"
showgrid="false"
inkscape:showpageshadow="true"
inkscape:snap-bbox="true"
inkscape:bbox-nodes="true"
inkscape:snap-page="true">
<inkscape:grid
type="xygrid"
id="grid833"
units="mm"
spacingx="0.25"
spacingy="0.25"
empspacing="4" />
</sodipodi:namedview>
<metadata
id="metadata5">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1">
<path
id="path1572"
style="display:inline;opacity:1;fill:#37abc8;stroke-width:4;stroke-linecap:round;stroke-linejoin:round"
d="m 31.5,3 c -0.291667,0 -0.836371,0.1644962 -1.585938,0.9140625 l -6.5,6.4999995 C 22.737286,11.090841 21.416667,12 20,12 H 10 c -4.4330505,0 -8,3.566949 -8,8 v 1 c 0,0 0.1497648,0.321639 0.4140625,0.585938 l 2,2 C 5.0908392,24.262714 6,25.583333 6,27 v 66 c 0,1.416667 -0.9091608,2.737286 -1.5859375,3.414062 l -2,2 C 2.1497648,98.67836 2,99 2,99 v 1 c 0,4.43305 3.5669495,8 8,8 h 1 c 0,0 0.321638,-0.14976 0.585938,-0.41406 l 2,-2 C 14.262711,104.90916 15.583333,104 17,104 H 29 V 92 c 0,-1.416667 0.909156,-2.737285 1.585938,-3.414062 l 2,-2 C 33.262714,85.90916 34.583333,85 36,85 h 77.5 c 0.79688,0 4,0.601562 4,4 v 19 H 140 c 4.43305,0 8,-3.56695 8,-8 v -1 c 0,0 -0.14976,-0.32164 -0.41406,-0.585938 l -2,-2 C 144.90916,95.737286 144,94.416667 144,93 V 27 c 0,-1.416667 0.90916,-2.737286 1.58594,-3.414062 l 2,-2 C 147.85024,21.321639 148,21 148,21 v -1 c 0,-4.433051 -3.56695,-8 -8,-8 h -10 c -1.41667,0 -2.73729,-0.909158 -3.41406,-1.585938 l -6.5,-6.4999995 C 119.33637,3.1644962 118.79167,3 118.5,3 H 113 v 6 c 0,2.104167 -1.79167,3 -3,3 h -8 C 100.58333,12 99.262714,11.090842 98.585938,10.414062 98.32164,10.149767 98,10 98,10 h -2.75 v 20 c 0,2.104167 -1.791667,3 -3,3 H 77 c -1.414296,3.43e-4 -2.711597,-0.883471 -3.414062,-1.585938 l -5,-5 C 67.90916,25.737286 67,24.416667 67,23 V 12 H 40 C 38.791667,12 37,11.104167 37,9 V 3 Z"
sodipodi:nodetypes="cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc" />
</g>
</svg>

Before

Width:  |  Height:  |  Size: 3.5 KiB

79
svg/back outline.svg Normal file
View file

@ -0,0 +1,79 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
width="150mm"
height="110mm"
viewBox="0 0 150 110"
version="1.1"
id="svg8"
inkscape:version="1.2.2 (b0a8486541, 2022-12-01)"
sodipodi:docname="back outline.svg"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:dc="http://purl.org/dc/elements/1.1/">
<defs
id="defs2">
<inkscape:path-effect
effect="offset"
id="path-effect2953"
is_visible="true"
lpeversion="1"
linejoin_type="miter"
unit="mm"
offset="-2"
miter_limit="4"
attempt_force_join="true"
update_on_knot_move="true" />
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="1.5800489"
inkscape:cx="281.63686"
inkscape:cy="248.41004"
inkscape:document-units="mm"
inkscape:current-layer="layer1"
inkscape:document-rotation="0"
showgrid="false"
inkscape:showpageshadow="true"
inkscape:snap-bbox="true"
inkscape:bbox-nodes="true"
inkscape:snap-page="true"
inkscape:pagecheckerboard="0"
inkscape:deskcolor="#d1d1d1">
<inkscape:grid
type="xygrid"
id="grid833"
units="mm"
spacingx="0.25"
spacingy="0.25"
empspacing="4" />
</sodipodi:namedview>
<metadata
id="metadata5">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1">
<path
id="rect1305"
style="fill:#4d4d4d;stroke:none;stroke-width:4;stroke-linecap:round"
d="M -5.0002116 -5.0002116 L -5.0002116 115.00022 L 154.99984 115.00022 L 154.99984 -5.0002116 L -5.0002116 -5.0002116 z M 31.499886 0.99993896 L 36.999809 0.99993896 C 38.999933 0.99993896 39.000203 2.9998169 39.000203 2.9998169 L 39.000203 8.9999674 C 39.000203 8.9999674 39.00019 9.1404571 39.052913 9.3162272 C 39.088063 9.4334073 39.146467 9.5664666 39.244116 9.6836466 C 39.292944 9.7422403 39.351571 9.7969686 39.421883 9.8438436 C 39.492196 9.8907184 39.574227 9.9296713 39.66993 9.957015 C 39.717781 9.970686 39.768995 9.981214 39.823926 9.9885376 C 39.878857 9.9958666 39.937642 9.9999064 40.000142 9.9999064 L 67.000045 9.9999064 C 69.000041 9.9999064 68.999923 11.999784 68.999923 11.999784 L 68.999923 23.000146 C 68.999923 23.750146 69.499862 24.500026 69.999862 25.000024 L 75.000073 30.000236 C 75.500073 30.500236 76.286455 31.000348 76.999951 31.000175 L 92.250183 31.000175 C 93.250181 31.000175 93.250122 30.000236 93.250122 30.000236 L 93.250122 8.9999674 C 93.250122 8.9999674 93.250063 8.0000285 94.250061 8.0000285 L 98.00022 8.0000285 C 98.750218 8.0000285 99.500096 8.4999679 100.0001 8.9999674 C 100.5001 9.4999664 101.24998 9.9999064 101.99998 9.9999064 L 110 9.9999064 C 110.0625 9.9999064 110.12132 9.9958576 110.17622 9.9885376 C 110.23112 9.9812136 110.28242 9.970686 110.33022 9.957015 C 110.42592 9.9296716 110.50796 9.8907185 110.57826 9.8438436 C 110.64858 9.7969686 110.70723 9.7422406 110.75603 9.6836466 C 110.80479 9.6251727 110.84369 9.5625673 110.87489 9.5001953 L 110.87489 9.4996785 C 110.99987 9.2496943 110.99994 8.9999674 110.99994 8.9999674 L 110.99994 2.9998169 C 110.99994 2.9998169 110.99982 0.99993896 112.99982 0.99993896 L 118.49974 0.99993896 C 119.49974 0.99993896 120.50007 1.5001078 121.50008 2.5001058 L 127.99994 8.9999674 C 128.12494 9.1249672 128.26566 9.2501996 128.418 9.3673869 C 128.57034 9.4845742 128.73447 9.5935141 128.90634 9.687264 C 129.16413 9.8278773 129.43944 9.9337456 129.71921 9.9776855 C 129.81248 9.9923365 129.90612 9.9999064 129.99982 9.9999064 L 140.00024 9.9999064 C 145.54022 9.9999064 150.00015 14.459823 150.00015 19.999813 L 150.00015 20.999752 C 150.00015 21.74975 149.50021 22.500148 149.00021 23.000146 L 146.99981 25.000024 C 146.49981 25.500024 145.99987 26.249904 145.99987 26.999902 L 145.99987 93.000008 C 145.99987 93.750006 146.49981 94.499888 146.99981 94.999886 L 149.00021 96.999764 C 149.50021 97.499762 150.00015 98.250159 150.00015 99.000159 L 150.00015 100.0001 C 150.00015 105.54008 145.54022 110 140.00024 110 L 117.4998 110 C 115.49982 110 115.49993 108.00013 115.49993 108.00013 L 115.49993 89.000252 C 115.49993 89.000252 115.50005 86.999858 113.50005 86.999858 L 35.99987 86.999858 C 35.249872 86.999858 34.49999 87.499797 33.999992 87.999797 L 32.000114 90.000191 C 31.500114 90.500189 31.000175 91.250071 31.000175 92.000069 L 31.000175 103.99985 C 31.000175 103.99985 30.999776 106.00025 28.99978 106.00025 L 16.999996 106.00025 C 16.249998 106.00025 15.500118 106.50019 15.000118 107.00019 L 13.00024 109.00007 C 12.500242 109.50005 11.749845 110 10.999845 110 L 9.9999064 110 C 4.4599176 110 0 105.54008 0 100.0001 L 0 99.000159 C 0 98.250159 0.49993996 97.499762 0.99993896 96.999764 L 2.9998169 94.999886 C 3.4998159 94.499888 3.9997559 93.750006 3.9997559 93.000008 L 3.9997559 26.999902 C 3.9997559 26.249904 3.4998159 25.500024 2.9998169 25.000024 L 0.99993896 23.000146 C 0.49993996 22.500148 0 21.74975 0 20.999752 L 0 19.999813 C 1.2533172e-15 14.459823 4.4599176 9.9999064 9.9999064 9.9999064 L 19.999813 9.9999064 C 20.374811 9.9999064 20.749955 9.8747483 21.093803 9.687264 C 21.265678 9.5935142 21.429802 9.4845742 21.582145 9.3673869 C 21.734489 9.2501996 21.875208 9.1249672 22.000208 8.9999674 L 28.500069 2.5001058 C 29.500065 1.5001078 30.499888 0.99993896 31.499886 0.99993896 z " />
</g>
</svg>

After

Width:  |  Height:  |  Size: 5.8 KiB

View file

@ -6,7 +6,7 @@
version="1.1" version="1.1"
id="svg8" id="svg8"
inkscape:version="1.2.2 (b0a8486541, 2022-12-01)" inkscape:version="1.2.2 (b0a8486541, 2022-12-01)"
sodipodi:docname="front hull.svg" sodipodi:docname="front outline.svg"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"
@ -23,9 +23,9 @@
borderopacity="1.0" borderopacity="1.0"
inkscape:pageopacity="0.0" inkscape:pageopacity="0.0"
inkscape:pageshadow="2" inkscape:pageshadow="2"
inkscape:zoom="2.2345265" inkscape:zoom="1.5800489"
inkscape:cx="283.28149" inkscape:cx="362.64702"
inkscape:cy="207.87402" inkscape:cy="266.13101"
inkscape:document-units="mm" inkscape:document-units="mm"
inkscape:current-layer="layer1" inkscape:current-layer="layer1"
inkscape:document-rotation="0" inkscape:document-rotation="0"
@ -33,23 +33,16 @@
inkscape:showpageshadow="true" inkscape:showpageshadow="true"
inkscape:snap-bbox="true" inkscape:snap-bbox="true"
inkscape:bbox-nodes="true" inkscape:bbox-nodes="true"
inkscape:snap-page="true"
inkscape:pagecheckerboard="0" inkscape:pagecheckerboard="0"
inkscape:deskcolor="#d1d1d1" inkscape:deskcolor="#d1d1d1">
inkscape:window-width="1438"
inkscape:window-height="880"
inkscape:window-x="0"
inkscape:window-y="16"
inkscape:window-maximized="1">
<inkscape:grid <inkscape:grid
type="xygrid" type="xygrid"
id="grid833" id="grid833"
units="mm" units="mm"
spacingx="0.25" spacingx="0.25"
spacingy="0.25" spacingy="0.25"
empspacing="4" empspacing="4" />
originx="0"
originy="0"
visible="true" />
</sodipodi:namedview> </sodipodi:namedview>
<metadata <metadata
id="metadata5"> id="metadata5">
@ -59,7 +52,6 @@
<dc:format>image/svg+xml</dc:format> <dc:format>image/svg+xml</dc:format>
<dc:type <dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title />
</cc:Work> </cc:Work>
</rdf:RDF> </rdf:RDF>
</metadata> </metadata>
@ -68,9 +60,8 @@
inkscape:groupmode="layer" inkscape:groupmode="layer"
id="layer1"> id="layer1">
<path <path
id="rect1044-6" id="rect1305"
style="display:inline;opacity:0.75;fill:#5fbcd3;stroke-width:2.11667;stroke-linecap:round;stroke-linejoin:round" style="fill:#4d4d4d;stroke:none;stroke-width:4;stroke-linecap:round"
d="M 10,1.9609375 C 5.5124037,1.9609375 1.9609204,5.5124119 1.9609375,10 v 29 c 0,0 0.156853,0.34435 0.4257813,0.613281 l 1,1 C 4.1177941,41.344366 4.9609351,42.378512 4.9609375,44 v 40 c 0,1.621317 -0.8428218,2.655468 -1.5742187,3.386719 l -1,1 C 2.1179875,88.655396 1.9609375,89 1.9609375,89 v 1 c 0,4.487599 3.5514785,8.039087 8.0390625,8.039062 h 114 c 0,0 0.34437,-0.15687 0.61328,-0.425781 l 1,-1 c 0.73109,-0.731085 1.76523,-1.574219 3.38672,-1.574219 h 10 c 3.37965,-8e-5 6.03912,-2.659509 6.03906,-6.039062 V 79 c -1e-5,-1.653651 1.0743,-2.886765 1.57422,-3.386719 l 1,-1 C 147.8822,74.344364 148.03906,74 148.03906,74 V 10 c 0,-4.4875973 -3.55146,-8.0390625 -8.03906,-8.0390625 z" d="M -5.0002116 -5.0002116 L -5.0002116 115.00022 L 154.99984 115.00022 L 154.99984 -5.0002116 L -5.0002116 -5.0002116 z M 9.9999064 0 L 140.00024 0 C 145.54023 3.0946786e-17 150.00015 4.459912 150.00015 9.9999064 L 150.00015 74.000134 C 150.00015 74.750135 149.50021 75.500011 149.00021 76.000012 L 148.00027 76.999951 C 147.50028 77.499971 147.00032 77.999829 147.00033 78.999829 L 147.00033 89.000252 C 147.00041 93.432246 143.4323 96.999659 139.0003 96.999764 L 129.00039 96.999764 C 128.2504 96.999764 127.5 97.500221 127 98.00022 L 126.00006 99.000159 C 125.50006 99.500158 124.75018 100.0001 124.00018 100.0001 L 9.9999064 100.0001 C 4.4599128 100.00013 0 95.540188 0 90.000191 L 0 89.000252 C 0 88.250252 0.49988811 87.499808 0.99993896 86.999858 L 1.9998779 85.999919 C 2.4999775 85.499919 2.9998169 84.75004 2.9998169 84.000041 L 2.9998169 43.999898 C 2.9998158 43.249901 2.4998771 42.500026 1.9998779 42.00002 L 0.99993896 41.000081 C 0.49993876 40.500075 -7.8332324e-17 39.750204 0 39.000203 L 0 9.9999064 C -2.116657e-05 4.459912 4.4599128 -1.2533172e-15 9.9999064 0 z " />
sodipodi:nodetypes="sccsccscccsccsssccccscsss" />
</g> </g>
</svg> </svg>

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB