Indexing cam mechanisms: a complex mathematical model for simulation