pub enum Shape {
Point(PointShape),
Line(Segment),
Polyline(Polyline),
Rect(Rect),
Circle(Circle),
Arc(Arc),
Path(Path),
Polygon(Polygon),
Text(Text),
}Expand description
A canonical 2D shape.
Variants§
Point(PointShape)
Point marker.
Line(Segment)
Line segment.
Polyline(Polyline)
Polyline (optionally closed, optional arc segments).
Rect(Rect)
Axis-aligned rectangle.
Circle(Circle)
Circle.
Arc(Arc)
Circular arc.
Path(Path)
Bézier path.
Polygon(Polygon)
Polygon with holes.
Text(Text)
Text annotation.
Implementations§
Source§impl Shape
impl Shape
Sourcepub fn is_region(&self) -> bool
pub fn is_region(&self) -> bool
Whether the shape bounds an area (fill and inside tests apply).
Sourcepub fn distance_to(&self, p: Point) -> f64
pub fn distance_to(&self, p: Point) -> f64
Distance from p to the outline (text: to its layout box).
Sourcepub fn contains_point(&self, p: Point, tol: FlattenTolerance) -> bool
pub fn contains_point(&self, p: Point, tol: FlattenTolerance) -> bool
Even-odd inside test for regions (always false for non-regions).
Straight edges use exact orientation predicates; curved edges are flattened
with tol.
Sourcepub fn hit(&self, p: Point, radius: f64, fill: bool) -> bool
pub fn hit(&self, p: Point, radius: f64, fill: bool) -> bool
Hit test: within radius of the outline, or inside when fill is set.
Sourcepub fn inside_rect(&self, r: Aabb) -> bool
pub fn inside_rect(&self, r: Aabb) -> bool
Window selection: shape entirely inside r.
Sourcepub fn intersects_rect(&self, r: Aabb, tol: ModelTolerance) -> bool
pub fn intersects_rect(&self, r: Aabb, tol: ModelTolerance) -> bool
Crossing selection: any part of the shape touches r (regions: also when
r lies inside the region).
Sourcepub fn flatten(&self, tol: FlattenTolerance) -> Vec<FlatPath>
pub fn flatten(&self, tol: FlattenTolerance) -> Vec<FlatPath>
Flatten into polylines/rings with maximum deviation tol.
Sourcepub fn area(&self) -> f64
pub fn area(&self) -> f64
Unsigned area of regions (0 for non-regions). Bézier areas use flattening.
Sourcepub fn transform(&self, t: Affine, policy: TransformPolicy) -> GeoResult<Self>
pub fn transform(&self, t: Affine, policy: TransformPolicy) -> GeoResult<Self>
Transform the shape. See TransformPolicy.