Uploaded image for project: 'Snowstorm'
  1. Snowstorm
  2. STORM-2083

LLCalcParser calculates inverse trigonometric functions wrong

    Details

    • Type: Defect
    • Status: Closed
    • Priority: Unset
    • Resolution: Released
    • Affects Version/s: None
    • Fix Version/s: None
    • Labels:
      None
    • Environment:
      -
    • Test Plan:
      Hide

      Before applying the fix:

      • Start the viewer and rez a prim
      • Go to the "Texture" tab in the edit window
      • Enter in the spinner for horizontal scale: "=sin(90)" (without parenthesis) and tab out of the spinner. Observe the expression evaluates to 1.000 - this is correct
      • Now go back to the spinner, enter "=asin(1)" and tab out again. Expected value would be 90.000. Observed value is 1.000. Try the same with "=asin(1.000)" and the observed value is an empty textfield of the spinner.

      After the fix:

      • In the spinner for horizontal scale, enter "=asin(1)" and tab out. The expression evaluates correctly to 90.000. Enter "=asin(1.000)" and tab out again. Observe that again, the correct value of 90.000 is shown.

      The same kind of behavior can be observed with inverse cosinus and inverse tangent. For instance inverse cosinus:

      Enter "=cos(90)" and observe the result of 0. Now enter "=acos(0)". Before the change, the expression evaluates to 1.571. After the change, "=acos(0)" correctly evaluates to 90.

      Show
      Before applying the fix: Start the viewer and rez a prim Go to the "Texture" tab in the edit window Enter in the spinner for horizontal scale: "=sin(90)" (without parenthesis) and tab out of the spinner. Observe the expression evaluates to 1.000 - this is correct Now go back to the spinner, enter "=asin(1)" and tab out again. Expected value would be 90.000. Observed value is 1.000. Try the same with "=asin(1.000)" and the observed value is an empty textfield of the spinner. After the fix: In the spinner for horizontal scale, enter "=asin(1)" and tab out. The expression evaluates correctly to 90.000. Enter "=asin(1.000)" and tab out again. Observe that again, the correct value of 90.000 is shown. The same kind of behavior can be observed with inverse cosinus and inverse tangent. For instance inverse cosinus: Enter "=cos(90)" and observe the result of 0. Now enter "=acos(0)". Before the change, the expression evaluates to 1.571. After the change, "=acos(0)" correctly evaluates to 90.

      Description

      In llmath/llcalcparser.h, the calculation for the 3 inverse trigonometric functions asin, acos and atan are wrong. The conversion from radians to degrees is applied before actually calculating the radians, resulting in wrong and partially even invalid calculations (e.g. passing a value < -1 or > 1 to asin()).

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              ansariel.hiller Ansariel Hiller
              Contributor:
              Ansariel Hiller
            • Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: