metafizzy / zdog

Flat, round, designer-friendly pseudo-3D engine for canvas & SVG
https://zzz.dog
10.36k stars 393 forks source link

Hemisphere, Cylinder, and Cone wedge shapes #3

Open desandro opened 5 years ago

desandro commented 5 years ago

Currently composite shapes like Hemisphere, Cylinder, and Cone can only be rendered with fully circular bases. There is no easy way to render a quarter-sphere or half-cone.

One solution may be to add a quarters option, similar to Ellipse. For example, quarters: 2 would render a half-cone.

Add a šŸ‘ reaction to this issue if you would like to see this feature added. Do not add +1 comments ā€” They will be deleted.

NEO97online commented 5 years ago

This would be a great feature to have. In the mean time, is there any workaround to make a half-hemisphere? (A quartersphere!)

theohonohan commented 5 years ago

Would it be more flexible to offer wedges of a certain angle, say multiples of 2*pi radians? So a full circle would be 1, a quarter circle would be 0.25, etc.

csalmeida commented 5 years ago

That sounds great! Does anyone know if there's a way of changing how tall an Hemisphere is? Maybe I'm missing something but changing the width or height only makes the base larger (can be seen better if a backface color is set).

codecodestop commented 10 months ago

I realize the most recent question is years old now at the time of my reply, but I have a solution, and since others may have the same question in future, I decided it would not be 100% obnoxious to answer ~5 years later. So I couldnā€™t resist. :)

Since a hemisphere is nothing more than half a sphere, and a sphere has no sense of height, you might achieve something closer to what you have in mindā€”assuming that Iā€™ve understood your question, which may be a risky assumptionā€”by using a cylinder. Using the ZDog concept of using extreme ā€˜strokeā€™ values to add volume, you could make it taller by just extending the path which defines the cylinderā€™s dimensions.

theohonohan commented 10 months ago

I don't understand what you are saying. As I understand it, the question was about creating a "hemi-ellipsoid" rather than a hemisphere.

There are two basic kinds of hemi-ellipsoid: oblate (currently supported) and prolate (seemingly not supported?). This isn't standard terminology, but this diagram should make the two possibilities clear: https://www.researchgate.net/figure/Schematic-diagram-of-prolate-and-oblate-ellipsoid-and-their-aspect-ratio_fig1_342297075

On Sat 9 Dec 2023, 13:10 codecodestop, @.***> wrote:

I realize the most recent question is years old now at the time of my reply, but I have a solution, and since others may have the same question in future, I decided it would not be 100% obnoxious to answer ~5 years later. So I couldnā€™t resist. :)

hemisphere is nothing more than half a sphere, and a sphere has no sense of height, you might achieve something closer to what you have in mindā€”assuming that Iā€™ve understood your question, which may be a risky assumptionā€”by using a cylinder. Using the ZDog concept of using extreme ā€˜strokeā€™ values to add volume, you could make it taller by just extending the path which defines the cylinderā€™s dimensions.

ā€” Reply to this email directly, view it on GitHub https://github.com/metafizzy/zdog/issues/3#issuecomment-1848405518, or unsubscribe https://github.com/notifications/unsubscribe-auth/AH22T3MCYHT4I6N7GN4PBYLYIRPKVAVCNFSM4HPWWT6KU5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TCOBUHA2DANJVGE4A . You are receiving this because you commented.Message ID: @.***>