I'm looking for an algorithm that will find an irregular shape, maybe not too irregular, like a squashed circle, on a surface, and trace a polygon of a maximum of n sides around the shape. The 'n' maximimum might be based on the area of the shape.
相关问题
- Finding k smallest elements in a min heap - worst-
- binary search tree path list
- High cost encryption but less cost decryption
- How to get a fixed number of evenly spaced points
- How to determine +/- sign when calculating diagona
相关文章
- What are the problems associated to Best First Sea
- Coin change DP solution to keep track of coins
- Algorithm for partially filling a polygonal mesh
- Robust polygon normal calculation
- Algorithm for maximizing coverage of rectangular a
- How to measure complexity of a string?
- Select unique/deduplication in SSE/AVX
- How to smooth the blocks of a 3D voxel world?
I would do it like this:
compute tangent angles
ang
and its changedang
for all curve segmentsyou can use atanxy or
atan2
for thatfind inflex points (Black)
at these points the sign of
dang
is changing sobut you need to handle the
dang=0.0
elements properly (need to scan before and after them). These points will be the fundamental skeleton for your output polygonadd the bumps max points (green)
at these points the tangent angle is between nearest inflex points so to find max point between two inflex points
i0
andi1
find the closest angle todo not forget that
so
+/- 2.0*PI
if this is not truenow you should have all significant points of your closed polycurve ...
it should look like this:
CW/CCW or Red/Blue just represents the sign of
dang[i]
...[Notes]
The output point type should be preserved (inflex/maxpoint) because it can be later used for comparison and detection of shapes ...