• + 0 comments

    Rotation is simpler.

    As far as flip, let there be 2 * n divisions, thn new rotaion after flip can be derived as,

    (-(old_rotation - flip_rotation) + (2 * n) + flip_rotation) % (2 * n)
    
    or
    
    ((2 * flip_rotation - old_rotation) + (2 * n)) % (2 * n)
    

    where n is the number of vertices.

    Once all operations are acuumulated, it is strightforward to restore the initial orientation.