@Name: Crop Cylinder
@Version: 1.2
@Tags: crop
@Description: Crop into a cylinder with the rotational axis along the Z axis, select visibility of inside, surface and edges (by Rychveldir)
@Hull: 0
@Edge: 0
@Inside: 1
@Radius: 0.5
@Zmin: -1
@Zmax: 1
float r = sqrt(p.x*p.x + p.y*p.y);
float nx = 0;
float ny = 0;
float nz = 0;
float ec = 0;
if (r > @Radius) {
if (random(next) < @Hull) {
p.x = @Radius*p.x/r;
p.y = @Radius*p.y/r;
ec += 1;
} else {return discarded_point;}
}
if (p.z > @Zmax) {
if (random(next) < @Hull) {
p.z = @Zmax;
ec += 1;
} else { return discarded_point; }
}
if (p.z < @Zmin) {
if (random(next) < @Hull) {
p.z = @Zmin;
ec += 1;
} else { return discarded_point; }
}
if (ec > 1 && random(next) > @Edge)
return discarded_point;
return p;