[x3d-public] Formulas of flowers and leaves
John Carlson
yottzumm at gmail.com
Sat Jul 3 18:52:55 PDT 2021
I don't know how to draw leaves. I would look up how to draw a maple
leaf or fern with fractals (Michael Barnsley comes to mind). It might be
easier to start off with a bunch of images/pictures. The way they do
movies these days is project the background onto a wall, then the actors
act in front of it. Why fake nature when you can sample the real thing?
I used surfaces for 3D "roses" in college a bit, with Newton's method. I
haven't done it recently, because I proved to myself that internal
intersections weren't found.
Mostly I use quadrilaterals or triangles to draw things. I did Maurer
Roses in 1981-1982 on Apple II+ before "Maurer" existed. You can find
formulas in old or new CRC Math books, perhaps. I used the 25th version
or older. The book has been updated, and I can't find the same thing in
the online version.
This might be an unorganized introduction (warning, some Perl required):
https://coderextreme.net/orbit/
But they aren't "roses" per se. For more unrealistic things
(animation), look at:
https://coderextreme.net/flower/
I would search through SIGGRAPH conference proceedings in hope of
getting something realistic.
I am not your "curve" person. For 3D you're looking for someone who
knows bicubics or NURBS, but really they pretty much get split up into
triangles by the graphics card or CPU, so knowing about triangle sets
and triangle fans are probably useful. What I do is take a tessellated
sphere from Blender or a grid IFS from X3D and offset the position to
make the "rose" surface, and ensure you've got enough resolution so the
result doesn't look crappy. Also, some work was done on the mailing list
with FX3D/FVRML way back in the distant past. That would help fit your
formulas into an X3D mindset. At this point, if you want to animate
the surface, I think your best bet is to go with something like GLSL.
I don't know about volumes at all, just surfaces. I've only rendered up
to 7 animated "roses" at a time--it's easy to add more, but I get
concerned about heat, etc.
Here's a sample of something you might get if you use PHP to draw things:
https://code.tutsplus.com/tutorials/rendering-text-and-basic-shapes-using-gd--cms-31767
If you really want better 2D flowers, I highly recommend contacting
@sxywu on Twitter. She may be working on 3D as well.
"Curves" indicates you're using 2D? There's Processing.JS for JavaScript.
So start small, with 2D vector/SVG drawing (see @sxywu), use polar
coordinates in an equation like
r = 100+100*cos(2*phi)
You have to figure out how to convert to Cartesian coordinates, but
that's easy to find. Break the curve into a series of lines by
stepping through values of phi in a loop. Make the delta phi small enough.
I hope you know what a loop is.
I'm pretty much at the point where I want to draw fractal "roses."
John Carlson
On 7/3/21 7:44 PM, Konstantin Smirnov wrote:
> Yes! I am looking for simple code that can use curves of roses to draw
> them
>
> вс, 4 июл. 2021 г., 03:40 John Carlson <yottzumm at gmail.com
> <mailto:yottzumm at gmail.com>>:
>
> Not using my imagination here much…would something like this do
> the trick?
>
> https://www.php.net/manual/en/function.imageline.php
> <https://www.php.net/manual/en/function.imageline.php>
>
>
> On Sat, Jul 3, 2021 at 7:37 PM Konstantin Smirnov
> <konstantin.e.smirnov at gmail.com
> <mailto:konstantin.e.smirnov at gmail.com>> wrote:
>
> Thanks! I saw your links
> Fibonacci on other sites really exist. Formulas for roses not
> clear how to apply,
> I am looking for those that can be plugged in simple languages
> such as php or JavaScript,
>
> More important is to have formulas. For example for drawing
> leaves. At first for php, then for 3d
>
> вс, 4 июл. 2021 г., 03:15 John Carlson <yottzumm at gmail.com
> <mailto:yottzumm at gmail.com>>:
>
> Ah, GD, I’ve used that in Perl, not PHP. I was never
> really impressed by GD, but it may work for 2D. I can
> help with JavaScript, GLSL or maybe Perl (OBJ file) if you
> want 3D. I don’t have my AppleSoft Basic around any more.
>
> Maybe you want something like vpython?
>
> You seem to be lazy and not even using resources given to
> you? What kind of flower do you want to draw?
>
> Look up converting converting polar or spherical
> coordinates to Cartesian coordinates would be a good
> start. Also look up L-systems and graftals.
>
> John
>
> On Sat, Jul 3, 2021 at 6:53 PM John Carlson
> <yottzumm at gmail.com <mailto:yottzumm at gmail.com>> wrote:
>
> I would start out with something like Processing, not php.
>
> Good luck!
>
> On Sat, Jul 3, 2021 at 6:51 PM John Carlson
> <yottzumm at gmail.com <mailto:yottzumm at gmail.com>> wrote:
>
> I’ve never heard of php doing drawings. You mean
> SVG or X3D?
>
> https://en.m.wikipedia.org/wiki/Rose_(mathematics)
> <https://en.m.wikipedia.org/wiki/Rose_(mathematics)>
>
> I don’t know about real flowers. Good luck with
> that.
>
> Number theory is really an odd choice, but I guess
> I suggested Fibonacci. That was more for numbers
> of petals.
>
> John
>
> On Sat, Jul 3, 2021 at 6:41 PM Konstantin Smirnov
> <konstantin.e.smirnov at gmail.com
> <mailto:konstantin.e.smirnov at gmail.com>> wrote:
>
> Thanks! I mean simple algorithm or formulas,
> for example on php, that can easily draw
> flowers with math, number theory. For example,
> some flowers may have structure like math
> equations solutions.
>
> Or for beginning, simply drawing a flower on
> php code.
>
> вс, 4 июл. 2021 г., 01:19 John Carlson
> <yottzumm at gmail.com <mailto:yottzumm at gmail.com>>:
>
> Mathematical Roses or Rhodonea should jump
> start you. Also look up @sxywu on
> Twitter. Her data sketches book may have
> specifics for a variety of “flowers”. For
> a more techy look, find Maurer Roses.
>
> I don’t know what you mean by Nt. You
> can find shaders or JavaScript code in
> X3DJSONLD. File names with “flower” or
> contents of “rose” will likely give you a
> jump start in 3D, but they are quite
> artificial and even more so animated.
> Plus it seems like my code is currently in
> a non-working state.
>
> I would try something with Fibonacci,
> golden ratio to get things more natural,
> or perhaps particle systems for imperfections.
>
> For previews, checkout
> https://codextreme.net
> <https://codextreme.net>. One can get
> quite a lot of diversity with parametric
> equations, especially when animating
> parameters.
>
> http://www.grad.hr/sgorjanc/Links/roses.pdf
> <http://www.grad.hr/sgorjanc/Links/roses.pdf>
>
>
> Good luck!
> On Sat, Jul 3, 2021 at 11:45 AM Konstantin
> Smirnov <konstantin.e.smirnov at gmail.com
> <mailto:konstantin.e.smirnov at gmail.com>>
> wrote:
>
> Hi
> Who knows formulas that can be used
> for drawing of flowers? Nt or algorithms
> _______________________________________________
> x3d-public mailing list
> x3d-public at web3d.org
> <mailto:x3d-public at web3d.org>
> http://web3d.org/mailman/listinfo/x3d-public_web3d.org
> <http://web3d.org/mailman/listinfo/x3d-public_web3d.org>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20210703/63aed9fa/attachment-0001.html>
More information about the x3d-public
mailing list