Forgot password?
 Create new account
View 129|Reply 2

[几何] 多边形的中心坐标

[Copy link]

3151

Threads

8500

Posts

610K

Credits

Credits
66231
QQ

Show all posts

hbghlyj Posted at 2023-1-7 17:31:10 |Read mode
多边形的中心由下式给出:
\begin{align*}C_x &= \frac{1}{6A}\sum_{i=0}^{N-1}(x_i+x_{i+1})(x_i\ y_{i+1} - x_{i+1}\ y_i)\\C_y &= \frac{1}{6A}\sum_{i=0}^{N-1}(y_i+y_{i+1})(x_i\ y_{i+1} - x_{i+1}\ y_i)\end{align*}
证明
三角形$(0,0)(x_i,y_i)(x_{i+1},y_{i+1})$的面积为$A_i=\frac{x_iy_{i+1}-x_{i+1}y_i}2$, 重心为$$G_i\left(\frac{x_i+x_{i+1}}3,\frac{y_i+y_{i+1}}3\right)$$
设多边形的面积为$A$, 重心$(C_x,C_y)$为$G_i$的加权平均
$$C_x=\frac1A\sum_{i=1}^nA_iG_i=\frac1A\sum_{i=1}^n\frac{x_i+x_{i+1}}3\cdot\frac{x_iy_{i+1}-x_{i+1}y_i}2$$

3151

Threads

8500

Posts

610K

Credits

Credits
66231
QQ

Show all posts

 Author| hbghlyj Posted at 2023-3-2 05:33:34
Friday, August 19, 2022 The True Centroid of a Polygon I would record a method for finding the true centroid of a planar polygon, given as a sequence of vertices that traverse the boundary in order. A quick and dirty approximation is to simply take the barycenter of the vertices. This is often good enough, and for convex polygons, is guaranteed to lie within the interior of the polygon, but consider the following example. Take any polygon and then split one of its vertices into two vertices connected by a very short edge. This new polygon should have approximately the same centroid, but the barycenter of its vertices changes quite a bit since the split vertex now exerts twice the pull on the centroid than it did before.

Luckily there is a very simple way to get the centroid, at least for planar polygons. I believe the formulas should generalize to higher dimensional embeddings of polygons, but have not given the matter sufficient thought. We start with Green's Theorem 

$$\iint_R \frac{\partial M}{\partial x}-\frac{\partial L}{\partial y}\,dx\,dy = \oint_{\partial R} L\,dx+M\,dy$$

for integrating a 1-form on the boundary of a region. 

As a warm-up, let $M=x$ and $L=0$. Then we discover that the area of the polygon is the integral

$$\oint_{\partial R} x\,dy$$ along its boundary. This integral can be evaluated on each line segment comprising the boundary to get a simple combinatorial formula.

Let $p_0=\left(\begin{matrix} x_0\\y_0\end{matrix}\right)$ and $p_1=\left(\begin{matrix} x_1\\y_1\end{matrix}\right)$. Then the path connecting them is $(1-t)p_0+tp_1$ for $0\leq t \leq 1$.  

Then $dy = (y_1-y_0)\,dt$ and $x= (1-t)x_0+tx_1$, so we get

$$\int_0^1 ((1-t)x_0+tx_1)(y_1-y_0)\,dt= \frac{1}{2}(x_1+x_0)(y_1-y_0).$$

This gives us a beautiful formula for area. If the polygon has $n$ points $p_1,\ldots,p_n$ we have

$$A=\frac{1}{2}\sum_{i=1}^n(x_i+x_{i+1})(y_{i+1}-y_i)$$

where the indices are read modulo $n$. $x_{n+1}=x_1, y_{n+1}=y_1$. As an exercise see if you can find two more similar formulas for area with different choices of $L$ and $M$ above. These types of formulas are the basis for mechanical planimeters which calculate area by tracing around the perimeter.

Returning to the centroid, we need to calculate the average position of both $x$ and $y$:

$$\overline{x} = \frac{1}{A}\iint_R x\,dx\,dy,\,\,\,\overline{y} = \frac{1}{A}\iint_R y\,dx\,dy$$

Tackling the $x$ coordinate, let $M=\frac{x^2}{2}$ and $L=0$. Then we have

$$\iint_R x\,dx = \sum_{i=1}^n\int_0^1 \frac{((1-t)x_i)^2+t x_{i+1}}{2}(y_{i+1}-y_i)\,dt$$

$$\iint_R x\,dx = \frac{1}{6}\sum_{i=1}^n (x_i^2+x_ix_{i+1}+x_{i+1}^2)(y_{i+1}-y_i)$$

In a similar way we can derive the formula

$$\iint_R y\,dy = \frac{1}{6}\sum_{i=1}^n (y_i^2+y_iy_{i+1}+y_{i+1}^2)(x_{i}-x_{i+1}).$$


It does not feel to me like these formulas are unique to planar embeddings of polygons, but the technique of proof, using Green's theorem, will not work for higher ambient dimensions.

3151

Threads

8500

Posts

610K

Credits

Credits
66231
QQ

Show all posts

 Author| hbghlyj Posted at 2023-3-2 05:35:19
相关帖子: 四边形的3个重心

手机版Mobile version|Leisure Math Forum

2025-4-22 01:48 GMT+8

Powered by Discuz!

× Quick Reply To Top Return to the list