mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 01:07:36 +00:00
LibWeb: Add DOMMatrix rotate, rotateFromVector and rotateAxisAngle
This commit is contained in:
parent
42c2a67c83
commit
6265c544f9
8 changed files with 144 additions and 6 deletions
8
Tests/LibWeb/Text/expected/geometry/dommatrix-rotate.txt
Normal file
8
Tests/LibWeb/Text/expected/geometry/dommatrix-rotate.txt
Normal file
|
@ -0,0 +1,8 @@
|
|||
1. 22.233366125282362
|
||||
2. 35.06980604270564
|
||||
3. 22.06722747248274
|
||||
4. 26.483172559777778
|
||||
5. {"a":30,"b":40,"c":-9.999999999999998,"d":-19.999999999999996,"e":50,"f":60,"m11":30,"m12":40,"m13":0,"m14":0,"m21":-9.999999999999998,"m22":-19.999999999999996,"m23":0,"m24":0,"m31":0,"m32":0,"m33":1,"m34":0,"m41":50,"m42":60,"m43":0,"m44":1,"is2D":true,"isIdentity":false}
|
||||
6. {"a":30,"b":40,"c":-9.999999999999998,"d":-19.999999999999996,"e":50,"f":60,"m11":30,"m12":40,"m13":0,"m14":0,"m21":-9.999999999999998,"m22":-19.999999999999996,"m23":0,"m24":0,"m31":0,"m32":0,"m33":1,"m34":0,"m41":50,"m42":60,"m43":0,"m44":1,"is2D":true,"isIdentity":false}
|
||||
7. {"a":9.84807753012208,"b":19.69615506024416,"c":30,"d":40,"e":50,"f":60,"m11":9.84807753012208,"m12":19.69615506024416,"m13":-0.17364817766693033,"m14":0,"m21":30,"m22":40,"m23":0,"m24":0,"m31":1.7364817766693033,"m32":3.4729635533386065,"m33":0.984807753012208,"m34":0,"m41":50,"m42":60,"m43":0,"m44":1,"is2D":false,"isIdentity":false}
|
||||
8. {"a":9.84807753012208,"b":19.69615506024416,"c":30,"d":40,"e":50,"f":60,"m11":9.84807753012208,"m12":19.69615506024416,"m13":-0.17364817766693033,"m14":0,"m21":30,"m22":40,"m23":0,"m24":0,"m31":1.7364817766693033,"m32":3.4729635533386065,"m33":0.984807753012208,"m34":0,"m41":50,"m42":60,"m43":0,"m44":1,"is2D":false,"isIdentity":false}
|
33
Tests/LibWeb/Text/input/geometry/dommatrix-rotate.html
Normal file
33
Tests/LibWeb/Text/input/geometry/dommatrix-rotate.html
Normal file
|
@ -0,0 +1,33 @@
|
|||
<script src="../include.js"></script>
|
||||
<script>
|
||||
test(() => {
|
||||
let testCounter = 1;
|
||||
function testPart(part) {
|
||||
println(`${testCounter++}. ${JSON.stringify(part())}`);
|
||||
}
|
||||
|
||||
// 1. Rotate DOMMatrix
|
||||
testPart(() => new DOMMatrix([10, 20, 30, 40, 50, 60]).rotate(10, 20, 30).a);
|
||||
|
||||
// 2. Rotate DOMMatrix with multiply
|
||||
testPart(() => new DOMMatrix([10, 20, 30, 40, 50, 60]).multiply(new DOMMatrix().rotate(10, 20, 30)).b);
|
||||
|
||||
// 4. Rotate DOMMatrix
|
||||
testPart(() => new DOMMatrix([10, 20, 30, 40, 50, 60]).rotate(10, 20, 30).c);
|
||||
|
||||
// 5. Rotate DOMMatrix with multiply
|
||||
testPart(() => new DOMMatrix([10, 20, 30, 40, 50, 60]).multiply(new DOMMatrix().rotate(10, 20, 30)).d);
|
||||
|
||||
// 6. Rotate from Vector DOMMatrix
|
||||
testPart(() => new DOMMatrix([10, 20, 30, 40, 50, 60]).rotateFromVector(0, 45));
|
||||
|
||||
// 7. Rotate from Vector DOMMatrix with multiply
|
||||
testPart(() => new DOMMatrix([10, 20, 30, 40, 50, 60]).multiply(new DOMMatrix().rotateFromVector(0, 45)));
|
||||
|
||||
// 8. Rotate from Axis Angle DOMMatrix
|
||||
testPart(() => new DOMMatrix([10, 20, 30, 40, 50, 60]).rotateAxisAngle(0, 1, 0, 10));
|
||||
|
||||
// 9. Rotate from Axis Angle DOMMatrix with multiply
|
||||
testPart(() => new DOMMatrix([10, 20, 30, 40, 50, 60]).multiply(new DOMMatrix().rotateAxisAngle(0, 1, 0, 10)));
|
||||
});
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue