Reputation: 121
i have a leaflet feature rectangle and i need to pragmatically draw another squre rectangle . see the image dotted rectangle is the one i need to calculate
possible solutions
Upvotes: 0
Views: 153
Reputation: 80177
Distance from square vertices to rectangle center is
d = rect_width / 2 + rect_height / 2
So their coordinates are
rect_center_x + d; rect_center_y
rect_center_x; rect_center_y - d
rect_center_x - d; rect_center_y
rect_center_x; rect_center_y + d
Upvotes: 1