@leafer/math
Advanced tools
+3
-3
| { | ||
| "name": "@leafer/math", | ||
| "version": "1.10.1", | ||
| "version": "1.11.0", | ||
| "description": "@leafer/math", | ||
@@ -25,5 +25,5 @@ "author": "Chao (Leafer) Wan", | ||
| "devDependencies": { | ||
| "@leafer/interface": "1.10.1", | ||
| "@leafer/data": "1.10.1" | ||
| "@leafer/interface": "1.11.0", | ||
| "@leafer/data": "1.11.0" | ||
| } | ||
| } |
+5
-2
@@ -80,4 +80,4 @@ import { IPoint, IPointData, IMatrixData } from '@leafer/interface' | ||
| public getDistancePoint(to: IPointData, distance: number, changeTo?: boolean): IPoint { | ||
| return new Point(P.getDistancePoint(this, to, distance, changeTo)) | ||
| public getDistancePoint(to: IPointData, distance: number, changeTo?: boolean, fromTo?: boolean): IPoint { | ||
| return new Point(P.getDistancePoint(this, to, distance, changeTo, fromTo)) | ||
| } | ||
@@ -93,2 +93,5 @@ | ||
| public isSame(point: IPointData): boolean { | ||
| return P.isSame(this, point) | ||
| } | ||
@@ -95,0 +98,0 @@ public reset(): IPoint { |
@@ -159,5 +159,6 @@ import { IPointData, IMatrixData, IRadiusPointData, IMatrixWithScaleData } from '@leafer/interface' | ||
| getDistancePoint(t: IPointData, to: IPointData, distance: number, changeTo: boolean): IPointData { | ||
| getDistancePoint(t: IPointData, to: IPointData, distance: number, changeTo?: boolean, fromTo?: boolean): IPointData { | ||
| const r = getAtan2(t, to) | ||
| to = changeTo ? to : {} as IPointData | ||
| fromTo && (t = to) | ||
| changeTo || (to = {} as IPointData) | ||
| to.x = t.x + cos(r) * distance | ||
@@ -174,2 +175,6 @@ to.y = t.y + sin(r) * distance | ||
| isSame(t: IPointData, point: IPointData): boolean { | ||
| return t.x === point.x && t.y === point.y | ||
| }, | ||
| reset(t: IPointData): void { | ||
@@ -176,0 +181,0 @@ P.reset(t) |
+4
-2
@@ -31,5 +31,6 @@ import * as _leafer_interface from '@leafer/interface'; | ||
| getDistance(to: IPointData): number; | ||
| getDistancePoint(to: IPointData, distance: number, changeTo?: boolean): IPoint; | ||
| getDistancePoint(to: IPointData, distance: number, changeTo?: boolean, fromTo?: boolean): IPoint; | ||
| getAngle(to: IPointData): number; | ||
| getAtan2(to: IPointData): number; | ||
| isSame(point: IPointData): boolean; | ||
| reset(): IPoint; | ||
@@ -169,4 +170,5 @@ } | ||
| getAtan2(t: IPointData, to: IPointData): number; | ||
| getDistancePoint(t: IPointData, to: IPointData, distance: number, changeTo: boolean): IPointData; | ||
| getDistancePoint(t: IPointData, to: IPointData, distance: number, changeTo?: boolean, fromTo?: boolean): IPointData; | ||
| toNumberPoints(originPoints: number[] | IPointData[]): number[]; | ||
| isSame(t: IPointData, point: IPointData): boolean; | ||
| reset(t: IPointData): void; | ||
@@ -173,0 +175,0 @@ }; |
72821
0.56%1719
0.53%