Skip to content
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

Create vectorRotate3D.sqf #898

Closed
wants to merge 5 commits into from
Closed

Conversation

LorenLuke
Copy link
Contributor

When merged this pull request will:
Add a file for rotating one vector about a second vector as a rotation axis by a set angle measure.

File for rotating one vector about a second vector as a rotation axis by a set angle measure.
*
* [weaponDir player, [0,0,1], 25] call CBA_fnc_vectorRotate3D
*
* Public: No
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be public though?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not part of CBA's header anyways.

params ["vector", "_rotationAxis", "_theta"];

private _normalVector = vectorNormalized _rotationAxis;
private = _s_theta = sin(_theta);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo =

@@ -0,0 +1,34 @@
/*
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@commy2
Copy link
Contributor

commy2 commented Mar 6, 2018

CBA_fnc_vectRotate2D already exists. I hate the name, but
CBA_fnc_vectorRotate3D seems super inconsistent.
What do?

@commy2 commy2 added the Feature label Mar 6, 2018
@commy2 commy2 added this to the 3.7 milestone Mar 6, 2018
@LorenLuke
Copy link
Contributor Author

@commy2
Just changed it. I prefer vector to vect, but I saw that with the Rommel example and was like... 'yeah'.

Copy link
Member

@jonpas jonpas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

*/
/* ----------------------------------------------------------------------------
Function: CBA_fnc_vectRotate3D
Description:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing newline above. Same for Returns and Author below. Might want to add an example as shown here as well:
https://github.com/CBATeam/CBA_A3/blob/master/addons/settings/fnc_init.sqf

@commy2
Copy link
Contributor

commy2 commented Mar 6, 2018

vector was undefined and not a valid local variable.
I added white space to the function header, so the export script doesn't fail.
I also changed the naming of the variables to use camel case and not snake case, for consistency.
And I removed one superfluous variable for the return value.

@LorenLuke
Copy link
Contributor Author

👍

@commy2
Copy link
Contributor

commy2 commented Mar 19, 2018

Needs testing.

@commy2 commy2 self-assigned this Mar 19, 2018
@commy2
Copy link
Contributor

commy2 commented Apr 14, 2018

execVM "\x\cba\addons\vectors\test_vectors.sqf"
17:38:09 [CBA] (vectors) LOG: Testing Vectors x\cba\addons\vectors\test_vectors.sqf:24
17:38:09 [CBA] (vectors) Test OK: (CBA_fnc_polar2vect is defined) x\cba\addons\vectors\test_vectors.sqf:28
17:38:09 [CBA] (vectors) Test OK: ([_result, _expected] call _fnc_vectorEquals) x\cba\addons\vectors\test_vectors.sqf:32
17:38:09 [CBA] (vectors) Test OK: ([_result, _expected] call _fnc_vectorEquals) x\cba\addons\vectors\test_vectors.sqf:36
17:38:09 [CBA] (vectors) Test OK: ([_result, _expected] call _fnc_vectorEquals) x\cba\addons\vectors\test_vectors.sqf:40
17:38:09 [CBA] (vectors) Test OK: ([_result, _expected] call _fnc_vectorEquals) x\cba\addons\vectors\test_vectors.sqf:44
17:38:09 [CBA] (vectors) Test OK: (CBA_fnc_scaleVect is defined) x\cba\addons\vectors\test_vectors.sqf:49
17:38:09 [CBA] (vectors) Test OK: ([_result, _expected] call _fnc_vectorEquals) x\cba\addons\vectors\test_vectors.sqf:53
17:38:09 [CBA] (vectors) Test OK: ([_result, _expected] call _fnc_vectorEquals) x\cba\addons\vectors\test_vectors.sqf:57
17:38:09 [CBA] (vectors) Test OK: ([_result, _expected] call _fnc_vectorEquals) x\cba\addons\vectors\test_vectors.sqf:61
17:38:09 [CBA] (vectors) Test OK: (CBA_fnc_scaleVectTo is defined) x\cba\addons\vectors\test_vectors.sqf:66
17:38:09 [CBA] (vectors) Test OK: ([_result, _expected] call _fnc_vectorEquals) x\cba\addons\vectors\test_vectors.sqf:70
17:38:09 [CBA] (vectors) Test OK: ([_result, _expected] call _fnc_vectorEquals) x\cba\addons\vectors\test_vectors.sqf:74
17:38:09 [CBA] (vectors) Test OK: ([_result, _expected] call _fnc_vectorEquals) x\cba\addons\vectors\test_vectors.sqf:78
17:38:09 [CBA] (vectors) Test OK: ([_result, _expected] call _fnc_vectorEquals) x\cba\addons\vectors\test_vectors.sqf:82
17:38:09 [CBA] (vectors) Test OK: (CBA_fnc_simplifyAngle is defined) x\cba\addons\vectors\test_vectors.sqf:87
17:38:09 [CBA] (vectors) Test OK: (_result == _expected) CBA_fnc_simplifyAngle x\cba\addons\vectors\test_vectors.sqf:91
17:38:09 [CBA] (vectors) Test OK: (_result == _expected) CBA_fnc_simplifyAngle x\cba\addons\vectors\test_vectors.sqf:95
17:38:09 [CBA] (vectors) Test OK: (_result == _expected) CBA_fnc_simplifyAngle x\cba\addons\vectors\test_vectors.sqf:99
17:38:09 [CBA] (vectors) Test OK: (CBA_fnc_simplifyAngle180 is defined) x\cba\addons\vectors\test_vectors.sqf:104
17:38:09 [CBA] (vectors) Test OK: (_result == _expected) CBA_fnc_simplifyAngle180 x\cba\addons\vectors\test_vectors.sqf:108
17:38:09 [CBA] (vectors) Test OK: (_result == _expected) CBA_fnc_simplifyAngle180 x\cba\addons\vectors\test_vectors.sqf:112
17:38:09 [CBA] (vectors) Test OK: (_result == _expected) CBA_fnc_simplifyAngle180 x\cba\addons\vectors\test_vectors.sqf:116
17:38:09 [CBA] (vectors) Test OK: (CBA_fnc_vect2Polar is defined) x\cba\addons\vectors\test_vectors.sqf:121
17:38:09 [CBA] (vectors) Test OK: ([_result, _expected] call _fnc_vectorEquals) x\cba\addons\vectors\test_vectors.sqf:125
17:38:09 [CBA] (vectors) Test OK: ([_result, _expected] call _fnc_vectorEquals) x\cba\addons\vectors\test_vectors.sqf:129
17:38:09 [CBA] (vectors) Test OK: ([_result, _expected] call _fnc_vectorEquals) x\cba\addons\vectors\test_vectors.sqf:133
17:38:09 [CBA] (vectors) Test OK: ([_result, _expected] call _fnc_vectorEquals) x\cba\addons\vectors\test_vectors.sqf:137
17:38:09 [CBA] (vectors) Test OK: (CBA_fnc_vectAdd is defined) x\cba\addons\vectors\test_vectors.sqf:143
17:38:09 [CBA] (vectors) Test OK: ([_result, _expected] call _fnc_vectorEquals) x\cba\addons\vectors\test_vectors.sqf:147
17:38:09 [CBA] (vectors) Test OK: ([_result, _expected] call _fnc_vectorEquals) x\cba\addons\vectors\test_vectors.sqf:151
17:38:09 [CBA] (vectors) Test OK: (CBA_fnc_vectCross is defined) x\cba\addons\vectors\test_vectors.sqf:157
17:38:09 [CBA] (vectors) Test OK: ([_result, _expected] call _fnc_vectorEquals) x\cba\addons\vectors\test_vectors.sqf:161
17:38:09 [CBA] (vectors) Test OK: (CBA_fnc_vectCross2D is defined) x\cba\addons\vectors\test_vectors.sqf:166
17:38:09 [CBA] (vectors) Test OK: (_result == _expected) CBA_fnc_vectCross2D x\cba\addons\vectors\test_vectors.sqf:170
17:38:09 [CBA] (vectors) Test OK: (CBA_fnc_vectDir is defined) x\cba\addons\vectors\test_vectors.sqf:175
17:38:09 [CBA] (vectors) Test OK: (_result == _expected) CBA_fnc_vectDir x\cba\addons\vectors\test_vectors.sqf:179
17:38:09 [CBA] (vectors) ERROR: Test FAIL x\cba\addons\vectors\test_vectors.sqf:252
17:38:09             (CBA_fnc_vectRotate3D is not defined)
17:38:09 Error in expression < };

_result = [[0,0,1],[0,0,1],0] call CBA_fnc_vectRotate3D;
_expected = [0,0,1>
17:38:09   Error position: <CBA_fnc_vectRotate3D;
_expected = [0,0,1>
17:38:09   Error Undefined variable in expression: cba_fnc_vectrotate3d
17:38:09 File x\cba\addons\vectors\test_vectors.sqf, line 254
17:38:09 [CBA] (vectors) Test OK: (_result == _expected) CBA_fnc_vectDir x\cba\addons\vectors\test_vectors.sqf:183
17:38:09 [CBA] (vectors) Test OK: (CBA_fnc_vectDot is defined) x\cba\addons\vectors\test_vectors.sqf:188
17:38:09 [CBA] (vectors) Test OK: (_result == _expected) CBA_fnc_vectDot x\cba\addons\vectors\test_vectors.sqf:192
17:38:09 [CBA] (vectors) Test OK: (_result == _expected) CBA_fnc_vectDot x\cba\addons\vectors\test_vectors.sqf:196
17:38:09 [CBA] (vectors) Test OK: (CBA_fnc_vectElev is defined) x\cba\addons\vectors\test_vectors.sqf:201
17:38:09 [CBA] (vectors) Test OK: (_result == _expected) CBA_fnc_vectElev x\cba\addons\vectors\test_vectors.sqf:205
17:38:09 [CBA] (vectors) Test OK: (_result == _expected) CBA_fnc_vectElev x\cba\addons\vectors\test_vectors.sqf:209
17:38:09 [CBA] (vectors) Test OK: (CBA_fnc_vectMagn is defined) x\cba\addons\vectors\test_vectors.sqf:214
17:38:09 [CBA] (vectors) Test OK: (_result == _expected) CBA_fnc_vectMagn x\cba\addons\vectors\test_vectors.sqf:218
17:38:09 [CBA] (vectors) Test OK: (_result == _expected) CBA_fnc_vectMagn x\cba\addons\vectors\test_vectors.sqf:222
17:38:09 [CBA] (vectors) Test OK: (CBA_fnc_vectMagn2D is defined) x\cba\addons\vectors\test_vectors.sqf:227
17:38:09 [CBA] (vectors) Test OK: (_result == _expected) CBA_fnc_vectMagn2D x\cba\addons\vectors\test_vectors.sqf:231
17:38:09 [CBA] (vectors) Test OK: (_result == _expected) CBA_fnc_vectMagn2D x\cba\addons\vectors\test_vectors.sqf:235
17:38:09 [CBA] (vectors) Test OK: (CBA_fnc_vectRotate2D is defined) x\cba\addons\vectors\test_vectors.sqf:240
17:38:09 [CBA] (vectors) Test OK: ([_result, _expected] call _fnc_vectorEquals) x\cba\addons\vectors\test_vectors.sqf:244
17:38:09 [CBA] (vectors) Test OK: ([_result, _expected] call _fnc_vectorEquals) x\cba\addons\vectors\test_vectors.sqf:248

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants