Skip to content

Matrix tests - skew #548

@MannyC

Description

@MannyC

So I've done a first draft of some Matrix2D tests (I'll link the code in a second).

My main issues are that the decomposition test is unverified (i.e. I did the comparison calculations in easeljs, so obviously it's going to pass at this point) and that the EaselJS skew isn't working in the same was as my calculations.

easeljs skew method:

p.skew = function(skewX, skewY) {
    skewX = skewX*Matrix2D.DEG_TO_RAD;
    skewY = skewY*Matrix2D.DEG_TO_RAD;
    this.append(Math.cos(skewY), Math.sin(skewY), -Math.sin(skewX), Math.cos(skewX), 0, 0);
    return this;
};

whereas I was using tans, which in easel would be

p.skew = function(skewX, skewY) {
    skewX = skewX*Matrix2D.DEG_TO_RAD;
    skewY = skewY*Matrix2D.DEG_TO_RAD;
    this.append(1, Math.tan(skewY), Math.tan(skewX),1, 0, 0);
    return this;
};

This is how it is done in CSS

They appear to give somewhat similar results except that the cos/sin method does add a scaling component.

Thoughts? I can just change to the cos/sin method if there's a reason for it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions