pub fn skeleton_of_polygon_to_linestring(
input_polygon: &Polygon,
orientation: bool,
) -> Vec<LineString>
Expand description
This function returns a set of LineSting
which represents an instantiated straight skeleton of the given polygon.
Each segment of the straight skeleton is represented as a single LineString
, and the returned vector is a set of these LineString
s.
If either endpoints of a LineString
is infinitely far from the other, then this LineString
will be clipped to one which has shorter length.
The order of these LineString
s is arbitrary. (There is no gauranteed order on segments of the straight skeleton.)
Click ‘Result’ below to see how this function works.
§Arguments
input_polygon
:Polygon
to get the straight skeleton.orientation
: determines the region where the straight skeleton created. The value of thisboolean
variable will be:true
to create the staright skeleton on the inward region of the polygon, and,false
to create on the outward region of the polygon.
§Example
use geo_buffer::buffer_polygon;
use geo::{Polygon, MultiPolygon, LineString};
let p1 = Polygon::new(
LineString::from(vec![(0., 0.), (2., 0.), (2., 2.), (0., 2.)]), vec![],
);
let ls1: Vec<LineString> = skeleton_of_polygon_to_linestring(&p1, true);