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

World: r3wp

[View] discuss view related issues

Geomol
18-Apr-2006
[4770x4]
(The instance is not made here, but can be made. This is just definition 
code.)
My REBOL code is wrong. :-) It should be:
den: (m/6 * tx) + (m/7 * ty) + 1.0
It's a bit weird, that m_mtx is 2 dimensional [8][1]. It's like in 
REBOL:
m_mtx: [[1.0] [2.0]Ê[3.0].... [8.0]]
where you could just do:
m_mtx: [1.0 2.0 3.0 ... 8.0]
If you choose the first way, you have to write:
den: (m/6/1 * tx) + (m/7/1 * ty) + 1.0
Anton
18-Apr-2006
[4774]
I think it helps in operations with other matrices, eg: [8][8]
Geomol
18-Apr-2006
[4775]
Probably.
Anton
18-Apr-2006
[4776]
(don't forget to add 1  -->> m[6][0] --> m/7/1
Geomol
18-Apr-2006
[4777]
oh yes, you're right. Did it help with your c++ -> REBOL conversoin?
Anton
18-Apr-2006
[4778x2]
but thanks for your overview. What's confusing to me was the constructor 
variable initialisation after the : (colon). I remember that notation 
now, and I think it looks so stupid, like they're function calls.
I haven't converted this yet, but about to..
Geomol
18-Apr-2006
[4780]
Yes, confusing. It's like they want everything to be classes, even 
basic datatypes like double. So you can initialize a double with 
something looking like a function call. Pure object-orientation is 
not good. :-)
Anton
18-Apr-2006
[4781x3]
:) Here is how I will translate it:
	iterator-x: context [
		den: none
		den-step: none
		nom-x: none
		nom-x-step: none
		nom-y: none
		nom-y-step: none

		x: none
		y: none

		init: func [tx ty step m][
			den: 
		]

		++: func [][
			den: den + den-step
		]
	]
Full translation like this (checking for bugs):
	iterator-x: context [
		den: none
		den-step: none
		nom-x: none
		nom-x-step: none
		nom-y: none
		nom-y-step: none

		x: none
		y: none

		init: func [tx ty step m][
			den: m/7/1 * tx + (m/8/1 * ty) + 1.0
			den-step: m/7/1 * step
			nom-x: m/1/1 + (m/2/1 * tx) + (m/3/1 * ty)
			nom-step: m/2/1 * step
			nom-y: m/4/1 + (m/5/1 * tx) + (m/6/1 * ty)
			nom-y-step: m/5/1 * step
			x: nom-x / den
			y: nom-y / den
		]

		++: func [][
			den: den + den-step
			nom-x: nom-x + nom-x-step
			nom-y: nom-y + nom-y-step
			d: 1.0 / den
			x: nom-x * d
			y: nom-y * d
		]
	]

	iterator-x-begin: func [x y step][
		make iterator-x [init x y step m-mtx]
	]
Now to figure out how to use these functions...
Geomol
18-Apr-2006
[4784]
It looks good to me.
Anton
18-Apr-2006
[4785x3]
Holy crap I think it's working !
First test...
do %agg-simul-eq.r
do %agg-trans-perspective.r

; test
trp: make trans-perspective [

 init reduce [10 10 200 100 [10 10 200 10 200 300 10 300]] ; [x1 y1 
 x2 y1 x2 y2 x1 y2]
	probe transform 50 50
]
==> [50.0 138.888888888889]
Excellent... :) Transforming a grid of points works. >:D
Geomol
18-Apr-2006
[4788]
Grats! :-)
Henrik
18-Apr-2006
[4789]
in plain English, what's the breakthrough here?
Geomol
18-Apr-2006
[4790x2]
My guess is, that Anton made a function in REBOL like IMAGE used 
in the DRAW dialect. It takes 4 points and do some calculations producing 
a modified image. Like what I do in Canvas, when you use perspective. 
I'm using DRAW for that, Anton is converting the routine from AGG 
C++-source.
Maybe something like this:

view layout [box 400x400 effect [draw [image logo.gif 20x20 380x50 
300x380 40x100]]]
Henrik
18-Apr-2006
[4792]
because we can
?
Anton
18-Apr-2006
[4793x3]
Not quite, although I think I could. What I have done is made a function 
which can transform a point from one space into another. Eg, for 
Geomol's example above, it maps from the image (logo.gif) space into 
the final rendered space shown on screen. So I could ask for any 
point in the image and find out where it is rendered to at the end.
It's good because it matches exactly the algorithm AGG uses to draw 
the image (I am pretty sure anyway .:)
Yep, locked on solid :)
Geomol
18-Apr-2006
[4796]
Anton, what is your plan with it? For what use do you need such a 
space-transformation routine?
Anton
18-Apr-2006
[4797x2]
Ahaha.... :)
Think - reverse transform.
Geomol
18-Apr-2006
[4799]
You have a "twisted" image and want the original one!? :-)
Anton
18-Apr-2006
[4800]
not image - individual points, one at a time
Anton
22-Apr-2006
[4801]
Why View should not admit defeat.
http://home.wilddsl.net.au/anton/rebol/virtual-face_xvid.avi
Henrik
22-Apr-2006
[4802]
anton, ahhh, so that's what you needed it for :-) very, very good 
demo
Graham
22-Apr-2006
[4803]
that is pretty neat anton!
Henrik
22-Apr-2006
[4804x2]
actually that is almost slashdottable
but I wouldn't do that to anton's server...
Graham
22-Apr-2006
[4806]
where's the source?
Henrik
22-Apr-2006
[4807]
somewhere in the Australian wilderness?
Graham
22-Apr-2006
[4808x2]
I wouldn't call Melbourne a wilderness!
Not that I would ask a user to use a rotated and skewed gui..!
Anton
22-Apr-2006
[4810x3]
Why not ? Novell with their XGL on the rotated desktop thinks it's 
useful.
Actually Melbourne is a bit of a wilderness, in a way.
source coming... hang on
Graham
22-Apr-2006
[4813]
Not familiar with Novell/XGL.  Got a link?
Henrik
22-Apr-2006
[4814]
it's a linux thing
Anton
22-Apr-2006
[4815]
Here, but there is a video somewhere...
http://www.novell.com/linux/xglrelease/
Graham
22-Apr-2006
[4816]
I"m trying to install Suse on a new AMD motherboard and it doesn't 
recognise the video on the motherboard, and so get some rather disturbing 
effects.
Anton
22-Apr-2006
[4817x2]
Some videos of XGL here:
http://cto.secs.oakland.edu/~castro/NLD10video/
Ah here it is:

http://video.google.com/videoplay?docid=-7587965514994593432&q=xgl&pl=true
Henrik
22-Apr-2006
[4819]
too bad the framerate is so low. the effects are completely smooth