Showing posts with label primitive. Show all posts
Showing posts with label primitive. Show all posts

Wednesday, 1 March 2023

primitive number as an attribute - enumerate

 use case - you have a bunch of curves and want to give them individual point colours - but you want the points to all use the same id.

an Enumerate sop node will let you store the number value in each point or primitive. Lets use the primitive option, then attribute promote it to points so that each curve's points all contain the same identifiable attribute.


It can also be used to name "pieces", which might be useful



Tuesday, 9 November 2021

Wednesday, 19 June 2019

rotate packed primitives/ WALTER ROTATE

how to rotate a/bunch of packed primitive/s -
Use a WALTER ROTATE.

in a primitive wrangle:


float randomFactor=rand(@primnum+2323)*chf("randomMult");
matrix3 rot = primintrinsic(0, "transform", @primnum);
vector4 orient = quaternion(rot);
vector x = normalize(qrotate(orient, {1,0,0}));
vector y = normalize(qrotate(orient, {0,1,0}));
rotate(rot, radians(chf("angle") * randomFactor), x);
rotate(rot, radians(chf("angley")), y);
setprimintrinsic(0, "transform", @primnum, rot);

//////////////////
what we are doing is:
  • making a random factor to multiply the rotations, using primnum as a seed
  • creating a matrix called "rot", and initialising it to the transform of the primitive
  • create a vector called "orient", using the quarternion of the rot matrix
  • create vectors x and y
  • rotate the rot matrix using input angles for x and y
  • then finally set the primitive intrinsic using the rot matrix

Tuesday, 2 April 2019

separating objects for booleans/other things

Case example - you have a 


To separate out an object, maybe for booleaning, or to avoid intersections when doing some other sort of calculation, make a point class attribute (connectivity)
then in a point wrangle do something like this-

@P.x+=@class;
@P.y+=@class;

This should separate the pieces enough. If not, use a multiplier.
Then promote the class to a primitive attribute - for some reason Boolean Fracture doesn't carry across the class attr to any newly generated points when it is left as a point attr.


Do your booleans...you might want to scatter some points on the surfaces or copy some turbulent grids onto the object points.

Bring the class attribute back to point level and then do the reverse transformation

@P.x-=@class;
@P.y-=@class

 link any multipliers you might have to save time changing values in multiple boxes!