Rename clamp to restrict

For the affine pattern functions do not do the repeat algo twice