@realsee/dnalogel 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +94 -0
- package/TERMS.txt +56 -0
- package/components/ARVideoFigure/ARVideoFigureMesh.d.ts +44 -0
- package/components/ARVideoFigure/ARVideoFigureMesh.js +347 -0
- package/components/ARVideoFigure/ARVideoFigureScene.d.ts +11 -0
- package/components/ARVideoFigure/ARVideoFigureScene.js +74 -0
- package/components/ARVideoFigure/ImgBgTransparent.d.ts +16 -0
- package/components/ARVideoFigure/ImgBgTransparent.js +49 -0
- package/components/ARVideoFigure/ImgBgTransparentMesh.d.ts +30 -0
- package/components/ARVideoFigure/ImgBgTransparentMesh.js +173 -0
- package/components/ARVideoFigure/fragmentShader.d.ts +5 -0
- package/components/ARVideoFigure/fragmentShader.js +16 -0
- package/components/ARVideoFigure/index.d.ts +15 -0
- package/components/ARVideoFigure/index.js +64 -0
- package/components/ARVideoFigure/vertexShader.d.ts +1 -0
- package/components/ARVideoFigure/vertexShader.js +8 -0
- package/components/GlassFilters/index.d.ts +32 -0
- package/components/GlassFilters/index.js +54 -0
- package/components/ModelView/ModelViewController.d.ts +18 -0
- package/components/ModelView/ModelViewController.js +147 -0
- package/components/ModelView/index.d.ts +10 -0
- package/components/ModelView/index.js +22 -0
- package/components/PBRView/index.d.ts +14 -0
- package/components/PBRView/index.js +31 -0
- package/components/PaintBrush/index.d.ts +16 -0
- package/components/PaintBrush/index.js +33 -0
- package/components/PanoTag/index.d.ts +4 -0
- package/components/PanoTag/index.js +11 -0
- package/custom.d.js +3 -0
- package/data/1aGKl9JmrlXMXx8d.d.ts +104 -0
- package/data/1aGKl9JmrlXMXx8d.js +535 -0
- package/data/6gyq3v1verxD7JO1.d.ts +104 -0
- package/data/6gyq3v1verxD7JO1.js +460 -0
- package/data/KpokNd82rwjhackhQTBEoYKHg8zGbPXe.d.ts +84 -0
- package/data/KpokNd82rwjhackhQTBEoYKHg8zGbPXe.js +598 -0
- package/data/PrXel3aqGbp34JQn.d.ts +389 -0
- package/data/PrXel3aqGbp34JQn.js +4639 -0
- package/data/YdoNP9K4rwQDwjJr.d.ts +83 -0
- package/data/YdoNP9K4rwQDwjJr.js +1451 -0
- package/data/auto3d-njL5J99VwCmnjtQElOmXQr.d.ts +86 -0
- package/data/auto3d-njL5J99VwCmnjtQElOmXQr.js +709 -0
- package/data/oPzy3ApbjjpD8YdR.d.ts +83 -0
- package/data/oPzy3ApbjjpD8YdR.js +281 -0
- package/data/qjAxMG4XbPn96wKG.d.ts +104 -0
- package/data/qjAxMG4XbPn96wKG.js +635 -0
- package/data/rXel3aPQRRBD4JQn.d.ts +86 -0
- package/data/rXel3aPQRRBD4JQn.js +620 -0
- package/data/vLykj3NWrllMrG06.d.ts +89 -0
- package/data/vLykj3NWrllMrG06.js +2532 -0
- package/data/wYnRjQ4KZoV1yPoG.d.ts +114 -0
- package/data/wYnRjQ4KZoV1yPoG.js +512 -0
- package/data/wz0QV9KA4ugyo9ME.d.ts +39 -0
- package/data/wz0QV9KA4ugyo9ME.js +134 -0
- package/examples/FiveStateController/index.js +140 -0
- package/examples/VRHouse/Mobile.js +22 -0
- package/examples/VRHouse/PC.js +22 -0
- package/examples/VRHouse/index.js +22 -0
- package/index.d.ts +15 -0
- package/index.js +43 -0
- package/package.json +19 -0
- package/plugins/CSS3DRenderPlugin/components/Marker/index.d.ts +12 -0
- package/plugins/CSS3DRenderPlugin/components/Marker/index.js +113 -0
- package/plugins/CSS3DRenderPlugin/index.d.ts +49 -0
- package/plugins/CSS3DRenderPlugin/index.js +220 -0
- package/plugins/CameraMovementPlugin/index.d.ts +7 -0
- package/plugins/CameraMovementPlugin/index.js +338 -0
- package/plugins/CameraMovementPlugin/typing.d.ts +68 -0
- package/plugins/CameraMovementPlugin/typing.js +35 -0
- package/plugins/ModelChassisCompassPlugin/index.d.ts +15 -0
- package/plugins/ModelChassisCompassPlugin/index.js +156 -0
- package/plugins/ModelEntryDoorGuidePlugin/index.d.ts +10 -0
- package/plugins/ModelEntryDoorGuidePlugin/index.js +16 -0
- package/plugins/ModelTVVideoPlugin/index.d.ts +21 -0
- package/plugins/ModelTVVideoPlugin/index.js +313 -0
- package/plugins/ModelViewPlugin/index.d.ts +17 -0
- package/plugins/ModelViewPlugin/index.js +199 -0
- package/plugins/PanoCursorRaycasterPlugin/PanoCursorRaycasterPluginUsage.d.ts +48 -0
- package/plugins/PanoCursorRaycasterPlugin/components/MovePointTowardsCamera.d.ts +9 -0
- package/plugins/PanoCursorRaycasterPlugin/components/MovePointTowardsCamera.js +113 -0
- package/plugins/PanoCursorRaycasterPlugin/components/PointAxesHelper.d.ts +11 -0
- package/plugins/PanoCursorRaycasterPlugin/components/PointAxesHelper.js +25 -0
- package/plugins/PanoCursorRaycasterPlugin/index.d.ts +49 -0
- package/plugins/PanoCursorRaycasterPlugin/index.js +119 -0
- package/plugins/PanoCursorRaycasterPlugin/utils/addLineToFive.d.ts +5 -0
- package/plugins/PanoCursorRaycasterPlugin/utils/addLineToFive.js +25 -0
- package/plugins/PanoCursorRaycasterPlugin/utils/createLine.d.ts +3 -0
- package/plugins/PanoCursorRaycasterPlugin/utils/createLine.js +34 -0
- package/plugins/PanoCursorRaycasterPlugin/utils/vecror3.d.ts +7 -0
- package/plugins/PanoCursorRaycasterPlugin/utils/vecror3.js +18 -0
- package/plugins/PanoDoorLabelPlugin/index.d.ts +4 -0
- package/plugins/PanoDoorLabelPlugin/index.js +12 -0
- package/plugins/PanoIRobotPlugin/index.d.ts +10 -0
- package/plugins/PanoIRobotPlugin/index.js +16 -0
- package/plugins/PanoRulerPlugin/data/roomInfo.d.ts +3 -0
- package/plugins/PanoRulerPlugin/data/roomInfo.js +49 -0
- package/plugins/PanoRulerPlugin/data/roomRules.d.ts +3 -0
- package/plugins/PanoRulerPlugin/data/roomRules.js +233 -0
- package/plugins/PanoRulerPlugin/index.d.ts +27 -0
- package/plugins/PanoRulerPlugin/index.js +589 -0
- package/plugins/PanoRulerPlugin/typings.d.ts +21 -0
- package/plugins/PanoRulerPlugin/typings.js +5 -0
- package/plugins/PanoTVVideoPlugin/index.d.ts +24 -0
- package/plugins/PanoTVVideoPlugin/index.js +351 -0
- package/plugins/TreasurePlugin/Controller.d.ts +32 -0
- package/plugins/TreasurePlugin/Controller.js +175 -0
- package/plugins/TreasurePlugin/TreasureFaceAnime.d.ts +23 -0
- package/plugins/TreasurePlugin/TreasureFaceAnime.js +128 -0
- package/plugins/TreasurePlugin/TreasureObject.d.ts +35 -0
- package/plugins/TreasurePlugin/TreasureObject.js +186 -0
- package/plugins/TreasurePlugin/TreasureOpenAnime.d.ts +23 -0
- package/plugins/TreasurePlugin/TreasureOpenAnime.js +103 -0
- package/plugins/TreasurePlugin/constants.d.ts +12 -0
- package/plugins/TreasurePlugin/constants.js +30 -0
- package/plugins/TreasurePlugin/index.d.ts +11 -0
- package/plugins/TreasurePlugin/index.js +16 -0
- package/plugins/TreasurePlugin/treasureDataMap.d.ts +7 -0
- package/plugins/TreasurePlugin/treasureDataMap.js +20 -0
- package/plugins/TreasurePlugin/typings.d.ts +2 -0
- package/plugins/TreasurePlugin/typings.js +5 -0
- package/plugins/TreasurePlugin/utils/loadTreasureTextures.d.ts +7 -0
- package/plugins/TreasurePlugin/utils/loadTreasureTextures.js +115 -0
- package/plugins/floorplan/Assets/floorplanExtraObject.d.ts +1 -0
- package/plugins/floorplan/Assets/floorplanExtraObject.js +8 -0
- package/plugins/floorplan/ModelFloorplanPlugin/Controller.d.ts +100 -0
- package/plugins/floorplan/ModelFloorplanPlugin/Controller.js +643 -0
- package/plugins/floorplan/ModelFloorplanPlugin/components/Camera.d.ts +13 -0
- package/plugins/floorplan/ModelFloorplanPlugin/components/Camera.js +58 -0
- package/plugins/floorplan/ModelFloorplanPlugin/components/Compass.d.ts +5 -0
- package/plugins/floorplan/ModelFloorplanPlugin/components/Compass.js +69 -0
- package/plugins/floorplan/ModelFloorplanPlugin/components/NowFloor/RoomHighlight.d.ts +10 -0
- package/plugins/floorplan/ModelFloorplanPlugin/components/NowFloor/RoomHighlight.js +105 -0
- package/plugins/floorplan/ModelFloorplanPlugin/components/NowFloor/RoomLabels.d.ts +13 -0
- package/plugins/floorplan/ModelFloorplanPlugin/components/NowFloor/RoomLabels.js +95 -0
- package/plugins/floorplan/ModelFloorplanPlugin/components/NowFloor/index.d.ts +13 -0
- package/plugins/floorplan/ModelFloorplanPlugin/components/NowFloor/index.js +48 -0
- package/plugins/floorplan/ModelFloorplanPlugin/components/index.d.ts +20 -0
- package/plugins/floorplan/ModelFloorplanPlugin/components/index.js +66 -0
- package/plugins/floorplan/ModelFloorplanPlugin/controller.style.d.ts +1 -0
- package/plugins/floorplan/ModelFloorplanPlugin/controller.style.js +14 -0
- package/plugins/floorplan/ModelFloorplanPlugin/index.d.ts +9 -0
- package/plugins/floorplan/ModelFloorplanPlugin/index.js +18 -0
- package/plugins/floorplan/ModelFloorplanPlugin/typings/events.type.d.ts +23 -0
- package/plugins/floorplan/ModelFloorplanPlugin/typings/events.type.js +5 -0
- package/plugins/floorplan/ModelFloorplanPlugin/utils/constant.d.ts +15 -0
- package/plugins/floorplan/ModelFloorplanPlugin/utils/constant.js +31 -0
- package/plugins/floorplan/ModelFloorplanPlugin/utils/correctFiveState.d.ts +14 -0
- package/plugins/floorplan/ModelFloorplanPlugin/utils/correctFiveState.js +162 -0
- package/plugins/floorplan/PanoFloorplanRadarPlugin/Content/Camera.d.ts +13 -0
- package/plugins/floorplan/PanoFloorplanRadarPlugin/Content/Camera.js +91 -0
- package/plugins/floorplan/PanoFloorplanRadarPlugin/Content/Camera.style.d.ts +3 -0
- package/plugins/floorplan/PanoFloorplanRadarPlugin/Content/Camera.style.js +35 -0
- package/plugins/floorplan/PanoFloorplanRadarPlugin/Content/NowFloor/ExtraObjects.d.ts +5 -0
- package/plugins/floorplan/PanoFloorplanRadarPlugin/Content/NowFloor/ExtraObjects.js +50 -0
- package/plugins/floorplan/PanoFloorplanRadarPlugin/Content/NowFloor/RoomHighlight.d.ts +9 -0
- package/plugins/floorplan/PanoFloorplanRadarPlugin/Content/NowFloor/RoomHighlight.js +102 -0
- package/plugins/floorplan/PanoFloorplanRadarPlugin/Content/NowFloor/index.d.ts +11 -0
- package/plugins/floorplan/PanoFloorplanRadarPlugin/Content/NowFloor/index.js +42 -0
- package/plugins/floorplan/PanoFloorplanRadarPlugin/Content/index.d.ts +17 -0
- package/plugins/floorplan/PanoFloorplanRadarPlugin/Content/index.js +75 -0
- package/plugins/floorplan/PanoFloorplanRadarPlugin/Content/index.style.d.ts +2 -0
- package/plugins/floorplan/PanoFloorplanRadarPlugin/Content/index.style.js +13 -0
- package/plugins/floorplan/PanoFloorplanRadarPlugin/Controller.d.ts +33 -0
- package/plugins/floorplan/PanoFloorplanRadarPlugin/Controller.js +214 -0
- package/plugins/floorplan/PanoFloorplanRadarPlugin/index.d.ts +8 -0
- package/plugins/floorplan/PanoFloorplanRadarPlugin/index.js +18 -0
- package/plugins/floorplan/TopviewFloorplanPlugin/Controller.d.ts +55 -0
- package/plugins/floorplan/TopviewFloorplanPlugin/Controller.js +267 -0
- package/plugins/floorplan/TopviewFloorplanPlugin/index.d.ts +5 -0
- package/plugins/floorplan/TopviewFloorplanPlugin/index.js +16 -0
- package/plugins/floorplan/TopviewFloorplanPlugin/style.d.ts +1 -0
- package/plugins/floorplan/TopviewFloorplanPlugin/style.js +14 -0
- package/plugins/floorplan/components/FloorplanImage.d.ts +7 -0
- package/plugins/floorplan/components/FloorplanImage.js +76 -0
- package/plugins/floorplan/typings/floorplanData.d.ts +127 -0
- package/plugins/floorplan/typings/floorplanData.js +5 -0
- package/plugins/floorplan/typings/floorplanServerData.d.ts +125 -0
- package/plugins/floorplan/typings/floorplanServerData.js +380 -0
- package/plugins/floorplan/utils/formatData.d.ts +5 -0
- package/plugins/floorplan/utils/formatData.js +220 -0
- package/plugins/floorplan/utils/formatPosition.d.ts +37 -0
- package/plugins/floorplan/utils/formatPosition.js +87 -0
- package/shared-utils/Preloader.d.ts +6 -0
- package/shared-utils/Preloader.js +51 -0
- package/shared-utils/Subscribe.d.ts +45 -0
- package/shared-utils/Subscribe.js +210 -0
- package/shared-utils/animationFrame/BetterTween.d.ts +11 -0
- package/shared-utils/animationFrame/BetterTween.js +102 -0
- package/shared-utils/animationFrame/calculateProgress.d.ts +8 -0
- package/shared-utils/animationFrame/calculateProgress.js +38 -0
- package/shared-utils/animationFrame/formatRad.d.ts +15 -0
- package/shared-utils/animationFrame/formatRad.js +34 -0
- package/shared-utils/animationFrame/index.d.ts +15 -0
- package/shared-utils/animationFrame/index.js +69 -0
- package/shared-utils/animationFrame/tween.d.ts +75 -0
- package/shared-utils/animationFrame/tween.js +76 -0
- package/shared-utils/changeModelCanvansOpacity.d.ts +2 -0
- package/shared-utils/changeModelCanvansOpacity.js +24 -0
- package/shared-utils/createFiveContainer.d.ts +10 -0
- package/shared-utils/createFiveContainer.js +165 -0
- package/shared-utils/createLine/index.d.ts +3 -0
- package/shared-utils/createLine/index.js +29 -0
- package/shared-utils/debounce.d.ts +6 -0
- package/shared-utils/debounce.js +26 -0
- package/shared-utils/equal.d.ts +11 -0
- package/shared-utils/equal.js +96 -0
- package/shared-utils/filter.d.ts +27 -0
- package/shared-utils/filter.js +93 -0
- package/shared-utils/five/changeMode.d.ts +2 -0
- package/shared-utils/five/changeMode.js +86 -0
- package/shared-utils/five/useFivePlugin.d.ts +1 -0
- package/shared-utils/five/useFivePlugin.js +15 -0
- package/shared-utils/formatRad.d.ts +7 -0
- package/shared-utils/formatRad.js +16 -0
- package/shared-utils/getPxmm.d.ts +6 -0
- package/shared-utils/getPxmm.js +37 -0
- package/shared-utils/getRandomColor.d.ts +1 -0
- package/shared-utils/getRandomColor.js +13 -0
- package/shared-utils/isTruelyObject.d.ts +18 -0
- package/shared-utils/isTruelyObject.js +27 -0
- package/shared-utils/math/evenNumber.d.ts +1 -0
- package/shared-utils/math/evenNumber.js +11 -0
- package/shared-utils/math/planimetry.d.ts +116 -0
- package/shared-utils/math/planimetry.js +342 -0
- package/shared-utils/math/rad2Deg.d.ts +1 -0
- package/shared-utils/math/rad2Deg.js +10 -0
- package/shared-utils/nearlyEqual.d.ts +7 -0
- package/shared-utils/nearlyEqual.js +17 -0
- package/shared-utils/nextFrame.d.ts +1 -0
- package/shared-utils/nextFrame.js +13 -0
- package/shared-utils/noop.d.ts +5 -0
- package/shared-utils/noop.js +17 -0
- package/shared-utils/object3d2LocalMatrix.d.ts +12 -0
- package/shared-utils/object3d2LocalMatrix.js +73 -0
- package/shared-utils/px2rem.d.ts +1 -0
- package/shared-utils/px2rem.js +12 -0
- package/shared-utils/tap.d.ts +8 -0
- package/shared-utils/tap.js +19 -0
- package/shared-utils/three/centerPoint.d.ts +2 -0
- package/shared-utils/three/centerPoint.js +12 -0
- package/shared-utils/three/getNormal.d.ts +2 -0
- package/shared-utils/three/getNormal.js +13 -0
- package/shared-utils/three/loadFbxObj.d.ts +3 -0
- package/shared-utils/three/loadFbxObj.js +42 -0
- package/shared-utils/three/loadTexture.d.ts +2 -0
- package/shared-utils/three/loadTexture.js +38 -0
- package/shared-utils/three/vecror3.d.ts +7 -0
- package/shared-utils/three/vecror3.js +18 -0
- package/shared-utils/throttle.d.ts +7 -0
- package/shared-utils/throttle.js +25 -0
- package/shared-utils/to.d.ts +9 -0
- package/shared-utils/to.js +25 -0
- package/shared-utils/useDebounce.d.ts +8 -0
- package/shared-utils/useDebounce.js +43 -0
- package/shared-utils/useThrottle.d.ts +8 -0
- package/shared-utils/useThrottle.js +41 -0
- package/shared-utils/uuid.d.ts +4 -0
- package/shared-utils/uuid.js +20 -0
- package/shared-utils/vectorTocoordinates.d.ts +7 -0
- package/shared-utils/vectorTocoordinates.js +16 -0
- package/typedoc/components.d.ts +6 -0
- package/typedoc/components.js +5 -0
- package/typedoc/plugins.d.ts +17 -0
- package/typedoc/plugins.js +113 -0
- package/typedoc/shared-utils.d.ts +3 -0
- package/typedoc/shared-utils.js +5 -0
- package/typedoc/typings.d.ts +3 -0
- package/typedoc/typings.js +5 -0
- package/typings/math.type.d.ts +44 -0
- package/typings/math.type.js +5 -0
- package/typings/utils.type.d.ts +2 -0
- package/typings/utils.type.js +5 -0
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 平面几何相关数学函数
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* 平面点坐标。
|
|
6
|
+
*/
|
|
7
|
+
export interface Point {
|
|
8
|
+
x: number;
|
|
9
|
+
y: number;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* 检查两个点是否位置相同
|
|
13
|
+
* @param point1
|
|
14
|
+
* @param point2
|
|
15
|
+
* @return
|
|
16
|
+
*/
|
|
17
|
+
export declare function samePointAt(point1: Point, point2: Point): boolean;
|
|
18
|
+
/**
|
|
19
|
+
* 计算两个点之间的位置
|
|
20
|
+
* @param {point} point1
|
|
21
|
+
* @param {point} point2
|
|
22
|
+
* @return {number}
|
|
23
|
+
*/
|
|
24
|
+
export declare function distance(point1: Point, point2: Point): number;
|
|
25
|
+
/**
|
|
26
|
+
* 两个计算的斜率是否相同
|
|
27
|
+
* @param {number} k1
|
|
28
|
+
* @param {number} k2
|
|
29
|
+
* @return
|
|
30
|
+
*/
|
|
31
|
+
export declare function sameK(k1: number, k2: number): boolean;
|
|
32
|
+
/**
|
|
33
|
+
* 获取两点之间的斜率
|
|
34
|
+
* @param {point} point1
|
|
35
|
+
* @param {point} point2
|
|
36
|
+
* @return {number}
|
|
37
|
+
*/
|
|
38
|
+
export declare function getK(point1: Point, point2: Point): number;
|
|
39
|
+
/**
|
|
40
|
+
* 获取一点对于线段上最近的一点,
|
|
41
|
+
* 如果可以是过直线垂线的垂足,不行的话取线段的两端
|
|
42
|
+
* @param {point} point1
|
|
43
|
+
* @param {linePoints} linePoints
|
|
44
|
+
* @return {point}
|
|
45
|
+
*/
|
|
46
|
+
export declare function closestPointOnLine(point: Point, linePoints: Point[]): {
|
|
47
|
+
x: number;
|
|
48
|
+
y: number;
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* 点到线段的距离,
|
|
52
|
+
* 如果可以是过直线垂线的垂足的距离,不行的话取线段的两端的距离
|
|
53
|
+
* @param {point} point1
|
|
54
|
+
* @param {linePoints} linePoints
|
|
55
|
+
* @return {number}
|
|
56
|
+
*/
|
|
57
|
+
export declare function pointDistanceFromLine(point: Point, linePoints: Point[]): number;
|
|
58
|
+
/**
|
|
59
|
+
* 做线段的距离一定值的平行线段
|
|
60
|
+
* @param {number} distanceOfLine
|
|
61
|
+
* @param {linePoints} linePoints
|
|
62
|
+
* @return {[linePoints, linePoints]}
|
|
63
|
+
*/
|
|
64
|
+
export declare function linesWithDistanceOfLine(distanceOfLine: number, linePoints: Point[]): {
|
|
65
|
+
x: number;
|
|
66
|
+
y: number;
|
|
67
|
+
}[][];
|
|
68
|
+
/**
|
|
69
|
+
* 做线段的距离一定值的平行线段 (如果线段是弧形的)
|
|
70
|
+
* @param {number} distanceOfLine
|
|
71
|
+
* @param {linePoints} linePoints
|
|
72
|
+
* @param {number} 弧形定点到线段的距离
|
|
73
|
+
* @return {[linePoints, linePoints]}
|
|
74
|
+
*/
|
|
75
|
+
export declare function linesWithDistanceOfLineWithCurve(distanceOfLine: number, linePoints: Point[], curve: number): {
|
|
76
|
+
x: number;
|
|
77
|
+
y: number;
|
|
78
|
+
}[][];
|
|
79
|
+
/**
|
|
80
|
+
* 两条线段(包括延长线)的交点点
|
|
81
|
+
* @param {linePoints} linePoints1
|
|
82
|
+
* @param {linePoints} linePoints2
|
|
83
|
+
* @param needIntersectionInLine 是否是延长线的相交
|
|
84
|
+
* @return {point || false}
|
|
85
|
+
*/
|
|
86
|
+
export declare function intersectionOfLine(linePoints1: Point[], linePoints2: Point[], needIntersectionInLine: boolean): false | Point;
|
|
87
|
+
/**
|
|
88
|
+
* 是否点在线段上
|
|
89
|
+
* @param {point} point
|
|
90
|
+
* @param {linePoints} linePoints
|
|
91
|
+
* @return
|
|
92
|
+
*/
|
|
93
|
+
export declare function pointOnLine(point: Point, linePoints: Point[]): boolean;
|
|
94
|
+
/**
|
|
95
|
+
* 让点按照另一个点为圆心,一定弧度的情况下转动得到下一个点
|
|
96
|
+
* @param {point} point
|
|
97
|
+
* @param {point} centerPoint
|
|
98
|
+
* @param {number} rad
|
|
99
|
+
* @return {point}
|
|
100
|
+
*/
|
|
101
|
+
export declare function pointRotateByCenterPoint(point: Point, centerPoint: Point, rad: number): {
|
|
102
|
+
x: number;
|
|
103
|
+
y: number;
|
|
104
|
+
};
|
|
105
|
+
/**
|
|
106
|
+
* 获取一些点的中心点
|
|
107
|
+
* @param {points} point
|
|
108
|
+
* @return {point}
|
|
109
|
+
*/
|
|
110
|
+
export declare function getCenterPointOfPoints(points: Point[]): {
|
|
111
|
+
x: number;
|
|
112
|
+
y: number;
|
|
113
|
+
};
|
|
114
|
+
export declare function isIntersect(linePoints1: Point[], linePoints2: Point[]): 1 | 0;
|
|
115
|
+
export declare function getAreaSize(points: Point[]): number;
|
|
116
|
+
export declare function getAreaSizeWithoutLine(points: Point[]): number;
|
|
@@ -0,0 +1,342 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.closestPointOnLine = closestPointOnLine;
|
|
7
|
+
exports.distance = distance;
|
|
8
|
+
exports.getAreaSize = getAreaSize;
|
|
9
|
+
exports.getAreaSizeWithoutLine = getAreaSizeWithoutLine;
|
|
10
|
+
exports.getCenterPointOfPoints = getCenterPointOfPoints;
|
|
11
|
+
exports.getK = getK;
|
|
12
|
+
exports.intersectionOfLine = intersectionOfLine;
|
|
13
|
+
exports.isIntersect = isIntersect;
|
|
14
|
+
exports.linesWithDistanceOfLine = linesWithDistanceOfLine;
|
|
15
|
+
exports.linesWithDistanceOfLineWithCurve = linesWithDistanceOfLineWithCurve;
|
|
16
|
+
exports.pointDistanceFromLine = pointDistanceFromLine;
|
|
17
|
+
exports.pointOnLine = pointOnLine;
|
|
18
|
+
exports.pointRotateByCenterPoint = pointRotateByCenterPoint;
|
|
19
|
+
exports.sameK = sameK;
|
|
20
|
+
exports.samePointAt = samePointAt;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* 平面几何相关数学函数
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* 平面点坐标。
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* 检查两个点是否位置相同
|
|
32
|
+
* @param point1
|
|
33
|
+
* @param point2
|
|
34
|
+
* @return
|
|
35
|
+
*/
|
|
36
|
+
function samePointAt(point1, point2) {
|
|
37
|
+
return point1.x === point2.x && point1.y === point2.y;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* 计算两个点之间的位置
|
|
41
|
+
* @param {point} point1
|
|
42
|
+
* @param {point} point2
|
|
43
|
+
* @return {number}
|
|
44
|
+
*/
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
function distance(point1, point2) {
|
|
48
|
+
return Math.sqrt(Math.pow(point2.x - point1.x, 2) + Math.pow(point2.y - point1.y, 2));
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* 两个计算的斜率是否相同
|
|
52
|
+
* @param {number} k1
|
|
53
|
+
* @param {number} k2
|
|
54
|
+
* @return
|
|
55
|
+
*/
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
function sameK(k1, k2) {
|
|
59
|
+
if (Math.abs(k1) === Infinity && Math.abs(k2) === Infinity) return true;
|
|
60
|
+
return Math.abs(k1 - k2) < 0.001;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* 获取两点之间的斜率
|
|
64
|
+
* @param {point} point1
|
|
65
|
+
* @param {point} point2
|
|
66
|
+
* @return {number}
|
|
67
|
+
*/
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
function getK(point1, point2) {
|
|
71
|
+
return (point2.y - point1.y) / (point2.x - point1.x);
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* 获取一点对于线段上最近的一点,
|
|
75
|
+
* 如果可以是过直线垂线的垂足,不行的话取线段的两端
|
|
76
|
+
* @param {point} point1
|
|
77
|
+
* @param {linePoints} linePoints
|
|
78
|
+
* @return {point}
|
|
79
|
+
*/
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
function closestPointOnLine(point, linePoints) {
|
|
83
|
+
var tA = point.x - linePoints[0].x;
|
|
84
|
+
var tB = point.y - linePoints[0].y;
|
|
85
|
+
var tC = linePoints[1].x - linePoints[0].x;
|
|
86
|
+
var tD = linePoints[1].y - linePoints[0].y;
|
|
87
|
+
var tDot = tA * tC + tB * tD;
|
|
88
|
+
var tLenSq = tC * tC + tD * tD;
|
|
89
|
+
var tParam = tDot / tLenSq;
|
|
90
|
+
var tXx, tYy;
|
|
91
|
+
|
|
92
|
+
if (tParam < 0 || samePointAt(linePoints[0], linePoints[1])) {
|
|
93
|
+
tXx = linePoints[0].x;
|
|
94
|
+
tYy = linePoints[0].y;
|
|
95
|
+
} else if (tParam > 1) {
|
|
96
|
+
tXx = linePoints[1].x;
|
|
97
|
+
tYy = linePoints[1].y;
|
|
98
|
+
} else {
|
|
99
|
+
tXx = linePoints[0].x + tParam * tC;
|
|
100
|
+
tYy = linePoints[0].y + tParam * tD;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
return {
|
|
104
|
+
x: tXx,
|
|
105
|
+
y: tYy
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* 点到线段的距离,
|
|
110
|
+
* 如果可以是过直线垂线的垂足的距离,不行的话取线段的两端的距离
|
|
111
|
+
* @param {point} point1
|
|
112
|
+
* @param {linePoints} linePoints
|
|
113
|
+
* @return {number}
|
|
114
|
+
*/
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
function pointDistanceFromLine(point, linePoints) {
|
|
118
|
+
var closestPoint = closestPointOnLine(point, linePoints);
|
|
119
|
+
return distance(point, closestPoint);
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* 做线段的距离一定值的平行线段
|
|
123
|
+
* @param {number} distanceOfLine
|
|
124
|
+
* @param {linePoints} linePoints
|
|
125
|
+
* @return {[linePoints, linePoints]}
|
|
126
|
+
*/
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
function linesWithDistanceOfLine(distanceOfLine, linePoints) {
|
|
130
|
+
var k = getK(linePoints[1], linePoints[0]);
|
|
131
|
+
var dx, dy;
|
|
132
|
+
|
|
133
|
+
if (Math.abs(k) === Infinity) {
|
|
134
|
+
dy = 0;
|
|
135
|
+
dx = distanceOfLine;
|
|
136
|
+
} else {
|
|
137
|
+
dy = Math.sqrt(distanceOfLine * distanceOfLine / (k * k + 1));
|
|
138
|
+
dx = dy / -(1 / k);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
var result = [[{
|
|
142
|
+
x: linePoints[0].x - dx,
|
|
143
|
+
y: linePoints[0].y - dy
|
|
144
|
+
}, {
|
|
145
|
+
x: linePoints[1].x - dx,
|
|
146
|
+
y: linePoints[1].y - dy
|
|
147
|
+
}], [{
|
|
148
|
+
x: linePoints[0].x + dx,
|
|
149
|
+
y: linePoints[0].y + dy
|
|
150
|
+
}, {
|
|
151
|
+
x: linePoints[1].x + dx,
|
|
152
|
+
y: linePoints[1].y + dy
|
|
153
|
+
}]];
|
|
154
|
+
|
|
155
|
+
if (linePoints[1].x - linePoints[0].x < 0) {
|
|
156
|
+
return result;
|
|
157
|
+
} else if (linePoints[1].x - linePoints[0].x > 0) {
|
|
158
|
+
return result.reverse();
|
|
159
|
+
} else {
|
|
160
|
+
if (linePoints[1].y - linePoints[0].y < 0) {
|
|
161
|
+
return result.reverse();
|
|
162
|
+
} else {
|
|
163
|
+
return result;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* 做线段的距离一定值的平行线段 (如果线段是弧形的)
|
|
169
|
+
* @param {number} distanceOfLine
|
|
170
|
+
* @param {linePoints} linePoints
|
|
171
|
+
* @param {number} 弧形定点到线段的距离
|
|
172
|
+
* @return {[linePoints, linePoints]}
|
|
173
|
+
*/
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
function linesWithDistanceOfLineWithCurve(distanceOfLine, linePoints, curve) {
|
|
177
|
+
var centerPoint = getCenterPointOfPoints(linePoints);
|
|
178
|
+
var pHelfDistance = distance(linePoints[0], centerPoint);
|
|
179
|
+
var cDistance = Math.sqrt(curve * curve - pHelfDistance * pHelfDistance);
|
|
180
|
+
var cpoint = isNaN(cDistance) ? centerPoint : linesWithDistanceOfLine(cDistance, [centerPoint, linePoints[0]])[curve > 0 ? 0 : 1][0];
|
|
181
|
+
var dx1 = (linePoints[0].x - cpoint.x) / curve * distanceOfLine;
|
|
182
|
+
var dy1 = (linePoints[0].y - cpoint.y) / curve * distanceOfLine;
|
|
183
|
+
var dx2 = (linePoints[1].x - cpoint.x) / curve * distanceOfLine;
|
|
184
|
+
var dy2 = (linePoints[1].y - cpoint.y) / curve * distanceOfLine;
|
|
185
|
+
return [[{
|
|
186
|
+
x: linePoints[0].x - dx1,
|
|
187
|
+
y: linePoints[0].y - dy1
|
|
188
|
+
}, {
|
|
189
|
+
x: linePoints[1].x - dx2,
|
|
190
|
+
y: linePoints[1].y - dy2
|
|
191
|
+
}], [{
|
|
192
|
+
x: linePoints[0].x + dx1,
|
|
193
|
+
y: linePoints[0].y + dy1
|
|
194
|
+
}, {
|
|
195
|
+
x: linePoints[1].x + dx2,
|
|
196
|
+
y: linePoints[1].y + dy2
|
|
197
|
+
}]];
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* 两条线段(包括延长线)的交点点
|
|
201
|
+
* @param {linePoints} linePoints1
|
|
202
|
+
* @param {linePoints} linePoints2
|
|
203
|
+
* @param needIntersectionInLine 是否是延长线的相交
|
|
204
|
+
* @return {point || false}
|
|
205
|
+
*/
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
function intersectionOfLine(linePoints1, linePoints2, needIntersectionInLine) {
|
|
209
|
+
var k1 = getK(linePoints1[1], linePoints1[0]);
|
|
210
|
+
var k2 = getK(linePoints2[1], linePoints2[0]);
|
|
211
|
+
if (isNaN(k1) || isNaN(k2)) return false;
|
|
212
|
+
if (sameK(k1, k2)) return false;
|
|
213
|
+
if (pointOnLine(linePoints1[0], linePoints2)) return linePoints1[0];
|
|
214
|
+
if (pointOnLine(linePoints1[1], linePoints2)) return linePoints1[1];
|
|
215
|
+
if (pointOnLine(linePoints2[0], linePoints1)) return linePoints2[0];
|
|
216
|
+
if (pointOnLine(linePoints2[1], linePoints1)) return linePoints2[1]; //needIntersectionInLine 是否焦点在线段内
|
|
217
|
+
|
|
218
|
+
if (needIntersectionInLine && !isIntersect(linePoints1, linePoints2)) return false;
|
|
219
|
+
var p1 = linePoints1[0];
|
|
220
|
+
var p2 = linePoints2[0];
|
|
221
|
+
|
|
222
|
+
if (Math.abs(k1) === Infinity) {
|
|
223
|
+
return {
|
|
224
|
+
x: p1.x,
|
|
225
|
+
y: linePoints2[1].y - (linePoints2[1].x - p1.x) * k2
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
if (Math.abs(k2) === Infinity) {
|
|
230
|
+
return {
|
|
231
|
+
x: p2.x,
|
|
232
|
+
y: linePoints1[1].y - (linePoints1[1].x - p2.x) * k1
|
|
233
|
+
};
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
var x = (p2.y - p1.y + k1 * p1.x - k2 * p2.x) / (k1 - k2);
|
|
237
|
+
var y = k1 * x - k1 * p1.x + p1.y;
|
|
238
|
+
return {
|
|
239
|
+
x: x,
|
|
240
|
+
y: y
|
|
241
|
+
};
|
|
242
|
+
}
|
|
243
|
+
/**
|
|
244
|
+
* 是否点在线段上
|
|
245
|
+
* @param {point} point
|
|
246
|
+
* @param {linePoints} linePoints
|
|
247
|
+
* @return
|
|
248
|
+
*/
|
|
249
|
+
|
|
250
|
+
|
|
251
|
+
function pointOnLine(point, linePoints) {
|
|
252
|
+
if (samePointAt(point, linePoints[0])) return true;
|
|
253
|
+
if (samePointAt(point, linePoints[1])) return true;
|
|
254
|
+
return true && (linePoints[0].x - point.x) * (point.x - linePoints[1].x) >= 0 && (linePoints[0].y - point.y) * (point.y - linePoints[1].y) >= 0 && sameK(getK(linePoints[0], point), getK(point, linePoints[1]));
|
|
255
|
+
}
|
|
256
|
+
/**
|
|
257
|
+
* 让点按照另一个点为圆心,一定弧度的情况下转动得到下一个点
|
|
258
|
+
* @param {point} point
|
|
259
|
+
* @param {point} centerPoint
|
|
260
|
+
* @param {number} rad
|
|
261
|
+
* @return {point}
|
|
262
|
+
*/
|
|
263
|
+
|
|
264
|
+
|
|
265
|
+
function pointRotateByCenterPoint(point, centerPoint, rad) {
|
|
266
|
+
var r = distance(point, centerPoint);
|
|
267
|
+
var nextRad = Math.atan2(point.y - centerPoint.y, point.x - centerPoint.x);
|
|
268
|
+
nextRad -= rad;
|
|
269
|
+
return {
|
|
270
|
+
x: centerPoint.x + Math.cos(nextRad) * r,
|
|
271
|
+
y: centerPoint.y + Math.sin(nextRad) * r
|
|
272
|
+
};
|
|
273
|
+
}
|
|
274
|
+
/**
|
|
275
|
+
* 获取一些点的中心点
|
|
276
|
+
* @param {points} point
|
|
277
|
+
* @return {point}
|
|
278
|
+
*/
|
|
279
|
+
|
|
280
|
+
|
|
281
|
+
function getCenterPointOfPoints(points) {
|
|
282
|
+
var minX = Infinity,
|
|
283
|
+
maxX = 0,
|
|
284
|
+
minY = Infinity,
|
|
285
|
+
maxY = 0;
|
|
286
|
+
points.forEach(function (point) {
|
|
287
|
+
minX = Math.min(minX, point.x);
|
|
288
|
+
maxX = Math.max(maxX, point.x);
|
|
289
|
+
minY = Math.min(minY, point.y);
|
|
290
|
+
maxY = Math.max(maxY, point.y);
|
|
291
|
+
});
|
|
292
|
+
return {
|
|
293
|
+
x: (minX + maxX) / 2,
|
|
294
|
+
y: (minY + maxY) / 2
|
|
295
|
+
};
|
|
296
|
+
}
|
|
297
|
+
/**
|
|
298
|
+
* 判断两条线段是否相交
|
|
299
|
+
*/
|
|
300
|
+
|
|
301
|
+
|
|
302
|
+
function multi(p1, p2, p0) {
|
|
303
|
+
return (p1.x - p0.x) * (p2.y - p0.y) - (p2.x - p0.x) * (p1.y - p0.y);
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
function isIntersect(linePoints1, linePoints2) {
|
|
307
|
+
if (Math.max(linePoints1[0].x, linePoints1[1].x) >= Math.min(linePoints2[0].x, linePoints2[1].x) && Math.max(linePoints2[0].x, linePoints2[1].x) >= Math.min(linePoints1[0].x, linePoints1[1].x) && Math.max(linePoints1[0].y, linePoints1[1].y) >= Math.min(linePoints2[0].y, linePoints2[1].y) && multi(linePoints2[0], linePoints1[1], linePoints1[0]) * multi(linePoints1[1], linePoints2[1], linePoints1[0]) > 0 && multi(linePoints1[0], linePoints2[1], linePoints2[0]) * multi(linePoints2[1], linePoints1[1], linePoints2[0]) > 0) return 1;
|
|
308
|
+
return 0;
|
|
309
|
+
}
|
|
310
|
+
/**
|
|
311
|
+
* 计算点按序围成区域的面就
|
|
312
|
+
* @param {[point]} points
|
|
313
|
+
* @return {number}
|
|
314
|
+
*/
|
|
315
|
+
|
|
316
|
+
|
|
317
|
+
function cross(p1, p2) {
|
|
318
|
+
// 向量叉积
|
|
319
|
+
return p1.x * p2.y - p1.y * p2.x;
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
function getAreaSize(points) {
|
|
323
|
+
var ret = 0;
|
|
324
|
+
return (cross(points.reduce(function (pf, pn) {
|
|
325
|
+
ret += cross(pf, pn);
|
|
326
|
+
return pn;
|
|
327
|
+
}), points[0]) + ret) / 2;
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
function getAreaSizeWithoutLine(points) {
|
|
331
|
+
var ret = 0;
|
|
332
|
+
var r = (cross(points.reduce(function (pf, pn) {
|
|
333
|
+
ret += cross(pf, pn);
|
|
334
|
+
return pn;
|
|
335
|
+
}), points[0]) + ret) / 2;
|
|
336
|
+
var wall = 0;
|
|
337
|
+
var wr = (distance(points.reduce(function (pf, pn) {
|
|
338
|
+
wall += distance(pf, pn) * 250;
|
|
339
|
+
return pn;
|
|
340
|
+
}), points[0]) * 250 + wall) / 2;
|
|
341
|
+
return r - (wr - 250 * 1000) * (r > 0 ? 1 : -1);
|
|
342
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function rad2Deg(rad: number): number;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = nearlyEqual;
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* 比较两个数字近似相等
|
|
10
|
+
* @param num1 数字1
|
|
11
|
+
* @param num2 数字2
|
|
12
|
+
* @param accuracy 精度:精确到小数点后几位,默认精确到 小数点后四位
|
|
13
|
+
*/
|
|
14
|
+
function nearlyEqual(num1, num2) {
|
|
15
|
+
var accuracy = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 4;
|
|
16
|
+
return Math.floor(num1 * Math.pow(10, accuracy)) === Math.floor(num2 * Math.pow(10, accuracy));
|
|
17
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function nextFrame(fn: () => void, delay?: number): void;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.nextFrame = nextFrame;
|
|
7
|
+
|
|
8
|
+
function nextFrame(fn) {
|
|
9
|
+
var delay = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
10
|
+
if (delay <= 0) requestAnimationFrame(fn);else requestAnimationFrame(function () {
|
|
11
|
+
return nextFrame(fn, delay - 1);
|
|
12
|
+
});
|
|
13
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
export declare const genRotationMatrix: (x: number, y: number, z: number) => THREE.Matrix4;
|
|
3
|
+
declare const bject3d2LocalMatrix: (mesh: THREE.Object3D, { scale, rotation, position, }: {
|
|
4
|
+
scale: number;
|
|
5
|
+
rotation: number[];
|
|
6
|
+
position: {
|
|
7
|
+
x: number;
|
|
8
|
+
y: number;
|
|
9
|
+
z: number;
|
|
10
|
+
};
|
|
11
|
+
}) => THREE.Object3D;
|
|
12
|
+
export default bject3d2LocalMatrix;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.genRotationMatrix = exports["default"] = void 0;
|
|
9
|
+
|
|
10
|
+
var THREE = _interopRequireWildcard(require("three"));
|
|
11
|
+
|
|
12
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
13
|
+
|
|
14
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
15
|
+
|
|
16
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
17
|
+
|
|
18
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
19
|
+
|
|
20
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
21
|
+
|
|
22
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
23
|
+
|
|
24
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
25
|
+
|
|
26
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
27
|
+
|
|
28
|
+
var genRotationMatrix = function genRotationMatrix(x, y, z) {
|
|
29
|
+
var matrix = new THREE.Matrix4();
|
|
30
|
+
var euler = new THREE.Euler(x, y, z, 'YXZ');
|
|
31
|
+
matrix.makeRotationFromEuler(euler);
|
|
32
|
+
return matrix;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
exports.genRotationMatrix = genRotationMatrix;
|
|
36
|
+
|
|
37
|
+
var bject3d2LocalMatrix = function bject3d2LocalMatrix(mesh, _ref) {
|
|
38
|
+
var scale = _ref.scale,
|
|
39
|
+
rotation = _ref.rotation,
|
|
40
|
+
position = _ref.position;
|
|
41
|
+
|
|
42
|
+
if (scale) {
|
|
43
|
+
mesh.scale.set(scale, scale, scale);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
if (rotation) {
|
|
47
|
+
var _rotation = _slicedToArray(rotation, 3),
|
|
48
|
+
x = _rotation[0],
|
|
49
|
+
y = _rotation[1],
|
|
50
|
+
z = _rotation[2];
|
|
51
|
+
|
|
52
|
+
if (x) {
|
|
53
|
+
mesh.applyMatrix4(genRotationMatrix(x, 0, 0));
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
if (y) {
|
|
57
|
+
mesh.applyMatrix4(genRotationMatrix(0, y, 0));
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
if (z) {
|
|
61
|
+
mesh.applyMatrix4(genRotationMatrix(0, 0, z));
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
if (position) {
|
|
66
|
+
mesh.position.set(position.x, position.y, position.z);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
return mesh;
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
var _default = bject3d2LocalMatrix;
|
|
73
|
+
exports["default"] = _default;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function px2rem(_px: number | string, precision?: number): string;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = px2rem;
|
|
7
|
+
|
|
8
|
+
function px2rem(_px) {
|
|
9
|
+
var precision = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 16;
|
|
10
|
+
var px = Number(typeof _px === 'string' ? _px.replace(/px/g, '') : _px);
|
|
11
|
+
return (px / precision).toFixed(5) + 'rem';
|
|
12
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = tap;
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* 把第一个参数传入第二个参数(函数)中并执行
|
|
10
|
+
* 一般用于执行函数后返回变量。
|
|
11
|
+
* @param {any} something
|
|
12
|
+
* @param {function} callback
|
|
13
|
+
* @return {any}
|
|
14
|
+
*/
|
|
15
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
16
|
+
function tap(something, callback) {
|
|
17
|
+
callback(something);
|
|
18
|
+
return something;
|
|
19
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = centerPoint;
|
|
7
|
+
|
|
8
|
+
var _three = require("three");
|
|
9
|
+
|
|
10
|
+
function centerPoint(point1, point2) {
|
|
11
|
+
return new _three.Vector3((point1.x + point2.x) / 2, (point1.y + point2.y) / 2, (point1.z + point2.z) / 2);
|
|
12
|
+
}
|