Struct gemini_engine::elements::geometry::Triangle
source · pub struct Triangle {
pub corners: [Vec2D; 3],
pub fill_char: ColChar,
}Expand description
Fields§
§corners: [Vec2D; 3]The 3 cornes of the triangle
fill_char: ColCharThe ColChar used to fill the triange
Implementations§
source§impl Triangle
impl Triangle
sourcepub const fn new(
pos0: Vec2D,
pos1: Vec2D,
pos2: Vec2D,
fill_char: ColChar
) -> Self
pub const fn new( pos0: Vec2D, pos1: Vec2D, pos2: Vec2D, fill_char: ColChar ) -> Self
Create a new triangle from three separate positions and a ColChar
sourcepub const fn with_array(corners: [Vec2D; 3], fill_char: ColChar) -> Self
pub const fn with_array(corners: [Vec2D; 3], fill_char: ColChar) -> Self
Create a new triangle from an array of Vec2Ds and a ColChar
sourcepub const fn corners(&self) -> [Vec2D; 3]
👎Deprecated: Triangle has been restructured, just use Triangle.corners now
pub const fn corners(&self) -> [Vec2D; 3]
Triangle.corners nowReturn the triangle’s points as an array
sourcepub fn interpolate(i0: isize, d0: isize, i1: isize, d1: isize) -> Vec<isize>
pub fn interpolate(i0: isize, d0: isize, i1: isize, d1: isize) -> Vec<isize>
Draw a pseudo-line between the independent and dependent positions. Returns rounded values as isizes. If you don’t want the values rounded, use Triangle::interpolate_floating()
Trait Implementations§
source§impl ViewElement for Triangle
impl ViewElement for Triangle
source§fn active_pixels(&self) -> Vec<Pixel>
fn active_pixels(&self) -> Vec<Pixel>
Return a vector of the element’s
Pixels - A ColChar. If your whole object is a solid colour, consider using utils::points_to_pixels() which will add the same ColChar to every point and can then be used as this function’s outputsource§fn active_points(&self) -> Vec<Vec2D>
fn active_points(&self) -> Vec<Vec2D>
Return the positions the
ViewElement occupies, essentially active_pixels() without the ColChars. This has a default setting that extracts the Vec2Ds from active_pixels but you can set it to something else to make it fasterAuto Trait Implementations§
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