Round-Anything icon indicating copy to clipboard operation
Round-Anything copied to clipboard

query about beamChain.

Open delooper opened this issue 3 years ago • 3 comments

Greetings,

Apologies for the elementary question about PolyRound. Sometimes when I call beamChain I get warnings "Tan() parameter could not be converted...".

Typically, either a portion of the curve is not rendered (the first vertex or last), or sometimes the entire curve is not rendered.

Is there some guidance on how do avoid these sorts of problems?

Here is a sample codeblock that causes such a problem:

R = 1.6; PTL = [ [20,0,R], [19,2,R], [12,2,R], [10,4,R], [1,4,R], [0,3,R], [0,0,R] ];

polygon(polyRound(beamChain(PTL, offset1=0.4, offset2=0, mode=1), 20));

As a side-note, if I call it without "mode=1", OpenSCAD does not render anything.

I'm running OpenSCAD 2019.05, in case this is relevant.

Your sample code works fine, so I imagine the problem must be in the geometry I'm submitting to beamChain.

edit: after a little fiddling around it seems the last coordinate [0,0,R] is the one causing the trouble. If I change it to [0.1,0,R] the code runs as I would expect. Perhaps the code can't handle points at the origin?

delooper avatar Oct 04 '20 09:10 delooper

So I found a bug which solves the problem with [0,0,R] it wasn't a origin problem so much as it was a problem with angles of 90, since tan(90) = inf some extra logic was needed. it's fixed in #13. In regards to your query about syntax, basically I need to update the docs because what I have written in the beamChain function and the docs are completely wrong, I must have changed it a long time ago without updating this and honestly, I'm a little confused myself so I need to spend a bit of time and do this properly. but what I can tell you now is don't use mode=1 seems broken. Instead use mode=0 (default) if you want the end angle to be relative to the line, and use mode=2 if you want the end angle to be absolute (from the x axis). Hope that helps.

Irev-Dev avatar Oct 05 '20 09:10 Irev-Dev

hello, I still believe there is an issue with 90 degree angles, for example the following code fails radiiPoints=[[0,0,0],[20,0,3],[20,10,3]]; polygon(polyRound(beamChain(radiiPoints,offset1=0.02, offset2=-0.02),20));

while this works ( radiiPoints=[[0,0,0],[20,1,3],[20,10,3]]; polygon(polyRound(beamChain(radiiPoints,offset1=0.02, offset2=-0.02),20));

viper2642 avatar Feb 06 '21 03:02 viper2642

@viper2642 Ah okay, I'll try and have a look at it soon. I'm a little busy atm.

Irev-Dev avatar Feb 11 '21 20:02 Irev-Dev