Jump to content
AntoineSfx

One-liner for point(0,"P",8).z in point wrangle

Recommended Posts

vector p8 = point(0,"P",8);

@P.z = p8.z; 

Is there a shorter  way to do it ? 

 

Edited by AntoineSfx

Share this post


Link to post
Share on other sites
1 hour ago, animatrix said:

Hi,

You can do it like this:


@P.z = point(0,"P",8).z;

 

No. It's like point() is seen as a float unless it is assigned explicitly to a vector.

 

Share this post


Link to post
Share on other sites

You indeed need to specify that point will return a vector by encapsulating it with the vector keyword.

@P.z = vector(point(0, "P", 8)).z;

 

Share this post


Link to post
Share on other sites
16 minutes ago, Alain2131 said:

You indeed need to specify that point will return a vector by encapsulating it with the vector keyword.


@P.z = vector(point(0, "P", 8)).z;

 

Thanks. I now realize that point is a template function -  meaning the type which is returned depends on the second argument "P" , thus it's not obvious to the compiler that it's a vector at parse time.

How hard would it be for the user to define a function with this signature once and for all:

vector vpoint (int input; int ptnum) return vector(point(input,"P",ptnum))

or something closer to this related trick:

v@opinput1_P.y  -- but with an additional argument

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×