<Guest35>
hi,I WANT TO OPEN OPENSCAD VIA VS WHICH MAY REQUIRE A DLL LIBRARY, HOW DO I IMPLEMENT THIS OR WHERE CAN I DOWNLOAD IT?
<buZz>
do the nightlies have color exports yet?
<Guest35>
someone can help me?
<buZz>
i dont know if openscad can be a dll library
<Guest35>
thank you
<buZz>
but hang aroung longer, devs arent here 24/7 :)
<nihil>
THANKS BUZZ i WILL WAIT
J24k63 has joined #openscad
J24k66 has quit [Ping timeout: 256 seconds]
<InPhase>
Guest35: There has been talk of the merit of making an OpenSCAD dll, and some effort was made toward restructuring that might facilitate that later. But most people use the executable as an engine which can be called.
<InPhase>
When bundling it with some other infrastructure, that is.
<Scopeuk>
I know they've gone (maybe they will read logs) but I think there was some talk about using the webasm version as embedable inside a vs code plugin
<Scopeuk>
J24k perhaps a step back to what you are trying to do?
<J24k>
Scopeuk calculate the volume of a sphere cap from h
<J24k>
it seems the math in openSCAD is limited - if i replace the exponents with let( v2=v^2,… ) i get results but they are just wrong and if i have PI it always is "nan"
<J24k>
probably i can only use the function for volume and then recursive iterate until i am at the volume i am looking for
<Scopeuk>
all I've got would be to break it up into multiple chunks and try to identify where it goes wrong
<J24k>
hadn't thought it would be so difficult to find out how high the water level for a certain volume in a bowl is
<Scopeuk>
I suspect this to be and attack of floating point maths but I have nothing concrete to hang that off
<J24k>
maybe easier to fill an array with the volumes for h=[0:r] and then use a lookup
peeps[zen] has quit [Remote host closed the connection]
peeps[zen] has joined #openscad
RoyK^ is now known as RoyK
<peeps[zen]>
J24k: why not use the builtin `PI` constant? makes it very hard to read and guess what multiple/fraction of pi you are intending all ovewr the equation
<J24k>
because with PI i always get nan as result so i started to simplify it
<J24k>
peeps[zen] here function h(v=10,r=d/2)= (sqrt(3) * sqrt(3 * v^2 - 4 * PI * r^3 * v) + 2 * PI * r^3 - 3 * v)^(1/3)/(2 * PI)^(1/3) + ((2 * PI)^(1/3) * r^2)/(sqrt(3) * sqrt(3 * v^2 - 4 * PI * r^3 * v) + 2 * PI * r^3 - 3 * v)^(1/3) + r;
peeps[zen] has quit [Quit: Connection reset by peep]
peepsalot has joined #openscad
<peepsalot>
well, i'm still having my weird crashing issues that apparently only happen to me on the nightly
<peepsalot>
open new doc, paste your function (with PI constants), try to type in another line like echo(h()); and it crashes before registering a single keypress
<J24k>
hmm sorry to hear
<peepsalot>
i would approach it by splitting the function into smaller let statements
<J24k>
yes i have startet with that and then i got results for some values but they seems to be terrible wrong
<InPhase>
J24k: So it works in Python returning a real value if I feed in real values of type complex.
<InPhase>
v=1+0j, r=20+0j gives me an output of 59.999734739416084-5.551115123125783e-17j
<InPhase>
Where 5e-17 is obviously just floating point error.
<InPhase>
So what that says is that the equation is just not adequately simplified to be working with reals and not complex values.
<InPhase>
Although that's the same problem I get when I solve the same expression in maxima.
<J24k>
i hate computer math - Ü
<InPhase>
I'm not sure that there's any variant of math which makes this one easier. ;)
<InPhase>
But let me try some automated simplification routines and see if one gets lucky.
<J24k>
Already said that just using the volume and fill a table then lookup() that table would be my next aproach
<J24k>
using a dipstick for a wok seems silly anyway but i thought it was a funny challenge until i got that formula back
<InPhase>
Got it.
<InPhase>
It was kind of obvious the expression had to be this when you think about it. <.< >.> https://bpa.st/A3SA
<InPhase>
J24k: My secret was using maxima and calling the realpart() function on the solution.
<InPhase>
Probably similar would have been doable with wolfram.
<InPhase>
It's not simplifiable out of the complex calculation unless you clarify that you're willing to ignore the complex results that you get when the volume exceeds that obtainable with that radius of sphere.
<J24k>
haha that is some function
<InPhase>
Fortunately, the copy-paste out of maxima is fully OpenSCAD code compatible except pi is lowercase.
<InPhase>
Otherwise I surely would have typoed that beast.
<InPhase>
Also, that expression can probably be radically simplified. It repeats a lot of stuff.
<InPhase>
But, I leave that as an exercise for the reader.
<J24k>
i don't care as long it is working .. and so i can play with my Shai-Hulud https://imgur.com/a/EIpY8J2
<J24k>
Thanks InPhase for solving!
<InPhase>
Well that's an impressive beast of a model for OpenSCAD. :)
<J24k>
So your formula is calculating something but it is not h for the volume
<J24k>
if i put the result into the original i got something different
<J24k>
i can change v and the result stays nearly the same
<J24k>
for h=2r the result seems correct but then h gets bigger when lowering the volume
teepee_ has joined #openscad
teepee has quit [Ping timeout: 260 seconds]
teepee_ is now known as teepee
mmu_man has quit [Ping timeout: 255 seconds]
<InPhase>
Well, I don't get anything sensible out of the other two solutions to that degree 3 polynomial.
<InPhase>
Maybe try asking wolfram to give you the real part solution to h from v.
<InPhase>
I thought it correct when it returned the same value for me as what I got in python with complex values. But maybe there's a deeper issue with what I extracted from maxima, because I also see it lacking a proper dependence on v.