pixijs / pixi-projection

MIT License
189 stars 34 forks source link

`PIXI.projection.AFFINE.AXIS_Y` can't work correctly #31

Open finscn opened 5 years ago

finscn commented 5 years ago

in the example

http://pixijs.io/examples/?v=v4.8.6#/projection/iso-basic.js & http://pixijs.io/examples/?v=v4.8.6#/projection/plane.js

I changed .proj.affine from AXIS_X to AXIS_Y .

I found the result is not as expected.

ivanpopelyshev commented 5 years ago

I agree, something is wrong

ivanpopelyshev commented 5 years ago

What does axis_X : it uses same X axis but changes Y to straight up.

so, that mode should save Y but change X, and its not working.

finscn commented 5 years ago

What do AFFINE[AFFINE["NONE"] = 0] = "NONE"; AFFINE[AFFINE["FREE"] = 1] = "FREE"; AFFINE[AFFINE["POINT"] = 4] = "POINT"; do ?

And I found there is no AFFINE.FREE in the logic

finscn commented 5 years ago

maybe use

                else if (affine === AFFINE.AXIS_Y) {
                    D /= Math.sqrt(matrix.a * matrix.a + matrix.c * matrix.c);
                    matrix.a = D;
                    matrix.b = 0;   // add this line
                    matrix.c = 0;
                }

could make AFFINE.AXIS_Y work correctly. ( But the D may be not right)

But I'm not sure , I'm not good at Matrix


update: NO, it's not right. in http://pixijs.io/examples/?v=v4.8.6#/projection/plane.js , the result is still wrong.


By the way :

image

Which one is right ? left or right ?