@leafer/math
Advanced tools
+2
-2
| { | ||
| "name": "@leafer/math", | ||
| "version": "1.6.7", | ||
| "version": "1.7.0", | ||
| "description": "@leafer/math", | ||
@@ -25,4 +25,4 @@ "author": "Chao (Leafer) Wan", | ||
| "devDependencies": { | ||
| "@leafer/interface": "1.6.7" | ||
| "@leafer/interface": "1.7.0" | ||
| } | ||
| } |
@@ -288,2 +288,4 @@ import { IMatrixData, IPointData, ILayoutData, IMatrixWithLayoutData, IMatrixWithOptionScaleData, IScaleData, IMatrixWithScaleData, IScrollPointData } from '@leafer/interface' | ||
| // translate | ||
| t.e = x | ||
@@ -290,0 +292,0 @@ t.f = y |
| import { IPointData, IMatrixData, IRadiusPointData, IMatrixWithScaleData } from '@leafer/interface' | ||
| import { OneRadian, PI2, getPointData } from './MathHelper' | ||
| import { OneRadian, getPointData } from './MathHelper' | ||
@@ -8,3 +8,3 @@ import { MatrixHelper as M } from './MatrixHelper' | ||
| const { toInnerPoint, toOuterPoint } = M | ||
| const { sin, cos, abs, sqrt, atan2, min, round, PI } = Math | ||
| const { sin, cos, abs, sqrt, atan2, min, round } = Math | ||
@@ -147,6 +147,7 @@ | ||
| if (toOriginX === undefined) toOriginX = originX, toOriginY = originY | ||
| let fromAngle = atan2(fromY - originY, fromX - originX) | ||
| let toAngle = atan2(toY - toOriginY, toX - toOriginX) | ||
| const radian = toAngle - fromAngle | ||
| return radian < -PI ? radian + PI2 : radian | ||
| const a = fromX - originX | ||
| const b = fromY - originY | ||
| const c = toX - toOriginX | ||
| const d = toY - toOriginY | ||
| return Math.atan2(a * d - b * c, a * c + b * d) | ||
| }, | ||
@@ -153,0 +154,0 @@ |
1599
0.13%67860
-0.02%