Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

query about beamChain. #11

Open
delooper opened this issue Oct 4, 2020 · 3 comments
Open

query about beamChain. #11

delooper opened this issue Oct 4, 2020 · 3 comments

Comments

@delooper
Copy link

delooper commented Oct 4, 2020

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?

@Irev-Dev
Copy link
Owner

Irev-Dev commented Oct 5, 2020

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.

@viper2642
Copy link

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));

@Irev-Dev
Copy link
Owner

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants