From 1f1c5eb31ab31bd641f11914680aed9d041952d9 Mon Sep 17 00:00:00 2001 From: Jinwoo Song Date: Wed, 3 Jun 2015 18:33:51 +0900 Subject: [PATCH] Apply skew transformation for alpha and beta angles. This patch is to fix #6237 in servo. --- Cargo.toml | 2 +- src/matrix.rs | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 59c4482..2d49de5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "euclid" -version = "0.1.6" +version = "0.2.0" authors = ["The Servo Project Developers"] description = "Geometry primitives" documentation = "http://doc.servo.org/euclid/" diff --git a/src/matrix.rs b/src/matrix.rs index 6db2361..ebef7d7 100644 --- a/src/matrix.rs +++ b/src/matrix.rs @@ -303,8 +303,10 @@ impl Matrix4 { ) } - /// Create a 2d skew matrix - pub fn create_skew(sx: f32, sy: f32) -> Matrix4 { + /// Create a 2d skew matrix. + /// https://drafts.csswg.org/css-transforms/#funcdef-skew + pub fn create_skew(alpha: f32, beta: f32) -> Matrix4 { + let (sx, sy) = (beta.tan(), alpha.tan()); Matrix4::new(1.0, sx, 0.0, 0.0, sy, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0,