Move selected face primitives along normal in a loop?

   679   4   0
User Avatar
Member
16 posts
Joined: Feb. 2019
Offline
Hi,

Am struggling trying to come up with a good practical solution to a problem that needs to be solved to meet a deadline.

I am selecting a number of face primitives in a group range node and then want to select each face primitive in a FOR-EACH loop and move it randomly along its normal (positively and negatively).

Currently, this is to select the start and end faces in a group of cylinders representing roof timbers to add some variation in an archaeological reconstruction of an Iron Age Roundhouse for an educational project.

I will use the same technique for other building elements.





Any help really appreciated!

Thanks,

Shaun
Edited by LittleYellowSpider - July 7, 2024 15:04:01

Attachments:
RoundhouseRoof.png (719.5 KB)
RoundHouse.png (716.6 KB)

User Avatar
Member
34 posts
Joined: July 2022
Offline
I'm sorry I didn't understand your meaning, but I guess you need this

I don't understand why the house needs to move every prim

You can use Peak SOP and VEX

```vex
int it = detail(1,'iteration',0);
int seed = 5;
f@dist = fit01(rand(it + seed),-1,1);
```

```
detail(0,'dist',0)
```
Edited by juejuezi - July 7, 2024 15:11:41

Attachments:
PixPin_2024-07-08_03-07-44.png (474.3 KB)

User Avatar
Member
16 posts
Joined: Feb. 2019
Offline
Thanks juejuezi.

I might not have explained it very well. I basically want to the select each end of the cylinder and then move those faces randomly along their normals both positively and negatively to effectively lengthen or shorten the cylinder keeping it in place. This is to provide some variation that would have been found in the real buildings.

This might help. I think you have given me a steer in the right direction that I can work on, which is very much appreciated.



Kind regards,

Shaun

Attachments:
Roof Pole.png (770.0 KB)

User Avatar
Member
34 posts
Joined: July 2022
Offline
Thank you, I understand now


In addition, if the cylinder is generated by a line through sweep, I suggest peaking the line first, rather than peaking the prim of the cylinder

Because peaking the lines is more convenient for calculation and can provide more information for future use

Attachments:
PixPin_2024-07-08_03-41-55.png (21.1 KB)

User Avatar
Member
269 posts
Joined: Aug. 2018
Offline
Here is a simple example of copying lines (poles when swept) and using a for loop to carve each end randomly to generate varying lengths.
Edited by Mike_A - July 7, 2024 18:54:33

Attachments:
pole length variation.hiplc (320.4 KB)

  • Quick Links