ruby-geometry icon indicating copy to clipboard operation
ruby-geometry copied to clipboard

distance between 2 polygon?

Open xor256 opened this issue 7 years ago • 10 comments

I search function to count distance 2 polygons. Simple outline as distance bitmap

xor256 avatar Mar 14 '18 08:03 xor256

There is a function Polygon#bounding_box which is the most helpful to implement a function of such distance. Please let me know if it helps.

DanielVartanov avatar Mar 14 '18 12:03 DanielVartanov

I thing about offset outside polygon. Minimal distance between alle edges to all edges other polygon. (i change image for clarify). offset is not this same shape.

How I can count distance between 2 edges?

xor256 avatar Mar 15 '18 08:03 xor256

You don't need a distance between edges, only distance between vertices (bounding boxes' edges are always parallel to axes).

DanielVartanov avatar Mar 15 '18 15:03 DanielVartanov

What add offset to Polygon_2 ? Any code with Kernel Point?

letarg0 avatar Mar 15 '18 21:03 letarg0

Sorry, I didn't get your question, could you please change its formulation somehow? Thanks in advance

DanielVartanov avatar Mar 16 '18 22:03 DanielVartanov

@DanielVartanov Please look at image. I have B shape, How get shape around B shape. Bigest , lighter shapes.

letarg0 avatar Mar 17 '18 19:03 letarg0

@letarg0, well, just to re-iterate, Polygon#bounding_box seems to be a solution to your problem: since you apply this method to both polygons, you'll have just two rectangles each edge of which is parallel to one of axes, which makes the problem trivial since then

DanielVartanov avatar Apr 02 '18 15:04 DanielVartanov

this is not a rectangle

mikolaj24 avatar Apr 03 '18 08:04 mikolaj24

Again, let me repeat: when you apply a method of Polygon#bounding_box to a second polygon labeled 'B', you will have a rectangle. Please see how Polygon#bounding_box works.

DanielVartanov avatar Apr 04 '18 22:04 DanielVartanov

canYou show me a code or draw a image? I dont know what I canthing about Yours sugestions.

letarg0 avatar Apr 07 '18 21:04 letarg0