The addon Addon to create special / extended geometries also shows how to create different more complex geometries. If you have the formulas/algorithm, it’s just a little work to get the result. 
see GitHub hofk (Klaus Hoffmeister) · GitHub
from THREEp: examples THREEp
