A Flash Developer Resource Site

Results 1 to 10 of 10

Thread: Matrix libs in as3?

  1. #1
    Senior Member realMakc's Avatar
    Join Date
    Oct 2002
    Posts
    927

    Matrix libs in as3?

    We all know that each and every flash 3D engine comes with 4x4 matrix math code (and sometimes 3x3 operations included), but recently I ran into a problem solving equation involving 4x3 (and, obviously 3x4) matrices at runtime. Having no suitable code at hand, I resorted to mathcad symbolic solution in terms of numbers that make up these matrices; needless to say, implementing these expressions is not fun. So. Does anyone know solid matrix math library for as3 that can operate with matrices of any dimensions?
    who is this? a word of friendly advice: FFS stop using AS2

  2. #2
    Senior Member
    Join Date
    May 2006
    Location
    Manhattan
    Posts
    246
    You can try this. I don't seem to remember ever testing it, so don't assume everything works! It's Flash 10

    http://lab.generalrelativity.org/file/MatrixND.as

    EDIT: Meh, looked at it, looks like it only has square matrix solvers...
    Last edited by newblack; 06-11-2009 at 08:28 AM.

  3. #3
    Senior Member realMakc's Avatar
    Join Date
    Oct 2002
    Posts
    927
    Interestingly enough, top google hits for non-square matrix inverse all say that there is no inverse for non-square matrices, and one should resort to LS/QR/SVD. If that's really so, I am puzzled how mathcad was able to find exact solution of my problem. Maybe I had a typo somewhere, but we'll see once I will implement it.
    who is this? a word of friendly advice: FFS stop using AS2

  4. #4
    Senior Member realMakc's Avatar
    Join Date
    Oct 2002
    Posts
    927
    Yep, that was a typo, I missed few variables, hence no solution for me
    who is this? a word of friendly advice: FFS stop using AS2

  5. #5
    Senior Member
    Join Date
    May 2006
    Location
    Manhattan
    Posts
    246
    that sucks... what are you trying to solve?

  6. #6
    Senior Member realMakc's Avatar
    Join Date
    Oct 2002
    Posts
    927
    if you have to ask I was trying to solve for 3d coords from 2d coords of 3 points for sort of augmented reality experiment (but without flartoolkit), and I missed how their z-s remained in what I thought was solution, so I had to estimate z-s in some other way (I had some limited success here btw). I've found some article on homography that said it takes at least 4 points, which brings us back to 4x4 matrices, I guess, and more than 4 points naturally go with LS.
    Last edited by realMakc; 06-12-2009 at 05:52 PM.
    who is this? a word of friendly advice: FFS stop using AS2

  7. #7
    Senior Member realMakc's Avatar
    Join Date
    Oct 2002
    Posts
    927
    Quote Originally Posted by newblack View Post
    I don't seem to remember ever testing it, so don't assume everything works!
    I finally got back to this, and tested, and there's actually a bug or restriction of some sort in the code. Check it out here (scroll down to line 107), let me know what you think...
    Last edited by realMakc; 09-08-2010 at 10:53 PM.
    who is this? a word of friendly advice: FFS stop using AS2

  8. #8
    Senior Member realMakc's Avatar
    Join Date
    Oct 2002
    Posts
    927
    duhh, found the answer here:
    If the matrix A is positive definite symmetric or if the matrix is diagonally dominant, then pivoting is not necessary; otherwise the version using pivoting should be used.
    looks like I need to edit your code a bit more
    who is this? a word of friendly advice: FFS stop using AS2

  9. #9
    Actionscript Developer KigD's Avatar
    Join Date
    Jan 2003
    Location
    georgia
    Posts
    597

    Actionscript 3 Matrix Library

    Here's an Actionscript 3 Matrix Library:
    http://k2xl.com/wordpress/2010/12/27...atrix-library/

    Direct link to library: http://code.google.com/as3matrix/
    K2xL - My games, tutorials, message boards, and experiments.
    Blog

  10. #10
    Senior Member realMakc's Avatar
    Join Date
    Oct 2002
    Posts
    927
    who is this? a word of friendly advice: FFS stop using AS2

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center