Skip to content

Fix: allow single-arg atan() outside strands; add visual test#8095

Closed
Abhayaj247 wants to merge 2 commits into
processing:dev-2.0from
Abhayaj247:fix/atan-strands
Closed

Fix: allow single-arg atan() outside strands; add visual test#8095
Abhayaj247 wants to merge 2 commits into
processing:dev-2.0from
Abhayaj247:fix/atan-strands

Conversation

@Abhayaj247
Copy link
Copy Markdown

Resolves #8092

  • The single-argument atan(x) was incorrectly treated as GLSL-only in strands, causing a friendly error and returning undefined when called outside a shader. This mirrors the noise() override issue fixed in Fix noise() getting overridden; add tests #8036.
  • The fix marks the 1-arg overload as a normal p5 function while keeping the 2-arg GLSL overload atan(y, x) strands-only.

Changes :

  • src/webgl/ShaderGenerator.js

    • In builtInGLSLFunctions, set:
      • atan single-arg overload: isp5Function: true
      • atan two-arg overload: remains isp5Function: false
  • test/unit/visual/cases/math.js

    • Add atan_outside_strands visual integration test that draws the value of atan(0.5) to ensure it evaluates and no friendly error is triggered.
  • test/unit/spec.js

    • Include the new visual test suite entry visual/cases/math.

Screenshots of the change :

  • Visual test creates baseline showing text like “atan(0.5) ≈ 0.464”; subsequent runs match the baseline.
000

PR Checklist

  • npm run lint passes
  • Inline reference is included / updated (function behavior unchanged; no reference edits needed)
  • Unit tests are included / updated (added visual/integration test)

@Abhayaj247 Abhayaj247 closed this Sep 17, 2025
@Abhayaj247 Abhayaj247 deleted the fix/atan-strands branch September 17, 2025 08:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant