Skip to content
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

Line and LineSegment #261

Open
richard-uk1 opened this issue Apr 6, 2023 · 3 comments
Open

Line and LineSegment #261

richard-uk1 opened this issue Apr 6, 2023 · 3 comments
Labels
needs discussion This change requires some more discussion before we decide we definitely want it question Further information is requested

Comments

@richard-uk1
Copy link
Collaborator

The Line struct in kurbo is a straight line between 2 points. This is commonly called a LineSegment in other libraries (e.g. lyon), while the Line struct represents an infinite line.

Because kurbo doesn't have the concept of a lyon_geom::Line, it perhaps doesn't matter that there is this mismatch, but I just want to highlight it. Perhaps if something like lyon_geom::Line was added to kurbo in the future, it could be called InfiniteLine? Such a structure could be drawn (just draw the part of it that intersects with the viewport), and you could implement Shape for it (with some f64::INFINITYs).

Again I don't think it's worth or desirable to change the name for kurbo::Line, but I thought it was worth thinking about this mismatch.

@richard-uk1 richard-uk1 added question Further information is requested needs discussion This change requires some more discussion before we decide we definitely want it labels Apr 6, 2023
@raphlinus
Copy link
Contributor

raphlinus commented Apr 26, 2023

I'm leaning toward not changing things, but it is an interesting question. I agree that more mathematically correct usage would be "line" for the infinite case and "line segment" for the bounded case. Actually if we're being really mathematically correct, it's a directed line segment, as the orientation is significant.

The other body of precedent includes SVG, which uses the word "line" for the same concept as in kurbo.

I'm not sure whether kurbo needs a type for the infinite line. It's not a proper shape (as it's not bounded), but I can see it maybe being useful for intersections.

@richard-uk1
Copy link
Collaborator Author

I think sometimes it is useful to draw an infinite line. The way to draw it would be to clip it to whatever bounds the viewport was using.

@richard-uk1
Copy link
Collaborator Author

I think the way to go naming-wise would be Line and InfiniteLine if there was a use-case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs discussion This change requires some more discussion before we decide we definitely want it question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants