An optimal flattening algorithm for ship hull plate fabricated by thermal forming