SMS: Theory of textile structure