-
Notifications
You must be signed in to change notification settings - Fork 20
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
golint fixes #7
base: master
Are you sure you want to change the base?
golint fixes #7
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,20 +29,22 @@ import ( | |
"math" | ||
) | ||
|
||
// Point is an X, Y coordinate pair. | ||
type Point struct { | ||
X, Y float64 | ||
} | ||
|
||
// Equals returns true if both p1 and p2 describe exactly the same point. | ||
func (p1 Point) Equals(p2 Point) bool { | ||
return p1.X == p2.X && p1.Y == p2.Y | ||
func (p Point) Equals(q Point) bool { | ||
return p.X == q.X && p.Y == q.Y | ||
} | ||
|
||
// Length returns distance from p to point (0, 0). | ||
func (p Point) Length() float64 { | ||
return math.Sqrt(p.X*p.X + p.Y*p.Y) | ||
} | ||
|
||
// A Rectangle contains the points with Min.X <= X <= Max.X, Min.Y <= Y <= Max.Y. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not 100% sure if it's |
||
type Rectangle struct { | ||
Min, Max Point | ||
} | ||
|
@@ -111,7 +113,7 @@ func (c Contour) segment(index int) segment { | |
// if out-of-bounds, we expect panic detected by runtime | ||
} | ||
|
||
// Checks if a point is inside a contour using the "point in polygon" raycast method. | ||
// Contains checks if a point is inside a contour using the "point in polygon" raycast method. | ||
// This works for all polygons, whether they are clockwise or counter clockwise, | ||
// convex or concave. | ||
// See: http://en.wikipedia.org/wiki/Point_in_polygon#Ray_casting_algorithm | ||
|
@@ -203,9 +205,13 @@ func (p Polygon) Clone() Polygon { | |
type Op int | ||
|
||
const ( | ||
// UNION operation | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't see how these comments bring any value here. I can't believe golint would require them this way. I don't think the standard library has them this way. Some random example I seem to have found in the stdlib: http://golang.org/pkg/unicode/#pkg-constants - the block with |
||
UNION Op = iota | ||
// INTERSECTION operation | ||
INTERSECTION | ||
// DIFFERENCE operation | ||
DIFFERENCE | ||
// XOR operation | ||
XOR | ||
) | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe
xMinMax
would be better?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, please make it xMinMax
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you confirm if that is the only change? I prefer to do them all at once. What about the other capitals such as UNION, DIFFERENCE, ...?