ClipCube (simple 3d)

Help Contents Examples ClipCube (simple 3d)
Citadel Problem Cubic (3d fractal)

ClipCube (simple 3d)

Example:   ClipCube
File name: ClipCube.eli
Modified:  November 21, 2000
Author:    Pavel Hristov Boytchev
Version:   5.0
E-mail:    pavel@elica.net

Copyright © 1999-2000 Elica Group

This example shows the use of a clipping plane and *user-defined object construction* with ondrawimage.

The clipping plane passes through (0,0,0).

run "graphix

to setclipplane :x :p0 :p1 :p2 :p3
	dll.graphix.setclipplane
end

to removeclipplane :x
	dll.graphix.removeclipplane
end

make "t 0

to clipcube :x :y :z :s

	(make local "c2 
		styled (cube point :x :y :z :s) 
			(set "color rgb 0 0 0 "width 1)
	)
	(make local "cu 
		styled (cube point :x :y :z :s) 
			(set "mode 2 "light "true "color rgb_ 1 0.8 0)
	)

	to ondrawimage
		setclipplane  0  sin 2*:t  0  -(cos :t)  sin (1.5*:t)  0
		cu.ondrawimage
		removeclipplane 0
		c2.ondrawimage
	end
end

to changeview
	(lookat 
		vector 21*(cos :t)  21*(sin 1.5*:t)  12 
		vector 0 0 0 
		vector 0 0 1
	)
	make "t :t+1
end

repeat 10000 
[
	make "c clipcube -2.5 -2.5 -2.5 5
	changeview
]

Citadel Problem Cubic (3d fractal)