ruby-geometry
ruby-geometry copied to clipboard
distance between 2 polygon?
I search function to count distance 2 polygons.
Simple outline as distance

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.
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?
You don't need a distance between edges, only distance between vertices (bounding boxes' edges are always parallel to axes).
What add offset to Polygon_2 ? Any code with Kernel Point?
Sorry, I didn't get your question, could you please change its formulation somehow? Thanks in advance
@DanielVartanov Please look at image. I have B shape, How get shape around B shape. Bigest , lighter shapes.
@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
this is not a rectangle
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.
canYou show me a code or draw a image? I dont know what I canthing about Yours sugestions.