# Подсчёт точек

addpos добавляет точку в список вершин многоугольника;

isline проверяет, что точка на линии;

isinside проверяет, что точка внутри многоугольника.

```python
from turtle import *


def addpos(A):
    x, y = pos()
    p = (round(x, 6), round(y, 6))
    if p not in A:
        A.append(p)


def isline(x, y, A):
    x1, y1 = A[-1]
    for x2, y2 in A:
        nx, ny = (y2 - y1, x1 - x2)
        f = nx * (x - x1) + ny * (y - y1)
        if f == 0 and min(x1,x2) <= x <= max(x1,x2) and min(y1,y2) <= y <= max(y2,y1):
            return True
        x1, y1 = x2, y2
    return False


def isinside(x, y, A):
    count = 0
    x1, y1 = A[-1]
    for x2, y2 in A:
        if (y1 > y) != (y2 > y):
            x_intersect = x1 + (x2 - x1) * (y - y1) / (y2 - y1)
            if x_intersect > x:
                count += 1
        x1, y1 = x2, y2
    return count % 2 > 0 and not isline(x, y, A)
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://andrewmaths.gitbook.io/conspects/inf/podschyot-tochek.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
