csp Posted October 7, 2020 Share Posted October 7, 2020 Hello, lets say I have a prim with 3 points and I want to add an new point on that prim, by splitting one of the 3 edges. I assume that the prim will have to be deleted and drawn again but what I am wondering how to get the correct order with the new point so the prim will close properly. Quote Link to comment Share on other sites More sharing options...
DonRomano Posted October 7, 2020 Share Posted October 7, 2020 I assume that a triangle has always the same order, so if you add a point between point 0 and 1, just offset the point number after point 1. Let's say you have a triangle, this should work : int pts = primpoints(0, @primnum); removeprim(0, @primnum, 0); vector pos1 = point(0, "P", pts[0]); vector pos2 = point(0, "P", pts[1]); vector new_pos = avg(pos1, pos2); int new_pt = addpoint(geoself(), new_pos); addprim(geoself(), "poly", pts[0], new_pt, pts[1], pts[2]); Cheers, 2 Quote Link to comment Share on other sites More sharing options...
Librarian Posted October 7, 2020 Share Posted October 7, 2020 (edited) vertex point or ..I just having Fun and learning POint.hiplc Edited October 7, 2020 by Librarian Quote Link to comment Share on other sites More sharing options...
csp Posted October 7, 2020 Author Share Posted October 7, 2020 Hey Romain, I would not assume the point order is always the same, I need something more precrural. I think makes sense to explain the bigger picture here. I have a model with some UVs and I want to remesh it for vellum but the UVs will be destroyed on the seams if I will do it once for the entire geometry. There are technics to improve a lot the UVs but the seams will never be perfect if I don't have the same edges on these areas. So I thought to remesh per UV connectivity in a for loop and transfer there the UVs, which gives me perfect seams of course but I need to fuse all the pieces after the loop and I don't get the same resolution on the seams unfortunately. It is close enough but not exactly. So I have some vex lines to detect if a point at the seams of a pieces does not have a point on the same location in the near by piece and add that point. This thread is regarding my next step to make this new point part of the target prim. Maybe is an overkill and maybe will not be enough but thanks for the hip Tesan. Quote Link to comment Share on other sites More sharing options...
Librarian Posted October 7, 2020 Share Posted October 7, 2020 @csp You're welcome Quote Link to comment Share on other sites More sharing options...
Aizatulin Posted October 7, 2020 Share Posted October 7, 2020 Hi, here is another version: With VEX you can insert your point into the point array of a primitive and rebuild the primitive with the new point. choose a primitive, a point and an index get the point array of the primitive and insert the new point to the position given by the index rebuild the primitive with the new pointarray and remove the old primitive insert_point.hipnc 2 Quote Link to comment Share on other sites More sharing options...
satoru Posted October 7, 2020 Share Posted October 7, 2020 (edited) You can add vertices to any edge by converting a polygon to a polyline and then sorting it using Intrinsic UV. addvertex.hiplc Edited October 7, 2020 by satoru 2 Quote Link to comment Share on other sites More sharing options...
csp Posted October 8, 2020 Author Share Posted October 8, 2020 @satoru your solution is very close the desired result but with more complicated geometry the sorting method based on u is not working unfortunately, you can see that in your example by increasing the count at the scatter. Quote Link to comment Share on other sites More sharing options...
satoru Posted October 8, 2020 Share Posted October 8, 2020 (edited) On 2020/10/8 at 8:22 PM, csp said: @satoru your solution is very close the desired result but with more complicated geometry the sorting method based on u is not working unfortunately, you can see that in your example by increasing the count at the scatter. @csp Indeed. I've made it even more robust. But this may not be perfect yet. addvertex_v2.hiplc Edited October 10, 2020 by satoru Fix hip file. 1 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.