Adding primitive flattening function to help creating dashed lines