Connect points, looking (aiming) to each other. VEX.
6335 6 1- yakymoto
- Member
- 8 posts
- Joined: 10月 2017
- Offline
Hello, the mighty community! After an intensive search on the SideFX forum, Odforce forum, and YouTube I didn't find any good results.
1) Here is my simple procedural building, and I need to create horizontal hanging wires over it.
2) I have scattered points on the convex edges with normals pointing outward.
3) Then I need to connect those points without intersection with the building and taking into account their direction: only points, looking (aiming) to each other, should be connected with the line.
4) My idea is to use “dot product” and compare point normals between each other, then connect points, which “dot product” is closer to a certain threshold. My preferable way is to work with the VEX code.
5) Operations with point clouds (“pcopen”, “pgfind”, etc.) are might be helpful. Next tutorials might be helpful too:
Naive Path Finding
https://youtu.be/PXbBhsJyEdk [youtu.be]
Understanding the DOT product!
https://youtu.be/6dJ_e94wI0U [youtu.be]
DIY Scatter Tool Solving Problems in Houdini
https://youtu.be/oeN5KgvWHfs [youtu.be]
Attaching .hip file to this topic.
Looking forward, and thank you for any help!
1) Here is my simple procedural building, and I need to create horizontal hanging wires over it.
2) I have scattered points on the convex edges with normals pointing outward.
3) Then I need to connect those points without intersection with the building and taking into account their direction: only points, looking (aiming) to each other, should be connected with the line.
4) My idea is to use “dot product” and compare point normals between each other, then connect points, which “dot product” is closer to a certain threshold. My preferable way is to work with the VEX code.
5) Operations with point clouds (“pcopen”, “pgfind”, etc.) are might be helpful. Next tutorials might be helpful too:
Naive Path Finding
https://youtu.be/PXbBhsJyEdk [youtu.be]
Understanding the DOT product!
https://youtu.be/6dJ_e94wI0U [youtu.be]
DIY Scatter Tool Solving Problems in Houdini
https://youtu.be/oeN5KgvWHfs [youtu.be]
Attaching .hip file to this topic.
Looking forward, and thank you for any help!
- Konstantin Magnus
- Member
- 682 posts
- Joined: 9月 2013
- Offline
Hi yakymoto,
would simply ray-casting work for your project?
would simply ray-casting work for your project?
Edited by Konstantin Magnus - 2020年10月25日 11:09:00
https://procegen.konstantinmagnus.de/ [procegen.konstantinmagnus.de]
- Aizatulin
- Member
- 495 posts
- Joined: 7月 2005
- Offline
If you loop for every point over all other points, you can also apply several filters. Here are some examples (in VEX):
- Height Filter (to detect, if the y-Component is in a specific range from base point)
- Intersection Filter (to detect, if a direct line has an intersection with the geometry)
- Cone Filter (to detect, if the angle of the direct line to the normal is small enough)
- xz-Filter (to detect, if two points share the same xz-value)
- Min/Max Distance Filter (to detect, if the length of the direct line is small/great enough)
Edited by Aizatulin - 2020年10月25日 12:53:16
- yakymoto
- Member
- 8 posts
- Joined: 10月 2017
- Offline
Hooray, the problem has been solved! Many thanks to repliers.
Konstantin Magnus, appreciate your setup, straight-forward. But it's a little bit too simple for my needs.
Aizatulin, holy moly, that's some serious VEX magic happening. A robust production-ready tool with tons of knobs. Exactly what I need!
Konstantin Magnus, appreciate your setup, straight-forward. But it's a little bit too simple for my needs.
Aizatulin, holy moly, that's some serious VEX magic happening. A robust production-ready tool with tons of knobs. Exactly what I need!
- richard269090576
- Member
- 6 posts
- Joined: 7月 2022
- Offline
AizatulinWhere can we find the other filter like you mentioned? i would love to read the vex code and learn from it!
If you loop for every point over all other points, you can also apply several filters. Here are some examples (in VEX):
- Height Filter (to detect, if the y-Component is in a specific range from base point)
- Intersection Filter (to detect, if a direct line has an intersection with the geometry)
- Cone Filter (to detect, if the angle of the direct line to the normal is small enough)
- xz-Filter (to detect, if two points share the same xz-value)
- Min/Max Distance Filter (to detect, if the length of the direct line is small/great enough)
- Aizatulin
- Member
- 495 posts
- Joined: 7月 2005
- Offline
In VEX you can do everything you want. Just loop over the points and apply any condition. For this you can use existing VEX functions. For example for the cone filter you can use pccone(...) function to get a (sub)set of points, which are in a specific cone. For Distance there are also functions like distance(x,y).
In the example above the loop was over point pairs, it is probably more intuitive to use a single loop.
For example if you have Geometry you want to delete all points, where the y-Coordinate is smaller 0, which means you want to keep all points, where y is greater or equal to zero.
Here is an example for points using a loop in detail wrangle and a point wrangle.
In the example above the loop was over point pairs, it is probably more intuitive to use a single loop.
For example if you have Geometry you want to delete all points, where the y-Coordinate is smaller 0, which means you want to keep all points, where y is greater or equal to zero.
Here is an example for points using a loop in detail wrangle and a point wrangle.
- yakymoto
- Member
- 8 posts
- Joined: 10月 2017
- Offline
Hello, the mighty community! I just want to share my wires implementation in a small building generator I finally finished. More about the project here: https://yakymoto.com/building-gen-v1 [yakymoto.com]
-
- Quick Links