Updated implementation of the Skyline class #23035
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Skylines are the main tool that we use for the vertical spacing calculations. The current implementation is quite primitive in that the Skyline is represented as a mere geometrical set of lines. This is fine for some stuff, but has clear limitations:
This update was long overdue. The main idea is that we already have the Shape class which is very powerful and can already do all of the above. So I've modified the internal implementation of the Skyline class (the public interface has stayed almost unchanged) to use the Shape class, which incidentally has made the Skyline class itself much simpler, as now most methods just wrap the corresponding Shape methods.
I've tested the performance hit on the biggest file I have and it is almost non measurable, in the order of 0.5%. All the vtest differences are either due to rounding differences or to improvements in the stave-centering logic.
Old skylines:
![image](https://private-user-images.githubusercontent.com/93707756/335203562-c39816f3-c634-40fe-804a-97b3a3236fa6.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQzODcyMzQsIm5iZiI6MTcyNDM4NjkzNCwicGF0aCI6Ii85MzcwNzc1Ni8zMzUyMDM1NjItYzM5ODE2ZjMtYzYzNC00MGZlLTgwNGEtOTdiM2EzMjM2ZmE2LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MjMlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODIzVDA0MjIxNFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTgwZjE1NDg3MzExNGM1Y2MwZDFjZGE5OWMwNjE1MTY3OWM3NDM1ZjdhZjMzMDI1MmIxYzI3NmRhMzIyNWQ4YzMmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.kGgxPvkJbrrJkpgHWZXk6Lj4DDO3ad7cBh4hocaKcZ4)
New skylines:
![image](https://private-user-images.githubusercontent.com/93707756/335198866-2bb4adcd-5c73-4701-a1c2-6f31b4b52d20.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQzODcyMzQsIm5iZiI6MTcyNDM4NjkzNCwicGF0aCI6Ii85MzcwNzc1Ni8zMzUxOTg4NjYtMmJiNGFkY2QtNWM3My00NzAxLWExYzItNmYzMWI0YjUyZDIwLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MjMlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODIzVDA0MjIxNFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWYyOGZkMjI2MmNjMjM5ZDZlZDUwYTJkZThjY2Q1NjY5MmQwOGY0N2EwZTYyMjg2NzdjNzgyYjhiODY2M2QxNDMmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.ypm80oHuF6_2iliC52tlQcEbUDdG5XFJNqGtWTl_MHk)