Skip to content

Instantly share code, notes, and snippets.

@patakk
Created September 17, 2023 15:17
Show Gist options
  • Save patakk/9452f26e88851767ec3fcae2a54e252b to your computer and use it in GitHub Desktop.
Save patakk/9452f26e88851767ec3fcae2a54e252b to your computer and use it in GitHub Desktop.
vexxx
int seed = detail(1, "iteration", 0);
vector rand_axis = set(0, 0, 0);
int rand_int = 0;
vector bbox_size = getbbox_size(0);
seed += int(bbox_size[0]*100) + int(bbox_size[1]*100) + int(bbox_size[2]*100);
if(rand(@class+seed+3113) < 1.5){
if (bbox_size.x > bbox_size.y && bbox_size.x > bbox_size.z) {
rand_axis = set(1, 0, 0);
rand_int = 0;
} else if (bbox_size.y > bbox_size.x && bbox_size.y > bbox_size.z) {
rand_axis = set(0, 1, 0);
rand_int = 1;
} else if (bbox_size.z > bbox_size.x && bbox_size.z > bbox_size.y) {
rand_axis = set(0, 0, 1);
rand_int = 2;
}
}
float split_point = fit01(.25 + .5*random(@class + 12345 + seed), getbbox_min(0)[rand_int], getbbox_max(0)[rand_int]);
v@rand_axis = rand_axis;
f@split_point = split_point;
/*
int rand_int = int(fit01(random(@class+seed), 0, 3));
vector rand_axis = set(0, 0, 0);
if (rand_int == 0) {
rand_axis = set(1, 0, 0);
} else if (rand_int == 1) {
rand_axis = set(0, 1, 0);
} else {
rand_axis = set(0, 0, 1);
}*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment