Fixing triangle contains()