1
0
Fork 0
freesewing/markdown/dev/reference/api/point/slope/en.md
Zee 1a17bce223
Update en.md
White space
2023-04-25 17:57:39 +02:00

745 B

title
Point.slope()

The Point.slope() method returns the slope (dy/dx) of a line between two Points.

Signature


point.slope(otherPoint)

Example


({ Point, points, Path, paths, Snippet, snippets, part, macro }) => {

 points.A = new Point(0,0)
 points.B = new Point(200,150)

 const slope = points.A.slope(points.B)

    macro('hd', {
      from: points.A,
      to: points.B,
      y: points.B.y,
    })
    macro('vd', {
      to: points.B,
      from: points.A,
      x: 0,
    })

paths.line = new Path()
.move(points.A)
.line(points.B)
.attr("class", "canvas")
.setText("Slope: " + slope,  "center text-lg")

  return part
}