Trait polygon::Polygon
[−]
[src]
pub trait Polygon: Sized { fn translate(&self, _: f64, _: f64) -> Self; fn rotate_radians(&self, _: f64) -> Self; fn angles_radians(&self) -> Vec<f64>; fn collides_with<P: Polygon>(&self, _: &P) -> Self; fn shadow(&self, _: f64) -> [f64; 2]; fn enlarge(&self, _: f64) -> Self; fn translate_x(&self, x: f64) -> Self { ... } fn translate_y(&self, y: f64) -> Self { ... } fn rotate_degrees(&self, r: f64) -> Self { ... } fn angles_degrees(&self) -> Vec<f64> { ... } fn angles_gradients(&self) -> Vec<f64> { ... } fn normals_radians(&self) -> Vec<f64> { ... } fn normals_degrees(&self) -> Vec<f64> { ... } fn normals_gradients(&self) -> Vec<f64> { ... } fn rotate_about_radians(&self, x: f64, y: f64, r: f64) -> Self { ... } fn rotate_about_degrees(&self, x: f64, y: f64, r: f64) -> Self { ... } fn enlarge_about(&self, x: f64, y: f64, s: f64) -> Self { ... } fn trans(&self, x: f64, y: f64) -> Self { ... } fn rot_rad(&self, r: f64) -> Self { ... } fn trans_x(&self, x: f64) -> Self { ... } fn trans_y(&self, y: f64) -> Self { ... } fn rot_deg(&self, r: f64) -> Self { ... } fn rot_about_rad(&self, x: f64, y: f64, r: f64) -> Self { ... } fn rot_about_deg(&self, x: f64, y: f64, r: f64) -> Self { ... } fn ang_rad(&self) -> Vec<f64> { ... } fn ang_deg(&self) -> Vec<f64> { ... } fn ang_grad(&self) -> Vec<f64> { ... } fn norm_rad(&self) -> Vec<f64> { ... } fn norm_deg(&self) -> Vec<f64> { ... } fn norm_grad(&self) -> Vec<f64> { ... } }
Functions for manipulating a polygon.
Required Methods
fn translate(&self, _: f64, _: f64) -> Self
translate(x, y)
Translate polygon by (x
, y
).
fn rotate_radians(&self, _: f64) -> Self
rotate_radians(r)
Rotate polygon about (0, 0) by r
radians.
fn angles_radians(&self) -> Vec<f64>
angles_radians()
Get a slice of all of the angles of lines present in the polygon in radians
fn collides_with<P: Polygon>(&self, _: &P) -> Self
collides_with(&rhs)
Check if polygon collides with another polygon (rhs
).
fn shadow(&self, _: f64) -> [f64; 2]
shadow(r)
Returns the shadow cast by the polygon by a light source incident at angle r
as an initial
and final position relative to the origin across the normal of r
.
fn enlarge(&self, _: f64) -> Self
enlarge(s)
Enlarge about (0, 0) with scale factor s
.
Provided Methods
fn translate_x(&self, x: f64) -> Self
Translate polygon by (x
, 0)
fn translate_y(&self, y: f64) -> Self
Translate polygon by (0, y
)
fn rotate_degrees(&self, r: f64) -> Self
Rotate polygon about (0, 0) by r
degrees.
fn angles_degrees(&self) -> Vec<f64>
Get a slice of all the angles of lines present in the polygon in degrees
fn angles_gradients(&self) -> Vec<f64>
Get a slice of all of the angles of lines present in the polygon as a gradients
fn normals_radians(&self) -> Vec<f64>
Get a slice of all of the angles of normals to lines present in the polygon in radians
fn normals_degrees(&self) -> Vec<f64>
Get a slice of all of the angles of normals to lines present in the polygon in degrees
fn normals_gradients(&self) -> Vec<f64>
Get a slice of all of the angles of normals to lines present in the polygon as a gradients
fn rotate_about_radians(&self, x: f64, y: f64, r: f64) -> Self
Rotate polygon about (x
, y
) by r
radians.
fn rotate_about_degrees(&self, x: f64, y: f64, r: f64) -> Self
Rotate polygon about (x
, y
) by r
degrees.
fn enlarge_about(&self, x: f64, y: f64, s: f64) -> Self
Enlarge polygon about (x
, y
) by a scale factor s
.
fn trans(&self, x: f64, y: f64) -> Self
Alias for Polygon::translate
fn rot_rad(&self, r: f64) -> Self
Alias for Polygon::rotate_radians
fn trans_x(&self, x: f64) -> Self
Alias for Polygon::translate_x
fn trans_y(&self, y: f64) -> Self
Alias for Polygon::translate_y
fn rot_deg(&self, r: f64) -> Self
Alias for Polygon::rotate_degrees
fn rot_about_rad(&self, x: f64, y: f64, r: f64) -> Self
Alias for Polygon::rotate_about_radians
fn rot_about_deg(&self, x: f64, y: f64, r: f64) -> Self
Alias for Polygon::rotate_about_degrees
fn ang_rad(&self) -> Vec<f64>
Alias for Polygon::angles_radians
fn ang_deg(&self) -> Vec<f64>
Alias for Polygon::angles_degrees
fn ang_grad(&self) -> Vec<f64>
Alias for Polygon::angles_gradients
fn norm_rad(&self) -> Vec<f64>
Alias for Polygon::normals_radians
fn norm_deg(&self) -> Vec<f64>
Alias for Polygon::normals_degrees
fn norm_grad(&self) -> Vec<f64>
Alias for Polygon::normals_gradients