module sample_clip(clamp_point, t=2.5, w=6, radius_of_curvature=undef, slope=30){
default_roc = clamp_point.z/2 + clamp_point.y*sin(slope) - t/2;
roc = if_undefined_set_default(radius_of_curvature, default_roc);
//z distance from the contact point to the centre of the curved part
z_dist = clamp_point.z - roc - t/2;
//a is the distance from the contact-point cylinder to the
//centre of the curved part
a = sqrt(clamp_point.y^2 + z_dist^2);
//angle through which we must rotate the join between
angle = acos((roc + t/2) / a) + atan(z_dist/clamp_point.y);
difference(){
union(){
//anchor to stage
cylinder(r=w/2,h=t);
translate_z(roc+t){
rotate_y(90){
difference(){
cylinder(r=roc+t,h=w,center=true);
cylinder(r=roc,h=999,center=true);
translate_z(-99){
cube([999,999,999]);
}
translate_z(-99){
rotate(angle){
cube([999,999,999]);
}
}
}
}
}
sequential_hull(){
translate_z(roc+t){
rotate_y(90){
rotate(angle){
translate_y(roc+t/2){
cylinder(r=t/2,h=w,center=true);
}
}
}
}
translate([0,clamp_point.y,clamp_point.z+t/2]){
rotate_y(90){
cylinder(r=t/2,h=w,center=true);
}
}
translate([0,clamp_point.y+t,clamp_point.z+t]){
rotate_y(90){
cylinder(r=t/2,h=w,center=true);
}
}
}
}
cylinder(r=3/2*1.2,h=999,center=true,$fn=16);
}
}