rotScaleTrans

exponentialPscale

float randomized_pscale = sample_exponential(ch("mean"), rand(@ptnum));
@pscale = lerp(@pscale, randomized_pscale, ch("randomize"));
@pscale *= ch("scale");
@pscale = min(max(ch("min_pscale"), @pscale), ch("max_pscale"));

makeTransform

vector t=chv("t"),r=chv("r"),s=chv("scale"),p=chv("pivot"),pr=chv("pr");
matrix transf = maketransform(0,0,t,r,s,p,pr);

v@tmpP = @P*transf;

normalizeGeoMaxSize

//center geo
vector min, max;
getbbox(0, min, max);
vector centroid = (min+max)/2;;
@P+= centroid*-1;

@P*= 1/(max(max.x-min.x,max.y-min.y,max.z-min.z)); //normalize by max size
@P*=2;

normalizeGeoY

//center geo
vector min, max;
getbbox(0, min, max);
vector centroid = (min+max)/2;;
@P+= centroid*-1;

@P*= 1/(max.y-min.y); //normalize by max height 
@P.y+=0.5; //normalize by max height

@P*=ch('realScale'); //real scale

opTransform

matrix tr =  optransform(chs("light"));

v@N = cracktransform(XFORM_TRS, XFORM_XYZ, 1, {0,0,0}, tr);

pointToZero

vector basePtPos = point (0,"P",chi("basepoint")); 

matrix m = ident();

v@Z_axis =normalize( basePtPos - point(0,"P",neighbour(0,chi("basepoint"),1)));
v@Y_axis =normalize( cross(@Z_axis,basePtPos-point(0,"P",neighbour(0,chi("basepoint"),0))))*-1;
v@X_axis =normalize ( cross (@Z_axis,@Y_axis))*-1 ;

m*= set (@X_axis,@Y_axis,@Z_axis);
translate (m,basePtPos);

4@myMatrix = m;
m=invert(m);

@P*= m;

pointToZeroInvert

4@Um = point (1,"myMatrix",0);
@P*= @Um ;

pointToZeroMieu


vector basePtPos = point (0,"P",chi("basepoint")); 

matrix m = ident();

v@Z_axis =normalize( basePtPos - point(0,"P",neighbour(0,chi("basepoint"),1)));
v@Y_axis =normalize( cross(@Z_axis,basePtPos-point(0,"P",neighbour(0,chi("basepoint"),0))))*1;
v@X_axis =normalize ( cross (@Z_axis,@Y_axis))*-1 ;

m*= set (@X_axis,@Y_axis,@Z_axis);

//rotate
float angleX = radians(ch("angleX"));
vector axisX = {1,0,0};
rotate(m,angleX,axisX);
float angleY = radians(ch("angleY"));
vector axisY = {0,1,0};
rotate(m,angleY,axisY);
float angleZ = radians(ch("angleZ"));
vector axisZ = {0,0,1};
rotate(m,angleZ,axisZ);

translate (m,basePtPos);

4@myMatrix = m;

m=invert(m);

@P*= m;

pscale

@pscale = fit01(rand(@id+454654),ch("min"),ch("max"));

if (rand(@id+987)<ch("gros")){
@pscale = fit01(rand(@id+454654),ch("minGros"),ch("maxGros"));
}

@pscale *= ch("globalMult");

quaternion

// rotation autour d un axe
vector axis = chv("axe");
axis = normalize(axis);
float angle = chf("angle");
angle = radians(angle);

vector4 quat = quaternion(angle,axis);
v@P = qrotate(quat,@P);

quaternionJojo

float angle = radians(ch('angle'));

p@orient = quaternion(angle,{0,1,0});

quaternionLookAtPacked

vector look = point(1,"P",0)-@P;
vector up=set(0,1,0);

vector4 quat = quaternion(maketransform(look,up));
matrix3 m = qconvert(quat);
setprimintrinsic(0,"transform",i@ptnum,m,"set");

quaternionPacked

vector axis = chv("axe");
axis = normalize(axis);
float angle = chf("angle");
angle = radians(angle);

vector4 quat = quaternion(angle,axis);
//v@P = qrotate(quat,@P);
matrix3 m = qconvert(quat);
setprimintrinsic(0,"transform",i@ptnum,m,"set");

randRot

float x = rand(@ptnum);
float y = rand(@ptnum+311);
float z = rand(@ptnum-801);
@orient = sample_orientation_uniform(set(x,y,z));

rotationMatrix

// cree matrix rotScaleTrans strandar
matrix3 m = ident();
//rotate
float angleX = radians(ch("angleX"));
vector axisX = {1,0,0};
rotate(m,angleX,axisX);
float angleY = radians(ch("angleY"));
vector axisY = {0,1,0};
rotate(m,angleY,axisY);
float angleZ = radians(ch("angleZ"));
vector axisZ = {0,0,1};
rotate(m,angleZ,axisZ);
//scale
vector scale = chv("scale");
scale(m,scale);
//transform
@P += chv("trans");

@P*=m;

rotAutourDeN

@N=normalize(@N);
@up=set(0,1,0);
@orient = quaternion(maketransform(@N,@up));
// avec x,y et z en degres
vector4 x = quaternion(radians(ch("x")),{1,0,0});
vector4 y = quaternion(radians(ch("y")),{0,1,0});
vector4 z = quaternion(radians(ch("z")),{0,0,1});

@orient = qmultiply(@orient,x);
@orient = qmultiply(@orient,y);
@orient = qmultiply(@orient,z);

scaleRelatifToCam

string camPath = chs("camPath");
vector posToNDC = toNDC(camPath,@P);
posToNDC.z *= chf("scale");
@P= fromNDC(camPath,posToNDC);

transfromPackGeo

//get packTransform
matrix3 m = primintrinsic(0,"transform",i@ptnum);
//rotate
float angleX = radians(ch("angleX"));
vector axisX = {1,0,0};
rotate(m,angleX,axisX);
float angleY = radians(ch("angleY"));
vector axisY = {0,1,0};
rotate(m,angleY,axisY);
float angleZ = radians(ch("angleZ"));
vector axisZ = {0,0,1};
rotate(m,angleZ,axisZ);
//scale
vector scale = chv("scale");
scale(m,scale);
//transform
@P += chv("trans");

setprimintrinsic(0,"transform",i@ptnum,m,"set");
VEX