Open sl-service-account opened 10 years ago
Moon Metty commented at 2014-09-04T23:13:43Z, updated at 2014-09-04T23:15:15Z
Implementation of the basics turns out to be very easy. This functionality was needed for a recent bugtest. The new EulerMode simply worked first try, and without any sign of trouble.
First, add an entry to settings.xml:
<key>EulerMode</key>
<map>
<key>Comment</key>
<string>Disable:-180 to 180 Enable:0 to 360</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>1</integer>
</map>
=======
Replace existing code in llpanelobject.cpp getstate():
mCurEulerDegrees.mV[VX] = fmod(llround(mCurEulerDegrees.mV[VX], OBJECT_ROTATION_PRECISION) + 360.f, 360.f);
mCurEulerDegrees.mV[VY] = fmod(llround(mCurEulerDegrees.mV[VY], OBJECT_ROTATION_PRECISION) + 360.f, 360.f);
mCurEulerDegrees.mV[VZ] = fmod(llround(mCurEulerDegrees.mV[VZ], OBJECT_ROTATION_PRECISION) + 360.f, 360.f);
With new code:
mCurEulerDegrees.mV[VX] = llround(mCurEulerDegrees.mV[VX], OBJECT_ROTATION_PRECISION);
mCurEulerDegrees.mV[VY] = llround(mCurEulerDegrees.mV[VY], OBJECT_ROTATION_PRECISION);
mCurEulerDegrees.mV[VZ] = llround(mCurEulerDegrees.mV[VZ], OBJECT_ROTATION_PRECISION);
if (gSavedSettings.getBOOL("EulerMode"))
{
if (mCurEulerDegrees.mV[VX] < 0.f) mCurEulerDegrees.mV[VX] += 360.f;
if (mCurEulerDegrees.mV[VY] < 0.f) mCurEulerDegrees.mV[VY] += 360.f;
if (mCurEulerDegrees.mV[VZ] < 0.f) mCurEulerDegrees.mV[VZ] += 360.f;
}
=======
Find existing code in lpanelobject.cpp sendRotation():
new_rot.mV[VX] = llround(new_rot.mV[VX], OBJECT_ROTATION_PRECISION);
new_rot.mV[VY] = llround(new_rot.mV[VY], OBJECT_ROTATION_PRECISION);
new_rot.mV[VZ] = llround(new_rot.mV[VZ], OBJECT_ROTATION_PRECISION);
Add new code:
new_rot.mV[VX] = llround(new_rot.mV[VX], OBJECT_ROTATION_PRECISION);
new_rot.mV[VY] = llround(new_rot.mV[VY], OBJECT_ROTATION_PRECISION);
new_rot.mV[VZ] = llround(new_rot.mV[VZ], OBJECT_ROTATION_PRECISION);
if (gSavedSettings.getBOOL("EulerMode"))
{
if (new_rot.mV[VX] < 0.f) new_rot.mV[VX] += 360.f;
if (new_rot.mV[VY] < 0.f) new_rot.mV[VY] += 360.f;
if (new_rot.mV[VZ] < 0.f) new_rot.mV[VZ] += 360.f;
}
=======
No more changes are needed to make the new EulerMode work. Of course there's no real user interface yet, apart form accessing the debugsettings, or editing settings.xml. Personally, I would probably always use the [-180, 180] range. However, the default setting should be [0, 360], because every tutorial uses this range. And some people could be allergic to negative numbers, you know?
Marissa Linden commented at 2014-09-17T18:05:55Z
Thank you for your suggestion Moon Metty. We're importing this to our internal feature request queue.
Traditionally, the buildtool displays rotations as numbers between 0 and 360 degrees. You can type a number outside of the 0 to 360 range, but as soon as the field loses focus, the number is wrapped in range 0 to 360. A circle is round, so the numbers -350, 10, 370 and 730 all represent the same angle, right?
The Y-rotation is a little strange, because of gimbal lock. Y only displays numbers in half of the circle: from 0 to 90, and from 270 to 360.
=======
This feature request is about a new optional setting to change the range from [0, 360] to [-180, 180]. As you can see, the range [-180, 180] makes a full circle, and the range is symmetrical around zero. This has a number of benefits:
The range [-180, 180] suffers less from floating point noise, so we get better accuracy.
The result is a more intuitive interface, in my opinion.
Original Jira Fields
| Field | Value | | ------------- | ------------- | | Issue | BUG-7197 | | Summary | Request for new setting: EulerMode -180 to 180 | | Type | New Feature Request | | Priority | Unset | | Status | Accepted | | Resolution | Accepted | | Reporter | Moon Metty (moon.metty) | | Created at | 2014-09-04T23:09:11Z | | Updated at | 2014-09-17T18:05:59Z | ``` { 'Business Unit': ['Platform'], 'Date of First Response': '2014-09-17T13:05:55.143-0500', 'How would you like the feature to work?': 'Traditionally, the buildtool displays rotations as numbers between 0 and 360 degrees. You can type a number outside of the 0 to 360 range, but as soon as the field loses focus, the number is wrapped in range 0 to 360. A circle is round, so the numbers -350, 10, 370 and 730 all represent the same angle, right?\r\n\r\nThe Y-rotation is a little strange, because of gimbal lock.\r\nY only displays numbers in half of the circle: from 0 to 90, and from 270 to 360.\r\n\r\n=======\r\n\r\nThis feature request is about a new optional setting to change the range from [0, 360] to [-180, 180].\r\nAs you can see, the range [-180, 180] makes a full circle, and the range is symmetrical around zero.\r\nThis has a number of benefits:\r\n\r\n- 12.3 and -12.3 represent the same angle, just in the opposite direction. \r\n- Y-rotation now displays numbers in the range [-90, 90].\r\n- Both gimbal lock thresholds have the same value, but one is negative.\r\n- The LSL function llRot2Euler() also uses the range [-180, 180].\r\n- The range [-180, 180] suffers less from floating point noise, so we get better accuracy.\r\n\r\nThe result is a more intuitive interface, in my opinion.', 'Target Viewer Version': 'viewer-development', 'Why is this feature important to you? How would it benefit the community?': '*', } ```