Skip to main content

dotloom_geometry/
lib.rs

1//! # dotloom-geometry
2//!
3//! Headless 2D geometry for Dotloom: `f64` primitives, affine transforms, exact
4//! orientation predicates, curve intersections, split/trim/extend, dimension
5//! geometry, dimensioned quantities and a bounding-box spatial index.
6//!
7//! This crate has no DOM, window or GPU dependency.
8//!
9//! ```
10//! use dotloom_geometry::{Point, Segment, Shape, Curve, intersect, ModelTolerance};
11//!
12//! let a = Curve::Line(Segment::new(Point::new(0.0, 0.0), Point::new(2.0, 2.0)));
13//! let b = Curve::Line(Segment::new(Point::new(0.0, 2.0), Point::new(2.0, 0.0)));
14//! let hits = intersect::intersect(&a, &b, ModelTolerance::DEFAULT);
15//! assert_eq!(hits.points[0].point, Point::new(1.0, 1.0));
16//! ```
17
18mod aabb;
19mod affine;
20mod curve;
21pub mod dimension;
22pub mod edit;
23mod error;
24mod font_metrics;
25pub mod intersect;
26pub mod math;
27mod point;
28mod shape;
29pub mod spatial;
30mod tolerance;
31pub mod units;
32
33pub use aabb::Aabb;
34pub use affine::{Affine, LinearKind};
35pub use curve::{Arc, Circle, CubicBez, Curve, QuadBez, Segment, circumcenter};
36pub use error::{GeoResult, GeometryError};
37pub use point::{Orientation, Point, Vector, normalize_angle, normalize_angle_signed, orientation};
38pub use shape::{
39    Anchor, AnchorKind, FlatPath, HAlign, MAX_SHAPE_POINTS, MAX_TEXT_CHARS, Path, PathEl, PointShape, Polygon,
40    Polyline, Rect, Shape, ShapeKind, SubPath, Text, TransformPolicy, VAlign, arc_to_cubics, point_in_ring,
41    ring_signed_area,
42};
43pub use spatial::SpatialIndex;
44pub use tolerance::{FlattenTolerance, ModelTolerance, ScreenTolerance};