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

World: r3wp

[View] discuss view related issues

Maxim
24-May-2009
[8930x3]
but right now the rotation is locked, cause I'm not sure its a good 
thing to rotate the ellipse for this specific application.
but the powerfull thing, is that you can drag the ellipse itself, 
by clicking on any part of the line itself, no cvs to drag the shape. 
 :-)
and just hovering over the line (the arc) the cvs appear, so they 
don't clutter the drawing while you're editing other parts of it.
Geomol
25-May-2009
[8933]
A REBOL Bezier algorithm:

do http://www.fys.ku.dk/~niclasen/rebol/fysik/bezier.r

Move the points around with the mouse.
Maxim
25-May-2009
[8934x4]
that's the demo I was talking about   ;-)
so you don't mind if I use that code in my own projects?
first use will be to build a keyframe editor, which will be distributed 
with liquid-paint, with MIT license.
(for spline-based animation curves.)
Geomol
25-May-2009
[8938x2]
Use as you like.
do you know of an algorythm (expressed in code, not in math) that 
can give me the ellipse with two supplied coordinates.
center and 
one point which touches the ellipse?

Isn't there an infinite number of ways, you can do that?
Maxim
25-May-2009
[8940x2]
thanks! for the spline code, with a few changes, one in three points 
should pass directly through the point and the two other points will 
be used as tangeants.
its not really obvious... I'm not a math expert, even if I've done 
some pretty cool 3D engines (crowd simulation, for example) it takes 
me a lot of time to get the math part of things done when its question 
of doing math mix and match.
Geomol
25-May-2009
[8942]
Let's say, you have center and a point with same y-coordinate as 
center. So it's just horizontal out from the center. Now the ellipse 
can be any height, so you can make infinite many ellipses with those 
two points.
Maxim
25-May-2009
[8943]
I did whole evening of research on the ellipse and didn't find a 
single exact procedure to do it... some math dr have done their thesis 
just on finding ways to calculate its arc len ! 


though I think its possible to resolve the two foci based on the 
angle and distance of the point we want to pass through the arc, 
all the math needed to get to the proper major and minor axis (eventually 
equating to what people call the x and y radius) is pretty intensive.
Geomol
25-May-2009
[8944]
In DPaint (and Canvas RPaint), you specify center and corner of ellipse. 
It's then not rotated. After specifying size this way with two points, 
you can rotate it.
Maxim
25-May-2009
[8945x2]
yes but the corner is not *ON* the line, its equal to the major and 
minor axis of the elipse.
if I where to drag one of those points to an angle of 30 degres, 
I still want the arc to touch my point.
Geomol
25-May-2009
[8947]
Yup, but you can't make just one ellipse with center and point on 
the ellipse.
Maxim
25-May-2009
[8948]
there is definitely a way to calculate it mathematically, but there 
are so many steps, I get lost in the procedure to get to it.
Geomol
25-May-2009
[8949x2]
:-) Think of my example with center and point horizontal out from 
the center. What height should your ellipse  be?
The problem is not, that it's hard. It's impossible.
Maxim
25-May-2009
[8951]
in that case, its can be treated as a special case... like a like 
since one of the axis is = 0  just like the up vector of a 3d object 
cannot be (0,0,0)
Geomol
25-May-2009
[8952]
Ah, I now think, I understand, what you want. It's like the arc drawing 
routine, where you want the point to be on the line. Same thing with 
ellipse.
Maxim
25-May-2009
[8953x2]
but if x and y axis aren't = 0  then the angle of the point, can 
let you calculate the two foci, which are relation to x/y.
yep.
Geomol
25-May-2009
[8955]
And you don't want the ellipse rotated at first?
Maxim
25-May-2009
[8956x5]
for an arc drawing its a bit simpler, since by using three points, 
you actually get points directly on the line.
yep. rotation I can deal separately, using an actual separate rotation 
value
(after)
re-reading... my answer is ambiguous....  


I mean that I don't need rotation as part of the arc on point algorythm.
do you think you can pull it off?
Geomol
25-May-2009
[8961x2]
I'm still not convinced, it can be done. That there is only one solution. 
Try Canvas RPaint:

do http://www.fys.ku.dk/~niclasen/rebol/canvas099.r


And draw two points. Then start an ellipse in one point. Can you 
see, you can make infinite many ellipses going through the other 
point?
Even if they're not rotated. You need to put some restrictions on 
your ellipse to only have one solution.
Maxim
25-May-2009
[8963x5]
its funny, yep... now that I try doing it interactively, I realise, 
that you must know 2 out of 3 values to resolve an ellipse...
the funny part is that my vectorial app lets me try it out just like 
yours, but I didn't get to that point in my head.  well, it was a 
nice dream while it lasted  ;-)
btw, rpaint is really nice.
I really like the look of the tool selection is it just a button 
rotated 180 degres?
LOL "workbench" in the menu...
Geomol
25-May-2009
[8968]
The selection effect is not just a button rotated 180, but took some 
drawing. :-)
Maxim
25-May-2009
[8969]
it really is perfect. probably some of the most polished rebol GUI 
work I've seen so far.
Geomol
25-May-2009
[8970]
Thanks! :-)
Dockimbel
25-May-2009
[8971]
I agree, that's very good and high quality work. Nice tribute to 
the Amiga.
Graham
15-Jun-2009
[8972x2]
Is there a way to dynamically turn a field into info and back again 
... so to prevent users from editing various fields on an as required 
basis?
Hope VID+ has a way to dynamically disable/ghost out widgets ....
Chris
15-Jun-2009
[8974]
Switch out 'feel objects and visual facets, unfocus, then 'show? 
 (trying to recall if that's right...)
Graham
15-Jun-2009
[8975]
should be easier!
Maxim
15-Jun-2009
[8976]
Oldes/graham


here is a complete application which shows you how to build and affect 
a face with a ghost effect.

----------------------------------
rebol []

ghost-blk: [
	ghost-data: none
	
	ghost: func [][
		self/ghost-data: make self []
		self/image: img: to-image self
		effect: [ merge grayscale contrast -50 ]
		;size: img/size
		edge: text: feel: pane: none
		show self
	]
	
	regenerate: func [/local attr][
		foreach attr [image effect feel edge text feel pane][
			set in self attr get in ghost-data attr
		]
		ghost-data: none
		show self
	]
]

stylize/master compose/only [
	field: field with ghost-blk
	button: button with ghost-blk
	btn: btn with ghost-blk
	scroller: scroller with  ghost-blk
]

view layout [
	across

 toggle "btn" [either face/data [my-btn/ghost][my-btn/regenerate]]	

 toggle "button" [either face/data [my-button/ghost][my-button/regenerate]]	

 toggle "field" [either face/data [my-field/ghost][my-field/regenerate]]

 toggle "scroller" [either face/data [my-scroller/ghost][my-scroller/regenerate]]
	return
	my-btn: btn "yippe"
	my-button: button "ka"
	my-field: field "yay"
	my-scroller: scroller 100x20
]
Graham
15-Jun-2009
[8977]
Very nice Max
Maxim
15-Jun-2009
[8978x2]
you can easily adapt this for rebgui by simply replacing the feel 
related code above by whatever rebgui uses.
thanks.