Closed Curves - What am I missing

   5679   6   0
User Avatar
Member
5 posts
Joined: March 2019
Offline
Hi everybody,

I attach a scene to explain at best what happens.
I made a very simple wrangle in order to save an attribute in a curve to say if it is open or closed using the vex expression: primintrinsic(geoself(), “closed”, @primnum);

I was quite happy with it but then I started to encounter problems especially after the use of Ends node to “Unroll U” in order to remove curves surfaces.

I prapared this simple scene where you have 6 different curves. A circle, an open curve, the same curve with the close option activated, the same closed surface after the Ends node, and finally two different version of the unrolled one, on one I tried to apply a Join Node, on the other one a Fuse node.

The shapes are red if the “closed” attribute is computed as 0 and green if it is computed as 1.

My questions:
- Why unrolling the U a closed curves becomes open (At least listening to my vex formula)?
- If I use the Join node and I activate “Wrap Last and First” the unrolled curve becomes closed but the surface is back, if I don't use the “Wrap Last and First” option the curve appears closed but results open after the vex check. Any ide awhat's happening?
- The Fuse Node behavior is also strange. If I deactivate it the last and first points of the curve are separated and on top of each other, if I activate it the last and first points get correctly welded into one unique number BUT the curve still results open (last one in red). Why is that? the curve is numerically close but still open.

My main concern is: am I confusing between vertices and points, primitives and curves and all this mess is because of this?
Any enlightenment or input of any kind is highly appreciated, I've lost so many hours already in trying to understand and debug this issue.

I guess my mistake is to check the Closed Primitive Intrinsic which is not related to the curve being closed or not. If so how should I do to know if a curve is closed or not?

Thanks

Image Not Found
Edited by mescalina - April 24, 2019 15:02:38

Attachments:
test_close_curves.hipnc (83.4 KB)

User Avatar
Member
7801 posts
Joined: Sept. 2011
Offline
There is no such thing as a closed curve. A polygon that is closed is a surface. An open polygon is a curve. It is immaterial that the first and last vertex share a point (such as when fusing). The curve is still open because the vertex doesn't wrap back to the first, resulting in a surface. Unrolling a polygon toggles the state from closed to open. The behaviors you describe are all expected.
User Avatar
Member
1755 posts
Joined: March 2014
Offline
jsmack
There is no such thing as a closed curve.
What?!
User Avatar
Member
7801 posts
Joined: Sept. 2011
Offline
McNistor
What?!
In Houdini. “Closed” is a property of a polygon that makes it no longer a curve. Having the ends ‘touch’ doesn't make it closed, with respect to the intrinsic property of open vs closed.
User Avatar
Member
5 posts
Joined: March 2019
Offline
jsmack
There is no such thing as a closed curve. A polygon that is closed is a surface. An open polygon is a curve. It is immaterial that the first and last vertex share a point (such as when fusing). The curve is still open because the vertex doesn't wrap back to the first, resulting in a surface. Unrolling a polygon toggles the state from closed to open. The behaviors you describe are all expected.

Thanks, yes I start to understand that the concept of curve in hudini is actually much more fluid than in other softwares.
I made various tests using all different kinds of curves and I cannot say I've totally understood the subject but I surely understand it better.

In my example the last curve is a closed poly curve unrolled and the I used the Fuse node on it. Before the Fuse it has 9 vertices with 0 and 8 on the very same position. After the fuse the vertices are 8 with n. 0 being shared also as a last point. But no surface is back.
What would you call it? It's a closed polygonal curve without surface that doesn't pass the closed test because of the unrolled U.
You wrote: “The curve is still open because the vertex doesn't wrap back to the first, resulting in a surface.”
Could you please explain this better to me, I cannot grasp it. What you mean with Wrap back to the first?

Anyway now I'm rewriting my asset using a curve kind detection at the beginning and acting differently depending on the input.

Thank you again for your time,
Bless.
Edited by mescalina - April 25, 2019 04:27:31
User Avatar
Member
7801 posts
Joined: Sept. 2011
Offline
Topology is determined by vertices, their order, and whether they are marked as ‘open’ or ‘closed’. Points are just data that says where the vertices are in space, but does not affect their topology. You can think of vertex topology as an abstract concept that has no spatial definition.

closed polygon:
vertex 5 ‘wraps’ to vertex 0. Polygons like this render with a surface.

0-1-2
|   |
5-4-3

open polygon:
vertex 5 is the end of the curve. Open polygons render as curves.
0-1-2
    |
5-4-3

Now, since points are just locations that vertices can use to represent their position, vertex 0 and 5 can both use the same point, and exist in the same position, however topologically, they are not connected. You can even use a single point for all the vertices. The curve will have no size, but will still have all 5 vertices and the same topology as if it had 5 unique points.

If you want to detect if an open polygon has it's first and last vertices sharing the same point, you can do so with some vex code in an attribute wrangle set to run over primitives. To include curves where the end vertices share the same position, but reference unique points, you can add a distance check instead of point number equivalence.

int pt0, ptN, vt0, vtN;
vt0 = vertexindex(0, @primnum, 0);
vtN = vertexindex(0, @primnum, primvertexcount(0, @primnum)-1);
pt0 = vertexpoint(0, vt0);
ptN = vertexpoint(0, vtN);
@group_closed = pt0==ptN;
Edited by jsmack - April 25, 2019 17:42:06
User Avatar
Member
5 posts
Joined: March 2019
Offline
jsmack
Topology is determined by vertices, their order, and whether they are marked as ‘open’ or ‘closed’. Points are just data that says where the vertices are in space, but does not affect their topology. You can think of vertex topology as an abstract concept that has no spatial definition.

closed polygon:
vertex 5 ‘wraps’ to vertex 0. Polygons like this render with a surface.

0-1-2
|   |
5-4-3

open polygon:
vertex 5 is the end of the curve. Open polygons render as curves.
0-1-2
    |
5-4-3

Now, since points are just locations that vertices can use to represent their position, vertex 0 and 5 can both use the same point, and exist in the same position, however topologically, they are not connected. You can even use a single point for all the vertices. The curve will have no size, but will still have all 5 vertices and the same topology as if it had 5 unique points.

If you want to detect if an open polygon has it's first and last vertices sharing the same point, you can do so with some vex code in an attribute wrangle set to run over primitives. To include curves where the end vertices share the same position, but reference unique points, you can add a distance check instead of point number equivalence.

int pt0, ptN, vt0, vtN;
vt0 = vertexindex(0, @primnum, 0);
vtN = vertexindex(0, @primnum, primvertexcount(0, @primnum)-1);
pt0 = vertexpoint(0, vt0);
ptN = vertexpoint(0, vtN);
@group_closed = pt0==ptN;

Thanks a lot for taking the time of putting down this explanation, it's incredibly clear and enlightening. What a wonderful community you have
Thanks again!
  • Quick Links