Produces a simple cut flower, with a stem and leaves. The idea comes from G. K. Klimek and M. Klimek's book, Discovering Curves and Surfaces with Maple , Springer-Verlag (1997).

Probably the most difficult part is organising the functions that describe a petal and the stem. The leaves are simple variations of the petals. The slight curve of the stem was particularily difficult to get just right.

The packages plots and plottools contain the essential features of the drawing. The setoptions commands, from plots, effectively, set the scene for the drawing. The multiple use of fractions of Pi are redefined, perhaps from my older programming principles; to gain a time advantage from Maple, it would be necessary to evaluate the Pi terms as floating point numbers using, say, evalf(Pi/3). The style removes any gridlines that might interfer. The projection and light specifics are a matter of personal taste; one might use the models lightmodel=light1 to light4 supplied with Maple.

> restart:

> with(plots): with(plottools):

Warning, the name changecoords has been redefined

> Pi2:=Pi/2: Pi3:=Pi/3: Pi6:=Pi/6: Pi9:=Pi/9:

> rnge:= x=-Pi..Pi,y=-Pi2..Pi2:

> setoptions3d(scaling=constrained,

> style=patchnogrid, projection=.5,
ambientlight=[.1,.3,.1], light=[75,55,1,.9,.2]);

The Algorithm

The algorithm consists of products of sines and cosines to give the right effect. Rotation and translation is the secret. The generation of a 3D image allows that all sides can be viewed. Rotations and translations place the petals and leaves and stem in the right place.

> osy := 1+sin(y):

> Xl:=2*sin(y)+1.85:

> Yl:=cos(x)*cos(y)*osy:

> Zl:=.1*sin(x)*cos(y)*osy+y-y^2-2:


> leaf:=plot3d([Xl,Yl,Zl],rnge,colour=[0,cos(y),0]):

> display3d({rotate(%,0,0,Pi/2),rotate(%,0,0,3*Pi/2)}):
translate(%,0,.3,-2); leaves:=%: # into the right place

[Maple Plot]


The petal looks a little 'out of sorts' but, of course, the default angles and light don't give a true view. The effects and defaults as exhibited here suggest 'green' petals, whereas the completed flower has red petals.

> Xp:=Xl: Yp:=Yl/2: Zp:=Zl+2:

> plot3d([Xp,Yp,Zp],rnge); # one petal

[Maple Plot]

The arguments for the rotation are combined into one variable argt and, indirectly, inserted into a sequence of a sequence. Multiple petals are designated with k representing the anglar rotation about the vertical (or stem) and l representing an increase in the vertical. This 'fills in' the petals to make a full bloom.

Of particular note is the procedure p( ) with arguments k and l. The symbolism allows the unassigned variables k and l to be the uultimate arguments of the procedure, carrying through from the first line, following. This sort of construct is easy to see and follow and exhibits one of the best features of symbolic manipulation.

> argt:=k*Pi3+l*Pi9:

> rotation:=[Xp*cos(argt)+Yp*sin(argt),

> Yp*cos(argt)-Xp*sin(argt),Zp+l/2]:

> p :=(k,l)->plot3d(rotation,rnge,

> colour=[sin(2*y)/2,-cos(y)/2,.2]):

> petals:= display([seq(seq(p(k,l),k=0..5),l=0..3)]):

> petals;

[Maple Plot]


The stem, and fitting the stem to the leaves and flower, is tricky. A stem that is a straight tubeplot( ) just doesn't look right. The slight curve is hard to match to the leaves.

> 2*[cos(t)-2*sin(2*t),2*cos(2*t)-sin(t),-cos(t)]:

> plots[tubeplot](%,t=0..2*Pi6,radius=.1,colour=green):

Cutflower Icon

With the petals, the leaves and the stem make up the flower. The routine, below, makes the cutflower ion, used as a linked button, as a .gif file, in html.

> stem0:=translate(rotate(%,Pi2,0,0),0,2.4,-4):

> display3d({petals,leaves,stem0},orientation=[-20,60]);

[Maple Plot]

Combined Flower

The flower icon seems OK but, in fact, it is not placed together correctly. Clock on the figure, drag it around so that the full 3D picture is clear. The flower has its parts, but they are not joined properly, they are rather disassembled.

A trial and error use of translate( ) allows one to relocate the pieces and make a proper 3D, joined cutflower. Including the labels and the frame helps to keep the spatial organisation, while remembering which axis is the x-axis and which is the y-axis.

> stem:=rotate(%%%,Pi2,0,0):

> display3d({petals,leaves,stem},orientation=[-20,60],
labels=[x,y,z], axes=FRAME);

[Maple Plot]

Again, click on the figure. Grab it and rotate it about. You can see how much the petals and the leaves need to be rotated and moved to complete the flower. The rotate( ) command positions the petals and the leaves with the appropriate angle along the stem; the translate( ) command slides the petals and leaves into the right position on the stem.

Note that this is a very crude way! It is better to use the version of rotate( ) that designates the line of rotation by a list of lists (a listlist) of two separate 3D points, a line that lyes along the stem. These points would, notionally, be the points at which the petals and leaves join the stem. Then, separate rotations of the petal and leaf images should not affect the joining positions. The fitting should be smooth and logical, like a starship joining a space station!

> rotate(petals,Pi/12,0,0): translate(%,-2.6,-.5,6):

> rotate(leaves,0,Pi/10,0): translate(%,-4.3,-1.8,6.5):

> display3d({%,%%%,stem},orientation=[150,60],
labels=[x,y,z], axes=FRAME);

[Maple Plot]