Skip to content

Instantly share code, notes, and snippets.

@thehans

thehans/perf.scad

Created Nov 6, 2019
Embed
What would you like to do?
Performance test of complex object unioned with many simple objects
$fn = 100;
module rounded_cube(size,r,center=false)
{
s = is_list(size) ? size : [size,size,size];
translate(center ? -s/2 : [0,0,0])
hull() {
translate([ r, r, r]) sphere(r=r);
translate([ r, r,s.z-r]) sphere(r=r);
translate([ r,s.y-r, r]) sphere(r=r);
translate([ r,s.y-r,s.z-r]) sphere(r=r);
translate([s.x-r, r, r]) sphere(r=r);
translate([s.x-r, r,s.z-r]) sphere(r=r);
translate([s.x-r,s.y-r, r]) sphere(r=r);
translate([s.x-r,s.y-r,s.z-r]) sphere(r=r);
}
}
union() {
rounded_cube(100,5,true);
// positive X face
translate([ 50,-40,-40]) cube(5, center=true);
translate([ 50,-40,-30]) cube(5, center=true);
translate([ 50,-40,-20]) cube(5, center=true);
translate([ 50,-40,-10]) cube(5, center=true);
translate([ 50,-40, 0]) cube(5, center=true);
translate([ 50,-40, 10]) cube(5, center=true);
translate([ 50,-40, 20]) cube(5, center=true);
translate([ 50,-40, 30]) cube(5, center=true);
translate([ 50,-40, 40]) cube(5, center=true);
translate([ 50,-30,-40]) cube(5, center=true);
translate([ 50,-30,-30]) cube(5, center=true);
translate([ 50,-30,-20]) cube(5, center=true);
translate([ 50,-30,-10]) cube(5, center=true);
translate([ 50,-30, 0]) cube(5, center=true);
translate([ 50,-30, 10]) cube(5, center=true);
translate([ 50,-30, 20]) cube(5, center=true);
translate([ 50,-30, 30]) cube(5, center=true);
translate([ 50,-30, 40]) cube(5, center=true);
translate([ 50,-20,-40]) cube(5, center=true);
translate([ 50,-20,-30]) cube(5, center=true);
translate([ 50,-20,-20]) cube(5, center=true);
translate([ 50,-20,-10]) cube(5, center=true);
translate([ 50,-20, 0]) cube(5, center=true);
translate([ 50,-20, 10]) cube(5, center=true);
translate([ 50,-20, 20]) cube(5, center=true);
translate([ 50,-20, 30]) cube(5, center=true);
translate([ 50,-20, 40]) cube(5, center=true);
translate([ 50,-10,-40]) cube(5, center=true);
translate([ 50,-10,-30]) cube(5, center=true);
translate([ 50,-10,-20]) cube(5, center=true);
translate([ 50,-10,-10]) cube(5, center=true);
translate([ 50,-10, 0]) cube(5, center=true);
translate([ 50,-10, 10]) cube(5, center=true);
translate([ 50,-10, 20]) cube(5, center=true);
translate([ 50,-10, 30]) cube(5, center=true);
translate([ 50,-10, 40]) cube(5, center=true);
translate([ 50, 0,-40]) cube(5, center=true);
translate([ 50, 0,-30]) cube(5, center=true);
translate([ 50, 0,-20]) cube(5, center=true);
translate([ 50, 0,-10]) cube(5, center=true);
translate([ 50, 0, 0]) cube(5, center=true);
translate([ 50, 0, 10]) cube(5, center=true);
translate([ 50, 0, 20]) cube(5, center=true);
translate([ 50, 0, 30]) cube(5, center=true);
translate([ 50, 0, 40]) cube(5, center=true);
translate([ 50, 10,-40]) cube(5, center=true);
translate([ 50, 10,-30]) cube(5, center=true);
translate([ 50, 10,-20]) cube(5, center=true);
translate([ 50, 10,-10]) cube(5, center=true);
translate([ 50, 10, 0]) cube(5, center=true);
translate([ 50, 10, 10]) cube(5, center=true);
translate([ 50, 10, 20]) cube(5, center=true);
translate([ 50, 10, 30]) cube(5, center=true);
translate([ 50, 10, 40]) cube(5, center=true);
translate([ 50, 20,-40]) cube(5, center=true);
translate([ 50, 20,-30]) cube(5, center=true);
translate([ 50, 20,-20]) cube(5, center=true);
translate([ 50, 20,-10]) cube(5, center=true);
translate([ 50, 20, 0]) cube(5, center=true);
translate([ 50, 20, 10]) cube(5, center=true);
translate([ 50, 20, 20]) cube(5, center=true);
translate([ 50, 20, 30]) cube(5, center=true);
translate([ 50, 20, 40]) cube(5, center=true);
translate([ 50, 30,-40]) cube(5, center=true);
translate([ 50, 30,-30]) cube(5, center=true);
translate([ 50, 30,-20]) cube(5, center=true);
translate([ 50, 30,-10]) cube(5, center=true);
translate([ 50, 30, 0]) cube(5, center=true);
translate([ 50, 30, 10]) cube(5, center=true);
translate([ 50, 30, 20]) cube(5, center=true);
translate([ 50, 30, 30]) cube(5, center=true);
translate([ 50, 30, 40]) cube(5, center=true);
translate([ 50, 40,-40]) cube(5, center=true);
translate([ 50, 40,-30]) cube(5, center=true);
translate([ 50, 40,-20]) cube(5, center=true);
translate([ 50, 40,-10]) cube(5, center=true);
translate([ 50, 40, 0]) cube(5, center=true);
translate([ 50, 40, 10]) cube(5, center=true);
translate([ 50, 40, 20]) cube(5, center=true);
translate([ 50, 40, 30]) cube(5, center=true);
translate([ 50, 40, 40]) cube(5, center=true);
// negative Y face
translate([-40,-50,-40]) cube(5, center=true);
translate([-40,-50,-30]) cube(5, center=true);
translate([-40,-50,-20]) cube(5, center=true);
translate([-40,-50,-10]) cube(5, center=true);
translate([-40,-50, 0]) cube(5, center=true);
translate([-40,-50, 10]) cube(5, center=true);
translate([-40,-50, 20]) cube(5, center=true);
translate([-40,-50, 30]) cube(5, center=true);
translate([-40,-50, 40]) cube(5, center=true);
translate([-30,-50,-40]) cube(5, center=true);
translate([-30,-50,-30]) cube(5, center=true);
translate([-30,-50,-20]) cube(5, center=true);
translate([-30,-50,-10]) cube(5, center=true);
translate([-30,-50, 0]) cube(5, center=true);
translate([-30,-50, 10]) cube(5, center=true);
translate([-30,-50, 20]) cube(5, center=true);
translate([-30,-50, 30]) cube(5, center=true);
translate([-30,-50, 40]) cube(5, center=true);
translate([-20,-50,-40]) cube(5, center=true);
translate([-20,-50,-30]) cube(5, center=true);
translate([-20,-50,-20]) cube(5, center=true);
translate([-20,-50,-10]) cube(5, center=true);
translate([-20,-50, 0]) cube(5, center=true);
translate([-20,-50, 10]) cube(5, center=true);
translate([-20,-50, 20]) cube(5, center=true);
translate([-20,-50, 30]) cube(5, center=true);
translate([-20,-50, 40]) cube(5, center=true);
translate([-10,-50,-40]) cube(5, center=true);
translate([-10,-50,-30]) cube(5, center=true);
translate([-10,-50,-20]) cube(5, center=true);
translate([-10,-50,-10]) cube(5, center=true);
translate([-10,-50, 0]) cube(5, center=true);
translate([-10,-50, 10]) cube(5, center=true);
translate([-10,-50, 20]) cube(5, center=true);
translate([-10,-50, 30]) cube(5, center=true);
translate([-10,-50, 40]) cube(5, center=true);
translate([ 0,-50,-40]) cube(5, center=true);
translate([ 0,-50,-30]) cube(5, center=true);
translate([ 0,-50,-20]) cube(5, center=true);
translate([ 0,-50,-10]) cube(5, center=true);
translate([ 0,-50, 0]) cube(5, center=true);
translate([ 0,-50, 10]) cube(5, center=true);
translate([ 0,-50, 20]) cube(5, center=true);
translate([ 0,-50, 30]) cube(5, center=true);
translate([ 0,-50, 40]) cube(5, center=true);
translate([ 10,-50,-40]) cube(5, center=true);
translate([ 10,-50,-30]) cube(5, center=true);
translate([ 10,-50,-20]) cube(5, center=true);
translate([ 10,-50,-10]) cube(5, center=true);
translate([ 10,-50, 0]) cube(5, center=true);
translate([ 10,-50, 10]) cube(5, center=true);
translate([ 10,-50, 20]) cube(5, center=true);
translate([ 10,-50, 30]) cube(5, center=true);
translate([ 10,-50, 40]) cube(5, center=true);
translate([ 20,-50,-40]) cube(5, center=true);
translate([ 20,-50,-30]) cube(5, center=true);
translate([ 20,-50,-20]) cube(5, center=true);
translate([ 20,-50,-10]) cube(5, center=true);
translate([ 20,-50, 0]) cube(5, center=true);
translate([ 20,-50, 10]) cube(5, center=true);
translate([ 20,-50, 20]) cube(5, center=true);
translate([ 20,-50, 30]) cube(5, center=true);
translate([ 20,-50, 40]) cube(5, center=true);
translate([ 30,-50,-40]) cube(5, center=true);
translate([ 30,-50,-30]) cube(5, center=true);
translate([ 30,-50,-20]) cube(5, center=true);
translate([ 30,-50,-10]) cube(5, center=true);
translate([ 30,-50, 0]) cube(5, center=true);
translate([ 30,-50, 10]) cube(5, center=true);
translate([ 30,-50, 20]) cube(5, center=true);
translate([ 30,-50, 30]) cube(5, center=true);
translate([ 30,-50, 40]) cube(5, center=true);
translate([ 40,-50,-40]) cube(5, center=true);
translate([ 40,-50,-30]) cube(5, center=true);
translate([ 40,-50,-20]) cube(5, center=true);
translate([ 40,-50,-10]) cube(5, center=true);
translate([ 40,-50, 0]) cube(5, center=true);
translate([ 40,-50, 10]) cube(5, center=true);
translate([ 40,-50, 20]) cube(5, center=true);
translate([ 40,-50, 30]) cube(5, center=true);
translate([ 40,-50, 40]) cube(5, center=true);
// positive Z face
translate([-40,-40, 50]) cube(5, center=true);
translate([-40,-30, 50]) cube(5, center=true);
translate([-40,-20, 50]) cube(5, center=true);
translate([-40,-10, 50]) cube(5, center=true);
translate([-40, 0, 50]) cube(5, center=true);
translate([-40, 10, 50]) cube(5, center=true);
translate([-40, 20, 50]) cube(5, center=true);
translate([-40, 30, 50]) cube(5, center=true);
translate([-40, 40, 50]) cube(5, center=true);
translate([-30,-40, 50]) cube(5, center=true);
translate([-30,-30, 50]) cube(5, center=true);
translate([-30,-20, 50]) cube(5, center=true);
translate([-30,-10, 50]) cube(5, center=true);
translate([-30, 0, 50]) cube(5, center=true);
translate([-30, 10, 50]) cube(5, center=true);
translate([-30, 20, 50]) cube(5, center=true);
translate([-30, 30, 50]) cube(5, center=true);
translate([-30, 40, 50]) cube(5, center=true);
translate([-20,-40, 50]) cube(5, center=true);
translate([-20,-30, 50]) cube(5, center=true);
translate([-20,-20, 50]) cube(5, center=true);
translate([-20,-10, 50]) cube(5, center=true);
translate([-20, 0, 50]) cube(5, center=true);
translate([-20, 10, 50]) cube(5, center=true);
translate([-20, 20, 50]) cube(5, center=true);
translate([-20, 30, 50]) cube(5, center=true);
translate([-20, 40, 50]) cube(5, center=true);
translate([-10,-40, 50]) cube(5, center=true);
translate([-10,-30, 50]) cube(5, center=true);
translate([-10,-20, 50]) cube(5, center=true);
translate([-10,-10, 50]) cube(5, center=true);
translate([-10, 0, 50]) cube(5, center=true);
translate([-10, 10, 50]) cube(5, center=true);
translate([-10, 20, 50]) cube(5, center=true);
translate([-10, 30, 50]) cube(5, center=true);
translate([-10, 40, 50]) cube(5, center=true);
translate([ 0,-40, 50]) cube(5, center=true);
translate([ 0,-30, 50]) cube(5, center=true);
translate([ 0,-20, 50]) cube(5, center=true);
translate([ 0,-10, 50]) cube(5, center=true);
translate([ 0, 0, 50]) cube(5, center=true);
translate([ 0, 10, 50]) cube(5, center=true);
translate([ 0, 20, 50]) cube(5, center=true);
translate([ 0, 30, 50]) cube(5, center=true);
translate([ 0, 40, 50]) cube(5, center=true);
translate([ 10,-40, 50]) cube(5, center=true);
translate([ 10,-30, 50]) cube(5, center=true);
translate([ 10,-20, 50]) cube(5, center=true);
translate([ 10,-10, 50]) cube(5, center=true);
translate([ 10, 0, 50]) cube(5, center=true);
translate([ 10, 10, 50]) cube(5, center=true);
translate([ 10, 20, 50]) cube(5, center=true);
translate([ 10, 30, 50]) cube(5, center=true);
translate([ 10, 40, 50]) cube(5, center=true);
translate([ 20,-40, 50]) cube(5, center=true);
translate([ 20,-30, 50]) cube(5, center=true);
translate([ 20,-20, 50]) cube(5, center=true);
translate([ 20,-10, 50]) cube(5, center=true);
translate([ 20, 0, 50]) cube(5, center=true);
translate([ 20, 10, 50]) cube(5, center=true);
translate([ 20, 20, 50]) cube(5, center=true);
translate([ 20, 30, 50]) cube(5, center=true);
translate([ 20, 40, 50]) cube(5, center=true);
translate([ 30,-40, 50]) cube(5, center=true);
translate([ 30,-30, 50]) cube(5, center=true);
translate([ 30,-20, 50]) cube(5, center=true);
translate([ 30,-10, 50]) cube(5, center=true);
translate([ 30, 0, 50]) cube(5, center=true);
translate([ 30, 10, 50]) cube(5, center=true);
translate([ 30, 20, 50]) cube(5, center=true);
translate([ 30, 30, 50]) cube(5, center=true);
translate([ 30, 40, 50]) cube(5, center=true);
translate([ 40,-40, 50]) cube(5, center=true);
translate([ 40,-30, 50]) cube(5, center=true);
translate([ 40,-20, 50]) cube(5, center=true);
translate([ 40,-10, 50]) cube(5, center=true);
translate([ 40, 0, 50]) cube(5, center=true);
translate([ 40, 10, 50]) cube(5, center=true);
translate([ 40, 20, 50]) cube(5, center=true);
translate([ 40, 30, 50]) cube(5, center=true);
translate([ 40, 40, 50]) cube(5, center=true);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.