eurocat2k / vectors2d

Demonstrates 2D vector manipulations

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Vectors in 2D

Demonstrates 2D vector manipulations

Demo

Usage

Download (as ZIP) or clone this code with git client and save in the local filesystem. Navigate to the src subdirectory and simply open the vectors.html file in your browser. That's all.

Description

This small JS application demonstrates basic vector manipulations - addition, subtraction, scale, dot product, distance, direction and magnitude.

Using mouse pointer user user can dynamically update the following elements:

  • vector AB + AM
  • vector AB - AM
  • vector dot product (AM • AB)
  • angle θ - angle between AM and AP

At window load event the mouse pointer drags point M along the canvas, however if user clicks on the canvas once, it will drop the M at the click position. Another click on the canvas picks the point, and drags along the the mouse pointer' path.

Video descriptions on YouTube

About

Demonstrates 2D vector manipulations

License:MIT License


Languages

Language:JavaScript 93.9%Language:HTML 6.1%