-
Notifications
You must be signed in to change notification settings - Fork 87
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
Implement equality for Line #105
Comments
I'm trying to solve this issue, and I have one question. Does a line have a parameter or a direction?
|
Thank you @hyrodium , did you read the docstring already? What is not clear? If I remember correctly our current implementation uses two points on the line to define it. |
Sorry for my confusing English. Yes, I've already read the docstring of It seems like the following properties are already satisfied. julia> Line(Point(1,2), Point(2,3)) == Line(Point(1,2), Point(2,3))
true
julia> Line(Point(1,2), Point(2,3)) == Line(Point(1,2), Point(2,2))
false sorry if I misunderstood something. At first, I thought |
We are aiming for equality of lines so even though two lines may be specified with different pairs of points they may be the same line. Makes sense? That is what is not implemented yet and would be a good contribution for a first-time contributor. |
Let me use an example to confirm this. l1 = Line(Point(1,2), Point(2,4))
l2 = Line(Point(1,2), Point(3,6))
l1 == l2 But, the lines julia> l1(1)
Point(2, 4)
julia> l2(1)
Point(3, 6) |
The parameter |
Okay, I understood. """
Note that same lines may have different parameters.
```jldoctest
julia> l1 = Line(Point(1,2), Point(2,4));
julia> l2 = Line(Point(1,2), Point(3,6));
julia> l1 == l2
true
julia> l1(1), l2(1)
(Point(2, 4), Point(3, 6))
```
"""
(l::Line)(t) = l.a + t * (l.b - l.a) |
It seems like that we also need equality for julia> s1 = Segment(Point(1,2), Point(3,6));
julia> s2 = Segment(Point(3,6), Point(1,2));
julia> s1 == s2
false |
Indeed |
|
Okay, but, how can I check these inequality? l1 = Line(Point(0.0, 0.0), Point(1.0, 2.0))
l2 = Line(Point(0, 0), Point(1, 2))
Is there any other equatility symbol? |
And also, I suspect the checking equality as set will be hard because of floating number, and the transitivity of (Sorry for many questions, someone can solve this issue smarter than me:wink:) |
Hmm, indeed if we overload |
|
I really agree with that. How about adding methods
|
Let't keep it simple @hyrodium , it is the best approach to start here. Simply define |
Thanks for the suggestion. Sorry for repeating, but there're two reasons for my concern.
Do you have any comments on my concern? I'm really new to this package, and maybe I haven't understood the concept of this package well, but I think the definition of equality is really important for everyone. (Changing the equal sign makes easy to understand, I guess. That would be one of our choices.) |
@hyrodium what I am trying to say is that this issue of sorting out a transitive Just helping with an approximate |
Ah, Okay, I understoold. |
We need a method
l1 == l2
that tells when two linesl1
andl2
are equal.The text was updated successfully, but these errors were encountered: