[−][src]Function conrod_core::widget::primitive::shape::triangles::from_quad
pub fn from_quad(points: [Point; 4]) -> (Triangle<Point>, Triangle<Point>)
Triangulates the given quad, represented by four points that describe its edges in either clockwise or anti-clockwise order.
Example
The following rectangle
ⓘThis example is not tested
a b -------- | | | | | | -------- d c
given as
ⓘThis example is not tested
from_quad([a, b, c, d])
returns
ⓘThis example is not tested
(Triangle([a, b, c]), Triangle([a, c, d]))
Here's a basic code example:
extern crate conrod_core; use conrod_core::widget::triangles::{from_quad, Triangle}; fn main() { let a = [0.0, 1.0]; let b = [1.0, 1.0]; let c = [1.0, 0.0]; let d = [0.0, 0.0]; let quad = [a, b, c, d]; let triangles = from_quad(quad); assert_eq!(triangles, (Triangle([a, b, c]), Triangle([a, c, d]))); }