convex-polygon

Fastest horizontal line <-> convex polygon intersection algorithm?

Hi, I need to solve a relatively simple thing -- I've got n-vertices convex 2D polygon and a horizontal (!) line with some 'y' coordinate. I need only one thing: to check if the polygon is crossed with this line (i.e. have 2 intersections) or not. The fastest one I can think of is to find min/max y coordinates within a polygon (loop re...

Java2D: Fill a convex rounded polygon (QuadCurves)

Hi, If I have a QuadCurve like this (+ = node): + + \ ./ +--⁻⁻ And I fill it in Java 2D the result is something like this: (x = colored) +xxxxxxxxx+ \xxxxxx./ +--⁻⁻ But I want to color the other side: + + x\ ./x xxx +--⁻⁻xx xxxxxxxxxxx This succeeds by drawing a rectangle around the curve in th...

Smooth a convex polygonal shape so that it becomes as large as possible while retaining diameter

Given a convex polygon, I am trying to grow its shape (as in "maximal area") while preserving its diameter. The diameter is defined as the length of the longest segment that can be placed within the polygon. Since the polygon is convex, I assume that this diameter can always be found by scanning all vertex pairs. For example, given an e...

Is there an simple algorithm for calculating maximum inscribed circle into a convex polygon?

I found some solutions, but they're too messy. ...