Skip to content

Instantly share code, notes, and snippets.

@BlueDrink9
Last active January 7, 2024 05:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BlueDrink9/53623ebd18ff6b8313d51cc2bc86a178 to your computer and use it in GitHub Desktop.
Save BlueDrink9/53623ebd18ff6b8313d51cc2bc86a178 to your computer and use it in GitHub Desktop.
Basic teardrop shape in openscad
/* Creates a flat 2D teardrop on the XY plane,
* where no angle in the positive y direction is greater than 45º.
* */
module teardrop2d(radius){
// Find tangents on the circle at 45 degrees
// Radius is triangle hypotenuse
function tangent_point(circle_r, angle) = [
circle_r * cos(angle),
circle_r * sin(angle),
];
teardrop_point = [0,
tangent_point(radius, 45).y + tangent_point(radius, 45).x];
circle(radius);
polygon([
tangent_point(radius, 45),
tangent_point(radius, 135),
teardrop_point
]);
}
/*
* Intended as a drop-in replacement for a basic cylinder().
* */
module teardrop(length, radius, center=false){
linear_extrude(height=length, center=center)
teardrop2d(radius);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment