Odległość punktów
Strona używa skryptu figures.js
Listing
var cv = document.getElementById("canvas"); var ctx = cv.getContext("2d"); //- var point = new Point(120, 20); point.strokeStyle = "blue"; point.shape="cross"; point.stroke = true; point.lineWidth = 0.5; point.diam = 10; point.draw(ctx); // var point1 = new Point(150, 50); point1.fillStyle="red"; point1.strokeStyle = "blue"; point1.fill = true; point1.stroke = true; point1.lineWidth = 1.0; point1.diam = 6; point1.draw(ctx); // var distance = point.distance(point1); ctx.fillText("odległość punktów: "+ distance + " px", 120, 80);