-
Query about Morph program in this site
i was wondering if anybody knows any of the details regarding the morph program available at
http://javaboutique.internet.com/Morph/
i would like to know which algorithm is being used and possibly some other details.
Thank you
in advance
-
 Originally Posted by AK_47
i was wondering if anybody knows any of the details regarding the morph program available at
http://javaboutique.internet.com/Morph/
i would like to know which algorithm is being used and possibly some other details.
Thank you
in advance
Looks like tweening to me. Bascially you have two shapes (start and end) and the tweening algorithm slowly (or fast if you want but it won't look as nice) converts each point in the start shape to the end shape. Here is a basic tween i made in openGL over a year ago.
Code:
Point2 Canvas::Tween(Point2 A, Point2 B, float t)
{
float difX = B.getX() - A.getX();
float difY = B.getY() - A.getY();
float tX = A.getX() + (difX*t);
float tY = A.getY() + (difY*t);
Point2 tween(tX,tY);
return(tween);
}
void Canvas::drawTween(Point2 A[], Point2 B[], int n, float t)
{
glBegin(GL_LINE_LOOP);
for(int i=0; i<n; i++)
{
Point2 P;
P= Tween(A[i], B[i], t);
cout << P.getX() << "," << P.getY() << endl;
glVertex2f(P.getX(), P.getY());
}
cout << "----------------" << endl;
glEnd();
glFlush();
}
Basically my drawTween function takes 2 array of points (A represents the start figure, B the end figure). Int n determines how many frames between the start and end, and float t is how much each frame differs from the last. There may be more complex Tweening/Morph methods but i'm not really sure. Anyways, do a google search and i'm sure you'll find some stuff.
EDIT: Also note this is a 2 dimensional tween, although it wouldn' be hard to convert to 3D. Also if your confused why the code looks weird thats because it's C++, not Java. As far as i know openGL is not supported in Java? However, you can still do it in Java (obviously, the applet did it) with their native 2D and 3D graphics.
Last edited by customwoodtek; 04-04-2005 at 09:16 PM.
Java has 99 problems but a pointer ain't one
-
Though the applet flickered a lot, and I barely saw any image, I can tell you the algorithm used. It's simple linear interpolation.
Result = A + (B-A)*k
Where 'A' is picture 1 and 'B' is picture 2, and 'K' is the set[0,1] (between 0 and 1)
A value of 0 would give the full picture of 'A', and 1 would give the full picture of 'B'.
Would you would actually do is get the color of each pixel in the two images for 'A' and 'B' and create a new image.
-
I need this code for a university project and was told its using the
cross -dissolve algorithm, but is that definitely not the case?
-
 Originally Posted by Phaelax
Though the applet flickered a lot, and I barely saw any image, I can tell you the algorithm used. It's simple linear interpolation.
Result = A + (B-A)*k
Where 'A' is picture 1 and 'B' is picture 2, and 'K' is the set[0,1] (between 0 and 1)
A value of 0 would give the full picture of 'A', and 1 would give the full picture of 'B'.
Would you would actually do is get the color of each pixel in the two images for 'A' and 'B' and create a new image.
this program also allows more than one image to be morphed.
-
Is tweening another name for mesh warping if not can you tell me what the difference is.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks