SShoalMetric
Workflows

Coding workflows · Signed polygon area

03
Built around your work

A concrete starting point

Return twice the signed polygon area for 3–256 integer vertices with coordinate magnitudes at most 1000000. Test reversed order and collinear vertices, treating self-crossing paths algebraically and rejecting malformed coordinates.

01

Open the context

Choose the project folder and name the files or behavior involved.

02

Define the change

Describe the input, expected output and boundaries that must stay intact.

03

Inspect the work

Review the proposed edits and any commands before relying on their result.

04

Check the outcome

Compare actual behavior with the expected result. If a check fails, investigate it before applying more changes.

Signed polygon area

A concrete starting point
def signed_double_area(points):
    if type(points) not in (list, tuple) or not 3 <= len(points) <= 256:
        raise ValueError("polygon.count")
    for p in points:
        if type(p) not in (list, tuple) or len(p) != 2 or any(type(v) is not int or abs(v) > 10**6 for v in p):
            raise ValueError("polygon.coordinate")
    return sum(a[0]*b[1]-a[1]*b[0] for a,b in zip(points, points[1:]+points[:1]))

The example is a starting point for a real project, not a claim that generated code is already tested. Adjust paths, dependencies and expected behavior to match your application.

AI coding workspace

Your next change starts here.

Get the Windows app ↗