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

[CODAP] Angle Stability using negative numbers #356

Open
Matthew-Moore240 opened this issue Oct 21, 2024 · 4 comments
Open

[CODAP] Angle Stability using negative numbers #356

Matthew-Moore240 opened this issue Oct 21, 2024 · 4 comments
Assignees
Labels

Comments

@Matthew-Moore240
Copy link

Test device
Win 11 Desktop

Operating System
Win 11 23H2

Browser
Firefox 131.0.3

Problem description
From phetsims/qa#1157 Angle Stability goes into the negative.

Steps to reproduce
N/A

Visuals
image

@KatieWoe
Copy link

Noting that the more stable, the more negative the number, which seems to be oposite the intended behavior.

@samreid
Copy link
Member

samreid commented Nov 8, 2024

In this code, we actually get the value of launcherStandardDeviationAngle and, after a linear transform, rename it to angle stability.

        const launcherMechanism = launcherName === 'custom' ? launcherMechanismName : '?';
        const angleStabilitySliderValue = ( 5 - 0.2 ) / ( 5 - 0.2 ) * ( projectile.launcherStandardDeviationAngle - 5 ) + 0.2;
        const angleStabilityRounded = valueRoundedToThousandths( angleStabilitySliderValue );
        const angleStability = launcherName === 'custom' ? angleStabilityRounded : '?';

This was implemented in #234. I'm not sure how to proceed.

@samreid
Copy link
Member

samreid commented Nov 11, 2024

@matthew-blackman recommended this patch:

Subject: [PATCH] Avoid grunt, see https://github.com/phetsims/chipper/issues/1436
---
Index: repos/projectile-data-lab/wrappers/codap/codapWrapper.html
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/repos/projectile-data-lab/wrappers/codap/codapWrapper.html b/repos/projectile-data-lab/wrappers/codap/codapWrapper.html
--- a/repos/projectile-data-lab/wrappers/codap/codapWrapper.html	(revision 5e758c1641c02fb5b2bce3bf3efe8a42a9b79104)
+++ b/repos/projectile-data-lab/wrappers/codap/codapWrapper.html	(date 1731358977956)
@@ -300,7 +300,12 @@
         const launcherMechanismName = projectile.launcherMechanism.phetioID.substring( projectile.launcherMechanism.phetioID.lastIndexOf( '.' ) + 1 );
 
         const launcherMechanism = launcherName === 'custom' ? launcherMechanismName : '?';
-        const angleStabilitySliderValue = ( 5 - 0.2 ) / ( 5 - 0.2 ) * ( projectile.launcherStandardDeviationAngle - 5 ) + 0.2;
+
+        // Determine the angle stability from the launcher standard deviation angle
+        const launcherStandardDeviationAngle = projectile.launcherStandardDeviationAngle;
+        const linear = ( a1, a2, b1, b2, a3 ) => ( b2 - b1 ) / ( a2 - a1 ) * ( a3 - a1 ) + b1;
+        const angleStabilitySliderValue = linear( 5, 0.2, 0, 1, launcherStandardDeviationAngle );
+
         const angleStabilityRounded = valueRoundedToThousandths( angleStabilitySliderValue );
         const angleStability = launcherName === 'custom' ? angleStabilityRounded : '?';
 

@samreid
Copy link
Member

samreid commented Nov 11, 2024

After the commit, I'm seeing values from 0 (low stability) to 1 (high stability)

image

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

No branches or pull requests

4 participants