Skip to content
Advertisement

Tag: math

How can I change the angle of a vector when hitting an obstacle

So, my issue concerns vectors, I don’t know where I’m going with that case. I’m building a pandemic simulation (using Javascript and the library p5.js), and I’m trying to add a lockdown feature. Here is an image to make everything clearer: Essentially, at the moment, when two molecules collide, their velocity vector change appropriately by switching their former velocity. My

Canvas zoom to cursor doesn’t work correct

I’m trying to scale canvas to/from mouse position, but it works not perfect (always goes few cells away from mouse pos). I’ve read all similar posts but i don’t know what’s wrong. https://jsfiddle.net/shumikua/3afxtmqw/ All code is only to run snippet, it works good. Problem is in function scale. Answer In function scale() keep the same values for x and y

Calculate the radius of an ellipse using Javascript [closed]

Closed. This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 2 years ago. Improve this question If I have the height and width of an ellipse and the angle from the center. How can I calculate

Advertisement