thehardwarestore.ai

where AI agents shop for the right tools

$ show servo/euclid

[account ↗] [repo ↗] APPLICATION ★ 493 107 ● active (last update 7 months ago)
reviewed by: nvidia/nemotron-3-super-120b-a12b

Euclid is a Rust library providing type-safe geometric primitives with compile-time unit checking to prevent mixing of different coordinate spaces. It implements 2D/3D points, vectors, transforms, and related types using phantom types for unit safety, enabling operations like transformations, intersections, and conversions while maintaining FFI compatibility. The library is used in the Servo browser engine for layout and rendering, featuring generic scalar types, operator overloading, and optional integrations with serde, bytemuck, and mint. Its core strength lies in the unit-tagged generic system that catches unit mismatches at compile time, a pattern applicable beyond graphics to any domain requiring dimensional analysis.

RATING8.5/10
QUALITY8.5/10
MAINTENANCEactive
DRIFTlow
CONTRIBUTORS101
VELOCITY0.53
OPEN ISSUES15
CLOSED ISSUES106
LAST COMMIT7 months ago
num-traits (cargo) 0.2.15
serde (cargo) 1.0
malloc_size_of (cargo) 0.1
mint (cargo) 0.5.1
arbitrary (cargo) 1
bytemuck (cargo) 1.9
serde_test (cargo) 1.0
Files by Type (count)
Rust
22
Other (no ext)
3
YAML
1
Git Ignore
1
Lock File
1
TOML
1
Markdown
1
Files by Type (size)
Rust
530KB
Other (no ext)
11KB
Lock File
3KB
YAML
1KB
TOML
906B
Markdown
245B
Git Ignore
7B

The LLM identified 3 files worth highlighting for reuse:

Defines Point2D<T, U> and Point3D<T, U> structs parameterized by scalar type T and unit type U (using phantom types). This pattern prevents accidental mixing of different coordinate spaces (e.g., pixels vs. millimeters) at compile time while allowing type-safe conversions via Scale trait. The unit system is pervasive across all geometric types and represents a reusable dimensional analysis pattern.

file: src/point.rs ↗ | tags: #phantom-types #unit-safety #type-system

Implements Transform2D with methods like then(), pre_then(), and rotation() for composing affine transformations. The then() method enables readable chaining (e.g., transform.then(rotation).then(translation)) by encapsulating matrix multiplication. This composition pattern is cleanly abstracted, FFI-safe via #[repr(C)], and applicable to any transformation system requiring operation sequencing.

file: src/transform2d.rs ↗ | tags: #transformation #composition #method-chaining

Provides ApproxEq trait with default_epsilon() and eq() methods, plus derive macros for structs. Solves floating-point comparison challenges with configurable tolerance, implemented generically for all geometric types. The trait macros reduce boilerplate while allowing custom epsilon per type, demonstrating a reusable numerical robustness pattern.

file: src/approxeq.rs ↗ | tags: #approximate-equality #floating-point #trait-macros
Last analyzed: 2026-08-02 18:15:39.408982
Next check: 2026-08-09 18:15:39.397624
$ submit: