World: r3wp
[Rebol School] Rebol School
older newer | first last |
kib2 8-Feb-2009 [1868] | Steeve : the purpose is to create a geometrical drawing dialect. Maybe I'll have a line (AB) that intersects an ellipsis and I wanted to use the intersection points |
Steeve 8-Feb-2009 [1869] | with Rebol ? |
Anton 8-Feb-2009 [1870] | *ding! did you mean Ellipse ? |
kib2 8-Feb-2009 [1871x2] | Anton: yes, sorry :) |
Steeve: why not ? | |
Anton 8-Feb-2009 [1873] | Why didn't you say so ? :) |
Geomol 8-Feb-2009 [1874] | lol |
Anton 8-Feb-2009 [1875] | .. because this is where I step in: http://anton.wildit.net.au/rebol/gfx/demo-intersection-points-of-line-and-ellipse.r http://anton.wildit.net.au/rebol/gfx/demo-intersection-points-of-line-and-circle.r |
Steeve 8-Feb-2009 [1876] | Kib as i stated previously, if you don't need of the exact coordinates then you should use boolean operators of the graphic engine to find the intersection points (using colors clash), no need of math operations in that case. |
Geomol 8-Feb-2009 [1877x2] | LOL again! I was just about to say: ah, intersection of a line and an ellipse, then you just have to go to Anton's library. |
Anton, that's a really cool demo with the line and ellipse! | |
Anton 8-Feb-2009 [1879] | Thanks, have you not already seen it, though ? |
Geomol 8-Feb-2009 [1880x2] | I think, I saw it the first time. It's just really cool! :-) |
And I can move the ellipse and endpoints of line around. Cool! | |
Anton 8-Feb-2009 [1882] | Note: I did not solve the "nearest point on an ellipse to a given point" problem yet, which is hard, so the auto-selection of nearest control point is not perfect. |
kib2 8-Feb-2009 [1883] | Anton: very nice ! bravo. |
Anton 8-Feb-2009 [1884] | Thanks - I hope it's useful. |
Geomol 8-Feb-2009 [1885] | About intersect of line and polynomial curve. There's a preview of the book, I was talking about here: http://books.google.com/books?id=82kntxqd1BoC&printsec=frontcover&dq=Geometric+Tools+for+Computer+Graphics#PPA250,M1 |
kib2 8-Feb-2009 [1886] | Geomol: thanks |
Geomol 8-Feb-2009 [1887] | The author, David Eberly, also has a lot of online documentation: http://www.geometrictools.com/Documentation/Documentation.html Look under "Intersection". |
kib2 8-Feb-2009 [1888x2] | Geomol: nice, I've bookmarked ! |
Is there any string interpolation ? | |
Geomol 8-Feb-2009 [1890x4] | You mean something like: >> rejoin ["Date: " now/date " Time: " now/time] == "Date: 8-Feb-2009 Time: 23:18:12" |
Some use COMPOSE, that will return a block: >> compose ["Date:" (now/date) "Time:" (now/time)] == ["Date:" 8-Feb-2009 "Time:" 23:21:57] That you can turn into a string with useful spaces by: >> form compose ["Date:" (now/date) "Time:" (now/time)] == "Date: 8-Feb-2009 Time: 23:21:08" | |
If you just wanna print the result, PRINT can work on a block, which will be reduced and spaces included in the output: >> print ["Date:" now/date "Time:" now/time] Date: 8-Feb-2009 Time: 23:24:27 | |
Another example: >> print ["2 + 2 =" 2 + 2] 2 + 2 = 4 | |
kib2 8-Feb-2009 [1894x3] | Geomol: awesome, thanks ! (it's very useful for debugging) |
I just found an article on the subject I'm working on : http://www.alistapart.com/stories/simplecontentmanagement/ | |
I don't like the implementation, but the parse rules are worth reading | |
Geomol 8-Feb-2009 [1897] | For debugging, you'll find PROBE to be very usefull. You can put it in about anywhere in your code, and it will just work as without PROBE. Examples: >> square-root probe 4 * 8 32 == 5.65685424949238 >> read probe join http:// "www.rebol.com" http://www.rebol.com connecting to: www.rebol.com == {<html> ... |
kib2 8-Feb-2009 [1898] | nice, thanks. Now, I'm looking for something like hashtables (key-value). Is there something special, or do I need to use blocks ? |
Geomol 8-Feb-2009 [1899x3] | >> if 1:00 > probe now/time [print "Go to bed!"] 0:05:35 Go to bed! |
Try >> ? hash | |
This will create a hashtable, that works like a block, but is faster: >> table: make hash! [a 1 b 12 c 4 d 65] | |
kib2 8-Feb-2009 [1902x2] | Geomol: sorry, you can go to bed |
Geomol: and thanks a lot for your help | |
Geomol 8-Feb-2009 [1904x2] | lol :-) it's ok, I'll go to bed in a moment. |
You can read a short intro to hash tables here: http://www.rebol.com/docs/core23/rebolcore-16.html#section-2.5 | |
kib2 8-Feb-2009 [1906x4] | I just discovered this: |
markup: ["**" "strong" "//" "em" "__" "u" "--" "del" "^^" "sup" ".." "sub"] | |
foreach [bal html] markup [format text bal html] | |
where format is a function I've written. | |
Geomol 8-Feb-2009 [1910] | REBOL has a build-markup function. |
kib2 8-Feb-2009 [1911x2] | really ? |
So mine overwrited Rebol's one ? | |
Geomol 8-Feb-2009 [1913x3] | It may have changed in recent version. Let me check... |
You have build-tag, to-tag and build-markup. | |
Functions to help you make markup text. | |
Izkata 8-Feb-2009 [1916] | Does hash! work with nested blocks? |
Geomol 8-Feb-2009 [1917] | >> build-tag [a b 1] == <a b="1"> |
older newer | first last |