Replace hardcoded points aabb and segment points with parameters
Add scaling of the result