[−][src]Struct myelin_geometry::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) -> Self
[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 for T
[src]
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = !
🔬 This is a nightly-only experimental API. (
try_from
)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> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,