pub enum Shape {
Rect {
min: Point,
max: Point,
},
Capsule {
a: Point,
b: Point,
radius: i32,
},
RoundRect {
min: Point,
max: Point,
radius: i32,
},
Polygon {
points: Vec<Point>,
radius: i32,
},
}Expand description
A copper primitive for clearance and connectivity calculations.
Variants§
Rect
Capsule
A segment swept by a disc. A circle has a == b.
RoundRect
A rectangle with corners rounded by radius: the rectangle min..max
shrunk by radius on every side, swept by a disc of radius.
Polygon
A simple polygon swept by a disc of radius: a trapezoid or custom
pad’s copper (rounded by its corner radius), and its mask opening grown
from it. points run counter-clockwise in a y-up frame, as
Shape::polygon puts them.
Implementations§
Source§impl Shape
impl Shape
Sourcepub fn polygon(points: Vec<Point>, radius: i32) -> Self
pub fn polygon(points: Vec<Point>, radius: i32) -> Self
A polygon swept by a disc of radius, its corners turned to run
counter-clockwise in a y-up frame (a positive signed area in board
coordinates) whichever way they were given, so a mirrored part’s pad
has the same winding as any other.
Sourcepub fn covers_box(&self, min: Point, max: Point) -> bool
pub fn covers_box(&self, min: Point, max: Point) -> bool
Whether the shape covers the whole box min..max.
Sourcepub fn pad(center: Point, size: Point, shape: PadShape) -> Self
pub fn pad(center: Point, size: Point, shape: PadShape) -> Self
A pad’s copper, a rounded rectangle taken square-cornered
(Shape::rounded_pad gives it its corners).
Sourcepub fn rounded_pad(
center: Point,
size: Point,
shape: PadShape,
corner: i32,
) -> Self
pub fn rounded_pad( center: Point, size: Point, shape: PadShape, corner: i32, ) -> Self
A pad’s copper. corner is the corner radius of a rounded rectangle (0
makes it an ordinary rectangle); other shapes ignore it.
pub fn circle(center: Point, radius: i32) -> Self
pub fn segment(a: Point, b: Point, width: i32) -> Self
Sourcepub fn grown(&self, grow: i32) -> Self
pub fn grown(&self, grow: i32) -> Self
The shape grown by grow on every side (shrunk when negative): a pad’s
solder mask opening or paste aperture. A shrink never inverts the shape.
Sourcepub fn swept_corners(&self) -> Option<Vec<SweptCorner>>
pub fn swept_corners(&self) -> Option<Vec<SweptCorner>>
A rounded polygon’s outline as exact arcs and the straights between
them, for a host that draws curves (the STEP export). None for any
other shape, an unrounded polygon (its corners are its outline), or one
whose rounding fills a notch, where only Shape::outline is exact.
Sourcepub fn grown_parts(&self, grow: i32) -> Vec<Self>
pub fn grown_parts(&self, grow: i32) -> Vec<Self>
The shape grown by grow, as Shape::grown, but a polygon that a
shrink cuts in two keeps every piece (two lands joined by a thin bridge
each keep their paste); a shrink that leaves nothing gives none.
Sourcepub fn outline(&self, facets: usize) -> Vec<Point>
pub fn outline(&self, facets: usize) -> Vec<Point>
The outline as a closed polygon, counter-clockwise in a y-up frame, arcs
faceted facets to the quarter turn, each vertex ON the true outline.
pub fn bounds(&self) -> (Point, Point)
pub fn center(&self) -> Point
Sourcepub fn distance_to_point(&self, p: Point) -> f64
pub fn distance_to_point(&self, p: Point) -> f64
Distance from a point to the shape; zero inside.
Sourcepub fn depth(&self, p: Point) -> f64
pub fn depth(&self, p: Point) -> f64
How deep p lies inside the shape: its distance to the boundary,
positive inside and negative outside.