Nabble has removed Mailing-list integration.
Posts created here DO NOT GET SENT TO THE MAILING LIST.
Mailing-list emails DO NOT GET POSTED TO THE FORUM.
So basically the Forum is now out of date, we are looking into migrating the history.

For now you should send emails, people will see them, discuss@lists.openscad.org.

Max X and Max Y value in a generated set of points

classic Classic list List threaded Threaded
3 messages Options
ajs
Reply | Threaded
Open this post in threaded view
|

Max X and Max Y value in a generated set of points

ajs
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 at Nabble.com.

_______________________________________________
OpenSCAD mailing list
To unsubscribe send an email to [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: Max X and Max Y value in a generated set of points

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


On Wed, 2 Jun 2021 at 14:10, ajs <[hidden email]> 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 at Nabble.com.
_______________________________________________
OpenSCAD mailing list
To unsubscribe send an email to [hidden email]

_______________________________________________
OpenSCAD mailing list
To unsubscribe send an email to [hidden email]
ajs
Reply | Threaded
Open this post in threaded view
|

Re: Max X and Max Y value in a generated set of points

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

On Wed, Jun 2, 2021 at 9:37 AM nop head <[hidden email]> wrote:
max_y = max([for(p = triangle) p.y]);


On Wed, 2 Jun 2021 at 14:10, ajs <[hidden email]> 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 at Nabble.com.
_______________________________________________
OpenSCAD mailing list
To unsubscribe send an email to [hidden email]
_______________________________________________
OpenSCAD mailing list
To unsubscribe send an email to [hidden email]

_______________________________________________
OpenSCAD mailing list
To unsubscribe send an email to [hidden email]