rothloup
2014-12-03 15:44:56 UTC
I have a few vectors defined in my SCAD file, and I need to assign the min
and max values in each vector a variety of variables. However, my code
always returns "undef" for the variable values if I reference the vector in
the argument list - it only seems to work if I explicitly type in hard-coded
values!
How do I get the max and min values of a vector?
If this only works with hard-coded values, then it seems eminently useless.
What's the point of a function that can't take referenced arguments? I
might as well just hardcode the result. I hope I'm just having trouble with
the syntax.
Thanks!
*Code:*
vector = [1, 2, 3];
var = max(vector);
echo("This doesn't work: ", var);
echo("Neither does this: ", max(vector));
echo("But this does??: ", max(1,2,3));
*Output:*
ECHO: "This doesn't work: ", undef
ECHO: "Neither does this: ", undef
ECHO: "But this does??: ", 3
--
View this message in context: http://forum.openscad.org/max-of-a-variable-tp10298.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
and max values in each vector a variety of variables. However, my code
always returns "undef" for the variable values if I reference the vector in
the argument list - it only seems to work if I explicitly type in hard-coded
values!
How do I get the max and min values of a vector?
If this only works with hard-coded values, then it seems eminently useless.
What's the point of a function that can't take referenced arguments? I
might as well just hardcode the result. I hope I'm just having trouble with
the syntax.
Thanks!
*Code:*
vector = [1, 2, 3];
var = max(vector);
echo("This doesn't work: ", var);
echo("Neither does this: ", max(vector));
echo("But this does??: ", max(1,2,3));
*Output:*
ECHO: "This doesn't work: ", undef
ECHO: "Neither does this: ", undef
ECHO: "But this does??: ", 3
--
View this message in context: http://forum.openscad.org/max-of-a-variable-tp10298.html
Sent from the OpenSCAD mailing list archive at Nabble.com.