Might have wired that graph up wrong, using a maximum for the X value or missing lacing, best to double check.
However it may be irrelevant as roofs have a Z component as well as an X and Y you likely don’t want the point closest to (-i,-i) but the last point on the rake line as your adaptive points likely want to be placed eve, eve, ridge, ridge. A ‘-i,-i, ignore Z would find the top left corner of a fable roof which has an eve that follows the X axis for the Y+ side of the roof, and the correct point for the Y- side of the roof.
There are several ways to do this, but a good first step is to confirm the shape is drawn counter clockwise, explode to lines, and then find the line with the lowest midpoint (everything else has an vertical component so it’s a rake, or is up high so it’s a ridge), get that index and shift your list of lines accordingly.