Improve chamfer_2d and perpendicular_line

This commit is contained in:
gumyr 2023-09-21 15:59:17 -04:00
parent c6038d5724
commit 0ce2859d0a
8 changed files with 66 additions and 24 deletions

View file

@ -52,12 +52,12 @@
<path d="M 16.283355,-49.404997 L 17.22002,-49.404997 Q 17.680024,-49.404997 17.945025,-49.079997 Q 18.210026,-48.754997 18.210026,-48.18833 Q 18.210026,-47.621663 17.946691,-47.298329 Q 17.683355,-46.974995 17.22002,-46.974995 L 16.283355,-46.974995 L 16.283355,-49.404997 M 16.593359,-49.131668 L 16.593359,-47.248334 L 17.166688,-47.248334 C 17.645306,-47.246599 17.90141,-47.575616 17.900022,-48.191661 C 17.90141,-48.802917 17.645306,-49.133751 17.166688,-49.131668 L 16.593359,-49.131668" />
<path d="M 20.540028,-49.404997 Q 20.863357,-49.404997 21.060026,-49.214996 Q 21.256695,-49.024995 21.256695,-48.711659 Q 21.256695,-48.491661 21.151693,-48.35166 Q 21.046691,-48.211659 20.813357,-48.121663 C 21.0378,-48.017222 21.150022,-47.840554 21.150022,-47.591661 C 21.149154,-47.453366 21.109223,-47.32496 21.008355,-47.193327 C 20.910612,-47.064471 20.698875,-46.972738 20.430024,-46.974995 L 19.443359,-46.974995 L 19.443359,-49.404997 L 20.540028,-49.404997 M 20.353364,-47.248334 Q 20.840028,-47.248334 20.840028,-47.634999 Q 20.840028,-48.021663 20.353364,-48.021663 L 19.753364,-48.021663 L 19.753364,-47.248334 L 20.353364,-47.248334 M 20.510026,-49.131668 L 19.753364,-49.131668 L 19.753364,-48.294992 L 20.510026,-48.294992 Q 20.72003,-48.294992 20.833361,-48.409993 Q 20.946691,-48.524995 20.946691,-48.715001 Q 20.946691,-48.815001 20.913357,-48.901666 Q 20.880024,-48.98833 20.776693,-49.059999 Q 20.673362,-49.131668 20.510026,-49.131668" />
<path d="M 22.603364,-48.451666 L 23.516699,-46.974995 L 23.146691,-46.974995 L 22.453364,-48.158328 L 21.740028,-46.974995 L 21.356695,-46.974995 L 22.293359,-48.451666 L 22.293359,-49.404997 L 22.603364,-49.404997 L 22.603364,-48.451666" />
<path d="M 24.180035,-47.658328 L 23.833366,-47.658328 L 23.833366,-48.004997 L 24.180035,-48.004997 L 24.180035,-47.658328" />
<path d="M 24.180035,-49.058328 L 23.833366,-49.058328 L 23.833366,-49.404997 L 24.180035,-49.404997 L 24.180035,-49.058328" />
<path d="M 24.180035,-47.658328 L 23.833366,-47.658328 L 23.833366,-48.004997 L 24.180035,-48.004997 L 24.180035,-47.658328" />
<path d="M 2.0,-53.744995 L 2.0,-57.389998 L 2.375,-57.389998 L 2.375,-57.055005 Q 2.670003,-57.505005 3.204997,-57.505005 Q 3.725,-57.505005 4.035002,-57.1125 Q 4.345003,-56.719995 4.345003,-56.069995 Q 4.345003,-55.435002 4.045003,-55.064998 Q 3.745003,-54.694995 3.225,-54.694995 Q 2.7,-54.694995 2.415007,-55.124992 L 2.415007,-53.744995 L 2.0,-53.744995 M 3.145003,-55.085002 Q 3.495003,-55.085002 3.702498,-55.364998 Q 3.909994,-55.644995 3.909994,-56.114998 Q 3.909994,-56.560002 3.697494,-56.8375 Q 3.484994,-57.114998 3.145003,-57.114998 Q 2.815007,-57.114998 2.615007,-56.8375 Q 2.415007,-56.560002 2.415007,-56.1 Q 2.415007,-55.639998 2.615007,-55.3625 Q 2.815007,-55.085002 3.145003,-55.085002" />
<path d="M 6.854997,-57.389998 L 6.854997,-54.769995 L 6.440007,-54.769995 L 6.440007,-56.255005 Q 6.440007,-56.655005 6.245003,-56.897502 Q 6.05,-57.139998 5.725,-57.139998 Q 5.475,-57.139998 5.330005,-57.0 Q 5.18501,-56.860002 5.18501,-56.624992 L 5.18501,-54.769995 L 4.770003,-54.769995 L 4.770003,-56.789998 Q 4.770003,-57.114998 4.997502,-57.310002 Q 5.225,-57.505005 5.604997,-57.505005 Q 5.895003,-57.505005 6.095003,-57.395003 Q 6.295003,-57.285002 6.479997,-57.024992 L 6.479997,-57.389998 L 6.854997,-57.389998" />
<path d="M 7.86499,-53.744995 L 7.444987,-53.744995 L 7.444987,-54.269995 L 7.86499,-54.269995 L 7.86499,-53.744995" />
<path d="M 7.86499,-54.769995 L 7.449984,-54.769995 L 7.449984,-57.389998 L 7.86499,-57.389998 L 7.86499,-54.769995" />
<path d="M 7.86499,-53.744995 L 7.444987,-53.744995 L 7.444987,-54.269995 L 7.86499,-54.269995 L 7.86499,-53.744995" />
<path d="M 8.904981,-53.744995 L 8.484977,-53.744995 L 8.484977,-57.389998 L 8.904981,-57.389998 L 8.904981,-53.744995" />
<path d="M 11.699984,-53.744995 L 11.284977,-53.744995 L 11.284977,-55.099992 Q 11.019987,-54.694995 10.479981,-54.694995 Q 9.969987,-54.694995 9.662484,-55.072493 Q 9.354981,-55.449992 9.354981,-56.074992 Q 9.354981,-56.739998 9.659977,-57.122502 Q 9.964974,-57.505005 10.494987,-57.505005 Q 10.764974,-57.505005 10.962476,-57.397502 Q 11.159977,-57.289998 11.329981,-57.044995 L 11.329981,-57.389998 L 11.699984,-57.389998 L 11.699984,-53.744995 M 10.549984,-55.085002 Q 10.884977,-55.085002 11.084977,-55.3625 Q 11.284977,-55.639998 11.284977,-56.110002 Q 11.284977,-56.564998 11.084977,-56.839998 Q 10.884977,-57.114998 10.554981,-57.114998 Q 10.209977,-57.114998 9.999976,-56.8375 Q 9.789974,-56.560002 9.789974,-56.099992 Q 9.789974,-55.644995 9.999976,-55.364998 Q 10.209977,-55.085002 10.549984,-55.085002" />
<path d="M 13.294987,-54.864998 L 13.294987,-57.389998 L 13.734977,-57.389998 L 13.734977,-53.844995 L 13.444987,-53.844995 Q 13.329981,-54.255005 13.174984,-54.370003 Q 13.019987,-54.485002 12.509977,-54.549992 L 12.509977,-54.864998 L 13.294987,-54.864998" />
@ -68,8 +68,8 @@
<path d="M 5.566667,-63.526666 L 5.816667,-64.256668 L 6.163336,-64.256668 L 5.310004,-61.826666 L 4.910004,-61.826666 L 4.043338,-64.256668 L 4.37334,-64.256668 L 4.630002,-63.526666 L 5.566667,-63.526666 M 5.480002,-63.266672 L 4.706673,-63.266672 L 5.106673,-62.159999 L 5.480002,-63.266672" />
<path d="M 7.356673,-62.100005 L 8.153331,-62.100005 L 8.153331,-61.826666 L 6.246669,-61.826666 L 6.246669,-62.100005 L 7.046669,-62.100005 L 7.046669,-64.256668 L 7.356673,-64.256668 L 7.356673,-62.100005" />
<path d="M 8.769998,-63.150005 L 10.093327,-63.150005 L 10.093327,-62.876666 L 8.769998,-62.876666 L 8.769998,-62.100005 L 10.143327,-62.100005 L 10.143327,-61.826666 L 8.459994,-61.826666 L 8.459994,-64.256668 L 10.203331,-64.256668 L 10.203331,-63.983339 L 8.769998,-63.983339 L 8.769998,-63.150005" />
<path d="M 10.916667,-63.909999 L 10.569998,-63.909999 L 10.569998,-64.256668 L 10.916667,-64.256668 L 10.916667,-63.909999" />
<path d="M 10.916667,-62.509999 L 10.569998,-62.509999 L 10.569998,-62.856668 L 10.916667,-62.856668 L 10.916667,-62.509999" />
<path d="M 10.916667,-63.909999 L 10.569998,-63.909999 L 10.569998,-64.256668 L 10.916667,-64.256668 L 10.916667,-63.909999" />
<path d="M 2.079997,-69.858325 L 2.520003,-69.858325 Q 2.570003,-69.013338 3.234994,-69.013338 Q 3.534994,-69.013338 3.734994,-69.203337 Q 3.934994,-69.393335 3.934994,-69.678328 Q 3.934994,-70.103328 3.454997,-70.378328 L 2.995003,-70.638338 Q 2.43999,-70.953328 2.234994,-71.270833 Q 2.029997,-71.588338 2.0,-72.173332 L 4.359994,-72.173332 L 4.359994,-71.738338 L 2.495003,-71.738338 Q 2.529997,-71.513338 2.669995,-71.348332 Q 2.809994,-71.183325 3.134994,-71.008325 L 3.634994,-70.738338 Q 4.384994,-70.328328 4.384994,-69.668335 Q 4.384994,-69.208325 4.069995,-68.918327 Q 3.754997,-68.628328 3.25,-68.628328 Q 2.11499,-68.628328 2.079997,-69.858325" />
<path d="M 4.825,-70.458325 Q 4.825,-71.353328 5.119995,-71.820833 Q 5.41499,-72.288338 5.984994,-72.288338 Q 6.55,-72.288338 6.847494,-71.825838 Q 7.144987,-71.363338 7.144987,-70.488338 Q 7.144987,-68.628328 5.984994,-68.628328 Q 5.819987,-68.628328 5.672494,-68.668327 Q 5.525,-68.708325 5.364998,-68.828328 Q 5.204997,-68.948332 5.089998,-69.140828 Q 4.975,-69.333325 4.9,-69.673332 Q 4.825,-70.013338 4.825,-70.458325 M 6.694987,-70.448332 Q 6.694987,-71.203328 6.519987,-71.56333 Q 6.344987,-71.923332 5.975,-71.923332 Q 5.275,-71.923332 5.275,-70.463338 Q 5.275,-69.018335 5.984994,-69.018335 Q 6.694987,-69.018335 6.694987,-70.448332" />
<path d="M 7.63999,-69.858325 L 8.079997,-69.858325 Q 8.129997,-69.013338 8.794987,-69.013338 Q 9.094987,-69.013338 9.294987,-69.203337 Q 9.494987,-69.393335 9.494987,-69.678328 Q 9.494987,-70.103328 9.01499,-70.378328 L 8.554997,-70.638338 Q 7.999984,-70.953328 7.794987,-71.270833 Q 7.58999,-71.588338 7.559994,-72.173332 L 9.919987,-72.173332 L 9.919987,-71.738338 L 8.054997,-71.738338 Q 8.08999,-71.513338 8.229989,-71.348332 Q 8.369987,-71.183325 8.694987,-71.008325 L 9.194987,-70.738338 Q 9.944987,-70.328328 9.944987,-69.668335 Q 9.944987,-69.208325 9.629989,-68.918327 Q 9.31499,-68.628328 8.809994,-68.628328 Q 7.674984,-68.628328 7.63999,-69.858325" />
@ -85,8 +85,8 @@
<path d="M 7.899989,-78.341661 L 8.149989,-79.071663 L 8.496658,-79.071663 L 7.643327,-76.641661 L 7.243327,-76.641661 L 6.37666,-79.071663 L 6.706662,-79.071663 L 6.963325,-78.341661 L 7.899989,-78.341661 M 7.813325,-78.081668 L 7.039996,-78.081668 L 7.439996,-76.974995 L 7.813325,-78.081668" />
<path d="M 9.039996,-76.641661 L 8.729991,-76.641661 L 8.729991,-79.071663 L 10.239996,-79.071663 L 10.239996,-78.798334 L 9.039996,-78.798334 L 9.039996,-76.641661" />
<path d="M 10.833333,-77.965001 L 12.156662,-77.965001 L 12.156662,-77.691661 L 10.833333,-77.691661 L 10.833333,-76.915001 L 12.206662,-76.915001 L 12.206662,-76.641661 L 10.523329,-76.641661 L 10.523329,-79.071663 L 12.266667,-79.071663 L 12.266667,-78.798334 L 10.833333,-78.798334 L 10.833333,-77.965001" />
<path d="M 12.980002,-78.724995 L 12.633333,-78.724995 L 12.633333,-79.071663 L 12.980002,-79.071663 L 12.980002,-78.724995" />
<path d="M 12.980002,-77.324995 L 12.633333,-77.324995 L 12.633333,-77.671663 L 12.980002,-77.671663 L 12.980002,-77.324995" />
<path d="M 12.980002,-78.724995 L 12.633333,-78.724995 L 12.633333,-79.071663 L 12.980002,-79.071663 L 12.980002,-78.724995" />
<path d="M 2.78501,-84.481665 L 2.78501,-87.006665 L 3.225,-87.006665 L 3.225,-83.461662 L 2.93501,-83.461662 Q 2.820003,-83.871672 2.665007,-83.98667 Q 2.51001,-84.101668 2.0,-84.166659 L 2.0,-84.481665 L 2.78501,-84.481665" />
<path d="M 5.190007,-84.386662 L 4.670003,-84.386662 L 4.670003,-84.906665 L 5.190007,-84.906665 L 5.190007,-84.386662" />
<path d="M 5.190007,-86.486662 L 4.670003,-86.486662 L 4.670003,-87.006665 L 5.190007,-87.006665 L 5.190007,-86.486662" />
@ -103,8 +103,8 @@
<path d="M 57.339974,-70.33999 L 57.339974,-65.099984 L 56.509994,-65.099984 L 56.509994,-68.070003 Q 56.509994,-68.870003 56.119987,-69.354997 Q 55.729981,-69.83999 55.079981,-69.83999 Q 54.579981,-69.83999 54.28999,-69.559993 Q 54.0,-69.279997 54.0,-68.809977 L 54.0,-65.099984 L 53.169987,-65.099984 L 53.169987,-69.13999 Q 53.169987,-69.78999 53.624984,-70.179997 Q 54.079981,-70.570003 54.839974,-70.570003 Q 55.419987,-70.570003 55.819987,-70.35 Q 56.219987,-70.129997 56.589974,-69.609977 L 56.589974,-70.33999 L 57.339974,-70.33999" />
<path d="M 58.539974,-63.049984 L 58.539974,-70.33999 L 59.289974,-70.33999 L 59.289974,-69.670003 Q 59.879981,-70.570003 60.949968,-70.570003 Q 61.989974,-70.570003 62.609977,-69.784993 Q 63.229981,-68.999984 63.229981,-67.699984 Q 63.229981,-66.429997 62.629981,-65.68999 Q 62.029981,-64.949984 60.989974,-64.949984 Q 59.939974,-64.949984 59.369987,-65.809977 L 59.369987,-63.049984 L 58.539974,-63.049984 M 60.829981,-65.729997 Q 61.529981,-65.729997 61.944971,-66.28999 Q 62.359961,-66.849984 62.359961,-67.78999 Q 62.359961,-68.679997 61.934961,-69.234993 Q 61.509961,-69.78999 60.829981,-69.78999 Q 60.169987,-69.78999 59.769987,-69.234993 Q 59.369987,-68.679997 59.369987,-67.759993 Q 59.369987,-66.83999 59.769987,-66.284993 Q 60.169987,-65.729997 60.829981,-65.729997" />
<path d="M 69.659994,-63.870003 L 72.049968,-63.870003 L 72.049968,-63.049984 L 66.329981,-63.049984 L 66.329981,-63.870003 L 68.729981,-63.870003 L 68.729981,-70.33999 L 69.659994,-70.33999 L 69.659994,-63.870003" />
<path d="M 73.849968,-65.099984 L 73.019955,-65.099984 L 73.019955,-70.33999 L 73.849968,-70.33999 L 73.849968,-65.099984" />
<path d="M 73.849968,-63.049984 L 73.009961,-63.049984 L 73.009961,-64.099984 L 73.849968,-64.099984 L 73.849968,-63.049984" />
<path d="M 73.849968,-65.099984 L 73.019955,-65.099984 L 73.019955,-70.33999 L 73.849968,-70.33999 L 73.849968,-65.099984" />
<path d="M 77.049968,-65.099984 L 76.189974,-65.099984 L 76.189974,-63.659977 L 75.359961,-63.659977 L 75.359961,-65.099984 L 74.649968,-65.099984 L 74.649968,-65.779997 L 75.359961,-65.779997 L 75.359961,-69.73999 Q 75.359961,-70.13999 75.619971,-70.354997 Q 75.879981,-70.570003 76.369955,-70.570003 Q 76.659961,-70.570003 77.049968,-70.499984 L 77.049968,-69.799984 Q 76.899968,-69.83999 76.649968,-69.83999 Q 76.379981,-69.83999 76.284977,-69.744987 Q 76.189974,-69.649984 76.189974,-69.370003 L 76.189974,-65.779997 L 77.049968,-65.779997 L 77.049968,-65.099984" />
<path d="M 78.609961,-63.049984 L 77.769955,-63.049984 L 77.769955,-70.33999 L 78.609961,-70.33999 L 78.609961,-63.049984" />
<path d="M 80.379948,-67.999984 L 84.239974,-67.999984 Q 84.239974,-64.949984 81.909961,-64.949984 Q 80.819955,-64.949984 80.164958,-65.724984 Q 79.509961,-66.499984 79.509961,-67.78999 Q 79.509961,-69.079997 80.149968,-69.825 Q 80.789974,-70.570003 81.889974,-70.570003 Q 82.789974,-70.570003 83.379964,-70.08999 Q 83.969955,-69.609977 84.129948,-68.749984 L 83.289974,-68.749984 Q 82.939974,-69.799984 81.919955,-69.799984 Q 81.209961,-69.799984 80.804964,-69.309993 Q 80.399968,-68.820003 80.379948,-67.999984 M 83.349968,-67.320003 L 80.399968,-67.320003 Q 80.449968,-66.58999 80.859961,-66.154997 Q 81.269955,-65.720003 81.899951,-65.720003 Q 82.529948,-65.720003 82.939958,-66.179997 Q 83.349968,-66.63999 83.349968,-67.320003" />
@ -121,8 +121,8 @@
<path d="M 71.743338,-79.071663 Q 72.066667,-79.071663 72.263336,-78.881662 Q 72.460004,-78.691661 72.460004,-78.378326 Q 72.460004,-78.158328 72.355002,-78.018327 Q 72.25,-77.878326 72.016667,-77.78833 C 72.24111,-77.683889 72.353331,-77.507221 72.353331,-77.258328 C 72.352463,-77.120032 72.312533,-76.991627 72.211665,-76.859993 C 72.113922,-76.731138 71.902184,-76.639404 71.633333,-76.641661 L 70.646669,-76.641661 L 70.646669,-79.071663 L 71.743338,-79.071663 M 71.556673,-76.915001 Q 72.043338,-76.915001 72.043338,-77.301666 Q 72.043338,-77.68833 71.556673,-77.68833 L 70.956673,-77.68833 L 70.956673,-76.915001 L 71.556673,-76.915001 M 71.713336,-78.798334 L 70.956673,-78.798334 L 70.956673,-77.961659 L 71.713336,-77.961659 Q 71.92334,-77.961659 72.03667,-78.07666 Q 72.15,-78.191661 72.15,-78.381668 Q 72.15,-78.481668 72.116667,-78.568332 Q 72.083333,-78.654997 71.980002,-78.726666 Q 71.876671,-78.798334 71.713336,-78.798334" />
<path d="M 73.086675,-77.965001 L 74.410004,-77.965001 L 74.410004,-77.691661 L 73.086675,-77.691661 L 73.086675,-76.915001 L 74.460004,-76.915001 L 74.460004,-76.641661 L 72.776671,-76.641661 L 72.776671,-79.071663 L 74.520009,-79.071663 L 74.520009,-78.798334 L 73.086675,-78.798334 L 73.086675,-77.965001" />
<path d="M 76.840007,-78.994992 Q 76.753342,-78.934999 76.72334,-78.841667 Q 76.693338,-78.748334 76.693338,-78.611659 Q 76.693338,-78.584999 76.695009,-78.528331 Q 76.69668,-78.471663 76.69668,-78.441661 Q 76.69668,-78.344992 76.686675,-78.274995 Q 76.676671,-78.204997 76.645009,-78.124995 Q 76.579178,-77.964996 76.363346,-77.871663 Q 76.566678,-77.771663 76.656679,-77.634999 Q 76.74668,-77.498334 76.74668,-77.291661 Q 76.74668,-76.978326 76.555013,-76.809993 Q 76.363346,-76.641661 76.006673,-76.641661 L 74.886675,-76.641661 L 74.886675,-79.071663 L 75.19668,-79.071663 L 75.19668,-78.024995 L 75.99668,-78.024995 C 76.273618,-78.026383 76.395292,-78.159168 76.39668,-78.458328 L 76.39668,-78.674995 Q 76.39668,-78.918332 76.463346,-79.071663 L 76.840007,-79.071663 L 76.840007,-78.994992 M 75.94668,-76.915001 C 76.095566,-76.915001 76.212231,-76.945 76.296674,-77.004997 C 76.381118,-77.064994 76.42334,-77.174995 76.42334,-77.334999 C 76.421605,-77.625624 76.277292,-77.749929 75.94668,-77.751666 L 75.19668,-77.751666 L 75.19668,-76.915001 L 75.94668,-76.915001" />
<path d="M 77.59668,-78.724995 L 77.250011,-78.724995 L 77.250011,-79.071663 L 77.59668,-79.071663 L 77.59668,-78.724995" />
<path d="M 77.59668,-77.324995 L 77.250011,-77.324995 L 77.250011,-77.671663 L 77.59668,-77.671663 L 77.59668,-77.324995" />
<path d="M 77.59668,-78.724995 L 77.250011,-78.724995 L 77.250011,-79.071663 L 77.59668,-79.071663 L 77.59668,-78.724995" />
<path d="M 48.145003,-87.056665 Q 48.629997,-87.056665 48.925,-86.771663 Q 49.220003,-86.486662 49.220003,-86.016659 Q 49.220003,-85.686662 49.0625,-85.47666 Q 48.904997,-85.266659 48.554997,-85.131665 C 48.891661,-84.975003 49.059994,-84.710002 49.059994,-84.336662 C 49.058691,-84.129219 48.998796,-83.93661 48.847494,-83.73916 C 48.772494,-83.640826 48.659994,-83.561659 48.509994,-83.50166 C 48.359994,-83.441661 48.183328,-83.411662 47.979997,-83.411662 L 46.5,-83.411662 L 46.5,-87.056665 L 48.145003,-87.056665 M 47.865007,-83.821672 Q 48.595003,-83.821672 48.595003,-84.401668 Q 48.595003,-84.981665 47.865007,-84.981665 L 46.965007,-84.981665 L 46.965007,-83.821672 L 47.865007,-83.821672 M 48.1,-86.646672 L 46.965007,-86.646672 L 46.965007,-85.391659 L 48.1,-85.391659 Q 48.415007,-85.391659 48.585002,-85.56416 Q 48.754997,-85.736662 48.754997,-86.021672 Q 48.754997,-86.171672 48.704997,-86.301668 Q 48.654997,-86.431665 48.5,-86.539168 Q 48.345003,-86.646672 48.1,-86.646672" />
<path d="M 50.095003,-84.656665 Q 50.104997,-84.311662 50.247502,-84.104167 Q 50.390007,-83.896672 50.770003,-83.896672 Q 51.06001,-83.896672 51.227507,-84.059172 Q 51.395003,-84.221672 51.395003,-84.501668 Q 51.395003,-84.826668 51.197502,-84.93667 Q 51.0,-85.046672 50.525,-85.056665 L 50.525,-85.431665 L 50.579997,-85.431665 L 50.765007,-85.426668 Q 51.5,-85.426668 51.5,-86.071672 Q 51.5,-86.406665 51.305005,-86.594165 Q 51.11001,-86.781665 50.765007,-86.781665 Q 50.404997,-86.781665 50.225,-86.596663 Q 50.045003,-86.411662 50.020003,-86.026668 L 49.579997,-86.026668 Q 49.66001,-87.171672 50.75,-87.171672 Q 51.295003,-87.171672 51.622502,-86.871672 Q 51.95,-86.571672 51.95,-86.066659 Q 51.95,-85.726668 51.810002,-85.529167 Q 51.670003,-85.331665 51.35,-85.221672 Q 51.845003,-85.026668 51.845003,-84.486662 Q 51.845003,-84.031665 51.557503,-83.771663 Q 51.270003,-83.511662 50.765007,-83.511662 Q 49.679997,-83.511662 49.654997,-84.656665 L 50.095003,-84.656665" />
<path d="M 52.6,-87.056665 L 54.004997,-87.056665 Q 54.695003,-87.056665 55.092505,-86.569165 Q 55.490007,-86.081665 55.490007,-85.231665 Q 55.490007,-84.381665 55.095003,-83.896663 Q 54.7,-83.411662 54.004997,-83.411662 L 52.6,-83.411662 L 52.6,-87.056665 M 53.065007,-86.646672 L 53.065007,-83.821672 L 53.925,-83.821672 C 54.642927,-83.819069 55.027082,-84.312593 55.025,-85.236662 C 55.025,-85.696666 54.931668,-86.046669 54.745003,-86.28667 C 54.558339,-86.526671 54.285004,-86.646672 53.925,-86.646672 L 53.065007,-86.646672" />
@ -133,8 +133,8 @@
<path d="M 95.919998,-77.965001 L 97.243327,-77.965001 L 97.243327,-77.691661 L 95.919998,-77.691661 L 95.919998,-76.915001 L 97.293327,-76.915001 L 97.293327,-76.641661 L 95.609994,-76.641661 L 95.609994,-79.071663 L 97.353331,-79.071663 L 97.353331,-78.798334 L 95.919998,-78.798334 L 95.919998,-77.965001" />
<path d="M 97.956673,-77.965001 L 99.280002,-77.965001 L 99.280002,-77.691661 L 97.956673,-77.691661 L 97.956673,-76.915001 L 99.330002,-76.915001 L 99.330002,-76.641661 L 97.646669,-76.641661 L 97.646669,-79.071663 L 99.390007,-79.071663 L 99.390007,-78.798334 L 97.956673,-78.798334 L 97.956673,-77.965001" />
<path d="M 100.666678,-76.915001 L 101.463336,-76.915001 L 101.463336,-76.641661 L 99.556673,-76.641661 L 99.556673,-76.915001 L 100.356673,-76.915001 L 100.356673,-79.071663 L 100.666678,-79.071663 L 100.666678,-76.915001" />
<path d="M 102.176671,-78.724995 L 101.830002,-78.724995 L 101.830002,-79.071663 L 102.176671,-79.071663 L 102.176671,-78.724995" />
<path d="M 102.176671,-77.324995 L 101.830002,-77.324995 L 101.830002,-77.671663 L 102.176671,-77.671663 L 102.176671,-77.324995" />
<path d="M 102.176671,-78.724995 L 101.830002,-78.724995 L 101.830002,-79.071663 L 102.176671,-79.071663 L 102.176671,-78.724995" />
</g>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 70 KiB

After

Width:  |  Height:  |  Size: 70 KiB

Before After
Before After

View file

@ -290,10 +290,13 @@ svg.add_shape(tech_drawing.sketch)
svg.write("assets/tech_drawing.svg")
# [ArrowHead]
arrow_head = ArrowHead(10)
s = 100 / max(*arrow_head.bounding_box().size)
arrow_head_types = [HeadType.CURVED, HeadType.STRAIGHT, HeadType.FILLETED]
arrow_heads = [ArrowHead(50, a_type) for a_type in arrow_head_types]
s = 100 / max(*arrow_heads[0].bounding_box().size)
svg = ExportSVG(scale=s)
svg.add_shape(arrow_head)
for i, arrow_head in enumerate(arrow_heads):
svg.add_shape(arrow_head.moved(Location((0, -i * 40))))
svg.add_shape(Text(arrow_head_types[i].name, 5).moved(Location((-25, -i * 40))))
svg.write("assets/arrow_head.svg")
# [Arrow]

View file

@ -103,7 +103,7 @@ LB = 453.59237 * G
operations_apply_to = {
"add": ["BuildPart", "BuildSketch", "BuildLine"],
"bounding_box": ["BuildPart", "BuildSketch", "BuildLine"],
"chamfer": ["BuildPart", "BuildSketch"],
"chamfer": ["BuildPart", "BuildSketch", "BuildLine"],
"extrude": ["BuildPart"],
"fillet": ["BuildPart", "BuildSketch", "BuildLine"],
"loft": ["BuildPart"],

View file

@ -135,7 +135,7 @@ class Arrow(BaseSketchObject):
shaft_path = shaft_path.trim(0.0, 1.0 - trim_amount)
# Create a perpendicular line to sweep the tail path
shaft_pen = shaft_path.perpendicular_line(shaft_width)
shaft_pen = shaft_path.perpendicular_line(shaft_width, 0)
shaft = sweep(shaft_pen, shaft_path, mode=Mode.PRIVATE)
arrow = arrow_head.fuse(shaft).clean()
@ -284,6 +284,8 @@ class Draft:
processed_path = Wire.make_polygon(pnts, close=False)
else:
raise ValueError("Unsupported patch descriptor")
# processed_path = Plane.XY.to_local_coords(processed_path)
return processed_path
def _label_to_str(
@ -547,7 +549,7 @@ class ExtensionLine(BaseSketchObject):
# Build the extension line sketch
e_lines = []
for extension_line in extension_lines:
line_pen = extension_line.perpendicular_line(draft.line_width)
line_pen = extension_line.perpendicular_line(draft.line_width, 0)
e_line_shape = sweep(line_pen, extension_line, mode=Mode.PRIVATE)
e_lines.append(e_line_shape)
d_line = DimensionLine(

View file

@ -274,6 +274,7 @@ def chamfer(
ValueError: objects must be Vertices
"""
context: Builder = Builder._get_context("chamfer")
length2 = length if length2 is None else length2
if (objects is None and context is None) or (
objects is None and context is not None and context._obj is None
@ -309,14 +310,13 @@ def chamfer(
target = (
Sketch(target.wrapped) if isinstance(target, BaseSketchObject) else target
)
if not all([isinstance(obj, Vertex) for obj in object_list]):
raise ValueError("2D chamfer operation takes only Vertices")
new_faces = []
for face in target.faces():
vertices_in_face = [v for v in face.vertices() if v in object_list]
if vertices_in_face:
new_faces.append(face.chamfer_2d(length, vertices_in_face))
new_faces.append(face.chamfer_2d(length, length2, vertices_in_face))
else:
new_faces.append(face)
new_sketch = Sketch(Compound.make_compound(new_faces).wrapped)
@ -325,6 +325,28 @@ def chamfer(
context._add_to_context(new_sketch, mode=Mode.REPLACE)
return new_sketch
elif target._dim == 1:
target = (
Wire(target.wrapped)
if isinstance(target, BaseLineObject)
else target.wires()[0]
)
if not all([isinstance(obj, Vertex) for obj in object_list]):
raise ValueError("1D fillet operation takes only Vertices")
# Remove any end vertices as these can't be filleted
if not target.is_closed():
object_list = filter(
lambda v: not (
(Vector(*v.to_tuple()) - target.position_at(0)).length == 0
or (Vector(*v.to_tuple()) - target.position_at(1)).length == 0
),
object_list,
)
new_wire = target.chamfer_2d(length, length2, object_list)
if context is not None:
context._add_to_context(new_wire, mode=Mode.REPLACE)
return new_wire
def fillet(
objects: Union[ChamferFilletType, Iterable[ChamferFilletType]],

View file

@ -140,7 +140,7 @@ def trace(
new_faces = []
for edge in trace_edges:
trace_pen = edge.perpendicular_line(line_width)
trace_pen = edge.perpendicular_line(line_width, 0)
new_faces.extend(Face.sweep(trace_pen, edge).faces())
if context is not None:
context._add_to_context(*new_faces, mode=mode)

View file

@ -835,20 +835,25 @@ class Mixin1D:
else:
return offset_wire
def perpendicular_line(self, length: float, plane: Plane = Plane.XY) -> Edge:
def perpendicular_line(
self, length: float, u_value: float, plane: Plane = Plane.XY
) -> Edge:
"""perpendicular_line
Create a line on the given plane perpendicular to and centered on beginning of self
Args:
length (float): line length
u_value (float): position along line between 0.0 and 1.0
plane (Plane, optional): plane containing perpendicular line. Defaults to Plane.XY.
Returns:
Edge: perpendicular line
"""
start = self.position_at(0)
local_plane = Plane(origin=start, x_dir=self.tangent_at(0), z_dir=plane.z_dir)
start = self.position_at(u_value)
local_plane = Plane(
origin=start, x_dir=self.tangent_at(u_value), z_dir=plane.z_dir
)
line = Edge.make_line(
start + local_plane.y_dir * length / 2,
start - local_plane.y_dir * length / 2,
@ -5136,11 +5141,14 @@ class Face(Shape):
return self.__class__(fillet_builder.Shape())
def chamfer_2d(self, distance: float, vertices: Iterable[Vertex]) -> Face:
def chamfer_2d(
self, distance: float, distance2: float, vertices: Iterable[Vertex]
) -> Face:
"""Apply 2D chamfer to a face
Args:
distance: float:
distance2: float:
vertices: Iterable[Vertex]:
Returns:
@ -5161,7 +5169,7 @@ class Face(Shape):
TopoDS.Edge_s(edge1.wrapped),
TopoDS.Edge_s(edge2.wrapped),
distance,
distance,
distance2,
)
chamfer_builder.Build()
@ -6629,19 +6637,26 @@ class Wire(Shape, Mixin1D):
"""
return Face.make_from_wires(self).fillet_2d(radius, vertices).outer_wire()
def chamfer_2d(self, distance: float, vertices: Iterable[Vertex]) -> Wire:
def chamfer_2d(
self, distance: float, distance2: float, vertices: Iterable[Vertex]
) -> Wire:
"""chamfer_2d
Apply 2D chamfer to a wire
Args:
distance (float): chamfer length
distance2 (float): chamfer length
vertices (Iterable[Vertex]): vertices to chamfer
Returns:
Wire: chamfered wire
"""
return Face.make_from_wires(self).chamfer_2d(distance, vertices).outer_wire()
return (
Face.make_from_wires(self)
.chamfer_2d(distance, distance2, vertices)
.outer_wire()
)
@classmethod
def make_rect(

View file

@ -3039,7 +3039,7 @@ class TestWire(DirectApiTestCase):
def test_chamfer_2d(self):
square = Wire.make_rect(1, 1)
squaroid = square.chamfer_2d(0.1, square.vertices())
squaroid = square.chamfer_2d(0.1, 0.1, square.vertices())
self.assertAlmostEqual(
squaroid.length, 4 * (1 - 2 * 0.1 + 0.1 * math.sqrt(2)), 5
)