2021-10-17 17:34:55 +02:00
|
|
|
***
|
|
|
|
|
|
|
|
## title: angle()
|
2021-08-25 16:09:31 +02:00
|
|
|
|
|
|
|
```js
|
|
|
|
float point.angle(Point point)
|
2021-10-17 17:34:55 +02:00
|
|
|
```
|
2021-08-25 16:09:31 +02:00
|
|
|
|
|
|
|
Returns the angle made by a line from this point to the point you pass it.
|
|
|
|
|
|
|
|
<Example
|
2021-10-17 17:34:55 +02:00
|
|
|
part="point_angle"
|
|
|
|
caption="An example of the Point.angle() method"
|
2021-08-25 16:09:31 +02:00
|
|
|
/>
|
|
|
|
|
|
|
|
```js
|
|
|
|
let { Point, points, Path, paths } = part.shorthand();
|
|
|
|
|
|
|
|
points.sun = new Point(10, 5);
|
|
|
|
points.moon = points.sun.shift(-15, 70);
|
|
|
|
points.text = points.sun
|
|
|
|
.shiftFractionTowards(points.moon, 0.8)
|
|
|
|
.attr("data-text", points.sun.angle(points.moon)+"°")
|
|
|
|
.attr("data-text-class", "text-sm fill-note center");
|
|
|
|
|
|
|
|
paths.line = new Path()
|
|
|
|
.move(points.sun)
|
|
|
|
.line(points.moon)
|
|
|
|
.attr("class", "dashed");
|
|
|
|
```
|