Finding the shortest & longest edge of a polygon?

Hi there,

I'm wondering how I can go about finding the shortest & longest edges of a polygon in the DRC engine. Attempts to use edges/each/collect_to_edge_pairs have been unsuccessful, but I have a feeling that's because I'm not quite comfortable with the intricacies of Ruby syntax. Any help guiding me in the right direction would be most appreciated!

Comments

  • If you have a polygon, you can get the shortest and longest edge this way:

    min_edge, max_edge = polygon.each_edge.minmax { |a,b| a.length <=> b.length }
    

    Matthias

  • Thank you so much Matthias!!

Sign In or Register to comment.