Closed glitchybunny closed 3 years ago
After way too much unnecessary agony, I've discovered the issue wasn't with the angle code at all, and was actually just an extremely dumb logic error.
this line was intended to ensure that dirPrev isn't equal to undefined
, but I failed to consider that angles can be equal to 0, which would also return false
it's such a simple fix
screams
I'm not sure why, but corners aren't being generated properly on lines heading towards 0 degrees that suddenly swap direction and go backwards, as seen here:
I've been able to successfully replicate this, but only at that specific angle. It doesn't occur at any other angles. It's either related to imprecision of atan2 in angle.directionI(), or an issue with how I'm calculating angle.difference().
Code below: https://github.com/darkrilin/open-picturephone/blob/ec4fcbd2c8306071344f60511610cd81f88e2a4f/static/js/fabric-regl.js#L17-L34