Jump to content
Arthur Spooner

Vertices Number

Recommended Posts

I want to return the number of vertices for a cube, I just know there is more code missing  :unsure:

@cr = int nvertices('box1'); 

I get an error that it's expecting a semicolon, I placed a semicolon ? 

Share this post


Link to post
Share on other sites

if the cube is connected to let's say first input it would be 

i@cr = nvertices(0); 

if it's not connected, but lives at the same level then

i@cr = nvertices("op:../box1"); 
Edited by anim

Share this post


Link to post
Share on other sites

 

if the cube is connected to let's say first input it would be 

i@cr = nvertices(0); 

if it's not connected, but lives at the same level then

i@cr = nvertices("op:../box1"); 

 

 

Ahh declare an integer for the variable, couldn't int nverticies, do the same thing ?  :unsure:

Edited by Arthur Spooner

Share this post


Link to post
Share on other sites

Is there a debug window where I can see the results of the nvertices command ? I was expecting to be informed of the number of points on the mesh ?

Share this post


Link to post
Share on other sites

well, regardless of the VEX snippet, to find out the statistics about geometry of any SOP you can jsut middle click and hold on it

 

if you want to actually see the result of the function you can assign it to an attribute and see it in Geometry Spreadsheet (RMB/Spreadsheet...)

i@nvtx = nvertices(0); 

will create integer attribute nvtx which will contain number of vertices of the first geometry and it depends on Wrangle type which attribute it will be (Point, Vertex, Primitive, Detail)

then you either see it in Geometry Spreadsheet or create visualizer in viewport

 

and be aware that  vertices and points are not the same thing, so if you want points use npoints() function

Share this post


Link to post
Share on other sites

This is my VEX code, is this how it should be written in wrangler ?  :unsure:

i@cr = nvertices("op:../box1");
i@nvtx = nvertices(0);

I recall somewhat the Geometry Spreadsheet, how do I create a visualizer in the viewport ?  :)

 

Vertices and points are not one in the same; what is the difference ?

 

In your previous message you wrote the following path, do you have any resources on how I can learn command such as op as you used in Houdini etc ?

i@cr = nvertices("op:../box1"); 

Thanks.

Share this post


Link to post
Share on other sites

I recall somewhat the Geometry Spreadsheet, how do I create a visualizer in the viewport ?  :)

http://www.sidefx.com/docs/houdini15.0/basics/visualizers#menu

In your previous message you wrote the following path, do you have any resources on how I can learn command such as op as you used in Houdini etc ?

http://www.sidefx.com/docs/houdini15.0/io/op_syntax

Share this post


Link to post
Share on other sites

This is all wonderful but my question was overlooked :)

 

For the following code to work;

i@cr = nvertices("op:../box1");
i@nvtx = nvertices(0);

I assume I have to create a visualizer ?

Share this post


Link to post
Share on other sites

No, just look at your geometry spreadsheet. Always have a geometry spreadsheet open. ALWAYS!

 

If you set the wrangle to run in details mode, set the geo spreadsheet to detail. If you set it to point, look at points.

 

Animated gif FTW:

 

post-7292-0-84211500-1459171543_thumb.gi

 

Yes, you can use a visualiser, it lets you take point/vertex/prim data and display it in the viewport as text/colour/vectors, but most of the time the geometry spreadsheet is less visual clutter, and keeps you thinking about the data your shunting around on your geometry.

Edited by mestela

Share this post


Link to post
Share on other sites

Does Vertex have more precedence over points ? I was reading the link mestela posted and that is what I understood, I'm probably wrong ?

 

Vertex are sub-level of points ?

 

Instead of using a file name, one can simply use op:<path> to the node ? Rather then (../../) you use (op:../) ?

 

What kind of visualizer does one apply to a pointWrangler node, marker, color, volume or tag in my situation.  I tried a marker node, and if that is the correct node visualizer, then I didn't do the right settings.

Edited by Arthur Spooner

Share this post


Link to post
Share on other sites

More gifs!

 

post-7292-0-47740000-1459212893_thumb.gi

 

 

Seems to not work for detail attribs though, tried going to pure wireframe, marker mode, up to object level and back, no dice.

 

You can see the value just fine in the geometry spreadsheet though...  ;)

 

 

Share this post


Link to post
Share on other sites

Ohh the visualizer node, these gifs are quite helpful :)

 

I was using the visualizer menu, now I see is just a toggle, make more sense.  

 

mestela - you wouldn't be able to help understand my other questions in my previous post ? :)

Share this post


Link to post
Share on other sites

A cube doesn't contain 24 points, so for each corner of the cube visualizer is displaying 24, that has to do with vertex and points, correct ?

 

ps - I understand your point about the Geo Spreadsheet graph, more options the better :)

Edited by Arthur Spooner

Share this post


Link to post
Share on other sites

I can never remember which way the order of precedence goes, so I usually explicitly set whatever attributes I want at the level I want, and delete others. Eg, if I want point colour, I'll attribpromote from prim to point if that's where my existing colour is, delete prim colour, and continue on.

 

Re point/vert/prim, it makes more sense if you think about how you'd construct shapes from 'nothing'.

 

A point can be standalone, like a single particle in maya.

 

Points can be linked together to form primitives, their linking structure is stored as vertices.

 

Put down a platonic sold in tetrahedron mode, and look at the geometry spreadsheet for points, verts, prims. The points store positions. The vertex id on the far left column represents prim:vert. You can see there's 3 prims (0,1,2), and each prim has 3 verts, and each vert references 1 point.

 

It makes more sense when you start creating your own primitives in wrangles. You take your points, add an empty primitive, then add verticies to the primitive that refernce points. Eg, say I had 3 points floating in space (with @ptnum's of 0, 1, 2), I could run this in a detail wrangle to connect them up into a triangle, by first creating the primitive, then adding verticies:

int myprim = addprim(0, 'poly');

addvertex(0,myprim,0);
addvertex(0,myprim,1);
addvertex(0,myprim,2);
Edited by mestela

Share this post


Link to post
Share on other sites

A cube doesn't contain 24 points, so for each corner of the cube visualizer is displaying 24, that has to do with vertex and points, correct ?

 

ps - I understand your point about the Geo Spreadsheet graph, more options the better :)

 

Each face contains 4 verts. You have 6 faces, so 6*4 = 24.

Share this post


Link to post
Share on other sites
Put down a platonic sold in tetrahedron mode, and look at the geometry spreadsheet for points, verts, prims. The points store positions. The vertex id on the far left column represents prim:vert. You can see there's 3 prims (0,1,2), and each prim has 3 verts, and each vert references 1 point.

 

 

When you said, vertix id on the far left column represents prim:vert, did you mean here ? 

 

 

post-15586-0-12797600-1459219150.png

Edited by Arthur Spooner

Share this post


Link to post
Share on other sites

I assume it's normal that for my platonic, I'm seeing more then just 0,1,2 as in your screen shot; rather this:

 

If so what does the 0:1, 0:2 etc represent ?

post-15586-0-27782900-1459221685.png

Edited by Arthur Spooner

Share this post


Link to post
Share on other sites

prim:vertex

 

to make it a little clearer I've switched to the dodecahedron primitive, and turned on point, vertex, prim numbering in the viewport (d hotkey in viewport, markers tab, enabled, point number, verticies number, prim number), that'll help you decipher whats going on.

 

I've also set the font to large (hit d in the viewport, guides tab, guide font -> large), and by blasting faces in turn, can see the relationship between points, verts, prims.

 

 

verts are local to each prim, so because each prim has 5 verts, the vertex numbers in the viewport only ever go 0-5.

 

post-7292-0-95153400-1459222949_thumb.gi

 

 

 

 

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

×