von Marwitz
Forum Guru
All right, folks.
Mebbe I felt the urge to increase my nerd factor. Or I just could not resist being laughed at...
I have observed that under certain circumstances the LOS Tool in VASL is imperfect:
In the situation above, the overlay causes a rather long text to appear that might blot out some crucial part of the LOS: Is the LOS blocked by the woods in R6? You can't see it.
This inspired me to think up a way that the text label always appears in a postion so that it cannot blot out the LOS - regardless how it is drawn.
Basically, what is needed is a certain coordinate where the text starts (either right-aligned or left-aligned from that coordinate) that never interferes with LOS.
I never liked math nor was I good at it nor have I cared about it in the last decades. On top of that I can't program nor do I have an idea of what's going on inside VASL. Nor am I a native English speaker and are not familiar with mathematical terms. So perfect prerequisites to have a go at it.
Those of you that have an idea of what you are doing are invited to shred, correct or enhance my idea.
So here's the basic idea:
VASL will have some sort of coordinate for any point on the map. So if you draw a LOS, VASL will know the coordinates of the starting point of the LOS (S) and the ending point of the LOS (E).
I want VASL to place the text label next to the LOS always at a certain distance and angle in relation to the starting point of the LOS (S). This label point shall be called L. To do so, VASL needs the coordinate of L automatically determined. I believe the trick can be done with some trigonometry.
The same should be done for the text label next to the ending point of the LOS. But to present the idea, I will only focus on the label point close to the starting point of the LOS.
As I have always suffered from unreadably scribblings of my math teachers, I will keep on the tradition they taught me and provide scribblings in the picture below:
When you are through with it, you know the way how to get the coordinate of the point where the text label next to the starting point should be placed (L). Don't nail me on the specific values - they are just there to provide an example.
With the coordinate of L given, what still might be needed is to set the direction to which the text of the label will flow from that point (i.e. left-aligned or right aligned). I believe that the following rules should apply:
IF the X-coordinate of E ≥ the X-coordinate of S THEN right-align the text from coordinate L.
IF the X-coordinate of E < the X-coordinate of S THEN left-align the text from coordinate L.
IF the Y-coordinate of E ≥ the Y-coordinate of S THEN top-align the text from coordinate L.*
IF the Y-coordinate of E < the Y-coordinate of S THEN bottom-align the text from coordinate L.*
* Any convenient distance of pixels, say for example, if the L coordinates are (1000,1000) change to (1000,1050) or (1000,950).
That's basically it. Now this only needs to be turned into code that VASL can understand...
Remarks anyone?
von Marwitz
Mebbe I felt the urge to increase my nerd factor. Or I just could not resist being laughed at...
I have observed that under certain circumstances the LOS Tool in VASL is imperfect:
In the situation above, the overlay causes a rather long text to appear that might blot out some crucial part of the LOS: Is the LOS blocked by the woods in R6? You can't see it.
This inspired me to think up a way that the text label always appears in a postion so that it cannot blot out the LOS - regardless how it is drawn.
Basically, what is needed is a certain coordinate where the text starts (either right-aligned or left-aligned from that coordinate) that never interferes with LOS.
I never liked math nor was I good at it nor have I cared about it in the last decades. On top of that I can't program nor do I have an idea of what's going on inside VASL. Nor am I a native English speaker and are not familiar with mathematical terms. So perfect prerequisites to have a go at it.
Those of you that have an idea of what you are doing are invited to shred, correct or enhance my idea.
So here's the basic idea:
VASL will have some sort of coordinate for any point on the map. So if you draw a LOS, VASL will know the coordinates of the starting point of the LOS (S) and the ending point of the LOS (E).
I want VASL to place the text label next to the LOS always at a certain distance and angle in relation to the starting point of the LOS (S). This label point shall be called L. To do so, VASL needs the coordinate of L automatically determined. I believe the trick can be done with some trigonometry.
The same should be done for the text label next to the ending point of the LOS. But to present the idea, I will only focus on the label point close to the starting point of the LOS.
As I have always suffered from unreadably scribblings of my math teachers, I will keep on the tradition they taught me and provide scribblings in the picture below:
When you are through with it, you know the way how to get the coordinate of the point where the text label next to the starting point should be placed (L). Don't nail me on the specific values - they are just there to provide an example.
With the coordinate of L given, what still might be needed is to set the direction to which the text of the label will flow from that point (i.e. left-aligned or right aligned). I believe that the following rules should apply:
IF the X-coordinate of E ≥ the X-coordinate of S THEN right-align the text from coordinate L.
IF the X-coordinate of E < the X-coordinate of S THEN left-align the text from coordinate L.
IF the Y-coordinate of E ≥ the Y-coordinate of S THEN top-align the text from coordinate L.*
IF the Y-coordinate of E < the Y-coordinate of S THEN bottom-align the text from coordinate L.*
* Any convenient distance of pixels, say for example, if the L coordinates are (1000,1000) change to (1000,1050) or (1000,950).
That's basically it. Now this only needs to be turned into code that VASL can understand...
Remarks anyone?
von Marwitz