added functionality to calculate patterns as svg