Skip to content

Commit

Permalink
Fix faulty projection overlap function.
Browse files Browse the repository at this point in the history
  • Loading branch information
d3rped committed Sep 2, 2024
1 parent 6184588 commit d608c38
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion shape.go
Original file line number Diff line number Diff line change
Expand Up @@ -1193,7 +1193,7 @@ func (projection Projection) Overlapping(other Projection) bool {

// Overlap returns the amount that a Projection is overlapping with the other, provided Projection. Credit to https://dyn4j.org/2010/01/sat/#sat-nointer
func (projection Projection) Overlap(other Projection) float64 {
return math.Min(projection.Max, other.Max) - math.Max(projection.Min, other.Min)
return math.Min(projection.Max - other.Min, other.Max - projection.Min)
}

// IsInside returns whether the Projection is wholly inside of the other, provided Projection.
Expand Down

0 comments on commit d608c38

Please sign in to comment.