Skip to content

arc() silently fails with Infinity/NaN values ( no console warnings) #8198

@Homaid

Description

@Homaid

Most appropriate sub-area of p5.js?

  • Accessibility
  • Color
  • Core/Environment/Rendering
  • Data
  • DOM
  • Events
  • Image
  • IO
  • Math
  • Typography
  • Utilities
  • p5.strands
  • WebGL
  • DevOps, Build process, Unit testing
  • Internationalization (i18n)
  • Friendly Errors
  • Other (specify if possible)

p5.js version

1.11.1

Web browser and version

Chrome 138.0.0.0 (64-bit)

Operating system

windows 11

Steps to reproduce this

Steps:

  1. Open https://editor.p5js.org/
  2. Paste the following code into the editor.
  3. Observe that no console warnings appear, even though invalid parameters are passed to arc().

Snippet:

function setup() {
  createCanvas(400, 400);
  strokeWeight(2);
}

function draw() {
  background(220);
  
  // Extreme / invalid values
  arc(100, 100, 80, 80, 0, 1000);           // Huge end angle
  arc(200, 100, 80, 80, -1000, 1000);       // Huge range
  arc(300, 100, 80, 80, Infinity, Infinity); // Infinity inputs
  arc(100, 200, 80, 80, NaN, PI);            // NaN value
  arc(200, 200, -80, -80, 0, PI);            // Negative radius
  arc(300, 200, Infinity, Infinity, 0, PI);  // Infinite radius
  
  print("Frame:", frameCount);
}

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions