How this calculation works
Calculate mean-value coordinates of an interior or boundary point relative to a simple polygon. The weights sum to one and reproduce the point through the polygon vertices, generalizing barycentric-style interpolation beyond triangles. Vertex and edge limits are handled explicitly, and the output preserves the supplied vertex order.
w_i=[tan(theta_(i−1)/2)+tan(theta_i/2)]/r_i; lambda_i=w_i/Σw.A worked example
At the center (1,1) of the square with vertices (0,0),(2,0),(2,2),(0,2), symmetry gives four weights of 1/4. The weights sum to 1 and reconstruct the query exactly. At a vertex, its own weight is 1 and all others are 0.
Good to know
Simple polygon≤32vertices, interior or boundary query; input order retained. Vertex/edge limits explicit. No outside extrapolation, harmonic-coordinate PDE or positivity guarantee for arbitrary concave geometry.
Use the polygon as an interpolation cage
Each weight corresponds to one polygon vertex. Their weighted sum reconstructs the query point, making the coordinates useful for interpolating vertex-associated quantities or describing a position inside a cage. The weights depend on the entire polygon geometry, not only the nearest triangle chosen by an unstated triangulation.
Vertices must be supplied in simple boundary order without holes. Reordering them arbitrarily changes the polygon. Reversing the boundary orientation should preserve the corresponding geometric weights after matching vertex labels, but the table remains indexed by the actual input order rather than by a hidden sorted list.
The Polygon kernel calculator for visibility from every vertex finds points visible from an entire polygon. Mean value interpolation can reconstruct an interior query outside that visibility kernel, and concave boundaries can produce signed weights.
Build the mean-value formula
From the query, form vectors to consecutive vertices with lengths ri and signed angles theta_i. The unnormalized weight at vertex i is the sum of the two adjacent half-angle tangents divided by ri. Dividing all weights by their total gives the coordinates.
This formula is not a triangle-area ratio copied to a larger number of vertices. The half-angle geometry incorporates the neighboring edges around the whole boundary. Numerical care is needed near a vertex or edge, where the direct formula can involve vanishing lengths or very large tangents.
Verify the square-center case
For the square with corners (0,0),(2,0),(2,2),(0,2), the query (1,1) has equal distance and equal angular surroundings at every vertex. All four raw weights are equal, so normalized weights are one quarter each.
Their sum is one and their weighted position is (1,1), reproducing the query. Moving the query changes the weights continuously within the valid region. Equal weights at the center are a symmetry check, not a general rule that any polygon’s vertex average equals the coordinate center you want to represent.
Read vertex and edge limits directly
At an input vertex, that vertex’s weight is one and all others zero. On an edge, only its two endpoint weights remain, in the linear interpolation proportion determined by distances along the edge. The calculator uses these limits instead of evaluating a singular generic formula.
A boundary result is not evidence that the query is outside or that reconstruction failed. It is a legitimate limiting coordinate case. A point on an extension of an edge beyond its endpoints is not the same as a point on the edge segment and is not accepted under that boundary rule.
Check affine reconstruction
The sum-of-weights metric should equal one, and the residual compares the weighted vertex position with the entered query. Together these check partition of unity and linear precision numerically. They do not prove every interpolated attribute is physically meaningful or free from overshoot under arbitrary vertex data.
The page computes geometry weights only. It does not apply them to colors, temperatures or a deformed cage automatically. For such a downstream interpolation, preserve the exact vertex-to-attribute correspondence. A reordered attribute list can give a wrong interpolated value even when the geometric reconstruction check is perfect.
Distinguish convex and concave situations
Mean-value coordinates support general simple polygons under their definition, unlike some other generalized coordinate families that require strict convexity. However, geometric properties such as positivity must not be assumed for every concave configuration merely because the query lies inside the boundary.
The form rejects exterior queries rather than presenting an unrequested extrapolation model. A winding check distinguishes interior from exterior after boundary cases are handled. Near reflex vertices and narrow features, finite-precision sensitivity can still matter, so use reasonable coordinate scales and inspect reconstruction rather than trusting an attractive weight pattern alone.
Keep the coordinate family explicit
Mean-value, harmonic, discrete harmonic and Wachspress coordinates are distinct constructions. They can agree on triangles or symmetric special cases and differ elsewhere. The calculator does not solve a harmonic PDE or choose a coordinate family based on a hidden heuristic.
Input is limited to thirty-two polygon vertices and one planar query. Holes, arbitrary point clouds and three-dimensional polyhedral cages require other definitions and algorithms. Retain the family name, boundary order and query position with the result so another implementation can reproduce the same mathematical problem.
A few questions, answered
Do weights follow my vertex order?
Yes. Output index i refers to input vertex i.
What happens at a polygon vertex?
Its weight is one and all other weights are zero.
Are these harmonic coordinates?
No. They are mean-value coordinates calculated from half-angle geometry, not a harmonic PDE solution.
Can exterior queries be used?
Not in this version. It accepts interior and on-boundary points only.