# Spherical Polygon Calculator AI Agent Connect

> Spherical Polygon Calculator provides your AI agent with the math needed to handle geographic shapes. It calculates surface area, perimeters, centroids, and bounding boxes for polygons on a sphere or ellipsoid. Instead of guessing distances, your agent can use these tools to get exact measurements for any set of coordinates.

## Overview
- **Category:** mathematics
- **Price:** Free
- **Endpoint:** https://edge.vinkius.com/vk_preview_leFjImVEBb8T8oYZQE3qC1YyQkjK4p7UDldHr1Lk/ai-agent-connect
- **Tags:** geography, polygon, area, perimeter, spherical, ellipsoid

## Description

You can give your AI client the ability to handle complex geographic math without writing custom geometry code. This MCP handles the heavy lifting of calculating properties for polygons on a sphere or ellipsoid. If you are working with mapping data, you can ask your agent to find the exact surface area of a region or the perimeter of a boundary. It also handles orientation and centroid calculations. You can use it to verify if a list of coordinates actually forms a closed loop or to find the geographic extent of a shape using a bounding box. It is built for precision, making it useful for any task involving coordinate-based geometry.

## Tools

### calculate_bounding_box
This tool finds the geographic extent of a polygon. It identifies the minimum and maximum latitude and longitude for your shape.

### calculate_polygon_metrics
This tool provides a full summary of geometric properties. It returns the area, perimeter, centroid, and orientation of a polygon.

### get_edge_contributions
This tool breaks a polygon down into its individual segments. It provides detailed data for each edge in the shape.

### verify_polygon_closure
This tool checks if a set of coordinates forms a valid, closed loop. It tells you if the start and end points meet.

## Prompt Examples

**Prompt:** 
```
What is the area and perimeter of a square polygon with vertices at (0,0), (0,1), (1,1), and (1,0) in kilometers?
```

**Response:** 
```
The area is 12345.67 square kilometers and the perimeter is 400.23 kilometers.
```

**Prompt:** 
```
Check if these coordinates form a closed loop: (45, -75), (46, -74), (45, -73).
```

**Response:** 
```
No, the polygon is not closed. The distance between the last and first vertex is 150.5 kilometers.
```

**Prompt:** 
```
Find the bounding box for a polygon with vertices at (10, 10), (20, 20), and (30, 10).
```

**Response:** 
```
The bounding box has a minimum latitude of 10, maximum latitude of 30, minimum longitude of 10, and maximum longitude of 20.
```

## Capabilities

### Area and Perimeter Calculation
Your agent calculates the exact surface area and boundary length of geographic shapes.

### Centroid Identification
Your agent finds the geographic center point of any given polygon.

### Boundary Verification
Your agent checks if a series of coordinates creates a closed geometric loop.

### Spatial Extent Mapping
The tool determines the bounding box to define the geographic limits of a shape.

### Segment Analysis
Your agent retrieves specific data for each individual edge within a polygon.

## Use Cases

### Land Area Measurement
An agent calculates the precise surface area of a specific plot of land using latitude and longitude.

### Boundary Validation
A user checks if a set of GPS waypoints actually forms a closed perimeter.

### Spatial Extent Checks
Your agent finds the bounding box for a group of coordinates to define a search area.

### Geographic Centering
An agent finds the center point of a region to place a marker or icon.

## Benefits

- Calculates geometry on both spheres and ellipsoids.
- Removes the need for manual geometric formulas in your prompts.
- Provides exact coordinate-based measurements for any polygon.
- Validates coordinate loops to ensure data integrity.

## How It Works

You connect the MCP to your client and start asking for math results.

1. Connect your MCP-compatible client to Vinkius.
2. Provide the MCP with a list of geographic coordinates.
3. Ask your agent to run a specific tool like calculate_polygon_metrics.
4. Your agent executes the math and returns the precise results to your chat.

## Frequently Asked Questions

**Does this MCP work on a sphere or an ellipsoid?**
It provides precise calculations for both spherical and ellipsoidal models.

**How do I check if my coordinates form a closed shape?**
You can use the verify_polygon_closure tool to check if the coordinates form a valid, closed loop.

**Can I get the center of a polygon?**
Yes, the calculate_polygon_metrics tool provides the geographic centroid of the polygon.

**What clients can I use this with?**
You can use this with any MCP-compatible client like Claude, Cursor, Windsurf, or VS Code.

**How do I find the limits of a geographic area?**
Use the calculate_bounding_box tool to find the minimum and maximum latitude and longitude.

**What is the difference between the sphere and ellipsoid models?**
The sphere model uses a constant radius for fast approximations, while the ellipsoid model accounts for Earth's equatorial bulge for higher precision.

**How does the tool handle polygons crossing the Antimeridian?**
The `calculate_polygon_metrics` tool automatically detects if a polygon crosses the Antimeridian and adjusts longitude calculations to ensure accurate results.

**Can I get the bounding box of a shape?**
Yes, you can use the `calculate_bounding_box` tool to find the minimum and maximum latitude and longitude for any set of vertices.
