MSWLogo 3D is not released yet. Still testing/documenting. to aaa ; ; This is a MSWLogo 3D example where I have written a simple ".3DV" ; file viewer. 3DV is a simple public domain format for 3D Vectors. ; ; Do not confuse how this "Shuttle" database was built. ; Do not confuse how you "normally" build 3D objects in MSWLogo. ; ; This example was just done for a completeness test. The data is ; absolute and uses SETXYZ for all drawing. ; ; It's a good example of how to use file and Array operations. ; ; It's also an example of seeing how I took "foreign" data from the ; internet and used it in logo. There is TONS of "data" out their. ; Mars weather statistics, continental drift statistics, etc. that ; can be used for all sorts of projects. ; shuttle end to object_display local "vtx local "cmd repeat :commands ~ [ ; Get a command. Format [VertexIndex Color] Color = 0 means "Move" make "cmd (item repcount :command) ; Get the vertex. Format [X Y Z] make "vtx (item (item 1 :cmd) :vertex) ; If color 0 then Move else Draw (I'm ingoring the color, not RGB Yuck) ifelse (item 2 :cmd) = 0 [pu] [pd] ; Move or draw to the vertex setxyz (item 1 :vtx) (item 2 :vtx) (item 3 :vtx) ] end to object_load :file ; Start in known state closeall ; Open Vectors Commands openread :file setread :file ; Get # of vertices (1st record of file) make "vertices first readlist ; Now build a "Vertex" array based on # of vertices make "vertex (array :vertices 1) ; Now read in each "Vertex". Format [X Y Z] repeat :vertices [setitem repcount :vertex readlist] ; Get # of "commands" (comes after all vertices) make "commands first readlist ; Now build a "Command" array based on # of commands make "command (array :commands 1) ; Now read in each "Command". Format [Vertex_Index Color] repeat :commands [setitem repcount :command readlist] ; Done setread [] close :file end to shuttle local "start local "finish ht perspective cs ; We have to stand WAY back for this baby setturtle -1 setxyz 30000 20000 30000 setturtle 0 ; Load Shuttle Vectors object_load "3dv\\shuttle.3dv ; Time and Display Shuttle make "start timemilli object_display make "finish (timemilli - :start) / 600 show (sentence :commands "3D "Commands "in :finish "seconds) ; It takes about 3 seconds on P133 end -- =============================================================== George Mills email: mills@softronix.com http://www.softronix.com The www page contains some very powerful educational software. Our single most important investment is our kids.
Global SchoolNet Foundation -
Linking Kids Around the World!
Copyright GSN - All Rights Reserved
- Comments
& Questions
Visit GSN's
Global
Schoolhouse for more exciting learning resources!
Search our Site
-
Home