FAQ
Cover
This is the archive Discourse for the Processing (ALPHA) software.
Please visit the new Processing forum for current information.

   Processing 1.0 _ALPHA_
   Topics & Contributions
   Tools
(Moderator: REAS)
   4 useful features in one!
« Previous topic | Next topic »

Pages: 1 
   Author  Topic: 4 useful features in one!  (Read 5824 times)
arielm

WWW
4 useful features in one!
« on: Jun 24th, 2003, 12:09pm »

this bit of code is featuring:
 
- a virtual trackball (a.k.a arcball)
- smooth, time-based rotation interpolation (could be between arbitrary coordinates)
- hidden face removal (on a cube)
- texture-mapping using quad-patches to minimize deformation
 
 
play with the mouse to control the cube, or use the colored cells at the bottom-right corner to smoothly switch between the cube's face:
 
http://www.chronotext.org/bits/031
 
http://www.chronotext.org/bits/031/alphabet_cube_1.pde
 
 
(keep 'x', 'y' or 'z' pressed in order to constrain to one of the axis)
 

Ariel Malka | www.chronotext.org
arielm

WWW
Re: 4 useful features in one!
« Reply #1 on: Jun 25th, 2003, 1:52am »

actually, i'm using a 1x1 quad-patch (i.e. not doing anything to avoid texture deformation) in this example, because the hebrew letters mapped on each face are huge, and the deformation is almost unoticeable...
 
but for other cases, where the deformation is noticeable (e.g. a paragraph with small text), then i would have give 4 (i.e. 4x4) as a parameter to the specific "face()" method that is handling quad-patched texture mapping.
 
if it sounds like gebrish and you want to know more, there is this post in english on the subject:
http://proce55ing.net/discourse/yabb/board_Programs_action_disp_lay_num_1056367221.html
 

Ariel Malka | www.chronotext.org
v3ga

WWW Email
Re: 4 useful features in one!
« Reply #2 on: Jun 25th, 2003, 10:02am »

Nice Cube, but thought it would be nicer to have smoothed animation between frames with something like :
 
qCube = SLERP( qCube, qCubeTarget, recoveryFactor), qCubeTarget being the orientation to reach.
 
Cool sinon tout ça
 
 

http://v3ga.net
arielm

WWW
Re: 4 useful features in one!
« Reply #3 on: Jun 25th, 2003, 11:21am »

do you mean "recoveryFactor" to be a float varying from 0 to 1? like the t argument in the original slerp method?
 
if so, then it guess it won't help, because i wanted to have a constant speed between interpolations (instead, if i simply iterate from 0 to 1, then some of the interpolations will occur very fast and some others not!..)
 
what i did is that i simply deconstructed the original slerp method to adapt it to time-based iterations:
 
so at the beginning of an interpolation, i first have to compute the distance (omega) on the sphere between the two quats, and then it's just a matter of incrementing a distance (domega, starts from 0) with a velocity (vomega, user defined) until omega is reached...
 
make sense?
 

Ariel Malka | www.chronotext.org
Dara

WWW Email
Re: 4 useful features in one!
« Reply #4 on: Jun 25th, 2003, 9:19pm »

this is a nice example. i was writing a new software with processing a while ago but i put project on hold because at that time i couldn't grasp few things. so looking at your example now, i see that few things are done in very smart ways. this is giving me hope. just wait for the "interpol" work that i will post on games section soon.
 
arielm

WWW
Re: 4 useful features in one!
« Reply #5 on: Jun 25th, 2003, 10:41pm »

nice! looking forward to seeing the game (interpol?.. sounds frightening!)
 

Ariel Malka | www.chronotext.org
v3ga

WWW Email
Re: 4 useful features in one!
« Reply #6 on: Jun 26th, 2003, 8:24am »

Arielm :  
 
Hmm if you wanted constant speed , then that's ok. My suggestion was to make the applet look like less "blocky".
To answer your question yes recoveryFactor was meant to be between 0 and 1, a fast patch to implement with quaternion the "classic" linear interpolation method!
 
Cheers
 

http://v3ga.net
arielm

WWW
Re: 4 useful features in one!
« Reply #7 on: Jun 26th, 2003, 8:47am »

actually, on my poor PIII/450mhz, the interpolation is running smooth, i don't see any blockiness!
 
could it be possible that you have an even slower machine than mine?
 

Ariel Malka | www.chronotext.org
v3ga

WWW Email
Re: 4 useful features in one!
« Reply #8 on: Jun 28th, 2003, 3:41pm »

The blocky feeling comes from the constant speed, ie when the cube is at rest and change the viewing position, its velocity changes immediatly from 0 to some value. Some acceleration would have been nice to provide the user a smooth feeling.
BTW, the animation is running well here too on my Celeron 600 Mhz !
 

http://v3ga.net
arielm

WWW
Re: 4 useful features in one!
« Reply #9 on: Jun 28th, 2003, 4:29pm »

yeah, i see now...
 
and it's a joke to implement, so it may worth a try!
 
and another interesting feature to implement to the arcball would be inerty + drag...
 

Ariel Malka | www.chronotext.org
Pages: 1 

« Previous topic | Next topic »