Hi all!
I've been practicing more and more in the use of this wonderful tool that is VEX, and I was wondering if you could give me some hint in finding the best direction to solve this problem:
as you can see on the hipfile, I was able to extend the first and last point of a curve, creating two points and attaching them to the curve. To obtain the right connection of the vertex, the only solution that I could find was to reverse the order of the point using a Sort and a Reverse SOP, and create the second point with the same code and a Pointwrangle
It works, even if I resample the curve the first and last points are exended in the right way, but I'm looking for a more straightforward solution using only VEX: is there a quick way to sort and reverse using VEX, rather then using the two SOPs? Is the reverse solution the right way to solve this problem (ie when you need to attach two points to the first and last point of a polygonal curve), or you might suggets a simpler solution?
Sort and Reverse using VEX
3583 4 1- arlo
- Member
- 3 posts
- Joined: Aug. 2015
- Offline
- N-G
- Member
- 209 posts
- Joined: March 2018
- Offline
- arlo
- Member
- 3 posts
- Joined: Aug. 2015
- Offline
thank you
really appreciated
a good point for studying and improving my vex coding
So you suggest to simplify the whole process, removing the primitive and creating a new one. I like it
I only have one question: you create two arrays, points and vertex, but at the end you use only one array, using this expression:
addprim(prim_num, geohandle, type, points, vertices)
this is your code:
addprim(primNumber, 0, “polyline”, points, points);
now I tried to change the last line of the code, adding the vertex array:
addprim(primNumber, 0, “polyline”, points, vertex);
but I get exactly the same results. I also checked on the Geometry Spreadsheet. Absolutely the same points, primitives and vertices
But the two arrays are slightly different, at the beginning and at the end
points {127, 24, 108, 30, 34, …, 107, 68, 92, 75, 126}
vertex {127, 0, 24, 108, 30, 34 …, 25, 107, 68, 92, 75}
Is it an expected behaviour?
best
really appreciated
a good point for studying and improving my vex coding
So you suggest to simplify the whole process, removing the primitive and creating a new one. I like it
I only have one question: you create two arrays, points and vertex, but at the end you use only one array, using this expression:
addprim(prim_num, geohandle, type, points, vertices)
this is your code:
addprim(primNumber, 0, “polyline”, points, points);
now I tried to change the last line of the code, adding the vertex array:
addprim(primNumber, 0, “polyline”, points, vertex);
but I get exactly the same results. I also checked on the Geometry Spreadsheet. Absolutely the same points, primitives and vertices
But the two arrays are slightly different, at the beginning and at the end
points {127, 24, 108, 30, 34, …, 107, 68, 92, 75, 126}
vertex {127, 0, 24, 108, 30, 34 …, 25, 107, 68, 92, 75}
Is it an expected behaviour?
best
- N-G
- Member
- 209 posts
- Joined: March 2018
- Offline
- arlo
- Member
- 3 posts
- Joined: Aug. 2015
- Offline
-
- Quick Links