Honey (3d)

Help Contents Examples Honey (3d)
Heart House (3d)

Honey (3d)

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

Copyright © 1999-2000 Elica Group

This example shows how to construct 3D objects with one nonplanar polygon. Each cone from the example is a single polygon.

run "graphix

; A procedure for changing the point of view
make "t 0
make "q 0
make "tt 2

to changeview
	make "t :t+:tt
	make "q :q+2
	(lookat 
		point  9*(cos :t)  9*(sin :t)  4+3.5*(sin :q/1.5) 
		vector 0 0 0 
		vector 0 0 1
	)
end

; Definition of one mosaic object
; which is the simples component of 
; the honey plate
to mosaic :center :r :n

	run bf :polygon

	make local "multicolor "true
	make local "mode 2

	make "da 360/:n
	make "a 0
	make "i 2
	changeview

	if (random) > 0.5
	[
		(make local "points.#1
			styled (point :center.x :center.y 0) 
				(set "color rgb_ (random) (random) (random))
		)
	]
	[
		(make local "points.#1 
			styled (point :center.x :center.y 0.2) 
				(set "color rgb_ 1 1 1)
		)
	]
	repeat :n+1
	[
		(make "col 
			(rgb_
				0.5+:center.x
				0.5+:center.y
				0.5-(:center.x+:center.y)/2
			)
		)
		(make local word "points.# :i 
			styled (point :center.x+:r*(cos :a) :center.y+:r*(sin :a) 0) 
			(set "color :col)
		)
		make "a :a+:da
		make "i :i+1
		changeview
	]
end


; Draw the honey plate
make "jx (-5)
repeat 11
[
	make "jy (-10)
	repeat 21
	[
		if (:jx+:jy) imod 2 = 0 
		[
			make (word "m :jx :jy) mosaic point 0.19*:jx 0.1*:jy 0 0.25 6
		]
		make "jy :jy+1
	]
	make "jx :jx+1
]

; Change the point of view
repeat 1000 [ changeview ]

Heart House (3d)