Jump to content

vex - Using @primnum in point mode or @P in primitive mode


julian johnson

Recommended Posts

I noticed a couple of clever tricks in recent sample scenes/tutorials both of which involved calling vex functions with either @P or @primnum in the 'wrong' mode e.g.

In Primitive Mode:

addpoint(0,@P);

In Point Mode:

removeprim(0,@primnum,1);

In the first case it looks like the primitive calls the average of all the point positions associated with the primitive whilst in the second case the function successfully identifies the primitive connected to the point and deletes it although, I imagine, only because the primitives have been uniqued.

I couldn't find any documentation on this behaviour or on what would happen if say, in the second case, the primitives were not unique i.e what primitive number would get returned on a point calling @primnum that had multiple polygons attached? Just wondering if it's safe to 'rely' on these methods or if they're likely to change i.e. might it be just as valid for addpoint(0,@P) to return the position of the first point on the primitive rather than the average?

Edited by julian johnson
Link to comment
Share on other sites

For the point mode case you could always just assign @primnum to an attribute so you could observe the result of making them unique in the Geometry Spreadsheet. When I did this it does look like @primnum is reliably set to the current associated point for that primitive.

@view_primnum = @primnum;

 

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...