### Convert mint::Point2 to Point Source: https://docs.rs/boostvoronoi/0.12.1/boostvoronoi/prelude/struct.Point.html Example of converting a mint::Point2 to a Point. ```rust let m = mint::Point2{x:1,y:2}; let p:Point = Point::from(&m); assert_eq!(p.x,m.x); assert_eq!(p.y,m.y); ``` -------------------------------- ### Copy conversion for Point Source: https://docs.rs/boostvoronoi/0.12.1/boostvoronoi/prelude/struct.Point.html Example of a copy conversion from a reference to a Point. ```rust let c = [1,2]; let p1:Point = Point::from(c); let p2:Point = Point::from(&p1); assert_eq!(p2.x,c[0]); assert_eq!(p2.y,c[1]); ``` -------------------------------- ### read_boost_input_file Source: https://docs.rs/boostvoronoi/0.12.1/boostvoronoi/prelude/fn.read_boost_input_file.html Reads an example file in the file format used by C++ boost voronoi. ```APIDOC ## Function: read_boost_input_file ### Description Reads an example file in the file format used by C++ boost voronoi. The file format expects the number of points followed by coordinates, then the number of lines followed by line segment coordinates. ### Signature `pub fn read_boost_input_file(filename: &Path) -> Result<(Vec>, Vec>), BvError>` ### Parameters - **filename** (&Path) - The path to the input file to be read. ### Returns - **Result<(Vec>, Vec>), BvError>** - A Result containing a tuple of points and lines on success, or a BvError on failure. ``` -------------------------------- ### Building a Voronoi diagram Source: https://docs.rs/boostvoronoi/0.12.1/boostvoronoi/prelude/struct.Builder.html Example demonstrating how to initialize the Builder with points and segments to generate a Voronoi diagram. ```rust use boostvoronoi::BvError; type I = i32; // this is the integer input type type F = f64; // this is the float output type (circle event coordinates) // Points should be unique. Points should not intersect lines let p = vec!(Point{x:9_i32, y:10}); // Lines may only intersect at the endpoints. let s = vec!(Line::new(Point{x:10_i32, y:11}, Point{x:12, y:13})); let result = Builder::::default() // You will have to keep track of the input geometry. it will be referenced as // input geometry indices in the output. // `with_vertices()` and `with_segments()` accepts iterators of anything that implements // `Into()` for `Point` and `Line` .with_vertices(p.iter())? .with_segments(s.iter())? // this will generate the list of cells, edges and circle events (aka vertices) .build()?; ``` -------------------------------- ### Convert geo::Point to Point Source: https://docs.rs/boostvoronoi/0.12.1/boostvoronoi/prelude/struct.Point.html Example of converting a geo::Point to a Point. ```rust let g = geo::Point::new(1,2); let p:Point = Point::from(&g); assert_eq!(p.x, g.x()); assert_eq!(p.y, g.y()); ``` -------------------------------- ### Convert glam::IVec2 to Point Source: https://docs.rs/boostvoronoi/0.12.1/boostvoronoi/prelude/struct.Point.html Example of converting a glam::IVec2 to a Point. ```rust let m = glam::IVec2::new(1,2); let p:Point = Point::from(&m); assert_eq!(p.x,m.x); assert_eq!(p.y,m.y); ``` -------------------------------- ### Convert array to Point Source: https://docs.rs/boostvoronoi/0.12.1/boostvoronoi/prelude/struct.Point.html Example of converting a fixed-size array to a Point. ```rust let c = [1,2]; let p:Point = Point::from(&c); assert_eq!(p.x,c[0]); assert_eq!(p.y,c[1]); ``` -------------------------------- ### read_boost_input_buffer Source: https://docs.rs/boostvoronoi/0.12.1/boostvoronoi/prelude/fn.read_boost_input_buffer.html Reads an example from a buffer using the format used by C++ boost voronoi. ```APIDOC ## Function: read_boost_input_buffer ### Description Reads an example from a buffer using the format used by C++ boost voronoi. The input format expects the number of points followed by their coordinates, then the number of lines followed by their coordinate pairs. ### Signature `pub fn read_boost_input_buffer(reader: BufReader) -> Result<(Vec>, Vec>), BvError>` ### Parameters - **reader** (BufReader) - The input buffer to read from. ### Returns - **Result<(Vec>, Vec>), BvError>** - A Result containing a tuple of points and lines on success, or a BvError on failure. ``` -------------------------------- ### Convert cgmath::Point2 to Point Source: https://docs.rs/boostvoronoi/0.12.1/boostvoronoi/prelude/struct.Point.html Example of converting a cgmath::Point2 to a Point. ```rust let c = cgmath::Point2{x:1,y:2}; let p:Point = Point::from(&c); assert_eq!(p.x,c.x); assert_eq!(p.y,c.y); ``` -------------------------------- ### Convert nalgebra::Point2 to Point Source: https://docs.rs/boostvoronoi/0.12.1/boostvoronoi/prelude/struct.Point.html Example of converting a nalgebra::Point2 to a Point. ```rust let c = nalgebra::Point2::new(1,2); let p:Point = Point::from(&c); assert_eq!(p.x,c.x); assert_eq!(p.y,c.y); ``` -------------------------------- ### Convert array to Line Source: https://docs.rs/boostvoronoi/0.12.1/boostvoronoi/prelude/struct.Line.html Shows how to initialize a Line from a flat array of four integers representing start and end coordinates. ```rust let a = [0,1,2,3]; let bl = Line::::from(a); assert_eq!(bl.start.x,a[0]); assert_eq!(bl.start.y,a[1]); assert_eq!(bl.end.x,a[2]); assert_eq!(bl.end.y,a[3]); ``` -------------------------------- ### Line::new Source: https://docs.rs/boostvoronoi/0.12.1/boostvoronoi/prelude/struct.Line.html Creates a new Line instance with the specified start and end points. ```APIDOC ## pub fn new(start: Point, end: Point) -> Self ### Description Creates a new Line instance. ### Parameters - **start** (Point) - The starting point of the line. - **end** (Point) - The ending point of the line. ``` -------------------------------- ### Convert Point to geo::Coord Source: https://docs.rs/boostvoronoi/0.12.1/boostvoronoi/prelude/struct.Point.html Example of converting a Point to a geo::Coord. ```rust let p = Point{x:1,y:2}; let c = geo::Coord::::from(&p); assert_eq!(p.x,c.x); assert_eq!(p.y,c.y); ``` -------------------------------- ### Convert geo::Coord to Point Source: https://docs.rs/boostvoronoi/0.12.1/boostvoronoi/prelude/struct.Point.html Example of converting a geo::Coord to a Point. ```rust let c = geo::Coord{x:1,y:2}; let p:Point = Point::from(&c); assert_eq!(p.x, c.x); assert_eq!(p.y, c.y); ``` -------------------------------- ### Point::new Source: https://docs.rs/boostvoronoi/0.12.1/boostvoronoi/prelude/struct.Point.html Creates a new Point instance. ```APIDOC ## pub const fn new(x: T, y: T) -> Self ### Description Creates a new `Point` instance with the specified x and y coordinates. ### Signature `pub const fn new(x: T, y: T) -> Self` ``` -------------------------------- ### Copy Conversion for Line Source: https://docs.rs/boostvoronoi/0.12.1/boostvoronoi/prelude/struct.Line.html Shows how to perform a copy conversion from a reference to a Line. ```rust let c = [1,2,3,4]; let p1:Line = Line::from(c); let p2:Line = Line::from(&p1); assert_eq!(p2.start.x,c[0]); assert_eq!(p2.start.y,c[1]); assert_eq!(p2.end.x,c[2]); assert_eq!(p2.end.y,c[3]); ``` -------------------------------- ### build Source: https://docs.rs/boostvoronoi/0.12.1/boostvoronoi/prelude/struct.Builder.html Executes the sweep-line algorithm and returns the resulting diagram. ```APIDOC ## pub fn build(self) -> Result ### Description Runs the sweep-line algorithm using the provided vertices and segments to generate and return the final Voronoi diagram. ``` -------------------------------- ### Convert Line to and from glam::IVec2 arrays Source: https://docs.rs/boostvoronoi/0.12.1/boostvoronoi/prelude/struct.Line.html Demonstrates bidirectional conversion between a Line and an array of two glam::IVec2 points. ```rust let bl = Line::::from([0,1,2,3]); let ml:[glam::IVec2;2] = bl.into(); assert_eq!(bl.start.x,ml[0].x); assert_eq!(bl.start.y,ml[0].y); assert_eq!(bl.end.x,ml[1].x); assert_eq!(bl.end.y,ml[1].y); let ml = [glam::IVec2::new(1,2),glam::IVec2::new(3,4)]; let bl = Line::from(ml); assert_eq!(bl.start.x,ml[0].x); assert_eq!(bl.start.y,ml[0].y); assert_eq!(bl.end.x,ml[1].x); assert_eq!(bl.end.y,ml[1].y); ``` -------------------------------- ### Cell::new Source: https://docs.rs/boostvoronoi/0.12.1/boostvoronoi/prelude/struct.Cell.html Creates a new instance of a Cell. ```APIDOC ### pub fn new(id: CellIndex, source_index: SourceIndex, source_category: ColorType) -> Self Creates a new Voronoi cell with the specified ID, source index, and source category. ``` -------------------------------- ### Convert Vertex to mint Point2 Source: https://docs.rs/boostvoronoi/0.12.1/boostvoronoi/prelude/struct.Vertex.html Converts a Vertex into a mint::Point2 instance. ```rust let v = Vertex::new_3(VertexIndex::default(),1.0,2.0,false); let p = mint::Point2::::from(v.clone()); assert_eq!(v.x(),p.x); assert_eq!(v.y(),p.y); ``` ```rust let v = Vertex::new_3(VertexIndex::default(),1.0,2.0,false); let p = mint::Point2::::from(v.clone()); assert_eq!(v.x(),p.x.as_()); assert_eq!(v.y(),p.y.as_()); ``` -------------------------------- ### Convert Point to mint::Point2 Source: https://docs.rs/boostvoronoi/0.12.1/boostvoronoi/prelude/struct.Point.html Converts a boostvoronoi::geometry::Point instance into a mint::Point2. ```rust let p:Point = Point{x:1, y:2}; let m = mint::Point2::from(p); assert_eq!(p.x,m.x); assert_eq!(p.y,m.y); ``` -------------------------------- ### Convert Vertex to mint::Point2 Source: https://docs.rs/boostvoronoi/0.12.1/boostvoronoi/prelude/struct.Vertex.html Converts a Vertex to mint::Point2 instances with different precision. ```rust let v = Vertex::new_3(VertexIndex::default(),1.0,2.0,false); let p = mint::Point2::::from(&v); assert_eq!(v.x(),p.x); assert_eq!(v.y(),p.y); ``` ```rust let v = Vertex::new_3(VertexIndex::default(),1.0,2.0,false); let p = mint::Point2::::from(&v); assert_eq!(v.x(),p.x.as_()); assert_eq!(v.y(),p.y.as_()); ``` -------------------------------- ### Convert Point to nalgebra::Point2 Source: https://docs.rs/boostvoronoi/0.12.1/boostvoronoi/prelude/struct.Point.html Converts a boostvoronoi::geometry::Point instance into a nalgebra::Point2. ```rust let p = Point{x:1,y:2}; let c = nalgebra::Point2::::from(p); assert_eq!(p.x,c.x); assert_eq!(p.y,c.y); ``` -------------------------------- ### Convert geo::Line to Line Source: https://docs.rs/boostvoronoi/0.12.1/boostvoronoi/prelude/struct.Line.html Demonstrates converting a geo::Line into a boostvoronoi Line. ```rust let gl = geo::Line::from([(0,1),(2,3)]); let bl = Line::::from(&gl); assert_eq!(bl.start.x,gl.start.x); assert_eq!(bl.start.y,gl.start.y); assert_eq!(bl.end.x,gl.end.x); assert_eq!(bl.end.y,gl.end.y); ``` -------------------------------- ### Convert Point to glam::IVec2 Source: https://docs.rs/boostvoronoi/0.12.1/boostvoronoi/prelude/struct.Point.html Converts a boostvoronoi::geometry::Point instance into a glam::IVec2. ```rust let p = Point::{x:1,y:2}; let c = glam::IVec2::from(p); assert_eq!(p.x,c.x); assert_eq!(p.y,c.y); ``` -------------------------------- ### Convert Point to [f64; 2] Source: https://docs.rs/boostvoronoi/0.12.1/boostvoronoi/prelude/struct.Point.html Converts a boostvoronoi::geometry::Point instance into a fixed-size array of f64. ```rust let c1 = [1,2]; let p:Point = Point::from(c1); let c2: [f64;2] = p.into(); println!("c1:{:?}, c2:{:?}", c1, c2); assert_eq!(c1[0] as f64, c2[0]); assert_eq!(c1[1] as f64, c2[1]); ``` -------------------------------- ### Convert Line to and from mint::Point2 Source: https://docs.rs/boostvoronoi/0.12.1/boostvoronoi/prelude/struct.Line.html Converts between a Line and an array of two mint::Point2 objects. ```rust let bl = Line::::from([0,1,2,3]); let ml:[mint::Point2;2] = bl.into(); assert_eq!(bl.start.x,ml[0].x); assert_eq!(bl.start.y,ml[0].y); assert_eq!(bl.end.x,ml[1].x); assert_eq!(bl.end.y,ml[1].y); let ml = [mint::Point2::::from([1,2]),mint::Point2::from([3,4])]; let bl = Line::::from(ml); assert_eq!(bl.start.x,ml[0].x); assert_eq!(bl.start.y,ml[0].y); assert_eq!(bl.end.x,ml[1].x); assert_eq!(bl.end.y,ml[1].y); ``` -------------------------------- ### Convert Point to cgmath::Point2 Source: https://docs.rs/boostvoronoi/0.12.1/boostvoronoi/prelude/struct.Point.html Converts a boostvoronoi::geometry::Point instance into a cgmath::Point2. ```rust let p = Point{x:1,y:2}; let c = cgmath::Point2::::from(p); assert_eq!(p.x,c.x); assert_eq!(p.y,c.y); ``` -------------------------------- ### Convert Vertex to nalgebra Point2 Source: https://docs.rs/boostvoronoi/0.12.1/boostvoronoi/prelude/struct.Vertex.html Converts a Vertex into an nalgebra::Point2 instance. ```rust let v = Vertex::new_3(VertexIndex::default(),1.0,2.0,false); let p = nalgebra::Point2::::from(v.clone()); assert_eq!(v.x(),p.x.as_()); assert_eq!(v.y(),p.y.as_()); ``` -------------------------------- ### Convert Vertex to nalgebra::Point2 Source: https://docs.rs/boostvoronoi/0.12.1/boostvoronoi/prelude/struct.Vertex.html Converts a Vertex to an nalgebra::Point2 instance. ```rust let v = Vertex::new_3(VertexIndex::default(),1.0,2.0,false); let p = nalgebra::Point2::::from(&v); assert_eq!(v.x(),p.x.as_()); assert_eq!(v.y(),p.y.as_()); ``` -------------------------------- ### Function signature for read_boost_input_buffer Source: https://docs.rs/boostvoronoi/0.12.1/boostvoronoi/prelude/fn.read_boost_input_buffer.html The function signature defines the required input reader and the expected return type containing points and lines. ```rust pub fn read_boost_input_buffer( reader: BufReader, ) -> Result<(Vec>, Vec>), BvError> ``` -------------------------------- ### read_boost_input_file function signature Source: https://docs.rs/boostvoronoi/0.12.1/boostvoronoi/prelude/fn.read_boost_input_file.html The function signature for reading Boost Voronoi input files, requiring a type that implements InputType. ```rust pub fn read_boost_input_file( filename: &Path, ) -> Result<(Vec>, Vec>), BvError> ``` -------------------------------- ### Convert Vertex to cgmath Point2 Source: https://docs.rs/boostvoronoi/0.12.1/boostvoronoi/prelude/struct.Vertex.html Converts a Vertex into a cgmath::Point2 instance. ```rust let v = Vertex::new_3(VertexIndex::default(),1.0,2.0,false); let p = cgmath::Point2::::from(v.clone()); assert_eq!(v.x(),p.x.as_()); assert_eq!(v.y(),p.y.as_()); ``` -------------------------------- ### Convert Vertex to cgmath::Point2 Source: https://docs.rs/boostvoronoi/0.12.1/boostvoronoi/prelude/struct.Vertex.html Converts a Vertex to a cgmath::Point2 instance. ```rust let v = Vertex::new_3(VertexIndex::default(),1.0,2.0,false); let p = cgmath::Point2::::from(&v); assert_eq!(v.x(),p.x.as_()); assert_eq!(v.y(),p.y.as_()); ``` -------------------------------- ### Point::as_f64 Source: https://docs.rs/boostvoronoi/0.12.1/boostvoronoi/prelude/struct.Point.html Converts the point coordinates to an array of f64 values. ```APIDOC ## pub fn as_f64(&self) -> [f64; 2] ### Description Converts the current `Point` coordinates into an array of two `f64` values. ### Signature `pub fn as_f64(&self) -> [f64; 2]` ``` -------------------------------- ### Convert Vertex to glam vectors Source: https://docs.rs/boostvoronoi/0.12.1/boostvoronoi/prelude/struct.Vertex.html Converts a Vertex into glam::DVec2 or glam::Vec2 instances. ```rust let v = Vertex::new_3(VertexIndex::default(),1.0,2.0,false); let p = glam::DVec2::from(v.clone()); assert_eq!(v.x(),p.x.as_()); assert_eq!(v.y(),p.y.as_()); ``` ```rust let v = Vertex::new_3(VertexIndex::default(),1.0,2.0,false); let p = glam::Vec2::from(v.clone()); assert_eq!(v.x(),p.x.as_()); assert_eq!(v.y(),p.y.as_()); ``` -------------------------------- ### Diagram struct definition Source: https://docs.rs/boostvoronoi/0.12.1/boostvoronoi/prelude/struct.Diagram.html The primary data structure for Voronoi output. ```rust pub struct Diagram { /* private fields */ } ``` -------------------------------- ### Convert Vertex to glam vectors Source: https://docs.rs/boostvoronoi/0.12.1/boostvoronoi/prelude/struct.Vertex.html Converts a Vertex to glam::DVec2 or glam::Vec2 instances. ```rust let v = Vertex::new_3(VertexIndex::default(),1.0,2.0,false); let p = glam::DVec2::from(&v); assert_eq!(v.x(),p.x); assert_eq!(v.y(),p.y); ``` ```rust let v = Vertex::new_3(VertexIndex::default(),1.0,2.0,false); let p = glam::Vec2::from(&v); assert_eq!(v.x(),p.x.as_()); assert_eq!(v.y(),p.y.as_()); ``` -------------------------------- ### Point Struct Definition Source: https://docs.rs/boostvoronoi/0.12.1/boostvoronoi/prelude/struct.Point.html The basic structure definition for the 2D coordinate container. ```rust pub struct Point { pub x: T, pub y: T, } ``` -------------------------------- ### Cell Property Methods Source: https://docs.rs/boostvoronoi/0.12.1/boostvoronoi/prelude/struct.Cell.html Methods to retrieve information about the cell's source and site type. ```APIDOC ### pub fn source_category(&self) -> SourceCategory Returns the category of the source. ### pub fn source_index(&self) -> SourceIndex Returns the origin index of the cell. ### pub fn source_index_2(&self) -> (SourceIndex, SourceCategory) Returns the origin index of the point that created this cell along with its source category. ### pub fn id(&self) -> CellIndex Returns the ID of the cell. ``` -------------------------------- ### Convert Line to Array Source: https://docs.rs/boostvoronoi/0.12.1/boostvoronoi/prelude/struct.Line.html Converts a Line instance into an array of four elements. ```rust let l = Line::from([0,1,2,3]); let a = <[i32;4]>::from(&l); assert_eq!(l.start.x,a[0]); assert_eq!(l.start.y,a[1]); assert_eq!(l.end.x,a[2]); assert_eq!(l.end.y,a[3]); ``` -------------------------------- ### Convert geo::Line to Line (Owned) Source: https://docs.rs/boostvoronoi/0.12.1/boostvoronoi/prelude/struct.Line.html Converts an owned geo::Line into a boostvoronoi Line. ```rust let gl = geo::Line::from([(0,1),(2,3)]); let bl = Line::::from(gl); assert_eq!(bl.start.x,gl.start.x); assert_eq!(bl.start.y,gl.start.y); assert_eq!(bl.end.x,gl.end.x); assert_eq!(bl.end.y,gl.end.y); ``` -------------------------------- ### Convert Point to geo::Point Source: https://docs.rs/boostvoronoi/0.12.1/boostvoronoi/prelude/struct.Point.html Converts a boostvoronoi::geometry::Point instance into a geo::Point. ```rust let p = Point{x:1,y:2}; let g = geo::Point::::from(p); assert_eq!(p.x, g.x()); assert_eq!(p.y, g.y()); ``` -------------------------------- ### Convert Array to Line Source: https://docs.rs/boostvoronoi/0.12.1/boostvoronoi/prelude/struct.Line.html Converts an array of four elements into a Line instance. ```rust let a = [0,1,2,3]; let bl = Line::::from(&a); assert_eq!(bl.start.x,a[0]); assert_eq!(bl.start.y,a[1]); assert_eq!(bl.end.x,a[2]); assert_eq!(bl.end.y,a[3]); ``` -------------------------------- ### Convert Line to geo::Line Source: https://docs.rs/boostvoronoi/0.12.1/boostvoronoi/prelude/struct.Line.html Converts a boostvoronoi Line into a geo::Line. ```rust let bl = Line::from([0,1,2,3]); let gl = geo::Line::::from(bl); assert_eq!(bl.start.x,gl.start.x); assert_eq!(bl.start.y,gl.start.y); assert_eq!(bl.end.x,gl.end.x); assert_eq!(bl.end.y,gl.end.y); ``` -------------------------------- ### with_vertices Source: https://docs.rs/boostvoronoi/0.12.1/boostvoronoi/prelude/struct.Builder.html Inserts vertices into the builder. This should be called before inserting segments. ```APIDOC ## pub fn with_vertices(self, vertices: T) -> Result ### Description Inserts a collection of vertices into the builder. This method must be called before inserting segments. ### Parameters - **vertices** (T) - Required - An iterator of items that implement `Into>`. ``` -------------------------------- ### Convert Point to geo::Coord Source: https://docs.rs/boostvoronoi/0.12.1/boostvoronoi/prelude/struct.Point.html Converts a boostvoronoi::geometry::Point instance into a geo::Coord. ```rust let p = Point{x:1,y:2}; let c = geo::Coord::::from(p); assert_eq!(p.x, c.x); assert_eq!(p.y, c.y); ``` -------------------------------- ### Define Vertex struct Source: https://docs.rs/boostvoronoi/0.12.1/boostvoronoi/prelude/struct.Vertex.html The basic definition of the Vertex struct. ```rust pub struct Vertex { /* private fields */ } ``` -------------------------------- ### Convert Vertex to geo::Point Source: https://docs.rs/boostvoronoi/0.12.1/boostvoronoi/prelude/struct.Vertex.html Converts a Vertex to a geo::Point instance. ```rust let v = Vertex::new_3(VertexIndex::default(),1.0,2.0,false); let c = geo::Point::::from(&v); assert_eq!(v.x(),c.x().as_()); assert_eq!(v.y(),c.y().as_()); ``` -------------------------------- ### Convert Owned Line to Array Source: https://docs.rs/boostvoronoi/0.12.1/boostvoronoi/prelude/struct.Line.html Converts an owned Line instance into an array of four elements. ```rust let l = Line::from([0,1,2,3]); let a = <[i32;4]>::from(l); assert_eq!(l.start.x,a[0]); assert_eq!(l.start.y,a[1]); assert_eq!(l.end.x,a[2]); assert_eq!(l.end.y,a[3]); ``` -------------------------------- ### Edge Methods Source: https://docs.rs/boostvoronoi/0.12.1/boostvoronoi/prelude/struct.Edge.html Methods available on the Edge struct to retrieve edge information and metadata. ```APIDOC ## pub fn id(&self) -> EdgeIndex Returns the edge index. ## pub fn cell(&self) -> Result Returns the cell index of this edge, or a BvError. ## pub fn vertex0(&self) -> Option Returns vertex0, it is perfectly ok for an edge to not contain a vertex0 so no Result<..> is needed here. ## pub fn twin(&self) -> Result Returns the twin edge or an error. ## pub fn next(&self) -> Result Returns the next edge (counterclockwise winding) or an error. ## pub fn prev(&self) -> Result Returns the previous edge (counterclockwise winding). ## pub fn is_linear(&self) -> bool Returns true if the edge is linear (segment, ray, line). Returns false if the edge is curved (parabolic arc). ## pub fn is_curved(&self) -> bool Returns true if the edge is curved (parabolic arc). Returns false if the edge is linear (segment, ray, line). ## pub fn is_primary(&self) -> bool Returns false if edge goes through the endpoint of the segment. Returns true else. ## pub fn is_secondary(&self) -> bool Returns true if edge goes through the endpoint of the segment. Returns false else. ## pub fn get_color(&self) -> ColorType get_color returns the custom edge info. (does not contain the reserved bits) ## pub fn set_color(&mut self, color: ColorType) -> ColorType set_color sets the custom edge info. (does not affect the reserved bits) ## pub fn or_color(&mut self, color: ColorType) -> ColorType or_color sets the custom edge info together with the previous value. (does not affect the reserved bits) ``` -------------------------------- ### discretize Source: https://docs.rs/boostvoronoi/0.12.1/boostvoronoi/prelude/struct.VoronoiVisualUtils.html Discretizes a parabolic Voronoi edge, which is formed by one point and one segment. The discretization is performed in the output coordinate system using an affine transformation. ```APIDOC ## pub fn discretize(point: &Point, segment: &Line, max_dist: f64, affine: &SimpleAffine, discretization: &mut Vec<[f64; 2]>) ### Description Discretize a parabolic Voronoi edge. Parabolic Voronoi edges are formed by one point and one segment from the initial input set. ### Parameters - **point** (&Point) - The input point in the diagram coordinate system. - **segment** (&Line) - The input segment in the diagram coordinate system. - **max_dist** (f64) - The maximum discretization distance in the output coordinate system. - **affine** (&SimpleAffine) - An affine transform converting from the diagram coordinate system to the output coordinate system. - **discretization** (&mut Vec<[f64; 2]>) - The point discretization of the given Voronoi edge in the output coordinate system. Note: this should contain both edge endpoints initially. ``` -------------------------------- ### point_projection Source: https://docs.rs/boostvoronoi/0.12.1/boostvoronoi/prelude/struct.VoronoiVisualUtils.html Calculates the projection of a point onto a segment within the context of an affine transformation. ```APIDOC ## pub fn point_projection(affine: &SimpleAffine, point: &[f64; 2], segment: &Line) -> f64 ### Description Calculates the projection of a point onto a segment. ### Parameters - **affine** (&SimpleAffine) - The affine transformation. - **point** (&[f64; 2]) - The point to project. - **segment** (&Line) - The segment to project onto. ### Returns - **f64** - The projection value. ``` -------------------------------- ### Builder struct definition Source: https://docs.rs/boostvoronoi/0.12.1/boostvoronoi/prelude/struct.Builder.html The internal structure definition for the Builder, which requires an InputType. ```rust pub struct Builder { /* private fields */ } ``` -------------------------------- ### Cell Site Type Methods Source: https://docs.rs/boostvoronoi/0.12.1/boostvoronoi/prelude/struct.Cell.html Methods to determine the type of site contained within the cell. ```APIDOC ### pub fn contains_point(&self) -> bool Returns true if the cell contains a point site. ### pub fn contains_segment(&self) -> bool Returns true if the cell contains a segment site. ### pub fn contains_segment_startpoint(&self) -> bool Returns true if the cell contains a segment start point. ### pub fn contains_segment_endpoint(&self) -> bool Returns true if the cell contains a segment end point. ``` -------------------------------- ### Cell Geometry Methods Source: https://docs.rs/boostvoronoi/0.12.1/boostvoronoi/prelude/struct.Cell.html Methods to inspect the geometric properties of the cell. ```APIDOC ### pub fn is_degenerate(&self) -> bool Returns true if the cell is degenerate (does not have any incident edges). ### pub fn get_incident_edge(&self) -> Option Returns a random edge defined by this cell. ``` -------------------------------- ### Convert Vertex to primitive arrays Source: https://docs.rs/boostvoronoi/0.12.1/boostvoronoi/prelude/struct.Vertex.html Converts a Vertex reference into a fixed-size array of floats. ```rust let v = Vertex::new_3(VertexIndex::default(),1.0,2.0,false); let a = <[f32;2]>::from(&v); assert_eq!(v.x(),a[0].as_()); assert_eq!(v.y(),a[1].as_()); ``` ```rust let v = Vertex::new_3(VertexIndex::default(),1.0,2.0,false); let a = <[f64;2]>::from(&v); assert_eq!(v.x(),a[0]); assert_eq!(v.y(),a[1]); ``` -------------------------------- ### Convert [T; 2] to Point Source: https://docs.rs/boostvoronoi/0.12.1/boostvoronoi/prelude/struct.Point.html Converts a fixed-size array of two elements into a boostvoronoi::geometry::Point. ```rust let c = [1,2]; let p:Point = Point::from(c); assert_eq!(p.x,c[0]); assert_eq!(p.y,c[1]); ``` -------------------------------- ### Line Struct Definition Source: https://docs.rs/boostvoronoi/0.12.1/boostvoronoi/prelude/struct.Line.html The basic structure of the Line type, which is generic over an InputType. ```rust pub struct Line { pub start: Point, pub end: Point, } ``` -------------------------------- ### Convert Vertex to geo::Coord Source: https://docs.rs/boostvoronoi/0.12.1/boostvoronoi/prelude/struct.Vertex.html Converts a Vertex to a geo::Coord instance. ```rust let v = Vertex::new_3(VertexIndex::default(),1.0,2.0,false); let c = geo::Coord::::from(&v); assert_eq!(v.x(),c.x.as_()); assert_eq!(v.y(),c.y.as_()); ``` -------------------------------- ### with_segments Source: https://docs.rs/boostvoronoi/0.12.1/boostvoronoi/prelude/struct.Builder.html Inserts segments into the builder. This should be called after inserting vertices. ```APIDOC ## pub fn with_segments(self, segments: T) -> Result ### Description Inserts a collection of segments into the builder. This method should be called after vertices have been inserted. ### Parameters - **segments** (T) - Required - An iterator of items that implement `Into>`. ``` -------------------------------- ### Convert Vertex to geo types Source: https://docs.rs/boostvoronoi/0.12.1/boostvoronoi/prelude/struct.Vertex.html Converts a Vertex into geo::Coord or geo::Point types. ```rust let v = Vertex::new_3(VertexIndex::default(),1.0,2.0,false); let c = geo::Coord::::from(v.clone()); assert_eq!(v.x(),c.x.as_()); assert_eq!(v.y(),c.y.as_()); ``` ```rust let v = Vertex::new_3(VertexIndex::default(),1.0,2.0,false); let p = geo::Point::::from(v.clone()); assert_eq!(v.x(),p.x().as_()); assert_eq!(v.y(),p.y().as_()); ``` -------------------------------- ### Line::cast Source: https://docs.rs/boostvoronoi/0.12.1/boostvoronoi/prelude/struct.Line.html Casts a Line to a Line where T can be converted to T2. ```APIDOC ## pub fn cast(self) -> Line ### Description Converts the underlying coordinate type of the line. ``` -------------------------------- ### SourceCategory Enum Definition Source: https://docs.rs/boostvoronoi/0.12.1/boostvoronoi/prelude/enum.SourceCategory.html Defines the variants representing the source geometry of a Voronoi cell. ```rust pub enum SourceCategory { SinglePoint, SegmentStart, SegmentEnd, Segment, } ``` -------------------------------- ### Point::cast Source: https://docs.rs/boostvoronoi/0.12.1/boostvoronoi/prelude/struct.Point.html Casts a Point of one type to a Point of another type. ```APIDOC ## pub fn cast(self) -> Point ### Description Casts a `Point` to a `Point`, provided that `T` implements `AsPrimitive`. ### Signature `pub fn cast(self) -> Point where T: AsPrimitive` ``` -------------------------------- ### Define ColorType alias Source: https://docs.rs/boostvoronoi/0.12.1/boostvoronoi/prelude/type.ColorType.html The ColorType alias is defined as a 32-bit unsigned integer. ```rust pub type ColorType = u32; ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.