Struct nannou::geom::line::Line
[−]
[src]
pub struct Line<S = DefaultScalar> { pub start: Point2<S>, pub end: Point2<S>, pub half_thickness: S, }
A line represented by two points.
Fields
start: Point2<S>
The start point of the line.
end: Point2<S>
The end point of the line.
half_thickness: S
Half of the thickness of the line.
Methods
impl<S> Line<S> where
S: BaseFloat,
[src]
S: BaseFloat,
pub fn new(start: Point2<S>, end: Point2<S>, half_thickness: S) -> Self
[src]
Short-hand constructor for a Line
.
pub fn centroid(&self) -> Point2<S>
[src]
The centre of the line.
pub fn bounding_rect(&self) -> Rect<S>
[src]
The bounding Rect of the Line including thickness and line caps.
pub fn quad_corners(&self) -> Quad<S>
[src]
The four corners of the rectangle describing the line.
pub fn quad_corners_iter(&self) -> Vertices<S>
[src]
Produce an iterator yielding the four corners of the rectangle describing the line.
pub fn triangles(&self) -> (Tri<S>, Tri<S>)
[src]
The two triangles that describe the line.
pub fn triangles_iter(&self) -> Triangles<S>
[src]
Given two points and half the line thickness, return the two triangles that describe the line.
pub fn contains(&self, point: &Point2<S>) -> Option<Tri<S>>
[src]
Describes whether or not the given point touches the line.
If so, the Tri
containing the point will be returned.
None
is returned otherwise.
Trait Implementations
impl<S> From<Line<S>> for Line<S> where
S: BaseFloat,
[src]
S: BaseFloat,
impl<S: Copy> Copy for Line<S>
[src]
impl<S: Clone> Clone for Line<S>
[src]
fn clone(&self) -> Line<S>
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl<S: Debug> Debug for Line<S>
[src]
fn fmt(&self, __arg_0: &mut Formatter) -> Result
[src]
Formats the value using the given formatter. Read more