Rose (3d)

Help Contents Examples Rose (3d)
Reflection Ryzhik (geometry)

Rose (3d)

Example:   Rose
File name: Rose.eli
Modified:  May 21, 2000
Author:    Pavel Christov Boychev
Version:   5.0
E-mail:    pavel@elica.net

Copyright © 1999-2000 Elica Group

This example is a mathematical representation of a rose. The contour is generated as a spiraly positioned cycloid.

run "graphix

make "z 0
make "dz 3
make "dr 0.5

; The rotating disk, which follows a spiral path
make "disk styled (circle (point 0 0 :dr) :dr vector 0 1 0) (set
		"mode 1
		"color rgb 255 205 165
		"precision 16)

; The spot on the disk, used for generating the cycloid
make "spot styled (sphere (point 0 0 2*:dr) 0.05) (set
		"mode 1
		"color rgb 155 155 0
		"precision 5 )

make "z 0
make "t 0
make "O point 0 0 0
make "UP point 0 0 10
lookat point 8 0 5 :O :UP

; Let's make the rose
repeat 444
[
	make "r 1+:z/600
	make "cz cos :z
	make "sz sin :z
	make "ct cos :t
	make "st sin :t
	make "disk.center point :r*:cz :r*:sz :dr
	make "disk.focus point :cz :sz 0

	make "spot.center (point
		:disk.center.x/2+(:r)*:cz/2+(:dr)*:ct*:sz
		:disk.center.y/2+(:r)*:sz/2-(:dr)*:ct*:cz
		:disk.center.z+(:dr-0.1)*:st ) 

	make word "c :z styled (point :spot.center.x :spot.center.y :spot.center.z) (set "color rgb 128 0 0)
	make word "t :z styled (segment point :spot.center.x/2 :spot.center.y/2 0 :(word "c :z)) (set "color rgb 200 60 50)

	if :z>0
	[
		make word "r :z styled (segment :(word "c :z-:dz) :(word "c :z)) (set "color rgb 128 0 0) 
	]
	make "z :z+:dz
	make "t :t+:dz*:r/:dr
]

; The rose is ready, let's turn it to see all its beauty
make "r (2+5*:r)
make "dz 0.1
make "z 0

repeat 360*5
[
	lookat point :r*(cos :z) :r*(sin :z) 10+10*(sin :z/2) :O :UP
	make "dz :dz+0.01
	make "z :z+:dz
]

Reflection Ryzhik (geometry)