How do I calculate its shape/dimensions? (It can be either petal or ring shaped.)
Photography Stack Exchange is a question and answer site for professional, enthusiast and amateur photographers. It only takes a minute to sign up.Sign up to join this community
The most important number here is angle of view. That tells you where the rectangular pyramid of light that gets to the camera sensor intersects with the edges of the lens hood.
The common "petal" lens hood shape comes from this pyramid. You can imagine in the design of such a hood that they build an overly-long round lens hood, then project this pyramid out from the lens. Where the two intersect, they cut that part away, then round it off a bit. They probably cut it back a bit, too, so there is no danger of vignetting.
So, if you can find another lens hood made for a lens with the same angle of view, you're partway there.
The real trick is that all of the lenses that site has got hoods for are going to be quite a bit larger in diameter than your lens. You can't just cinch up the hood, because that will distort the petal shape. You could do that with a round one, though.