I’m writing a book. It’s called JavaScript Testing Recipes.

Sylvester 0.1.3

Rounding out today’s flurry of posts, a quick note to the effect that Sylvester is now at version 0.1.3. The 0.1.2 release missed a couple of bugs that I meant to fix with it. Well not bugs, as such, but places where value/reference ambiguity could have caused problems. I’m beginning work on 0.2 again, after a long break focusing on other projects and house hunting. This should be the final 0.1 release, unless I find any particularly catastrophic bugs.

4 thoughts on “Sylvester 0.1.3

  1. Hello! i have a question.
    ex:
    i have 4 point (a rectangle)
    and i want to rotate them in 90°

    code:
    angle = Math.PI/2;

    var a = $M([
    [2,2,0],
    [2,5,0],
    [7,5,0],
    [7,5,0]
    ]);

    var b = $V([7,2,0]);

    R = Matrix.Rotation(angle);
    test = R.add(a.elements);

  2. sry i wrote wrong, sory
    ex:
    i have 4 point (a rectangle)
    and i want to rotate them in 90°

    code:
    angle = Math.PI/2;

    var a = $M([
    [2,2,0],
    [2,5,0],
    [7,5,0],
    [7,2,0]
    ]);

    R = Matrix.Rotation(angle);
    result = R.add(a);

    Dis i do wrong? i try to read the Tutorial
    http://sylvester.jcoglan.com/api/matrix

    but i cant get it! sry
    can you help me?

  3. You’re trying to add two matrices of different sizes, which doesn’t make mathematical sense. The way to model your problem is with vectors: vectors represent single points in space.

    var rect = [$V([2,2]), $V([2,5]),
                $V([7,5]), $V([7,2])];

    Then you multiply each point with the rotation matrix to transform them:

    var rot = Matrix.Rotation(Math.PI/2),
        i = rect.length;
    
    while (i--) rect[i] = rot.x(rect[i]);

    Or, use the Vector#rotate method.

  4. Anyone port Sylvester to Actionscript? Even though they have a Matrix class, there’s little support. There is a Clevrlib1 which has some more, including SVD and QR decomposition, but it doesn’t support Vector, Plane, Line, except as special cases of Matrix.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>