Struct graphics_shapes::triangle::Triangle
source · pub struct Triangle { /* private fields */ }
Implementations§
source§impl Triangle
impl Triangle
pub fn angles(&self) -> [isize; 3]
pub fn angle_type(&self) -> &TriangleAngleType
pub fn side_type(&self) -> &TriangleSideType
source§impl Triangle
impl Triangle
pub fn as_rect(&self) -> Rect
pub fn as_lines(&self) -> [Line; 3]
sourcepub fn right_angle<P: Into<Coord>>(
angle_coord: P,
size: usize,
angle_position: AnglePosition,
) -> Triangle
pub fn right_angle<P: Into<Coord>>( angle_coord: P, size: usize, angle_position: AnglePosition, ) -> Triangle
Create an Isosceles Right Angle Triangle
sourcepub fn equilateral<P: Into<Coord>>(
center: P,
size: usize,
flat_side: FlatSide,
) -> Triangle
pub fn equilateral<P: Into<Coord>>( center: P, size: usize, flat_side: FlatSide, ) -> Triangle
Create an equilateral triangle with width and height of [size] around [center] The top left would be (center.x - size / 2, center.y + size / 2) and bottom right (center.x + size / 2, center.y + size / 2)
Trait Implementations§
source§impl ContainsShape for Triangle
impl ContainsShape for Triangle
source§fn contains_circle(&self, circle: &Circle) -> bool
fn contains_circle(&self, circle: &Circle) -> bool
Returns true if
self
contains circle
source§fn contains_rect(&self, rect: &Rect) -> bool
fn contains_rect(&self, rect: &Rect) -> bool
Returns true if
self
contains rect
source§fn contains_line(&self, line: &Line) -> bool
fn contains_line(&self, line: &Line) -> bool
Returns true if
self
contains line
source§fn contains_triangle(&self, triangle: &Triangle) -> bool
fn contains_triangle(&self, triangle: &Triangle) -> bool
Returns true if
self
contains triangle
source§fn contains_ellipse(&self, ellipse: &Ellipse) -> bool
fn contains_ellipse(&self, ellipse: &Ellipse) -> bool
Returns true if
self
contains ellipse
source§impl<'de> Deserialize<'de> for Triangle
impl<'de> Deserialize<'de> for Triangle
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl IntersectsContains for Triangle
impl IntersectsContains for Triangle
source§impl IntersectsShape for Triangle
impl IntersectsShape for Triangle
source§fn intersects_rect(&self, rect: &Rect) -> bool
fn intersects_rect(&self, rect: &Rect) -> bool
Returns true if
rect
intersects self
source§fn intersects_circle(&self, circle: &Circle) -> bool
fn intersects_circle(&self, circle: &Circle) -> bool
Returns true if
circle
intersects self
source§fn intersects_line(&self, line: &Line) -> bool
fn intersects_line(&self, line: &Line) -> bool
Returns true if
line
intersects self
source§fn intersects_triangle(&self, triangle: &Triangle) -> bool
fn intersects_triangle(&self, triangle: &Triangle) -> bool
Returns true if
triangle
intersects self
source§fn intersects_ellipse(&self, ellipse: &Ellipse) -> bool
fn intersects_ellipse(&self, ellipse: &Ellipse) -> bool
Returns true if
ellipse
intersects self
source§fn intersects_polygon(&self, polygon: &Polygon) -> bool
fn intersects_polygon(&self, polygon: &Polygon) -> bool
Returns true if
polygon
intersects self
source§impl Shape for Triangle
impl Shape for Triangle
source§fn from_points(points: &[Coord]) -> Selfwhere
Self: Sized,
fn from_points(points: &[Coord]) -> Selfwhere
Self: Sized,
create this shape from a list of points (corners of a shape or tips of a line)
source§fn outline_pixels(&self) -> Vec<Coord>
fn outline_pixels(&self) -> Vec<Coord>
The coords for drawing the shape outline, the points may be in any order
This should be cached rather than called per frame
source§fn filled_pixels(&self) -> Vec<Coord>
fn filled_pixels(&self) -> Vec<Coord>
The coords for drawing the filled shape, the points may be in any order
This should be cached rather than called per frame
source§fn to_shape_box(&self) -> ShapeBox
fn to_shape_box(&self) -> ShapeBox
Convert to ShapeBox, used to store shapes with type (for bulk drawing, etc)
source§fn translate_by(&self, delta: Coord) -> Selfwhere
Self: Sized,
fn translate_by(&self, delta: Coord) -> Selfwhere
Self: Sized,
change every point by +
delta
source§fn move_to(&self, point: Coord) -> Selfwhere
Self: Sized,
fn move_to(&self, point: Coord) -> Selfwhere
Self: Sized,
moves the shapes first point to
point
(and changes every other point to match their original distance and angle) Read moresource§fn move_center_to(&self, point: Coord) -> Selfwhere
Self: Sized,
fn move_center_to(&self, point: Coord) -> Selfwhere
Self: Sized,
Moves the shapes center to
point
(and changes every other point to match their original distance and angle) Read moresource§fn rotate_around(&self, degrees: isize, point: Coord) -> Selfwhere
Self: Sized,
fn rotate_around(&self, degrees: isize, point: Coord) -> Selfwhere
Self: Sized,
Rotate shape around a point
fn top_left(&self) -> Coord
fn top_right(&self) -> Coord
fn bottom_left(&self) -> Coord
fn bottom_right(&self) -> Coord
impl Eq for Triangle
impl StructuralPartialEq for Triangle
Auto Trait Implementations§
impl Freeze for Triangle
impl RefUnwindSafe for Triangle
impl Send for Triangle
impl Sync for Triangle
impl Unpin for Triangle
impl UnwindSafe for Triangle
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)