1. No response?
- Posted by Noah Smith <nhs6080 at UNIX.TAMU.EDU> Sep 18, 1998
- 496 views
What no response to my challenge? Well, the Bogo Vault has no bounds: Using only the "open" function, write a function which returns all files in a directory. snortboy
2. Re: No response?
- Posted by Lewis Townsend <keroltarr at HOTMAIL.COM> Sep 18, 1998
- 468 views
Hey, >What no response to my challenge? > >Well, the Bogo Vault has no bounds: > >Using only the "open" function, write a function which returns all files >in a directory. > >snortboy Hey man, give people a chance. I'm considdering your chalenge but I have other things to do as well. Just slow down and you could start some cool threads. Right now I'm trying to figure out the formula for the distance between two 3D points. My math teacher wasn't any help. He said he couldn't remember but that it would probably be in a calculus book somewhere in chapters 12-14. And he didn't even loan me a book, he told me to get one at the library (yeah right or ask a math Tutor. So, can anyone help me here? What I'm trying to do is enhance the 3d function that Lithex (I think) posted in response to a question. It works fine except that it calculates perspective with Z-distance rather than real distance. -- original function function perspective (sequence thing, sequence eye) sequence t, i atom r r = thing [Z] / (thing [Z] - eye [Z]) -- Notice this line**** t=thing[X..Y] i=eye[X..Y] return (t + r * (i - t)) end function I want a function that replaces this line: r = thing [Z] / (thing [Z] - eye [Z]) with something that uses the 3D distance formula instead of: (thing [Z] - eye [Z]) which is only 100% accurate when "thing" is in a strait Z-direction from "eye" Any help would be appreciated; also functions for rotating 3D objects and the camera (eye) are welcome. Sincerely, Lewis Townsend PS No, I'm not making another 3D graphics game engine with gourad shading, texture maping etc... I'm just trying to learn all I can about 3D stuff so I can use the REAL engines better and maybe make a few graphics demos and games while I'm at it. PPS Also, the function above seems to be able to to "see" things that are "behind" the eye and that just doesn't seem right some how. ______________________________________________________ Get Your Private, Free Email at http://www.hotmail.com
3. Re: No response?
- Posted by Noah Smith <nhs6080 at UNIX.TAMU.EDU> Sep 18, 1998
- 487 views
For any of those interested in the Bogo Ellipse Function, email me at nhs6080 at unix.tamu.edu and I'll send you my "algebraic ellipse" package. Its a webpage which describes the definition and construction of an ellipse, algebraically. snortboy
4. Re: No response?
- Posted by lithex <lithex at INTERGATE.BC.CA> Sep 18, 1998
- 462 views
Hi The formula for 3d distance is almost the same as the one for 2d distance for the points (x1, y1, z1) and (x2, y2, z2) instead of distance=((x2-x1)^2+(y2-y1)^2)^.5 as in 2d just do distance=((x2-x1)^2+(y2-y1)^2+(z2-z1)^2)^.5 I think in Euphoria we might do something like this: --Start of Euphoria Code sequence p1, p2 atom distance p1={1,2,3) ---- 3d coordinates of point 1 p2={4,5,6) ---- 3d coordinates of point 2 distance=((p2[1]-p1[1])^2 + (p2[2]-p1[2])^2 + (p2[3]-p1[3])^2)^.5 -- End of Euphoria Code This code is just off the top of my head - I'm sure a much more elegant and compact expression is possible in Euphoria. Bye Martin
5. Re: No response?
- Posted by Mycroft <Mycroft at STLNET.COM> Aug 09, 1998
- 486 views
Lewis Townsend wrote: > > Hey, > > >What no response to my challenge? > > > >Well, the Bogo Vault has no bounds: > > > >Using only the "open" function, write a function which returns all > files > >in a directory. > > > >snortboy > > Hey man, give people a chance. I'm considdering your chalenge but I > have other things to do as well. Just slow down and you could start > some cool threads. > > Right now I'm trying to figure out the formula for the distance between > two 3D points. My math teacher wasn't any help. He said he couldn't > remember but that it would probably be in a calculus book somewhere in > chapters 12-14. And he didn't even loan me a book, he told me to get > one at the library (yeah right or ask a math Tutor. So, can anyone > help me here? What I'm trying to do is enhance the 3d function that > Lithex (I think) posted in response to a question. It works fine except > that it calculates perspective with Z-distance rather than real > distance. > > -- original function > function perspective (sequence thing, sequence eye) > sequence t, i > atom r > r = thing [Z] / (thing [Z] - eye [Z]) -- Notice this line**** > t=thing[X..Y] i=eye[X..Y] > return (t + r * (i - t)) > end function > > I want a function that replaces this line: > r = thing [Z] / (thing [Z] - eye [Z]) > with something that uses the 3D distance formula instead of: > (thing [Z] - eye [Z]) > which is only 100% accurate when "thing" is in a strait Z-direction from > "eye" > > Any help would be appreciated; also functions for rotating 3D objects > and the camera (eye) are welcome. > > Sincerely, > Lewis Townsend <snip> the distance between two points in 3d space is almost the same as for 2d, it's the suare root of the sum of the squares of the disatnce along each axis. eg: distance = sqroot(xdistance+ydistance+zdistance) Kasey
6. Re: No response?
- Posted by lithex <lithex at INTERGATE.BC.CA> Sep 18, 1998
- 491 views
- Last edited Sep 19, 1998
I made a bit of a mistake > > I think in Euphoria we might do something like this: > > --Start of Euphoria Code > sequence p1, p2 > atom distance > > p1={1,2,3) ---- 3d coordinates of point 1 > p2={4,5,6) ---- 3d coordinates of point 2 > distance=((p2[1]-p1[1])^2 + (p2[2]-p1[2])^2 + (p2[3]-p1[3])^2)^.5 lets make this: distance=(power((p2[1]-p1[1]),2) +power((p2[2]-p1[2])^2 + (p2[3]-p1[3]),2))^.5 > > -- End of Euphoria Code > > Bye Martin
7. Re: No response?
- Posted by Hawke <mdeland at NWINFO.NET> Sep 18, 1998
- 497 views
- Last edited Sep 19, 1998
Noah Smith wrote: >Using only the "open" function, write a function >which returns all files in a directory. here's my attempt... seems to work and is tested code... this is almost assuredly *not* the fastest way to do this, but it meets the given problem's criteria... Enjoy the wait... ------------begin --I hereby declare and understand that ValidChars may *NOT* --represent *all* possible characters that can appear in a filename. --It's a good stab at it tho...and it's easy enuff to change... constant ValidChars=" abcdefghijklmnopqrstuvwxyz1234567890-_~@${}" --these are actually devices, not files, so we exclude them... constant Bad={ "nul . ","prn . ", "aux . ","con . ", "com1 . ","com2 . ", "com3 . ","com4 . " } constant TRUE=1, FALSE=0 sequence try,found integer lengthVC atom now function IsBadName(sequence test) for i = 1 to length(Bad) do if compare(test,Bad[i]) = 0 then return TRUE end if end for return FALSE end function function Exists(sequence filename) if open(filename,"r") = -1 then return FALSE end if return TRUE end function procedure ShowList(sequence list) --Go crazy here, make it as fancy as you want. I opt for simple since --the output for the problem wasn't specified. position (2,1) for i = 1 to length(list) do puts (1,"'" & list[i] & "' ") end for end procedure procedure ScrollNames() for try12 =1 to lengthVC do try[12] = ValidChars[try12] for try11 =1 to lengthVC do try[11] = ValidChars[try11] for try10 =1 to lengthVC do try[10] = ValidChars[try10] for try8 =1 to lengthVC do --note:skip 9 here, it's the '.' try[8] = ValidChars[try8] for try7 =1 to lengthVC do try[7] = ValidChars[try7] for try6 =1 to lengthVC do try[6] = ValidChars[try6] for try5 =1 to lengthVC do try[5] = ValidChars[try5] for try4 =1 to lengthVC do try[4] = ValidChars[try4] for try3=1 to lengthVC do try[3] = ValidChars[try3] for try2=1 to lengthVC do try[2] = ValidChars[try2] for try1=1 to lengthVC do try[1] = ValidChars[try1] --for speed, these lines are commented out --to see it work, uncomment the next 2 lines --position(1,1) --puts(1,try) if Exists(try) and (not IsBadName(try)) then found = append(found,try) --for speed, leave this commented --to see it work, uncomment it --ShowList(found) end if end for end for end for end for end for end for end for end for end for end for end for end procedure --MAIN clear_screen() found = {} try=repeat(' ',12) try[9]='.' lengthVC=length(ValidChars) now = time() ScrollNames() ShowList(found) printf(1,"It took %f seconds to do this DIR",time()-now) --did you actually wait to see the above line printed??? ;) ---------------end --Hawke'
8. Re: No response?
- Posted by Noah Smith <nhs6080 at UNIX.TAMU.EDU> Sep 19, 1998
- 480 views
What?! Return code so quickly? You mock the Bogo Vault!! Actually, both responses were good responses (and nearly identical to the code that was actually written to perform these tasks.) The Score So Far? Lithex: 1 point for solution; -1 point (lacking some algorithmic optimization) Hawke: 1 point for solution; -1,000,000 for brain cells wasted on algorithm The next Bogo Problem? A _random_ sort function. That's right, you may use any comparison technique your little heart desires, as long as the next element is chosen randomly. ,morF yteicoS s'remmargorP ogoB ehT
9. Re: No response?
- Posted by Matt Z Nunyabidness <matt1421 at JUNO.COM> Sep 19, 1998
- 474 views
>,morF yteicoS s'remmargorP ogoB ehT < From, The Bogo Programmer's Society _____________________________________________________________________ You don't need to buy Internet access to use free Internet e-mail. Get completely free e-mail from Juno at http://www.juno.com Or call Juno at (800) 654-JUNO [654-5866]