JSXGraph. Calculate displacement of point -


how can calculate displacement of point in jsxgraph. suppose there point @ (0, 0) location. if drag point (0, 0) (2, 0). displacement 2 units. query formula in jsxgraph calculate displacement.

if want calculate distance between 2 jsxgraph points, p , q, dist method can used:

p.dist(q) 

if want determine distance point p coordinate array [x, y], done this:

jxg.math.geometry.distance(p.coords.usrcoords, [1, x, y]); 

instead of [x, y] 1 has use [1, x, y], because jsxgraph works homogeneous coordinates, allow handle infinite points.

a dynamic example this:

var p = board.create('point', [3, 0]),     q = board.create('point', [0, 0]),     t = board.create('text', [1, 1, function() { return p.dist(q); }]); 

Comments

Popular posts from this blog

mysql - FireDac error 314 - but DLLs are in program directory -

git - How to list all releases of public repository with GitHub API V3 -

c++ - Getting C2512 "no default constructor" for `ClassA` error on the first parentheses of constructor for `ClassB`? -