flkit 0.1.0__py3-none-any.whl
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.
- flkit/__init__.py +2 -0
- flkit/alg/__init__.py +68 -0
- flkit/alg/build_idx.py +9 -0
- flkit/alg/c_track.py +88 -0
- flkit/alg/collierydb.py +1217 -0
- flkit/alg/del2.py +421 -0
- flkit/alg/delaunay_triangulation.py +476 -0
- flkit/alg/finite_plane_distance.py +239 -0
- flkit/alg/get_up_low.py +32 -0
- flkit/alg/in_tin.py +139 -0
- flkit/alg/index.py +9 -0
- flkit/alg/inter/BasePredictor.py +69 -0
- flkit/alg/inter/Kriging.py +226 -0
- flkit/alg/inter/KrigingM.py +262 -0
- flkit/alg/inter/LossFuncs.py +164 -0
- flkit/alg/inter/__init__.py +178 -0
- flkit/alg/inter/idw.py +253 -0
- flkit/alg/inter/midw.py +145 -0
- flkit/alg/inter/nearest_neighbor.py +445 -0
- flkit/alg/inter/rbf.py +345 -0
- flkit/alg/inter/trilinear.py +572 -0
- flkit/alg/point_in_polygon.py +126 -0
- flkit/alg/point_in_volume.py +188 -0
- flkit/alg/point_in_volume_rs.pyi +7 -0
- flkit/alg/point_to_triangle.py +116 -0
- flkit/alg/point_to_triangle_mesh.py +309 -0
- flkit/alg/point_to_triangle_rs.pyi +9 -0
- flkit/alg/rotated_rect.py +184 -0
- flkit/db/__init__.py +17 -0
- flkit/db/db_model.py +724 -0
- flkit/db/duck_model.py +151 -0
- flkit/db/fileobj.py +72 -0
- flkit/db/path_utl.py +174 -0
- flkit/mtcli/__init__.py +18 -0
- flkit/mtcli/core.py +489 -0
- flkit/mtcli/parse.py +218 -0
- flkit/py.typed +0 -0
- flkit/tools/__init__.py +28 -0
- flkit/tools/del_key.py +13 -0
- flkit/tools/dict_to_list.py +10 -0
- flkit/tools/get_region.py +42 -0
- flkit/tools/max_key.py +7 -0
- flkit/tools/mongo.py +119 -0
- flkit/tools/mt_dash.py +121 -0
- flkit/tools/prase_type.py +27 -0
- flkit/typr/Res.py +21 -0
- flkit/typr/__init__.py +107 -0
- flkit/typr/c_grid.py +425 -0
- flkit/typr/console.py +283 -0
- flkit/typr/engine.py +59 -0
- flkit/typr/getenv.py +89 -0
- flkit/typr/result.py +81 -0
- flkit/typr/table.py +34 -0
- flkit/typr/utils.py +542 -0
- flkit/typr/verify.py +64 -0
- flkit/typr/webview.py +219 -0
- flkit/typr/wstask.py +344 -0
- flkit-0.1.0.dist-info/METADATA +186 -0
- flkit-0.1.0.dist-info/RECORD +60 -0
- flkit-0.1.0.dist-info/WHEEL +4 -0
flkit/__init__.py
ADDED
flkit/alg/__init__.py
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"""
|
|
2
|
+
算法库
|
|
3
|
+
|
|
4
|
+
- c_next_point: 计算钻孔轨迹的下一个拐点坐标
|
|
5
|
+
- get_up_low: 获取钻孔轨迹的上、下点坐标
|
|
6
|
+
- finite_plane_distance: 计算点到有限平面的距离
|
|
7
|
+
- inter: 插值算法
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
from .c_track import c_next_point, comp_towards, comp_towards_batch
|
|
11
|
+
from .get_up_low import get_up_low, linear_interpolation
|
|
12
|
+
from .finite_plane_distance import comp_sliding_diff, finite_plane_distance
|
|
13
|
+
from . import inter
|
|
14
|
+
from .in_tin import (
|
|
15
|
+
is_point_in_triangle,
|
|
16
|
+
is_point_in_triangles,
|
|
17
|
+
point_to_triangle_distance,
|
|
18
|
+
)
|
|
19
|
+
from .point_in_polygon import PointInPolygon
|
|
20
|
+
from .rotated_rect import RotatedRect
|
|
21
|
+
from .index import list_index
|
|
22
|
+
from .point_to_triangle_mesh import PointToTriangleMesh
|
|
23
|
+
from .delaunay_triangulation import (
|
|
24
|
+
DelaunayTriangulation,
|
|
25
|
+
OptimizedDelaunayTriangulation,
|
|
26
|
+
TriangleLibTriangulation,
|
|
27
|
+
point_in_polygon,
|
|
28
|
+
bound_triangulation,
|
|
29
|
+
interpolate_delaunary_z,
|
|
30
|
+
convex_hull_boundary,
|
|
31
|
+
)
|
|
32
|
+
from .point_to_triangle import PointInTriangle
|
|
33
|
+
from .point_to_triangle_rs import PointInTriangle as PointInTriangleRs
|
|
34
|
+
from .point_in_volume import PointInVolume
|
|
35
|
+
from .point_in_volume_rs import PointInVolume as PointInVolumeRs
|
|
36
|
+
|
|
37
|
+
from .build_idx import build_idx
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
__all__ = [
|
|
41
|
+
"c_next_point",
|
|
42
|
+
"comp_towards",
|
|
43
|
+
"comp_towards_batch",
|
|
44
|
+
"get_up_low",
|
|
45
|
+
"linear_interpolation",
|
|
46
|
+
"comp_sliding_diff",
|
|
47
|
+
"finite_plane_distance",
|
|
48
|
+
"inter",
|
|
49
|
+
"is_point_in_triangle",
|
|
50
|
+
"is_point_in_triangles",
|
|
51
|
+
"point_to_triangle_distance",
|
|
52
|
+
"PointInPolygon",
|
|
53
|
+
"RotatedRect",
|
|
54
|
+
"list_index",
|
|
55
|
+
"PointToTriangleMesh",
|
|
56
|
+
"DelaunayTriangulation",
|
|
57
|
+
"OptimizedDelaunayTriangulation",
|
|
58
|
+
"TriangleLibTriangulation",
|
|
59
|
+
"point_in_polygon",
|
|
60
|
+
"bound_triangulation",
|
|
61
|
+
"interpolate_delaunary_z",
|
|
62
|
+
"convex_hull_boundary",
|
|
63
|
+
"PointInTriangle",
|
|
64
|
+
"PointInTriangleRs",
|
|
65
|
+
"PointInVolume",
|
|
66
|
+
"PointInVolumeRs",
|
|
67
|
+
"build_idx",
|
|
68
|
+
]
|
flkit/alg/build_idx.py
ADDED
flkit/alg/c_track.py
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import math
|
|
2
|
+
from typing import Any, Dict, List
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
def c_next_point(start_point, length, inclination, azimuth):
|
|
6
|
+
"""
|
|
7
|
+
计算钻孔轨迹的下一个拐点坐标
|
|
8
|
+
|
|
9
|
+
参数:
|
|
10
|
+
start_point: 起点坐标 (x, y, z) 元组
|
|
11
|
+
length: 钻孔长度 (必须为正数)
|
|
12
|
+
inclination: 倾角/倾斜角 (度,-90到90度,负值表示向上)
|
|
13
|
+
azimuth: 方位角 (度,0-360度)
|
|
14
|
+
|
|
15
|
+
返回:
|
|
16
|
+
下一个拐点的三维坐标 (x, y, z) 元组
|
|
17
|
+
|
|
18
|
+
坐标系约定:
|
|
19
|
+
- X轴:东西方向(东为正)
|
|
20
|
+
- Y轴:南北方向(北为正)
|
|
21
|
+
- Z轴:垂直方向(向下为正,符合钻孔深度增加的习惯)
|
|
22
|
+
|
|
23
|
+
倾角约定:
|
|
24
|
+
- 0度:水平
|
|
25
|
+
- 90度:垂直向下
|
|
26
|
+
- -90度:垂直向上
|
|
27
|
+
"""
|
|
28
|
+
if length < 0:
|
|
29
|
+
raise ValueError(f"钻孔长度必须为正数{length}")
|
|
30
|
+
|
|
31
|
+
# 倾角范围检查(允许负值)
|
|
32
|
+
if not -90 <= inclination <= 90:
|
|
33
|
+
raise ValueError("倾角必须在-90到90度之间")
|
|
34
|
+
|
|
35
|
+
if not 0 <= azimuth <= 360:
|
|
36
|
+
raise ValueError("方位角必须在0-360度之间")
|
|
37
|
+
|
|
38
|
+
# 转换为弧度
|
|
39
|
+
inclination_rad = math.radians(inclination)
|
|
40
|
+
azimuth_rad = math.radians(azimuth)
|
|
41
|
+
|
|
42
|
+
# 计算坐标增量
|
|
43
|
+
# 水平分量(在XY平面上的投影)
|
|
44
|
+
horizontal_component = length * math.cos(inclination_rad)
|
|
45
|
+
# 垂直分量(Z方向)
|
|
46
|
+
vertical_component = length * math.sin(inclination_rad)
|
|
47
|
+
|
|
48
|
+
# 分解水平分量到X和Y方向
|
|
49
|
+
delta_x = horizontal_component * math.sin(azimuth_rad)
|
|
50
|
+
delta_y = horizontal_component * math.cos(azimuth_rad)
|
|
51
|
+
delta_z = vertical_component
|
|
52
|
+
|
|
53
|
+
# 计算新坐标
|
|
54
|
+
x = start_point[0] + delta_x
|
|
55
|
+
y = start_point[1] + delta_y
|
|
56
|
+
z = start_point[2] + delta_z
|
|
57
|
+
|
|
58
|
+
return (x, y, z)
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
def comp_towards(start: dict, end: dict) -> float:
|
|
62
|
+
"""计算从起点指向终点的方向角度(顺时针,以正北为0度)"""
|
|
63
|
+
if "x" not in start or "y" not in start or "x" not in end or "y" not in end:
|
|
64
|
+
raise ValueError("点必须包含x和y坐标")
|
|
65
|
+
dx = end["x"] - start["x"]
|
|
66
|
+
dy = end["y"] - start["y"]
|
|
67
|
+
angle = math.acos(dy / math.sqrt(dx**2 + dy**2))
|
|
68
|
+
return round(math.degrees(angle), 3)
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
def comp_towards_batch(points: List[Dict[str, Any]]) -> List[Dict[str, Any]]:
|
|
72
|
+
"""批量计算从起点指向终点的方向角度(顺时针,以正北为0度)"""
|
|
73
|
+
if len(points) < 2:
|
|
74
|
+
raise ValueError("点列表长度必须大于等于2")
|
|
75
|
+
|
|
76
|
+
blocks = []
|
|
77
|
+
for i in range(len(points) - 1):
|
|
78
|
+
block = {
|
|
79
|
+
"start": points[i],
|
|
80
|
+
"end": points[i + 1],
|
|
81
|
+
}
|
|
82
|
+
blocks.append(block)
|
|
83
|
+
|
|
84
|
+
for block in blocks:
|
|
85
|
+
angle = comp_towards(block["start"], block["end"])
|
|
86
|
+
block["angle"] = angle
|
|
87
|
+
|
|
88
|
+
return blocks
|