P5.js: p5.Geometry._getFaceNormal generates many warnings in console via p5.Vector.mult

Created on 26 Jan 2018  路  3Comments  路  Source: processing/p5.js

Nature of issue?

  • [x] Found a bug
  • [ ] Existing feature enhancement
  • [ ] New feature request

Most appropriate sub-area of p5.js?

  • [ ] Color
  • [ ] Core
  • [ ] Data
  • [ ] Events
  • [ ] Image
  • [ ] IO
  • [ ] Math
  • [ ] Typography
  • [ ] Utilities
  • [x] WebGL
  • [ ] Other (specify if possible)

Which platform were you using when you encountered this?

  • [ ] Mobile/Tablet (touch devices)
  • [x] Desktop/Laptop
  • [ ] Others (specify if possible)

Details about the bug:

  • p5.js version:
  • Web browser and version: Chrome
  • Operating System: macOS Sierra
  • Steps to reproduce this:

Run example in manual-test-samples/webgl/geometry. It produces hundreds of errors saying,

p5.Vector.prototype.mult: n is undefined or not a finite number

which seems to trace up to trying to take the angle between two vectors [0, 0, 0] and a divide-by-zero NaN in p5.Geometry._getFaceNormal. happens for cylinder and cone on initialization, doesn't repeat again after first frame. other shapes in this example are fine.

webgl

Most helpful comment

This is from some colinearity or repeated points in the cone and cylinder geometry, presumably from the circular base. From my quick testing it looks like both exist. Ideally all geometries should be well formed so this shouldn't happen. As a guard against this we can escape early in the case of colinear points or repeated points. This is when sinAlpha is 0 or NaN.

(This is my first contribution! I would love to help a bit with p5.js since I found @shiffman on youtube and watched some of his videos.)

All 3 comments

This is from some colinearity or repeated points in the cone and cylinder geometry, presumably from the circular base. From my quick testing it looks like both exist. Ideally all geometries should be well formed so this shouldn't happen. As a guard against this we can escape early in the case of colinear points or repeated points. This is when sinAlpha is 0 or NaN.

(This is my first contribution! I would love to help a bit with p5.js since I found @shiffman on youtube and watched some of his videos.)

@tau- go for it! I can't assign it to you for some reason, but feel free to assign it to yourself so people know you're working on it!

I cannot assign this to myself either. I think the issue is that I am not marked as a contributor.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kappaxbeta picture kappaxbeta  路  3Comments

kartikay-bagla picture kartikay-bagla  路  3Comments

stalgiag picture stalgiag  路  3Comments

Vbbab picture Vbbab  路  3Comments

ogoossens picture ogoossens  路  3Comments