We study the problem of fitting a two-joint orthogonal polygonal chain to a set S of n points in the plane, where the objective function is to minimize the maximum orthogonal distance from S to the chain. We show that this problem can be solved in Θ(n) time if the orientation of the chain is fixed, and in Θ(n log n) time when the orientation is not a priori known. We also consider some variations of the problem in three-dimensions where a polygonal chain is interpreted as a configuration of orthogonal planes. In this case we obtain O(n) and O(n log n) time algorithms depending on which plane orientations are fixed.
CitacióDíaz-Báñez, J.M. [et al.]. Fitting a two-joint orthogonal chain to a point set. "Computational geometry. Theory and applications", Abril 2011, vol. 44, núm. 3, p. 135-147.