thehans / functionalopenscad Goto Github PK
View Code? Open in Web Editor NEWImplementing OpenSCAD in OpenSCAD
License: MIT License
Implementing OpenSCAD in OpenSCAD
License: MIT License
text() is not in the list of implemented functions, and not in the list of not-yet-implemented. I hope it's not forgotten.
It doesn't seem to be impossible to implement, with some custom fonts. Here's an example: https://www.thingiverse.com/thing:16193
I have an actual use case for it: Concatenating text, where each text has a different font size.
The way that sum is written here, it explicitly involves numbers, but in OpenSCAD, + works on other kinds of things. Not explicitly involving 0 can save that for summation.
Consider this example:
function vsum(v,i=0) = len(v)-1 > i ? v[i] + vsum(v, i+1) : v[i];
echo(vsum([1,2,3]));
echo(vsum([[1,2,3],[4,5,6]]));
echo(sum([1,2,3]));
echo(sum([[1,2,3],[4,5,6]]));
This is an inefficient method - order N^2 - but should work and large complex faces aren't going to come up often in this kind of application.
I'm not sure what your stylistic sensibilities are, but there's a 'shoelace formula' for volume that seems like it would fight right in here:
function signed_volume(poly)=
sum([ for(i=[0:len(poly[1])]
_signed_volume(poly[0],poly[1][i])
])
;
function _signed_volume(points,face)=
let( l=len(face) )
(l>2)?
sum([
for(i=[1:l-2])
cross(points[face[i]]-points[face[0]],points[face[i+1]]-points[face[i]])
])*points[face[0]]/6;
:
0
;
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.