[−][src]Struct myelin_engine::prelude::PolygonBuilder
Polygon factory, which can be used in order to configure
the properties of a new polygon.
Methods can be chained on it in order to configure it.
Examples
use myelin_geometry::PolygonBuilder; let builder = PolygonBuilder::default();
Methods
impl PolygonBuilder[src]
pub fn vertex(self, x: f64, y: f64) -> PolygonBuilder[src]
Adds a vertex to the polygon
Examples
use myelin_geometry::PolygonBuilder; let unfinished_builder = PolygonBuilder::default() .vertex(-50.0, -50.0) .vertex(50.0, -50.0) .vertex(50.0, 50.0) .vertex(-50.0, 50.0);
pub fn build(self) -> Result<Polygon, ()>[src]
Finishes building the Polygon with all
vertices that have been configured up to this point
Errors
This method will return an error if the number of configured
vertices is less than three, as the resulting Polygon
would not be two-dimensional.
Examples
use myelin_geometry::PolygonBuilder; let square = PolygonBuilder::default() .vertex(-50.0, -50.0) .vertex(50.0, -50.0) .vertex(50.0, 50.0) .vertex(-50.0, 50.0) .build() .unwrap();
Trait Implementations
impl Default for PolygonBuilder[src]
fn default() -> PolygonBuilder[src]
impl Debug for PolygonBuilder[src]
Auto Trait Implementations
impl Send for PolygonBuilder
impl Sync for PolygonBuilder
Blanket Implementations
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T[src]
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>, [src]
SS: SubsetOf<SP>,
fn to_subset(&self) -> Option<SS>[src]
fn is_in_subset(&self) -> bool[src]
unsafe fn to_subset_unchecked(&self) -> SS[src]
fn from_subset(element: &SS) -> SP[src]
impl<T> Downcast for T where
T: Any,
T: Any,