简体   繁体   中英

Calculating the boundary of irregular shape in Cartesian Coordinate 2D

I'm looking for a solution to calculate the boundary of an irregular shape.

Lats take a look at Square example: 简单的广场

if i have Minimum x and y and Maximum x and y like:

MaxX = 5
MinX = 1
MaxY = 5
MinY = 1

in python language:

#Python Code
X = {"Min":1, "Max":5} # is Dictionary of x Axis
Y = {"Min":1, "Max":5} # is Dictionary of y Axis

I can check if any coordinate is in the square boundary or not, simpley by comparing the axis against min and max of square boundary.

now let's look at these 2 irregular example: 在此输入图像描述 在此输入图像描述

Now how can i calculate the boundary and coordinates of the shape? i do have the point coordinate but i don't have the coordinates inside the shape and lines coordinate that connecting every points of the shape.

Note: you might suggest for Point-in-Polygon but that's like calculating every time for specific coordinate, and if shape is huge it will take time.

Note: even if you heard of a solution in any book, speech, video, website, or even you are guessing, please do let me know in the comment, that could help me out.

如果要获取形状内的整数坐标列表,请考虑使用floodfill算法

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM