Logical question: Given corners, find Center of Quadrilateral?

ε祈祈猫儿з 提交于 2019-12-11 05:01:00

问题


Given the cordinates of all corners of a quadrilateral, how can the cordinates of its center be found?

Thanks.


回答1:


Origin = x=0,y=0

a(0,0) b(10,0)

c(0,5) d(10,5)

a+(b-a/2)=5
a+(c-a/2)=2.5

centre co-ordinate = 5,2.5

or dx-ax/2=5 dy-ay/2=2.5

with those formulas it wouldn't matter if the sides were uneven the centre can always be calculated.

Regards Ray




回答2:


I suppose you are talking about the centroid or center of masses. In a quadrilateral there are two general ways of getting the coordinates:

  1. Intersection point of the two bimedians (A bimedian is the line joining the center points of two opposing sides).

  2. The midpoint of the line joining the midpoints of both diagonals of the quadrilateral.

Hope this helps.




回答3:


If your shape is defined by a piecewise continuous curve you can do numerical integration using Gaussian quadrature of a contour integral for the center of mass. This is the most general algorithm for 2D planar shapes. It'll even work for shapes with holes inside.

You get the contour integral using Green's Theorem.




回答4:


You can also cut up the quadrilateral in two triangles, take their centre and find the centre between them.

Doesn't really change anything but it might be easier to think about (ps. I don't say this would yield a particularly better solution).



来源:https://stackoverflow.com/questions/6149175/logical-question-given-corners-find-center-of-quadrilateral

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!