euclidthegame / euclidthegame-iOS

Ipad version of Euclid: The Game
euclidthegame.com
1 stars 0 forks source link

Fixes intersection point duplicates. #3

Closed kasperpeulen closed 10 years ago

kasperpeulen commented 10 years ago

Creates DHPoint* FindPointAtIntersection Uses that in DHIntersectTool

I will make all my changes as a pull request, so that you can check if I don't break anything. I think this works quite fine. Not sure if this is really smart to do it this way:

// check if point at intersection already exists, if so, don't create new one
CGPoint newPoint = [closestPoint position];
DHPoint* oldPoint = FindPointClosestToPoint(newPoint, geometricObjects, kClosestTapLimit / geoViewScale);
CGPoint oldPointPos = [oldPoint position];
if ((newPoint.x == oldPointPos.x) && (newPoint.y == oldPointPos.y))
  {
    return nil;
  }

but it works.