adds salient example to point.slope
This commit is contained in:
parent
aa2887c507
commit
b5b65b82b7
1 changed files with 17 additions and 5 deletions
|
@ -2,28 +2,40 @@
|
|||
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
|
||||
|
||||
```js
|
||||
point.slope(a,b)
|
||||
|
||||
point.slope(otherPoint)
|
||||
|
||||
```
|
||||
|
||||
## Example
|
||||
|
||||
<Example caption="An example of the Point.slope() method">
|
||||
|
||||
```js
|
||||
|
||||
({ Point, points, Path, paths, Snippet, snippets, part }) => {
|
||||
|
||||
points.A = new Point(5,10)
|
||||
points.B = new Point(10,20)
|
||||
points.A = new Point(0,0)
|
||||
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
|
||||
}
|
||||
|
||||
```
|
||||
</Example>
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue