Home
JAQForum Ver 20.06
Log In or Join  
Active Topics
Local Time 09:42 14 May 2024 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : CMM2: V5.06.00b7 - 3D engine

     Page 4 of 6    
Author Message
toml_12953
Guru

Joined: 13/02/2015
Location: United States
Posts: 328
Posted: 12:43pm 02 Dec 2020
Copy link to clipboard 
Print this post

  matherp said  
  Quote  DRAW3D CREATE with no params locks up the machine.


Seems reasonable. Every bit of extra syntax checking slows the interpreter down. The CREATE command has no optional parameter so why would you expect it to check if you call it without any?

OPTIONS?


That seems to go against the whole philosophy of BASIC. What's next? Taking the checks off array bounds? BASIC error checking and reporting is what makes it safe for beginners to play around with. If you start letting things like that go, beginners will become afraid to use it and that would definitely be against the spirit of BASIC.

I'd expect to get an error message whenever BASIC encountered a command that it couldn't perform. If the speed is slightly slower, then so be it.
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 8601
Posted: 01:11pm 02 Dec 2020
Copy link to clipboard 
Print this post

Please ignore b11 until further notice - something wrong with the compile
 
RetroJoe

Senior Member

Joined: 06/08/2020
Location: Canada
Posts: 290
Posted: 01:13pm 02 Dec 2020
Copy link to clipboard 
Print this post

  toml_12953 said   That seems to go against the whole philosophy of BASIC.


100% agree...the B in BASIC stands for Beginner.  But more importantly, what is the design philosophy behind the MaxiMite platform, historically and going forward?

The CMM2 is the latest in a long line of MM devices designed for engineers and tech hobbyists, but arguably it’s the first one with mass market appeal e.g. to older 8-bit nostalgia folks but also younger “maker” types who are sick of simply consuming content on their iPads and Playstations. These people are tech-savvy, but expect technology to be consumer-friendly (e.g. the reason the Apple II was so wildly successful was because it was fully assembled in a cool-looking case).

If the target market for the CMM2 remains experienced engineers who are happy reading a spec sheet cover to cover to avoid inadvertently activating the ejector seat (see below)  so be it. I consider myself an experienced technologist and can live with the quirkiness, but you’ll lose a lot of potential folks if you don’t also cater to the “newbie” crowd. Tom’s Welcome Tape, for example, are the types of “OOBX” (Out of Box Experience) I think are vital to growing the community.


Edited 2020-12-02 23:15 by RetroJoe
Enjoy Every Sandwich / Joe P.
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 8601
Posted: 01:31pm 02 Dec 2020
Copy link to clipboard 
Print this post

  Quote  Please ignore b11 until further notice - something wrong with the compile


Hopefully OK now so please give it a go

This version also includes a new function CALL(

This works exactly like the CALL command except that it allows you to call a user function based on a variable. Like the CALL command it can only call user defined functions and not built-in ones. For that you have to use eval$ which is considerably less efficient

a$="firstsub"
b$="myadd"
c$="mysub"
? call(b$, 8,9)
? call(c$, sin(rad(90)),7)
? call("sadd$", a$,a$)
'
function mysub(a,b)
 mysub=a+b
end function
'
function myadd(a,b)
 myadd=a+b
end function
'
function sadd$(a$,b$)
sadd$=a$+b$
end function

Edited 2020-12-03 00:06 by matherp
 
qwerty823
Newbie

Joined: 30/07/2020
Location: United States
Posts: 30
Posted: 03:25pm 02 Dec 2020
Copy link to clipboard 
Print this post

With b11 and the stock spinning cube demo, if you pass a small z value to DRAW3D SHOW, then it can lock up the machine. It might be related to drawing to close to the viewplane (or potentially behind the viewplane, which technically should be near clipped, but not sure how the 3d engine handles that).
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 8601
Posted: 03:35pm 02 Dec 2020
Copy link to clipboard 
Print this post

  Quote  but not sure how the 3d engine handles that

Not at all seems to be the answer - I'll look at it
 
qwerty823
Newbie

Joined: 30/07/2020
Location: United States
Posts: 30
Posted: 04:21pm 02 Dec 2020
Copy link to clipboard 
Print this post

Not sure if this is something new to b11, but it seems I can no longer create an array of a single element (unless maybe its too early and my lack of coffee is not letting me think straight):


> new

> option base 0
> DIM integer a(0)
Dimensions

> new

> option base 1
> DIM integer a(1)
Dimensions

>
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 8601
Posted: 04:42pm 02 Dec 2020
Copy link to clipboard 
Print this post

  Quote  Not sure if this is something new to b11, but it seems I can no longer create an array of a single element (unless maybe its too early and my lack of coffee is not letting me think straight):


You never have been able to and can't in any version of MMBasic. Its something I would really like as well but would be one for Geoff as the code is deep within MMBasic.
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 8601
Posted: 05:06pm 02 Dec 2020
Copy link to clipboard 
Print this post

  Quote  Not at all seems to be the answer - I'll look at it


Should be fixed in V5.06.00b12 attached. Whether the display makes sense is another question but it shouldn't lock up.

http://geoffg.net/Downloads/Maximite/CMM2_Beta.zip

In addition I've removed all limits on the number of vertices and faces other than overall memory size

I've also added the option of disabling hidden face culling

DRAW3D SHOW n, x, y, z [,nocull]
DRAW3D WRITE n, x, y, z [,nocull]


Set nocull to 1 to disable calculation of normals and hidden face culling and relies on Painter's algorithm for the display. Omit or set to 0 for normal culling

WHY? So that you can look inside a hollow object. Try using it with our favourite Octahedron but remove one of the faces from the CREATE then as that face rotates past you can see inside
 
qwerty823
Newbie

Joined: 30/07/2020
Location: United States
Posts: 30
Posted: 06:28pm 02 Dec 2020
Copy link to clipboard 
Print this post

Peter,

Have you tried the DRAW3D commands using 5 (or more vertices) per face? I'm trying to convert the data from the dodecahedron VRML file using the spinning cube demo, but it's not drawing anything.

option explicit
option default float
option base 0

dim integer n
dim integer i
dim integer viewplane = 500
const camera = 1
dim x,y,z
dim q(4)
dim yaw=rad(1), pitch=rad(2), roll=rad(0.5)
dim integer nv=20, nf=12

' Read vertices
dim v(2,nv-1)
restore points
for n = 0 to nv-1
 read x,y,z
 v(0,n) = x : v(1,n) = y : v(2,n) = z
next n
math scale v(),100,v()

dim integer fc(nf-1) = (5,5,5,5,5,5,5,5,5,5,5,5)
'dim integer fc(nf-1) = (4,4,4,4,4,4,4,4,4,4,4,4)

dim integer cindex(6)
restore colors
for n = 0 to 5
 read x,y,z
 cindex(n) = rgb(x*255,y*255,z*255)
next n
cindex(6) = rgb(black)

' Face colors
dim integer fcol(nf-1)
restore colorIndex
for n = 0 to nf-1
 read i
 fcol(n) = i
next n

dim integer bcol(nf-1)
math set 6, bcol()

dim integer fv(math(sum fc())-1)
restore coords
for n = 0 to bound(fv())
 read i
 fv(n) = i
next n

'cls
'math m_print v()
'math v_print fc()
'math v_print fv()
'math v_print cindex()
'math v_print bcol()
'math v_print fcol()
'end

draw3d create 1, nv, nf, camera, v(), fc(), fv(), cindex(), bcol(), fcol()
dim integer c
page write 1
draw3d camera 1, viewplane, mm.hres\2, mm.vres\4
do
 for c=0 to 720
   timer=0
   draw3d show 1, mm.hres\2, mm.vres\2, 500+c
   math q_euler yaw, pitch, roll, q()
   draw3d rotate q(), 1
   inc yaw, rad(1)
   inc pitch, rad(2)
   inc roll, rad(0.5)
   text 0, 0, str$(1000/timer)
   page copy 1 to 0,b
 next
loop
draw3d close all

points:
Data 1.0, 1.0, 1.0
Data 1.0, 1.0, -1.0
Data 1.0, -1.0, 1.0
Data 1.0, -1.0, -1.0
Data -1.0, 1.0, 1.0
Data -1.0, 1.0, -1.0
Data -1.0, -1.0, 1.0
Data -1.0, -1.0, -1.0
Data 0.618, 1.618, 0.0
Data -0.618, 1.618, 0.0
Data 0.618, -1.618, 0.0
Data -0.618, -1.618, 0.0
Data 1.618, 0.0, 0.618
Data 1.618,  0.0, -0.618
Data -1.618, 0.0, 0.618
Data -1.618,  0.0, -0.618
Data 0.0, 0.618, 1.618
Data 0.0, -0.618, 1.618
Data 0.0, 0.618, -1.618
Data 0.0, -0.618, -1.618

coords:
Data 1,  8, 0, 12, 13
Data 4,  9, 5, 15, 14
Data 2, 10, 3, 13, 12
Data 7, 11, 6, 14, 15
Data 2, 12, 0, 16, 17
Data 1, 13, 3, 19, 18
Data 4, 14, 6, 17, 16
Data 7, 15, 5, 18, 19
Data 4, 16, 0,  8,  9
Data 2, 17, 6, 11, 10
Data 1, 18, 5,  9,  8
Data 7, 19, 3, 10, 11

coords2:
Data 13, 12, 0, 8, 1
Data 14, 15, 5, 9, 4
Data 12, 13, 3, 10, 2
Data 15, 14, 5, 11, 7
Data 17, 16, 0, 12, 2
Data 18, 19, 3, 13, 1
Data 16, 17, 6, 14, 4
Data 19, 18, 5, 15, 7
Data 9, 8, 0, 16, 4
Data 10, 11, 6, 17, 2
Data 8, 9, 5, 17, 2
Data 11, 10, 3, 19, 7

colors:
Data 0.0, 0.0, 1.0
Data 0.0, 1.0, 0.0
Data 0.0, 1.0, 1.0
Data 1.0, 0.0, 0.0
Data 1.0, 0.0, 1.0
Data 1.0, 1.0, 0.0

colorIndex:
Data 0, 1, 1, 0, 2, 3, 3, 2, 4, 5, 5, 4


If you toggle the comments between these two lines, it works (albeit with a weird geometry).

dim integer fc(nf-1) = (5,5,5,5,5,5,5,5,5,5,5,5)
'dim integer fc(nf-1) = (4,4,4,4,4,4,4,4,4,4,4,4)


Also, I included data for the coords in the same order in the VRML and in reverse order, in case one is clockwise vs counter-clockwise. You can switch between them by changing 'restore coords' vs 'restore coords2'

I'm hoping you (or someone else) might see an obvious mistake I've made, or perhaps it uncovered a bug.

Thanks,
David
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 8601
Posted: 06:55pm 02 Dec 2020
Copy link to clipboard 
Print this post

David

Its a stupid bug I introduced. Forgot to copy the colour when there are more than 4 vertices. If you download b12 again it should be fixed.

In addition I've added a diagnostic to help debug the configuration data for 3D objects.

After you have created the object and set a camera position you can use the command

DRAW3D DIAGNOSE objectno, x, y, z


This calculates the position of the 3D object and then lists the faces in depth order with an analysis of whether they would be hidden or not based on their surface normal.

This should make it much easier to test the object data to confirm that the vertex ordering for each of the faces is correct.

Correctly specified object

Face 3 at distance  600.0000 is Hidden
Face 0 at distance  509.9019 is Hidden
Face 1 at distance  509.9019 is Hidden
Face 2 at distance  509.9019 is Hidden
Face 4 at distance  509.9019 is Hidden
Face 5 at distance  438.4315 is Showing
Face 6 at distance  438.4315 is Showing
Face 7 at distance  438.4315 is Showing
Face 8 at distance  438.4315 is Showing


The bucky ball object

Face 12 at distance 1214.5010 is Showing
Face 13 at distance 1214.5010 is Hidden
Face 0 at distance 1204.2164 is Hidden
Face 2 at distance 1204.2164 is Showing
Face 24 at distance 1145.9534 is Showing
Face 26 at distance 1145.9534 is Hidden
Face 28 at distance 1145.9534 is Hidden
Face 30 at distance 1145.9534 is Showing
Face 8 at distance 1139.6891 is Hidden
Face 10 at distance 1139.6891 is Showing
Face 17 at distance 1101.4578 is Hidden
Face 19 at distance 1101.4578 is Showing
Face 4 at distance 1026.7277 is Hidden
Face 5 at distance 1026.7277 is Showing
Face 6 at distance 1026.7277 is Showing
Face 7 at distance 1026.7277 is Hidden
Face 20 at distance 1025.3807 is Showing
Face 21 at distance 1025.3807 is Hidden
Face 22 at distance 1025.3807 is Hidden
Face 23 at distance 1025.3807 is Showing
Face 16 at distance  943.1874 is Hidden
Face 18 at distance  943.1874 is Showing
Face 9 at distance  899.6935 is Hidden
Face 11 at distance  899.6935 is Hidden
Face 25 at distance  888.5958 is Showing
Face 29 at distance  888.5958 is Hidden
Face 27 at distance  888.5957 is Hidden
Face 31 at distance  888.5957 is Showing
Face 1 at distance  811.2966 is Hidden
Face 3 at distance  811.2966 is Showing
Face 14 at distance  792.3376 is Hidden
Face 15 at distance  792.3376 is Showing


Some work needed I think  
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 8601
Posted: 07:26pm 02 Dec 2020
Copy link to clipboard 
Print this post

Try this on b12. The speed is ridiculous

option explicit
option default none
mode 2
dim float phi=(1+sqr(5))/2
' data for location of verticies for of edge length 2
data 0,1,3*phi
data 0,1,-3*phi
data 0,-1,3*phi
data 0,-1,-3*phi
data 1,3*phi,0
data 1,-3*phi,0
data -1,3*phi,0
data -1,-3*phi,0
data 3*phi,0,1
data 3*phi,0,-1
data -3*phi,0,1
data -3*phi,0,-1
data 2,(1+2*phi),phi
data 2,(1+2*phi),-phi
data 2,-(1+2*phi),phi
data 2,-(1+2*phi),-phi
data -2,(1+2*phi),phi
data -2,(1+2*phi),-phi
data -2,-(1+2*phi),phi
data -2,-(1+2*phi),-phi
data (1+2*phi),phi,2
data (1+2*phi),phi,-2
data (1+2*phi),-phi,2
data (1+2*phi),-phi,-2
data -(1+2*phi),phi,2
data -(1+2*phi),phi,-2
data -(1+2*phi),-phi,2
data -(1+2*phi),-phi,-2
data phi,2,(1+2*phi)
data phi,2,-(1+2*phi)
data phi,-2,(1+2*phi)
data phi,-2,-(1+2*phi)
data -phi,2,(1+2*phi)
data -phi,2,-(1+2*phi)
data -phi,-2,(1+2*phi)
data -phi,-2,-(1+2*phi)
data 1,(2+phi),2*phi
data 1,(2+phi),-2*phi
data 1,-(2+phi),2*phi
data 1,-(2+phi),-2*phi
data -1,(2+phi),2*phi
data -1,(2+phi),-2*phi
data -1,-(2+phi),2*phi
data -1,-(2+phi),-2*phi
data (2+phi),2*phi,1
data (2+phi),2*phi,-1
data (2+phi),-2*phi,1
data (2+phi),-2*phi,-1
data -(2+phi),2*phi,1
data -(2+phi),2*phi,-1
data -(2+phi),-2*phi,1
data -(2+phi),-2*phi,-1
data 2*phi,1,(2+phi)
data 2*phi,1,-(2+phi)
data 2*phi,-1,(2+phi)
data 2*phi,-1,-(2+phi)
data -2*phi,1,(2+phi)
data -2*phi,1,-(2+phi)
data -2*phi,-1,(2+phi)
data -2*phi,-1,-(2+phi)
' 12 faces with 5 sides
data 0,28,36,40,32
data 33,41,37,29,1
data 34,42,38,30,2
data 3,31,39,43,35
data 4,12,44,45,13
data 15,47,46,14,5
data 17,49,48,16,6
data 7,18,50,51,19
data 8,20,52,54,22
data 23,55,53,21,9
data 26,58,56,24,10
data 25,57,59,27,11
' 20 faces with 6 sides
data 32,56,58,34,2,0
data 0,2,30,54,52,28
data 29,53,55,31,3,1
data 1,3,35,59,57,33
data 13,37,41,17,6,4
data 4,6,16,40,36,12
data 5,7,19,43,39,15
data 14,38,42,18,7,5
data 22,46,47,23,9,8
data 8,9,21,45,44,20
data 10,11,27,51,50,26
data 24,48,49,25,11,10
data 36,28,52,20,44,12
data 13,45,21,53,29,37
data 14,46,22,54,30,38
data 39,31,55,23,47,15
data 16,48,24,56,32,40
data 41,33,57,25,49,17
data 42,34,58,26,50,18
data 19,51,27,59,35,43
'
dim float q1(4)
dim integer i, j, nf=32, nv=60, camera=1
dim float vertices(2,59)
' read in the coordinates of the verticies and scale
for j=0 to 59
for i=0 to 2
  read vertices(i,j)
  vertices(i,j)=vertices(i,j)*50
next i
next j
'math scale vertices(),50,vertices()
'
dim integer faces(179)
for i=0 to 179
 read faces(i)
next i

dim integer fc(31)=  (5,5,5,5,5,5,5,5,5,5,5,5,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6)
dim integer colours(2)=(rgb(red),rgb(white),rgb(black))
dim integer edge(31)=(2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2)
dim integer fill(31)=(0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1)
math q_create rad(2),1,0.5,0.25,q1()
draw3d create 1, nv,nf, camera, vertices(), fc(), faces(), colours(), edge(), fill()
draw3d camera 1,800,mm.hres\2,mm.vres\2
'draw3d diagnose 1,mm.hres\2,mm.vres\2,1000
page write 1
draw3d show 1,mm.hres\2,mm.vres\2,1000
do
draw3d rotate q1(),1
draw3d show 1,mm.hres\2,mm.vres\2,1000
draw3d reset 1
page copy 1 to 0
loop
 
qwerty823
Newbie

Joined: 30/07/2020
Location: United States
Posts: 30
Posted: 07:35pm 02 Dec 2020
Copy link to clipboard 
Print this post

  matherp said  Try this on b12. The speed is ridiculous


I had to put a 'pause 10' just so I could slow it down and see it. Now I REALLY want to build a loader using this for some of the bigger ply files from the DemoX folder, but I really need to get back to work.

Really nice work, Peter.  
 
vegipete

Guru

Joined: 29/01/2013
Location: Canada
Posts: 1084
Posted: 08:05pm 02 Dec 2020
Copy link to clipboard 
Print this post

  matherp said  V5.06.00b11

Note: The firmware is 758332 bytes long. You are strongly recommended to update using a USB A-A cable rather than over the serial connection. This is a lot of bytes to transfer over serial with no error correction!

Them thar's alotta bytes. Bill may have said something about 640K being more than enough. All those bytes to emulate something from the early eighties, when a tricked out machine might have had a full 64K of ROM and RAM. Lovin' it!

"CMM2V5.05.06RC22.bin" has been getting a free ride in all the latest beta release zip files.

I've been updating my Waveshare CMM2 with the micro-usb jack. I stacked an extra header onto each header for clearance over the 40 pin I/O header. The keyboard must be unplugged for this to work, plus I must manipulate the switches, but it has proven fast and reliable.
Visit Vegipete's *Mite Library for cool programs.
 
toml_12953
Guru

Joined: 13/02/2015
Location: United States
Posts: 328
Posted: 08:39pm 02 Dec 2020
Copy link to clipboard 
Print this post

  vegipete said  

"CMM2V5.05.06RC22.bin" has been getting a free ride in all the latest beta release zip files.


It's a good thing, too. My unit doesn't work with betas up through b10 but works fine with RC22. I'm hesitant to try b11 or b12 since whatever it is my system doesn't like about the betas doesn't seem to have been addressed.
 
vegipete

Guru

Joined: 29/01/2013
Location: Canada
Posts: 1084
Posted: 08:54pm 02 Dec 2020
Copy link to clipboard 
Print this post

Newly broken:

It looks like the polygon closing line is not being drawn when it is vertical and ... something else.

This doesn't work:
dim x(7) = (400, 200, 400, 0, 0, 0, 0, 0)
dim y(7) = (172, 300, 498, 0, 0, 0, 0, 0)
n = 3
polygon n,x(),y()

Change either of the x=400 to something else, x(2)=401 say, and it works.
Visit Vegipete's *Mite Library for cool programs.
 
vegipete

Guru

Joined: 29/01/2013
Location: Canada
Posts: 1084
Posted: 09:02pm 02 Dec 2020
Copy link to clipboard 
Print this post

Here is the Platonic Solid vertex and face data I have been using. These should be unit sized - all vertices should lie on the surface of a sphere of radius 1.

Note the cube is NOT body centered. Instead, one vertex is at the origin. I leave it as an exercise for the reader to convert it to a proper unit sized cube. (Hint, cube root of 3 is important.)

In case it is not clear, the value '-1' indicates the end of the list of vertices for each given face.
tetrashape:
' vertices (first value is count)
data  4, 0.576,0.576,0.576, -0.576,-0.576,0.576, -0.576,0.576,-0.576, 0.576,-0.576,-0.576
' faces (first value is count)
data  4
data  0,2,1,-1
data  0,1,3,-1
data  0,3,2,-1
data  1,2,3,-1

cubeshape:
data 8  ' vertices
data 0,0,0,      0.577,0,0,      0.577,0.577,0,      0,0.577,0
data 0,0,0.577,  0.577,0,0.577,  0.577,0.577,0.577,  0,0.577,0.577

data 6  ' faces
data 0,1,5,4,-1,  1,2,6,5,-1,  4,5,6,7,-1,  0,3,2,1,-1,  0,4,7,3,-1,  2,3,7,6,-1

octashape:
data 6
' vertices    0      1       2       3      4      5
data        0,1,0, 1,0,0, -1,0,0, 0,-1,0, 0,0,1, 0,0,-1
' faces
data 8
data  4,2,3,-1,  4,3,1,-1,  4,1,0,-1,  4,0,2,-1
data  5,3,2,-1,  5,1,3,-1,  5,0,1,-1,  5,2,0,-1

dodecashape:
data 20  ' vertices
data 0.577, 0.577, 0.577,  0.577, 0.577,-0.577,  0.577,-0.577, 0.577, -0.577, 0.577, 0.577
data 0.577,-0.577,-0.577, -0.577, 0.577,-0.577, -0.577,-0.577, 0.577, -0.577,-0.577,-0.577
data 0.000, 0.934, 0.357,  0.000,-0.934, 0.357,  0.000, 0.934,-0.357,  0.000,-0.934,-0.357
data 0.357, 0.000, 0.934, -0.357, 0.000, 0.934,  0.357, 0.000,-0.934, -0.357, 0.000,-0.934
data 0.934, 0.357, 0.000, -0.934, 0.357, 0.000,  0.934,-0.357, 0.000, -0.934,-0.357, 0.000

data 12  ' faces
data 2,12,13,6,9,-1
data 0,8,3,13,12,-1
data 0,12,2,18,16,-1
data 3,17,19,6,13,-1
data 0,16,1,10,8,-1
data 3,8,10,5,17,-1
data 6,19,7,11,9,-1
data 2,9,11,4,18,-1
data 1,16,18,4,14,-1
data 5,15,7,19,17,-1
data 1,14,15,5,10,-1
data 4,11,7,15,14,-1

icosashape:
' vertices
data 12
data 0,0.528,0.852, 0,-0.528,0.852, 0,0.528,-0.852, 0,-0.528,-0.852
data 0.528,0.852,0, -0.528,0.852,0, 0.528,-0.852,0, -0.528,-0.852,0
data 0.852,0,0.528, 0.852,0,-0.528, -0.852,0,0.528, -0.852,0,-0.528

' faces
data 20
data  1, 6, 8,-1,     1, 8, 0,-1,     1, 0,10,-1,     1,10, 7,-1    ' vertices for
data  1, 7, 6,-1,     6, 7, 3,-1,     6, 3, 9,-1,     6, 9, 8,-1    '  each face in
data  8, 9, 4,-1,     8, 4, 0,-1,     0, 4, 5,-1,     0, 5,10,-1    '  counter-clockwise
data 10, 5,11,-1,    10,11, 7,-1,     7,11, 3,-1,     3,11, 2,-1    '  order
data  2,11, 5,-1,     2, 5, 4,-1,     2, 4, 9,-1,     2, 9, 3,-1

Edited 2020-12-03 07:04 by vegipete
Visit Vegipete's *Mite Library for cool programs.
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 8601
Posted: 10:51pm 02 Dec 2020
Copy link to clipboard 
Print this post

  Quote  Newly broken:


Fixed if you re-download
 
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 3858
Posted: 11:53am 03 Dec 2020
Copy link to clipboard 
Print this post

  matherp said  This version also includes a new function CALL( ...


Nice.

@matherp I offer the following not necessarily because I think it is a good idea, but because it might cause you to have a good idea.

Make the CALL and EVAL functions synonyms with the following pseudo-implementation:

IF the function hash map contains arg1 THEN
 RETURN result of calling function named arg1 with arguments arg2, arg3, ...
ELSE
 RETURN result of EVALuating arg1
ENDIF


In the latter case you could consider two options of how to handle arg2, arg3, arg4 ... if they exist.

1. Report an error.

2. Let arg1 contain placeholder markers, e.g. @1, @2, @3 and paste in the values of the correponding arguments before evaluating.

Why would you do such a thing? .. and remember I'm not saying you should.

1. Making CALL and EVAL synonyms frees up a FUNCTION slot.

2. Allows this to happen:


' Transforms the elements of a%().
SUB transint(a%(), transform$)
 Local i%, lb% = Bounds(a%(), 0), ub% = Bounds(a$(), 1)
 For i% = lb% To ub%
   a%(i%) = CALL(transform$, a%(i%))
 Next
END SUB

Function my_square%(x%)
 my_square% = x% * x%
End Function

Dim a%(10) = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }

' Replace every value in the array with its square.
transint(a%(), "my_square%")

' Also square every value in the array, but without the need to declare an
' additional function.
transint(a%(), "@1 * @1")

' Add 5 to every value in the array.
transint(a$(), "@1 + 5")


I'm probably mad and I'm certainly stretching the definition of BASIC.

Tom
Edited 2020-12-03 21:54 by thwill
Game*Mite, CMM2 Welcome Tape, Creaky old text adventures
 
toml_12953
Guru

Joined: 13/02/2015
Location: United States
Posts: 328
Posted: 03:12pm 03 Dec 2020
Copy link to clipboard 
Print this post

What do the betas do with flash that's different from RC22? RC22 works perfectly in my system but all the betas (up through b12 at least) cause flash corruption, lockups and crashes when I make the least little change to OPTIONS. If I knew what the difference was, maybe I could sort of diagnose this thing.
 
     Page 4 of 6    
Print this page
© JAQ Software 2024