On 1/16/2022 8:07 AM, Joe Weinpert wrote:
Was not sure what "closed" meant.
In the world of polygons, "closed" means that the path comes back to
finish at its start. When you're representing a closed polygon as a
list, the fact that there's a beginning and an end is kind of an
unfortunate implementation artifact, because logically the "first" point
immediately follows the "last". A closed polygon is a loop with no true
beginning and end.
If I understand, it now means to remove any and all end rows in the
array that match the very first row.
Assuming that we're talking about a deduplicator... yes, in addition to
removing all other points that duplicate the immediately previous point.
https://github.com/revarbat/BOSL2/wiki/comparisons.scad#function-deduplicate
has some examples.
For completeness, though it's not directly relevant in this discussion,
in a 3D mesh "closed" means that there are faces completely covering the
object, that the "inside" is entirely on the inside. If you're trying
to build a cube, it is not "closed" until you have supplied all six faces.
The term "closed" here is a BOSL2 term, not a general OpenSCAD or
modeling term, I think. It is meant to indicate that the sequence of
points has no end, that the first and last point are adjacent. We are
thinking that we may change "closed=true" to "wrap=true" in some
cases. (And in other cases to "polygon=true", to distinguish a path
with two endpoints from one that describes a polygon.) Does this seem
more clear to you?
On Sun, Jan 16, 2022 at 11:08 AM Joe Weinpert joe.weinpert@gmail.com wrote:
Well, to me I am looking at a list as an array. Was not sure what "closed" meant. I am guessing now that it is something in the world of mesh. My ignorance of the OpenSCAD terminology will stay with me for a long time. I was expecting something like javaScript (not sure why). If I understand, it now means to remove any and all end rows in the array that match the very first row.
Joe Weinpert
(440) 796-7165
joe.weinpert@gmail.com
On Sat, Jan 15, 2022 at 7:11 PM Adrian Mariano avm4@cornell.edu wrote:
Can you elaborate on what you are referring to (something in the BOSL2
docs?) that made you think that "equality" referred only the x
coordinate? How could the docs be clarified to improve this?On Sat, Jan 15, 2022 at 6:46 PM Joe Weinpert joe.weinpert@gmail.com wrote:
I will try that, too. However, The description of the "Closed" clause I read as being only based on the value of each value within the sub arrays being checked ... i.e. check only the X value and if it matches delete the row without needing to check the Y value.
On Sat, Jan 15, 2022, 6:27 PM Adrian Mariano avm4@cornell.edu wrote:
It occurs to me that if you're running deduplicate already when
creating your point list that you should just add closed=true to
deduplicate, and it will remove repeated points between the start and
end as well. The BOSL2 deduplicate implementation considers points
equal if they are closer than eps, which defaults to 1e-9. I don't
think doing exact compares for floats is the best plan, though I guess
it might work. (You could end up with some very tiny triangles in
your model.)On Sat, Jan 15, 2022 at 5:40 PM Joe Weinpert joe.weinpert@gmail.com wrote:
I am finding answers here, so it is appreciated. Will look deeper into the BOSL library as I go. Knowing what to look for is tough.
On Sat, Jan 15, 2022, 5:22 PM Adrian Mariano avm4@cornell.edu wrote:
Variables can only be set once. If you think you're setting one a
second time it's actually in a nested scope and it will vanish once
you leave the scope. With let() statements you can cascade scopes in
a way that looks like you are redefining the variables, but each let
opens a new scope.Looks like nophead has explained a way around this using the ?
operator. You might also want to use BOSL2's cleanup_path() function,
assuming your data is numeric.On Sat, Jan 15, 2022 at 5:09 PM Joe Weinpert joe.weinpert@gmail.com wrote:
What am I missing here?
I need to set a new array of points with the last index removed from the original array or the whole original array depending on if the last one in the original array equals the first one in the original array.
Essentially:
x = len( objPoints )-1;
if( str( objPoints[x] ) == str( objPoints[0] ) ){
newPoints = list_remove( objPoints, x );
}else{
newPoints = objPoints;
}
echo( newPoints );So why isn't the newPoints variable recognized outside the IF statement?
OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org
OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org
OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org
OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org
OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org
OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org
OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org