equation formula Heart polyhedron

hello,

I would like to make a 3D heart with openscad.
I found the equation https://mathworld.wolfram.com/HeartSurface.html

How can I make a polyhedron from it ?

Why not just do this?

module hheart(){
difference(){
rotate([0,45,0])scale([1,.5,2])sphere(r=20);
translate([-50,0,0])
cube([100,100,100],center=true);
}
}
module heart(){
hheart();
mirror([1,0,0])hheart();
}

mmm That's a great idea! it's very simple!
It looks even better with scale([1, .7, 1.7])

The one with the equation looks much better.
and I would like to try to make a polyhedron from an equation, that would be a great a achievement.

I made a thing from your replies, thanks guys! https://www.thingiverse.com/thing:5635344
You can choose cube or sphere as voxels
I hope it will be useful as a base for other things, it's full openscad code so it can be include in another project and be use in the customizer.

I'm still looking for a smoother version (not voxels).

the sources are here: https://github.com/yannickbattail/openscad-models/tree/main/VoxelHeart

Voxel Heart full openscad
by XcinnaY

I improved my code:

• I improve the randering time by 4, I only generate voxels for a quarter of the heart and then use mirror() to have a full heart.
• I use hull() to smooth the hear, but it merge the 2 bumps, so I use hull() in only on the half oh the heart and use mirror()
• I include easiestHeart from the idea of @woodrobot
• max_res.stl is model with a lot of voxels and hull() it took 2 hours to render on my machine :-o

Thank you everybody for you help and ideas!

You have 1 like :)
I'm still working on my surface renderer btw, maybe i will publish something as well.

thank you
good idea

This is not exactly what you asked but here is a fast approximation generated from the SVG in the link you gave.

This one is a full computed polyhedron but not good enough to release the code :)

I'd say you have to solve for one of the parameters so you have a set of functions to iterate over.

You could also iterate over the existing parameters and use the equation as boundary condition on whether to plot a voxel or not, but that will give you a voxel heart.

thank you for your code,
here is mine, I made fully functional model from your code and you can choose cube or sphere as "voxel"
if you reduce the size of the cube, it takes a lot of time to process.

if somebody have a solution to make it smooth, that would be great (even if I like voxel design).

I gave this a go yesterday and really didn't finish. Using Wolfram Alpha, I converted the equation from cartesian to spherical coordinates. The radius is then a function of the altitude and azimuth angles. For any set of input angles you get a 6th order polynomial for the radius which you solve for a positive real root. I was able to solve for the positive real root using a recursive function, but it's quite slow. The result didn't look right and I haven't slogged back through the math to find if or where I made a mistake.