Skip to content

Instantly share code, notes, and snippets.

@joshuazt
Last active February 19, 2021 01:26
Show Gist options
  • Save joshuazt/661b1cc26543728f01d4f0d7dfba04ea to your computer and use it in GitHub Desktop.
Save joshuazt/661b1cc26543728f01d4f0d7dfba04ea to your computer and use it in GitHub Desktop.
//create variables
vector tangentv = v@tangentv;
vector tangentu = v@tangentu;
tangentv = cross(tangentu, @N);
float seed = ch('seed') + @primseed;
@up = tangentu;
//define rotations YAW
float RandYaw= fit01(rand(i@ptnum+seed+225), -ch('rand_yaw'), ch('rand_yaw')) * chramp("ramp_yaw", @curveu);
float Yaw = chf('yaw') * chramp('ramp_yaw', @curveu) + 0.001;
//apply rotations YAW
@Yaw = Yaw;
RandYaw = RandYaw;
vector4 rot = quaternion(radians(Yaw+RandYaw), tangentv);
@N = qrotate(rot, @N);
@N = normalize(@N);
//define rotations ROLL
float RandRoll= fit01(rand(i@ptnum+seed+225), -ch('rand_roll'), ch('rand_roll')) * chramp("ramp_roll", @curveu);
float Roll = chf('roll') * chramp('ramp_roll', @curveu);
@Roll = Roll;
@RandRoll = RandRoll;
//apply rotations ROLL
vector4 rotr = quaternion(radians(Roll+RandRoll), tangentu);
@N = qrotate(rotr, @N);
@N = normalize(@N);
//define rotations TWIST
float RandTwist= fit01(rand(i@ptnum+seed+225), -ch('rand_twist'), ch('rand_twist')) * chramp("ramp_twist", @curveu);
float Twist = chf('twist') * chramp('ramp_twist', @curveu);
@RandTwist = RandTwist;
@Twist = Twist;
//apply rotations TWIST
vector4 rott = quaternion(radians(Twist+RandTwist), @N);
@up = qrotate(rott, @up);
@up = normalize(@up);
@joshuazt
Copy link
Author

joshuazt commented Feb 19, 2021

REQURIED ATTRIBUTES:
resample:
curveu
polyframe:
N (if its a straight line, might need to define N before polyframe)
tangentu
tangentv

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment