For easiness in the implementation, it is handy to select the proper model representation. The model should be simple on the one hand and general on the other. Than a standard (general) algorithm could be applied without larger customization. Such a representation is also useful in various programs and environments.
The last but not least advise is to strictly follow the transformation chain and the sequence of partial operations, because the operations are not commutative in general, and in opposite case, the structure could have a strange behavior. The same order of operations is also needed in a hardware implementation.