Skip to content

Commit 55f08de

Browse files
author
bors-servo
authored
Auto merge of #308 - nical:translation, r=kvark
Introduce TypedTranslation2D Fixes #214. Example usage: ```rust fn simple_translation() { use rect; struct A; struct B; type Translation = TypedTranslation2D<i32, A, B>; type SrcRect = TypedRect<i32, A>; type DstRect = TypedRect<i32, B>; let tx = Translation::new(10, -10); let r1: SrcRect = rect(10, 20, 30, 40); let r2: DstRect = tx.transform_rect(&r1); assert_eq!(r2, rect(20, 10, 30, 40)); let inv_tx = tx.inverse(); assert_eq!(inv_tx.transform_rect(&r2), r1); } ``` <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/euclid/308) <!-- Reviewable:end -->
2 parents 1c60bba + 8b14d3f commit 55f08de

File tree

3 files changed

+477
-1
lines changed

3 files changed

+477
-1
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "euclid"
3-
version = "0.19.2"
3+
version = "0.19.3"
44
authors = ["The Servo Project Developers"]
55
description = "Geometry primitives"
66
documentation = "https://docs.rs/euclid/"

src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ pub use vector::{BoolVector2D, BoolVector3D, bvec2, bvec3};
7878
pub use homogen::HomogeneousVector;
7979

8080
pub use rect::{rect, Rect, TypedRect};
81+
pub use translation::{TypedTranslation2D, TypedTranslation3D};
8182
pub use rotation::{Angle, Rotation2D, Rotation3D, TypedRotation2D, TypedRotation3D};
8283
pub use side_offsets::{SideOffsets2D, TypedSideOffsets2D};
8384
pub use size::{Size2D, TypedSize2D, size2};
@@ -98,6 +99,7 @@ mod side_offsets;
9899
mod size;
99100
mod transform2d;
100101
mod transform3d;
102+
mod translation;
101103
mod trig;
102104
mod vector;
103105

0 commit comments

Comments
 (0)