Notifications
Clear all

[Closed] Find visual center of contour/polygon

are you happy now?

1 Reply
(@miauu)
Joined: 11 months ago

Posts: 0

Yep.

Maybe I am doing something wrong. Again.
When I set the precision to 100 000 and h = cellSize/2.0 I get the same results – time is 0, the point is at the same position.

It depends on the geometry of the contour. In your case, you have very long and very short segments at the same time. This makes the loop step quite tiny.

And this is also interesting. The lasts shape which I posted above, where the time for the js version was:
precision:0.1 time:56803 heap:80946052L

Now it takes:
precision:100000 time:0 heap:68L

The point is the same.

I think we should forget about precision and only use a smaller step. Try to do more experiments with different geometry

1 Reply
(@denist)
Joined: 11 months ago

Posts: 0

No! I was wrong. For different geometries it doesn’t work. So, we have to find right precision, and use 1/2

Best Distance for very high precision is very close to the precision of 0.1, not only for this shape.

try this:

#(
[192.554,-170.634,0], [208.145,-203.765,0], [255.893,-194.995,0], 
[259.791,-149.683,0], [250.046,-104.371,0], [304.128,-110.705,0], 
[328.002,-99.012,0], [289.999,-65.8808,0], [272.459,-76.5997,0], 
[239.327,-89.7548,0], [218.377,-104.859,0], [233.481,-140.913,0], 
[244.687,-164.787,0], [223.249,-164.787,0], [210.094,-128.733,0], 
[123.855,-160.402,0], [123.368,-203.765,0], [192.554,-170.634,0]
)

i have very different results for different precision:

image

Page 5 / 5