SShoalMetric
AI coding workspace

Signed polygon area

ShoalMetric gives polygon arithmetic a place in an AI-assisted coding session. Discuss vertex order and exact integer operations with a compatible model, then review the returned code against reversed and crossing paths.

● ● ●ShoalMetric●
A concrete starting point · Signed polygon area ×
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]))
✳Return twice the signed polygon area for 3–256 integer vertices with coordinate magnitudes at most 1000000.
✓ ChangesReview before applying ↗
Illustrative workspace
  1. Review before applying

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

  2. Connection

    Base URL, credentials and a reachable server.

  3. Project

    Test reversed order and collinear vertices, treating self-crossing paths algebraically and rejecting malformed coordinates.

Workflows

Signed polygon area

Workflows ↗
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]))
AI coding workspace

Connect coordinate conventions to the code that uses them

ShoalMetric is a Windows AI coding workspace for discussing calculations in the context of the application that consumes them. Select the project folder and describe the coordinate convention, expected output and cases the application must reject. Ask the connected assistant to inspect validation and consumers before suggesting changes. This gives a geometry task a concrete software boundary instead of leaving its meaning inside an isolated formula.

A task involving polygon.py could ask why reversing point order changes a signed area result. Bring an example polygon and state whether your caller needs orientation, magnitude or another representation. Review the proposed edit against that requirement, including the order in which vertices arrive. The useful outcome is code whose result has an agreed meaning wherever the application uses it.

After inspection, run your project checks with a simple shape, reversed order and the degenerate cases your contract addresses. Compare the calculation and the downstream behavior, then bring discrepancies back to the conversation. ShoalMetric supports OpenAI-compatible or Anthropic model connections with credentials as required. You may choose an unrestricted model where available, subject to provider rules; tools, context capacity and response restrictions still depend on the configured model and server. The expected geometric behavior remains yours to verify.

Geometry assumptions to settle in the workspace

Should a negative area result be treated as an error?

That depends on whether the caller uses a signed quantity to preserve orientation. Specify the required meaning before changing the sign or taking a magnitude, then check the effect on code that consumes the result.

Why include reversed vertex order in a test?

It exposes whether orientation is part of the contract and whether the implementation preserves it. Use a shape with an independently known result, then inspect both the numeric output and the caller behavior for the reversed sequence.

Does the example validate every possible polygon?

Do not infer that from an area calculation. If your application needs checks for intersections or other geometric properties, state those requirements separately and inspect the relevant implementation rather than assuming the calculation establishes them.

How should I choose coordinate bounds?

Use the constraints of your application and numeric representation. Tell the assistant those limits, inspect how they are enforced and test values near them. Bounds in sample code do not establish accuracy or performance for a different data scale.

Get the Windows app ↗

ShoalMetric · Updated 2026-10-25