-
Notifications
You must be signed in to change notification settings - Fork 148
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update geometry related functions #442
Conversation
Yes there is a "system", reference this. Basically move it into a backwards compat file so it doesn't get included in documentation and prints warnings. CBA does not remove deprecated functions like we do in ACE3. |
Suggestion for |
Before: After: While I have no idea why they chose to make this the alternative syntax of |
|
||
Description: | ||
Returns the array form of any area construct: | ||
[center, a, b, angle, isRectangle] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Has to be a single line. The format should probably be in L:09 f anyway though
While rejection sampling would work, the reason I originally wrote this function was to avoid that since it requires looping an indeterminate amount of times. This way you're guaranteed to get a position in a single shot. |
But that "single shot" could take way longer on average. I guess it also depends on the marker shape. For circles and hexagons it will on average be faster, but it could take a long time on narrow rectangles and ellipses. |
- added a new getArea function to return the array form of any area construct - randPosArea now accepts areas in the form of an array or location (same as the `inArea` command) - taskSearchArea now accepts area in the form of an array or location - inArea now directly calls the `inArea` command
New `inArea` command replaces this functionality
My thinking is that you'd use the function for a guaranteed result, whereas if you wanted to use rejection sampling for possibly quicker execution you'd just write it manually with |
Trying to figure out if there's a way to optimise this part of randPosArea:
It's used to uniformly find a position along the perimeter of a rectangle, but I feel like there must some way to condense it down. |
@@ -71,3 +71,11 @@ CBA_fnc_intToString = { | |||
if (isNil "_int") exitWith {""}; | |||
str _int | |||
}; | |||
|
|||
CBA_fnc_inArea = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This won't be compileFinal:ed, which, if I'm not mistaken, CfgFunctions functions are.
Also, there's a deprecation macro.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a general problem with this file and should probably be fixed in another PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed, so we should not add to the problem.
Instead, change the old function file and keep its CfgFunctions entry.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The problem with that is, that the function will appear in the config functions viewer. Deprecated functions shouldn't appear there in my opinion.
When merged this pull request will:
inArea
command)inArea
commandI'm not sure if CBA has a deprecation system we might want to use for the inArea function now that there's an equivalent engine command