JW
Joe Weinpert
Thu, May 5, 2022 6:49 PM
Is there a function that returns the minimum or maximum value within an
array of points?
Say there is an array of 200 points [[X,Y,Z],[X,Y,Z], ...] to make a path.
How could I get the minimum value of X or Y or Z from the array? How about
the maximum value?
Is there a function that returns the minimum or maximum value within an
array of points?
Say there is an array of 200 points [[X,Y,Z],[X,Y,Z], ...] to make a path.
How could I get the minimum value of X or Y or Z from the array? How about
the maximum value?
RP
Ronaldo Persiano
Thu, May 5, 2022 7:00 PM
There is no native function for that. The native min() and max() functions
operate only on list of numbers. You should extract the appropriate
component of the points before calling any of them using list comprehension.
Em qui., 5 de mai. de 2022 15:50, Joe Weinpert joe.weinpert@gmail.com
escreveu:
Is there a function that returns the minimum or maximum value within an
array of points?
Say there is an array of 200 points [[X,Y,Z],[X,Y,Z], ...] to make a
path. How could I get the minimum value of X or Y or Z from the array?
How about the maximum value?
OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org
There is no native function for that. The native min() and max() functions
operate only on list of numbers. You should extract the appropriate
component of the points before calling any of them using list comprehension.
Em qui., 5 de mai. de 2022 15:50, Joe Weinpert <joe.weinpert@gmail.com>
escreveu:
> Is there a function that returns the minimum or maximum value within an
> array of points?
>
> Say there is an array of 200 points [[X,Y,Z],[X,Y,Z], ...] to make a
> path. How could I get the minimum value of X or Y or Z from the array?
> How about the maximum value?
>
>
>
>
>
> _______________________________________________
> OpenSCAD mailing list
> To unsubscribe send an email to discuss-leave@lists.openscad.org
>
JG
Jonathan Gilbert
Thu, May 5, 2022 7:02 PM
I suppose you could do something akin to:
max( [for (p=path) p.x] );
or
min( [for (p=path) p.y] );
...adjusted, as needed (above completely untested).
On Thu, May 5, 2022 at 11:49 AM Joe Weinpert joe.weinpert@gmail.com wrote:
Is there a function that returns the minimum or maximum value within an
array of points?
Say there is an array of 200 points [[X,Y,Z],[X,Y,Z], ...] to make a
path. How could I get the minimum value of X or Y or Z from the array?
How about the maximum value?
OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org
I suppose you could do something akin to:
max( [for (p=path) p.x] );
or
min( [for (p=path) p.y] );
...adjusted, as needed (above completely untested).
On Thu, May 5, 2022 at 11:49 AM Joe Weinpert <joe.weinpert@gmail.com> wrote:
> Is there a function that returns the minimum or maximum value within an
> array of points?
>
> Say there is an array of 200 points [[X,Y,Z],[X,Y,Z], ...] to make a
> path. How could I get the minimum value of X or Y or Z from the array?
> How about the maximum value?
>
>
>
>
>
> _______________________________________________
> OpenSCAD mailing list
> To unsubscribe send an email to discuss-leave@lists.openscad.org
>
--
- Jon Gilbert
jong@jong.org / jgilbertsjc@gmail.com
AM
Adrian Mariano
Thu, May 5, 2022 7:51 PM
The BOSL2 function pointlist_bounds will do it.
On Thu, May 5, 2022 at 2:50 PM Joe Weinpert joe.weinpert@gmail.com wrote:
Is there a function that returns the minimum or maximum value within an array of points?
Say there is an array of 200 points [[X,Y,Z],[X,Y,Z], ...] to make a path. How could I get the minimum value of X or Y or Z from the array? How about the maximum value?
OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org
The BOSL2 function pointlist_bounds will do it.
On Thu, May 5, 2022 at 2:50 PM Joe Weinpert <joe.weinpert@gmail.com> wrote:
>
> Is there a function that returns the minimum or maximum value within an array of points?
>
> Say there is an array of 200 points [[X,Y,Z],[X,Y,Z], ...] to make a path. How could I get the minimum value of X or Y or Z from the array? How about the maximum value?
>
>
>
>
>
> _______________________________________________
> OpenSCAD mailing list
> To unsubscribe send an email to discuss-leave@lists.openscad.org
JW
Joe Weinpert
Thu, May 5, 2022 8:05 PM
Thanks. What you suggested worked perfectly.
minX = min([ for( i = shapeOuter ) i.x ]);
minY = min([ for( i = shapeOuter ) i.y ]);
echo( minX = minX );
echo( minY = minY );
On Thu, May 5, 2022 at 3:03 PM Jonathan Gilbert jong@jong.org wrote:
I suppose you could do something akin to:
max( [for (p=path) p.x] );
or
min( [for (p=path) p.y] );
...adjusted, as needed (above completely untested).
On Thu, May 5, 2022 at 11:49 AM Joe Weinpert joe.weinpert@gmail.com
wrote:
Is there a function that returns the minimum or maximum value within an
array of points?
Say there is an array of 200 points [[X,Y,Z],[X,Y,Z], ...] to make a
path. How could I get the minimum value of X or Y or Z from the array?
How about the maximum value?
OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org
Thanks. What you suggested worked perfectly.
minX = min([ for( i = shapeOuter ) i.x ]);
minY = min([ for( i = shapeOuter ) i.y ]);
echo( minX = minX );
echo( minY = minY );
On Thu, May 5, 2022 at 3:03 PM Jonathan Gilbert <jong@jong.org> wrote:
> I suppose you could do something akin to:
>
> max( [for (p=path) p.x] );
>
> or
>
> min( [for (p=path) p.y] );
>
> ...adjusted, as needed (above completely untested).
>
> On Thu, May 5, 2022 at 11:49 AM Joe Weinpert <joe.weinpert@gmail.com>
> wrote:
>
>> Is there a function that returns the minimum or maximum value within an
>> array of points?
>>
>> Say there is an array of 200 points [[X,Y,Z],[X,Y,Z], ...] to make a
>> path. How could I get the minimum value of X or Y or Z from the array?
>> How about the maximum value?
>>
>>
>>
>>
>>
>> _______________________________________________
>> OpenSCAD mailing list
>> To unsubscribe send an email to discuss-leave@lists.openscad.org
>>
>
>
> --
> - Jon Gilbert
> jong@jong.org / jgilbertsjc@gmail.com
> _______________________________________________
> OpenSCAD mailing list
> To unsubscribe send an email to discuss-leave@lists.openscad.org
>
BR
Bob Roos
Thu, May 5, 2022 8:08 PM
Hi Adrian,
yep. In vectors.scad
// Function: pointlist_bounds()
// Usage:
// pt_pair = pointlist_bounds(pts);
// Topics: Geometry, Bounding Boxes, Bounds
// Description:
// Finds the bounds containing all the points in pts
which can be a list of points in any dimension.
// Returns a list of two items: a list of the minimums and a list of the maximums. For example, with
// 3d points [[MINX, MINY, MINZ], [MAXX, MAXY, MAXZ]]
// Arguments:
// pts = List of points.
Thursday, May 5, 2022, 3:51:55 PM, you wrote:
The BOSL2 function pointlist_bounds will do it.
Is there a function that returns the minimum or maximum value within an array of points?
Say there is an array of 200 points [[X,Y,Z],[X,Y,Z], ...] to make a path. How could I get the minimum value of X or Y or Z from the array? How about the maximum value?
OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org
Hi Adrian,
yep. In vectors.scad
// Function: pointlist_bounds()
// Usage:
// pt_pair = pointlist_bounds(pts);
// Topics: Geometry, Bounding Boxes, Bounds
// Description:
// Finds the bounds containing all the points in `pts` which can be a list of points in any dimension.
// Returns a list of two items: a list of the minimums and a list of the maximums. For example, with
// 3d points `[[MINX, MINY, MINZ], [MAXX, MAXY, MAXZ]]`
// Arguments:
// pts = List of points.
Thursday, May 5, 2022, 3:51:55 PM, you wrote:
> The BOSL2 function pointlist_bounds will do it.
> On Thu, May 5, 2022 at 2:50 PM Joe Weinpert <joe.weinpert@gmail.com> wrote:
>>
>> Is there a function that returns the minimum or maximum value within an array of points?
>>
>> Say there is an array of 200 points [[X,Y,Z],[X,Y,Z], ...] to make a path. How could I get the minimum value of X or Y or Z from the array? How about the maximum value?
>>
>>
>>
>>
>>
>> _______________________________________________
>> 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
--
have Fun,
Bob mailto:roosbob@wybatap.com
JW
Joe Weinpert
Thu, May 5, 2022 8:15 PM
Like the other suggestion from Jon Gilbert, this works perfectly, too.
Thanks. I spent some time earlier trying to find a function within BOSL2,
but there was so much to look through I posted the question and got two
great answers.
bounds = pointlist_bounds( shapeOuter );
echo( bounds = bounds );
ECHO: bounds = [[40.221, 6.25542], [106.812, 65.8355]]
On Thu, May 5, 2022 at 3:52 PM Adrian Mariano avm4@cornell.edu wrote:
The BOSL2 function pointlist_bounds will do it.
On Thu, May 5, 2022 at 2:50 PM Joe Weinpert joe.weinpert@gmail.com
wrote:
Is there a function that returns the minimum or maximum value within an
Say there is an array of 200 points [[X,Y,Z],[X,Y,Z], ...] to make a
path. How could I get the minimum value of X or Y or Z from the array?
How about the maximum value?
Like the other suggestion from Jon Gilbert, this works perfectly, too.
Thanks. I spent some time earlier trying to find a function within BOSL2,
but there was so much to look through I posted the question and got two
great answers.
bounds = pointlist_bounds( shapeOuter );
echo( bounds = bounds );
ECHO: bounds = [[40.221, 6.25542], [106.812, 65.8355]]
On Thu, May 5, 2022 at 3:52 PM Adrian Mariano <avm4@cornell.edu> wrote:
> The BOSL2 function pointlist_bounds will do it.
>
> On Thu, May 5, 2022 at 2:50 PM Joe Weinpert <joe.weinpert@gmail.com>
> wrote:
> >
> > Is there a function that returns the minimum or maximum value within an
> array of points?
> >
> > Say there is an array of 200 points [[X,Y,Z],[X,Y,Z], ...] to make a
> path. How could I get the minimum value of X or Y or Z from the array?
> How about the maximum value?
> >
> >
> >
> >
> >
> > _______________________________________________
> > 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
>
AM
Adrian Mariano
Thu, May 5, 2022 8:33 PM
If you have suggestions for how the BOSL2 docs can be improved so you
can find stuff you can also make a github issue for that. :) There
are some search features to search the docs. Some of the complex
functions have had doc clarifications driven by user feedback.
On Thu, May 5, 2022 at 4:15 PM Joe Weinpert joe.weinpert@gmail.com wrote:
Like the other suggestion from Jon Gilbert, this works perfectly, too. Thanks. I spent some time earlier trying to find a function within BOSL2, but there was so much to look through I posted the question and got two great answers.
bounds = pointlist_bounds( shapeOuter );
echo( bounds = bounds );
ECHO: bounds = [[40.221, 6.25542], [106.812, 65.8355]]
On Thu, May 5, 2022 at 3:52 PM Adrian Mariano avm4@cornell.edu wrote:
The BOSL2 function pointlist_bounds will do it.
On Thu, May 5, 2022 at 2:50 PM Joe Weinpert joe.weinpert@gmail.com wrote:
Is there a function that returns the minimum or maximum value within an array of points?
Say there is an array of 200 points [[X,Y,Z],[X,Y,Z], ...] to make a path. How could I get the minimum value of X or Y or Z from the array? How about the maximum value?
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
If you have suggestions for how the BOSL2 docs can be improved so you
can find stuff you can also make a github issue for that. :) There
are some search features to search the docs. Some of the complex
functions have had doc clarifications driven by user feedback.
On Thu, May 5, 2022 at 4:15 PM Joe Weinpert <joe.weinpert@gmail.com> wrote:
>
> Like the other suggestion from Jon Gilbert, this works perfectly, too. Thanks. I spent some time earlier trying to find a function within BOSL2, but there was so much to look through I posted the question and got two great answers.
>
> bounds = pointlist_bounds( shapeOuter );
> echo( bounds = bounds );
>
>
> ECHO: bounds = [[40.221, 6.25542], [106.812, 65.8355]]
>
>
>
>
>
>
>
> On Thu, May 5, 2022 at 3:52 PM Adrian Mariano <avm4@cornell.edu> wrote:
>>
>> The BOSL2 function pointlist_bounds will do it.
>>
>> On Thu, May 5, 2022 at 2:50 PM Joe Weinpert <joe.weinpert@gmail.com> wrote:
>> >
>> > Is there a function that returns the minimum or maximum value within an array of points?
>> >
>> > Say there is an array of 200 points [[X,Y,Z],[X,Y,Z], ...] to make a path. How could I get the minimum value of X or Y or Z from the array? How about the maximum value?
>> >
>> >
>> >
>> >
>> >
>> > _______________________________________________
>> > 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
JW
Joe Weinpert
Thu, May 5, 2022 8:58 PM
Reading the docs (and I do that a lot) tells me I am not geeky enough to
know the true purpose of this function or that function. I can understand
a lot, but not understand just as much. I do know that there are a yuuuge
number of functions making this a yuuuuuge library. In fact, when I
started using OpenSCAD a couple of months ago to help with things I could
not do with TinkerCAD, I almost it tossed it out ... until tripping across
BOSL which made OpenSCAD much easier and clearer to use.
On Thu, May 5, 2022 at 4:34 PM Adrian Mariano avm4@cornell.edu wrote:
If you have suggestions for how the BOSL2 docs can be improved so you
can find stuff you can also make a github issue for that. :) There
are some search features to search the docs. Some of the complex
functions have had doc clarifications driven by user feedback.
On Thu, May 5, 2022 at 4:15 PM Joe Weinpert joe.weinpert@gmail.com
wrote:
Like the other suggestion from Jon Gilbert, this works perfectly, too.
Thanks. I spent some time earlier trying to find a function within BOSL2,
but there was so much to look through I posted the question and got two
great answers.
bounds = pointlist_bounds( shapeOuter );
echo( bounds = bounds );
ECHO: bounds = [[40.221, 6.25542], [106.812, 65.8355]]
On Thu, May 5, 2022 at 3:52 PM Adrian Mariano avm4@cornell.edu wrote:
The BOSL2 function pointlist_bounds will do it.
On Thu, May 5, 2022 at 2:50 PM Joe Weinpert joe.weinpert@gmail.com
Is there a function that returns the minimum or maximum value within
Say there is an array of 200 points [[X,Y,Z],[X,Y,Z], ...] to make a
path. How could I get the minimum value of X or Y or Z from the array?
How about the maximum value?
Reading the docs (and I do that a lot) tells me I am not geeky enough to
know the true purpose of this function or that function. I can understand
a lot, but not understand just as much. I do know that there are a yuuuge
number of functions making this a yuuuuuge library. In fact, when I
started using OpenSCAD a couple of months ago to help with things I could
not do with TinkerCAD, I almost it tossed it out ... until tripping across
BOSL which made OpenSCAD much easier and clearer to use.
On Thu, May 5, 2022 at 4:34 PM Adrian Mariano <avm4@cornell.edu> wrote:
> If you have suggestions for how the BOSL2 docs can be improved so you
> can find stuff you can also make a github issue for that. :) There
> are some search features to search the docs. Some of the complex
> functions have had doc clarifications driven by user feedback.
>
> On Thu, May 5, 2022 at 4:15 PM Joe Weinpert <joe.weinpert@gmail.com>
> wrote:
> >
> > Like the other suggestion from Jon Gilbert, this works perfectly, too.
> Thanks. I spent some time earlier trying to find a function within BOSL2,
> but there was so much to look through I posted the question and got two
> great answers.
> >
> > bounds = pointlist_bounds( shapeOuter );
> > echo( bounds = bounds );
> >
> >
> > ECHO: bounds = [[40.221, 6.25542], [106.812, 65.8355]]
> >
> >
> >
> >
> >
> >
> >
> > On Thu, May 5, 2022 at 3:52 PM Adrian Mariano <avm4@cornell.edu> wrote:
> >>
> >> The BOSL2 function pointlist_bounds will do it.
> >>
> >> On Thu, May 5, 2022 at 2:50 PM Joe Weinpert <joe.weinpert@gmail.com>
> wrote:
> >> >
> >> > Is there a function that returns the minimum or maximum value within
> an array of points?
> >> >
> >> > Say there is an array of 200 points [[X,Y,Z],[X,Y,Z], ...] to make a
> path. How could I get the minimum value of X or Y or Z from the array?
> How about the maximum value?
> >> >
> >> >
> >> >
> >> >
> >> >
> >> > _______________________________________________
> >> > 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
>
SP
Sanjeev Prabhakar
Fri, May 6, 2022 12:51 AM
x_min=min(points*[1,0,0])
y_min=min(points*[0,1,0])
z_min=min(points*[0,0,1])
and similarly max should be faster I suppose
On Fri, 6 May 2022, 00:20 Joe Weinpert, joe.weinpert@gmail.com wrote:
Is there a function that returns the minimum or maximum value within an
array of points?
Say there is an array of 200 points [[X,Y,Z],[X,Y,Z], ...] to make a
path. How could I get the minimum value of X or Y or Z from the array?
How about the maximum value?
OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org
x_min=min(points*[1,0,0])
y_min=min(points*[0,1,0])
z_min=min(points*[0,0,1])
and similarly max should be faster I suppose
On Fri, 6 May 2022, 00:20 Joe Weinpert, <joe.weinpert@gmail.com> wrote:
> Is there a function that returns the minimum or maximum value within an
> array of points?
>
> Say there is an array of 200 points [[X,Y,Z],[X,Y,Z], ...] to make a
> path. How could I get the minimum value of X or Y or Z from the array?
> How about the maximum value?
>
>
>
>
>
> _______________________________________________
> OpenSCAD mailing list
> To unsubscribe send an email to discuss-leave@lists.openscad.org
>