1
0
Fork 0

adds salient example to point.slope

This commit is contained in:
Zee 2023-04-16 16:39:13 +00:00
parent aa2887c507
commit b5b65b82b7

View file

@ -2,28 +2,40 @@
title: Point.slope() title: Point.slope()
--- ---
The `Point.slope()` method returns slope of a line made by this Point and that Point. The `Point.slope()` method returns the slope of a line made by this Point and that Point.
## Signature ## Signature
```js ```js
point.slope(a,b)
point.slope(otherPoint)
``` ```
## Example ## Example
<Example caption="An example of the Point.slope() method"> <Example caption="An example of the Point.slope() method">
```js ```js
({ Point, points, Path, paths, Snippet, snippets, part }) => { ({ Point, points, Path, paths, Snippet, snippets, part }) => {
points.A = new Point(5,10) points.A = new Point(0,0)
points.B = new Point(10,20) points.B = new Point(40,30)
const slope = points.A.slope(points.B)
paths.line = new Path()
.move(points.A)
.line(points.B)
.attr("class", "canvas")
.setText("Slope: " + slope, "text-xs center")
point.slope(A,B)
return part return part
} }
``` ```
</Example> </Example>