AntoineSfx Posted June 24, 2021 Share Posted June 24, 2021 (edited) vector p8 = point(0,"P",8); @P.z = p8.z; Is there a shorter way to do it ? Edited June 24, 2021 by AntoineSfx Quote Link to comment Share on other sites More sharing options...
animatrix Posted June 24, 2021 Share Posted June 24, 2021 Hi, You can do it like this: @P.z = point(0,"P",8).z; Quote Link to comment Share on other sites More sharing options...
AntoineSfx Posted June 24, 2021 Author Share Posted June 24, 2021 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. Quote Link to comment Share on other sites More sharing options...
Alain2131 Posted June 24, 2021 Share Posted June 24, 2021 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; Quote Link to comment Share on other sites More sharing options...
AntoineSfx Posted June 24, 2021 Author Share Posted June 24, 2021 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 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.