1
0
Fork 0
freesewing/sites/dev/docs/reference/api/point/slope
Joost De Cock ab3204f9f1 chore: Port FreeSewing.dev to docusaurus
The replaces the NextJS site powering FreeSewing.dev with a Docusaurus
setup. It's part of my efforts to simplify FreeSewing's setup so we can
focus on our core value proposition.
2024-09-28 13:13:48 +02:00
..
readme.mdx chore: Port FreeSewing.dev to docusaurus 2024-09-28 13:13:48 +02:00

---
title: Point.slope()
---

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

## Signature

```js

point.slope(otherPoint)

```

## Example

<Example caption="An example of the Point.slope() method">

```js

({ 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
}

```
</Example>