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
Post a Comment