-
Notifications
You must be signed in to change notification settings - Fork 199
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Line
type
#118
Add Line
type
#118
Conversation
@frewsxcv I added |
let's wait a couple and see if anyone else has anything to say, otherwise I'll ditch the |
Sorry for the delay! I agree that having it in the enum could lead to confusion. Related: Are any of the public / private visibility refinements that are landing in 1.19 useful here? |
Define Line as a struct with public members `start: Point<T>` and `end: Point<T>`. Attach helper methods `new` and `slope`.
+ Implements intersects between Line and Point, Line, LineString, and Polygon. + Move slope into private function withn intersects.rs
Not that I know of, if you find anything, please please open an issue :) |
fyi, I rebased and merged without the |
Adds a
Line
type to represent a line segment by its two endpoints.This PR is the first step to implementing Union/Intersection traits as outlined in #80 (See also #81). Additionally, it addresses #99.
Implements the following (with converse operations where applicable) for
Line
:Length
Area
BoundingBox
Centroid
Rotate
Contains
(Point
,Line
,LineString
)Intersects
(Point
,Line
,LineString
,Polygon
)Distance
(Point
)I wanted to get this up sooner rather than later, and it's already on the large side so there are a few things left unimplemented (operations on
Multi*
geometries for example). Additionally, several operations onLineString
(Length
for example) could be nicely expressed as operations on anLine
iterator. As a result, there is some redundancy that could be resolved in subsequent PRs.