Constrained Optimal Fitting of Three-dimensional Vector Patterns