LOGO-L> A 3D starship runs in UCB Logo 
Author Message
 LOGO-L> A 3D starship runs in UCB Logo

; Got this stuff from an old BASIC book

to aaa
for [i 90 450 10] [cs ship :i 40 300]
end

to proyect :vec :d
local [x y z xp yp]
make "x item 1 :vec
make "y item 2 :vec
make "z item 3 :vec
make "xp :d * :x / (:d - :z)
make "yp :d * :y / (:d - :z)
op list :xp :yp
end

to rotate :vec :a :b
local [a1 a2 b1 b2 x y z xr yr zr]
make "a1 cos :a
make "a2 sin :a
make "b1 cos :b
make "b2 sin :b
make "x item 1 :vec
make "y item 2 :vec
make "z item 3 :vec
make "xr (:a1 * :x) - (:a2 * :z)
make "yr (:b1 * :y) - (:a1 * :b2 * :z) - (:a2 * :b2 * :x)
make "zr (:b2 * :y) + (:a1 * :b1 * :z) + (:a2 * :b1 * :x)
op (list :xr :yr :zr)
end

to scale :vec :sx :sy :sz
local [x y z xs ys zs]
make "x item 1 :vec
make "y item 2 :vec
make "z item 3 :vec
make "xs :x * :sx
make "ys :y * :sy
make "zs :z * :sz
op (list :xs :ys :zs)
end

to ship :a :b :d

; How about making this part portable so that SuperLogos can use it?
foreach :shipPoints [
run first ?
setpos (proyect (rotate (scale (last ?) 0.4 0.4 0.4) :a :b) :d)
]

end

Make "shipPoints [
[pu [0 0 100]]
[pd [0 10 25]]
[pd [300 0 0]]
[pu [0 10 25]]
[pd [0 40 0]]
[pd [0 83 0]]
[pd [33 83 0]]
[pd [65 35 0]]
[pu [0 40 0]]
[pd [300 0 0]]
[pu [150 4 0]]
[pd [30 0 -100]]
[pd [0 0 -100]]
[pd [0 10 -25]]
[pd [300 0 0]]
[pu [0 10 -25]]
[pd [0 40 0]]
[pu [0 0 -100]]
[pd [0 0 100]]
[pd [30 0 100]]
[pd [150 4 0]]
]

Daniel

---------------------------------------------------------------





Wed, 20 Mar 2002 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. LOGO-L>UCB Logo

2. LOGO-L> 3D - Logo For Beginners

3. LOGO-L> 3d-logo -cosinudid

4. LOGO-L> Robot running LOGO

5. LOGO-L> Apple logo/MSW Logo

6. LOGO-L> Reseach Machines Logo (RM LOGO)

7. LOGO-L> 3d extensions to UCBLogo

8. LOGO-L> 3d isometric code in UCBLogo

9. LOGO-L> MswLogo ver 6.3d

10. LOGO-L> spherical coordinates in 3d

11. LOGO-L> using cylindrical coordinates in 3d

12. LOGO-L> using sphirical coordinates in 3d

 

 
Powered by phpBB® Forum Software