r3wp [groups: 83 posts: 189283]
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

World: r3wp

[AGG] to discus new Rebol/View with AGG

Volker
18-May-2006
[786]
How about exposing the math? To map mouse back to faces, as in Antons 
demo?
Graham
18-May-2006
[787]
What do you think?
Cyphre
18-May-2006
[788]
Wait guys ;) I was asking for bug reports not for new features :) 
But feel free to add those to RAMBO as  wishes to not forget on them.
Volker
18-May-2006
[789]
How far can transformation go? can it turn things upside down?
Graham
18-May-2006
[790]
I think using top left 0,0 is a bug :)
Volker
18-May-2006
[791x3]
But common on screens.
also similar to line-counting. top line is first line, not #66
but for diagramms it is terrible *nod+
Cyphre
18-May-2006
[794]
Graham: lot of people could think writing from letf to right is a 
bug too :)
Graham
18-May-2006
[795x2]
but that's for text.  Not for drawing.
mathematics uses Cartesian coordinates
Cyphre
18-May-2006
[797]
BTW you can very easily change the coordinate system even now.
Graham
18-May-2006
[798x2]
How?
Is there a way of applying translate to invert the y axis?
Cyphre
18-May-2006
[800x4]
here is simple example:
view layout [
	origin 0
	bx: box 400x400 black effect [
		draw [
			translate 0x400
			scale 1 -1
			pen red
			line 50x50 350x50
			pen blue
			line 50x50 50x350
			pen yellow
			line 50x50 100x200 200x150 300x250 350x225
		]
	]
]
but this won't work with text though because it would be reversed 
in Y axis too.
Another solution is to apply own translation function on the dialect 
block or generate the dialect block with translated coords from scratch. 
(this shouldn't be a rocket science and would work with text too)
Volker
18-May-2006
[804x3]
Regarding text, maybe Graham is right and a graphics-only reverse 
would help? for diagrams. The current way is a bit complicated, until 
one gets the trick.
means "apply own translation function on the dialect block". And 
now that little reversion-math, y: high - y .
now -> know
Pekr
18-May-2006
[807]
that would require one step above parser to draw dialect, no?
Cyphre
19-May-2006
[808x2]
It's really easy:
translate-draw: func [
	height [integer!]
	blk [block!]
	/local dr p
][

 parse blk [some ['draw set dr block! (parse dr [some [p: pair! (p/1: 
 as-pair p/1/x height - p/1/y) | skip]]) | skip]]
	blk
]

view layout [
	origin 0
	bx: box 400x400 black effect translate-draw 400 [
		draw [
			pen red
			line 50x50 350x50
			pen blue
			line 50x50 50x350
			pen yellow
			line 50x50 100x200 200x150 300x250 350x225
			pen white
			text aliased 10x350 "Y axis"
			text aliased 320x40 "X axis"
		]
	]
]
Volker
19-May-2006
[810]
Looks like magic :) But should not be required to draw a line through 
some data?
Graham
5-Jun-2006
[811x2]
rotate says it sets the clockwise rotation for draw commands.
So, why does the text move across the page ?

view/new layout [
		b: box 400x400 black effect [ draw []]
]

for i 0 90 5 [

 b/effect: compose/deep [ draw [ rotate (i) text vectorial "This is 
 a string of text 1" 300x75 ]]
	show b
	wait .2
]
Henrik
5-Jun-2006
[813]
because the text rotates around 0x0 rather than around itself
Graham
5-Jun-2006
[814]
should this be changed?
Henrik
5-Jun-2006
[815x2]
which is what I figured you wanted to do. you need to make the text 
at 0x0, rotate it and then translate it to the position you want
e.g. translate 100x100 rotate 30 text "something"
Graham
5-Jun-2006
[817]
or set up a straight line "spline" for the text ...
Henrik
5-Jun-2006
[818]
possibly
Graham
5-Jun-2006
[819]
Well, seems to me it should be changed.
Henrik
5-Jun-2006
[820]
changed in AGG or in the code?
Graham
5-Jun-2006
[821x5]
Text should rotate at the point where it is being drawn
in AGG.
boxes don't rotate around 0x0
why should text?
or do they ??
Henrik
5-Jun-2006
[826x2]
well, if you did that, how would you rotate around another point? 
I won't argue for one solution or the other, but this approach seems 
natural enough to me.
I think they do
Graham
5-Jun-2006
[828]
which approach?
Henrik
5-Jun-2006
[829x3]
1. first you draw
2. then you rotate
3. then you translate

in classic REBOL order
which means start at 3. :-)
speaking of which, it could be fun to see a LOGO like dialect for 
DRAW. fun for the kids.
Graham
5-Jun-2006
[832]
Gregg has one.
Henrik
5-Jun-2006
[833]
that's good. I don't have to do it then.
Graham
5-Jun-2006
[834]
do you have to create the kids first?
Henrik
5-Jun-2006
[835]
got plenty of those around, not mine though. I don't know how interested 
they would be in it yet. I spent countless hours in COMAL80 when 
I was a kid drawing with the "turtle".