@js-draw/math 1.8.0 → 1.9.0

Sign up to get free protection for your applications and to get access to all the features.
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2022 Henry Heino
3
+ Copyright (c) 2023 Henry Heino
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -46,6 +46,15 @@ export declare class Vec3 {
46
46
  * Return this' angle in the XY plane (treats this as a Vec2).
47
47
  *
48
48
  * This is equivalent to `Math.atan2(vec.y, vec.x)`.
49
+ *
50
+ * As such, observing that `Math.atan2(-0, -1)` $\approx -\pi$ and `Math.atan2(0, -1)`$\approx \pi$
51
+ * the resultant angle is in the range $[-\pi, pi]$.
52
+ *
53
+ * ```ts,runnable,console
54
+ * import { Vec2 } from '@js-draw/math';
55
+ * console.log(Vec2.of(-1, -0).angle()); // atan2(-0, -1)
56
+ * console.log(Vec2.of(-1, 0).angle()); // atan2(0, -1)
57
+ * ```
49
58
  */
50
59
  angle(): number;
51
60
  /**
package/dist/cjs/Vec3.js CHANGED
@@ -71,6 +71,15 @@ class Vec3 {
71
71
  * Return this' angle in the XY plane (treats this as a Vec2).
72
72
  *
73
73
  * This is equivalent to `Math.atan2(vec.y, vec.x)`.
74
+ *
75
+ * As such, observing that `Math.atan2(-0, -1)` $\approx -\pi$ and `Math.atan2(0, -1)`$\approx \pi$
76
+ * the resultant angle is in the range $[-\pi, pi]$.
77
+ *
78
+ * ```ts,runnable,console
79
+ * import { Vec2 } from '@js-draw/math';
80
+ * console.log(Vec2.of(-1, -0).angle()); // atan2(-0, -1)
81
+ * console.log(Vec2.of(-1, 0).angle()); // atan2(0, -1)
82
+ * ```
74
83
  */
75
84
  angle() {
76
85
  return Math.atan2(this.y, this.x);
@@ -46,6 +46,15 @@ export declare class Vec3 {
46
46
  * Return this' angle in the XY plane (treats this as a Vec2).
47
47
  *
48
48
  * This is equivalent to `Math.atan2(vec.y, vec.x)`.
49
+ *
50
+ * As such, observing that `Math.atan2(-0, -1)` $\approx -\pi$ and `Math.atan2(0, -1)`$\approx \pi$
51
+ * the resultant angle is in the range $[-\pi, pi]$.
52
+ *
53
+ * ```ts,runnable,console
54
+ * import { Vec2 } from '@js-draw/math';
55
+ * console.log(Vec2.of(-1, -0).angle()); // atan2(-0, -1)
56
+ * console.log(Vec2.of(-1, 0).angle()); // atan2(0, -1)
57
+ * ```
49
58
  */
50
59
  angle(): number;
51
60
  /**
package/dist/mjs/Vec3.mjs CHANGED
@@ -68,6 +68,15 @@ export class Vec3 {
68
68
  * Return this' angle in the XY plane (treats this as a Vec2).
69
69
  *
70
70
  * This is equivalent to `Math.atan2(vec.y, vec.x)`.
71
+ *
72
+ * As such, observing that `Math.atan2(-0, -1)` $\approx -\pi$ and `Math.atan2(0, -1)`$\approx \pi$
73
+ * the resultant angle is in the range $[-\pi, pi]$.
74
+ *
75
+ * ```ts,runnable,console
76
+ * import { Vec2 } from '@js-draw/math';
77
+ * console.log(Vec2.of(-1, -0).angle()); // atan2(-0, -1)
78
+ * console.log(Vec2.of(-1, 0).angle()); // atan2(0, -1)
79
+ * ```
71
80
  */
72
81
  angle() {
73
82
  return Math.atan2(this.y, this.x);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@js-draw/math",
3
- "version": "1.8.0",
3
+ "version": "1.9.0",
4
4
  "description": "A math library for js-draw. ",
5
5
  "types": "./dist/mjs/lib.d.ts",
6
6
  "main": "./dist/cjs/lib.js",
@@ -19,7 +19,7 @@
19
19
  "license": "MIT",
20
20
  "private": false,
21
21
  "scripts": {
22
- "dist-test": "npm run build && cd dist-test/test_imports && npm install && npm run test",
22
+ "dist-test": "cd dist-test/test_imports && npm install && npm run test",
23
23
  "dist": "npm run build && npm run dist-test",
24
24
  "build": "rm -rf ./dist && mkdir dist && build-tool build",
25
25
  "watch": "rm -rf ./dist/* && mkdir -p dist && build-tool watch"
@@ -45,5 +45,5 @@
45
45
  "svg",
46
46
  "math"
47
47
  ],
48
- "gitHead": "89f7991833dec5c17ce0890321286198ff7b1900"
48
+ "gitHead": "e824c37e9f216852cf096976e3a74fb4f177ead3"
49
49
  }