Page MenuHomeFeedback Tracker

BIS_fnc_inTrigger doesn't work for some ellipses
New, WishlistPublic

Description

Here is the code from fn_inTrigger.sqf

//--- ELLIPSE
_e = sqrt(_tx^2 - _ty^2);

This is only correct if _tx is major and _ty is minor radii (i.e. _tx >= _ty).
{F24108}

Details

Legacy ID
2781926180
Severity
None
Resolution
Open
Reproducibility
Always
Category
Scripting
Steps To Reproduce
  1. place marker (or trigger) with "AXIS A" = 10 and "AXIS B" = 20
  2. ["mymarker1", markerPos "mymarker1", true] call BIS_fnc_inTrigger will return -1.#IND
Additional Information

Could be fixed by swapping _tx and _ty

//--- ELLIPSE
if (_ty > _tx) then { _e = _tx; _tx = _ty; _ty = _e; _tdir = _tdir + 90; };
_e = sqrt(abs(_tx^2 - _ty^2));

Please see attached mission resproducing the bug.

Event Timeline

sms edited Steps To Reproduce. (Show Details)Jun 19 2014, 6:05 PM
sms edited Additional Information. (Show Details)
sms set Category to Scripting.
sms set Reproducibility to Always.
sms set Severity to None.
sms set Resolution to Open.
sms set Legacy ID to 2781926180.May 7 2016, 6:47 PM
sms added a subscriber: sms.May 7 2016, 6:47 PM
sms added a comment.Jun 21 2014, 8:57 PM

Another issue with this function is that _dify is not checked against zero before devision:

_dir = atan (_difx / _dify);

Here is an error from rpt file:

Error in expression < select 1) - _tPosy;
_dir = atan (_difx / _dify);
if (_dify < 0) then {_dir = _d>

Error position: </ _dify);

if (_dify < 0) then {_dir = _d>

Error Zero divisor

Any chance you can dump a working version here?

This is still broken for elliptical markers if axisB > axisA.
Triggers are ok as you can not create a trigger that has axisB > axisA as they automatically have their dir rotated 90degrees and axis swapped.