### discuss@lists.openscad.org

OpenSCAD general discussion

### Max X and Max Y value in a generated set of points A
ajs
Wed, Jun 2, 2021 1:09 PM

Hello:

Occasional user here, not a coder, I'm hoping someone can help me out.

I would like to find the the maximum "x" value and "y" value in a array of
points.  I have been hunting around but haven't been able to find any
applicable examples.

For example if I have a simple vector like:

triangle  = [[0,0], [1,0], [0.5,1]] (my vector isn't this simple, its
function generated with many points)

I would like to be able to determine  max_x_y = [1,1].  Using
"max(triangle)"  [1,0] is returned (so I can extract the max "x" value), is
there a way to get the max "y" value or should I just index through each "y"
and store the max value?

Any insight would be greatly appreciated.

Thank you,

AJS

--
Sent from: http://forum.openscad.org/

Hello: Occasional user here, not a coder, I'm hoping someone can help me out. I would like to find the the maximum "x" value and "y" value in a array of points. I have been hunting around but haven't been able to find any applicable examples. For example if I have a simple vector like: triangle = [[0,0], [1,0], [0.5,1]] (my vector isn't this simple, its function generated with many points) I would like to be able to determine max_x_y = [1,1]. Using "max(triangle)" [1,0] is returned (so I can extract the max "x" value), is there a way to get the max "y" value or should I just index through each "y" and store the max value? Any insight would be greatly appreciated. Thank you, AJS -- Sent from: http://forum.openscad.org/ NH
nop head
Wed, Jun 2, 2021 1:36 PM

max_y = max([for(p = triangle) p.y]);

On Wed, 2 Jun 2021 at 14:10, ajs a.j.scaraggi@gmail.com wrote:

Hello:

Occasional user here, not a coder, I'm hoping someone can help me out.

I would like to find the the maximum "x" value and "y" value in a array of
points.  I have been hunting around but haven't been able to find any
applicable examples.

For example if I have a simple vector like:

triangle  = [[0,0], [1,0], [0.5,1]] (my vector isn't this simple, its
function generated with many points)

I would like to be able to determine  max_x_y = [1,1].  Using
"max(triangle)"  [1,0] is returned (so I can extract the max "x" value), is
there a way to get the max "y" value or should I just index through each
"y" and store the max value?

Any insight would be greatly appreciated.

Thank you,

## AJS

Sent from the OpenSCAD mailing list archive http://forum.openscad.org/
at Nabble.com.

OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

max_y = max([for(p = triangle) p.y]); On Wed, 2 Jun 2021 at 14:10, ajs <a.j.scaraggi@gmail.com> wrote: > Hello: > > Occasional user here, not a coder, I'm hoping someone can help me out. > > I would like to find the the maximum "x" value and "y" value in a array of > points. I have been hunting around but haven't been able to find any > applicable examples. > > For example if I have a simple vector like: > > triangle = [[0,0], [1,0], [0.5,1]] (my vector isn't this simple, its > function generated with many points) > > I would like to be able to determine max_x_y = [1,1]. Using > "max(triangle)" [1,0] is returned (so I can extract the max "x" value), is > there a way to get the max "y" value or should I just index through each > "y" and store the max value? > > Any insight would be greatly appreciated. > > Thank you, > > AJS > ------------------------------ > Sent from the OpenSCAD mailing list archive <http://forum.openscad.org/> > at Nabble.com. > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org > AJ
Anthony J. Scaraggi
Wed, Jun 2, 2021 1:43 PM

Thank you, very grateful for your time and thoroughness.  Stay healthy!!

On Wed, Jun 2, 2021 at 9:37 AM nop head nop.head@gmail.com wrote:

max_y = max([for(p = triangle) p.y]);

On Wed, 2 Jun 2021 at 14:10, ajs a.j.scaraggi@gmail.com wrote:

Hello:

Occasional user here, not a coder, I'm hoping someone can help me out.

I would like to find the the maximum "x" value and "y" value in a array
of points.  I have been hunting around but haven't been able to find any
applicable examples.

For example if I have a simple vector like:

triangle  = [[0,0], [1,0], [0.5,1]] (my vector isn't this simple, its
function generated with many points)

I would like to be able to determine  max_x_y = [1,1].  Using
"max(triangle)"  [1,0] is returned (so I can extract the max "x" value), is
there a way to get the max "y" value or should I just index through each
"y" and store the max value?

Any insight would be greatly appreciated.

Thank you,

## AJS

Sent from the OpenSCAD mailing list archive http://forum.openscad.org/
at Nabble.com.

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

Thank you, very grateful for your time and thoroughness. Stay healthy!! On Wed, Jun 2, 2021 at 9:37 AM nop head <nop.head@gmail.com> wrote: > max_y = max([for(p = triangle) p.y]); > > > On Wed, 2 Jun 2021 at 14:10, ajs <a.j.scaraggi@gmail.com> wrote: > >> Hello: >> >> Occasional user here, not a coder, I'm hoping someone can help me out. >> >> I would like to find the the maximum "x" value and "y" value in a array >> of points. I have been hunting around but haven't been able to find any >> applicable examples. >> >> For example if I have a simple vector like: >> >> triangle = [[0,0], [1,0], [0.5,1]] (my vector isn't this simple, its >> function generated with many points) >> >> I would like to be able to determine max_x_y = [1,1]. Using >> "max(triangle)" [1,0] is returned (so I can extract the max "x" value), is >> there a way to get the max "y" value or should I just index through each >> "y" and store the max value? >> >> Any insight would be greatly appreciated. >> >> Thank you, >> >> AJS >> ------------------------------ >> Sent from the OpenSCAD mailing list archive <http://forum.openscad.org/> >> at Nabble.com. >> _______________________________________________ >> 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 >
Replying to: