LMCAS
Lamina Computer Algebra System
载入中...
搜索中...
未找到
symbolic_geometry_line_plane.hpp
浏览该文件的文档.
1#pragma once
3
4namespace LMCAS {
5
6/** @brief 由一点和方向向量定义的符号直线。 */
8 std::vector<std::shared_ptr<SymbolicExpr>> point; /**< 直线上一点。 */
9 std::vector<std::shared_ptr<SymbolicExpr>> direction; /**< 方向向量。 */
10};
11
13
14/** @brief 由法向量和常数 d 定义的符号平面 ax + by + cz = d。 */
16 std::vector<std::shared_ptr<SymbolicExpr>> normal; /**< 法向量。 */
17 std::shared_ptr<SymbolicExpr> d; /**< 常数项。 */
18};
19
21
22/**
23 * @brief 由一般方程系数构造平面 ax + by + cz = d。
24 * @param a x 方向法向量分量
25 * @param b y 方向法向量分量
26 * @param c z 方向法向量分量
27 * @param d 常数项
28 * @return 构造的 PlaneSymbolic 对象
29 */
31 std::shared_ptr<SymbolicExpr> a,
32 std::shared_ptr<SymbolicExpr> b,
33 std::shared_ptr<SymbolicExpr> c,
34 std::shared_ptr<SymbolicExpr> d
35) {
36 return PlaneSymbolic{{a, b, c}, d};
37}
38
39/**
40 * @brief 计算直线与平面的交点。
41 *
42 * 有限向量的点积或交点坐标更新存在溢出、下溢风险时,按最大分量
43 * 缩放相关向量和坐标,并同步缩放平面常数及直线参数化。
44 * 点积按维数预留累加余量;非零尺度变换保持交点不变。
45 * @param line 直线
46 * @param plane 平面
47 * @return 交点坐标向量
48 */
49
51 const LineSymbolic& line,
54);
55
57 const LineSymbolic& line,
58 const PlaneSymbolic& plane
59);
60
61/**
62 * @brief 计算点到平面的距离。
63 *
64 * 有限法向量的平方或点积部分和存在溢出、下溢风险时,同尺度缩放
65 * 法向量与常数项,保持平面和距离不变。点积按维数预留累加余量,
66 * 使最终可表示的抵消结果免受部分和溢出影响。
67 * @param point 空间点坐标
68 * @param plane 平面
69 * @return 距离的符号表达式
70 */
71
73 const std::vector<std::shared_ptr<SymbolicExpr>>& point,
74 const PlaneSymbolic& plane,
76);
77
79 const std::vector<std::shared_ptr<SymbolicExpr>>& point,
80 const PlaneSymbolic& plane
81);
82
83/**
84 * @brief 计算两条异面直线之间的距离。
85 *
86 * 有限方向向量分别按自身最大分量归一化后计算叉积。
87 * 有限点坐标差可能溢出时,先按公共最大分量缩放两点,
88 * 求出距离比值后恢复点尺度;方向及临时点尺度保持距离不变。
89 * @param l1 第一条直线
90 * @param l2 第二条直线
91 * @return 距离的符号表达式
92 */
93
95 const LineSymbolic& l1,
98);
99
101 const LineSymbolic& l1,
102 const LineSymbolic& l2
103);
104
105/**
106 * @brief 由两点构造直线。
107 *
108 * 有限点坐标差可能溢出时,先按两点的公共最大分量缩放再求差;
109 * 公共方向尺度保持直线不变。
110 * @param p1 第一个点
111 * @param p2 第二个点
112 * @return 直线(point = p1, direction = p2 - p1)
113 */
114
116 const std::vector<std::shared_ptr<SymbolicExpr>>& p1,
117 const std::vector<std::shared_ptr<SymbolicExpr>>& p2,
119);
120
122 const std::vector<std::shared_ptr<SymbolicExpr>>& p1,
123 const std::vector<std::shared_ptr<SymbolicExpr>>& p2
124);
125
126/**
127 * @brief 由三点构造平面(法向量 = (p2-p1)×(p3-p1))。
128 *
129 * 有限点坐标差可能溢出时,按三点的公共尺度构造边;
130 * 叉积或其范数平方仍有溢出、下溢风险时,分别缩放两条边。
131 * 这些尺度变换保持平面不变。
132 * @param p1 第一个点
133 * @param p2 第二个点
134 * @param p3 第三个点
135 * @return 平面(法向量 + 常数 d = n·p1)
136 */
138 const std::vector<std::shared_ptr<SymbolicExpr>>& p1,
139 const std::vector<std::shared_ptr<SymbolicExpr>>& p2,
140 const std::vector<std::shared_ptr<SymbolicExpr>>& p3,
142);
143
145 const std::vector<std::shared_ptr<SymbolicExpr>>& p1,
146 const std::vector<std::shared_ptr<SymbolicExpr>>& p2,
147 const std::vector<std::shared_ptr<SymbolicExpr>>& p3
148);
149
150/**
151 * @brief 计算两平面之间的二面角 arccos(|n₁·n₂| / (|n₁||n₂|))。
152 *
153 * 有限法向量的非零验证和角度计算均避开直接分量平方和,
154 * 支持方向可表示但平方会溢出的法向量。
155 * @param p1 第一个平面
156 * @param p2 第二个平面
157 * @return 二面角表达式(弧度)
158 */
159
161 const PlaneSymbolic& p1,
164);
165
167 const PlaneSymbolic& p1,
168 const PlaneSymbolic& p2
169);
170
171}
#define LMCAS_API
const std::string const LimitExprPtr & point
const PlaneSymbolic & plane
const std::vector< Polynomial< BigInt > > const BigInt ComputationContext & context
LineSymbolicResult line_from_two_points_checked(const std::vector< std::shared_ptr< SymbolicExpr > > &p1, const std::vector< std::shared_ptr< SymbolicExpr > > &p2, ComputationContext &context)
Result< PlaneSymbolic > PlaneSymbolicResult
const VectorField const VectorField & c
__attribute__((visibility("default"))) ExpressionResult point_plane_distance_checked(const std __attribute__((visibility("default"))) ExpressionResult point_plane_distance_checked(const std const LineSymbolic & l2
const MultiPoly & b
Result< std::shared_ptr< SymbolicExpr > > ExpressionResult
Result of an operation that produces a symbolic expression.
std::vector< std::shared_ptr< SymbolicExpr > > point
直线上一点。
PlaneSymbolicResult plane_from_three_points_checked(const std::vector< std::shared_ptr< SymbolicExpr > > &p1, const std::vector< std::shared_ptr< SymbolicExpr > > &p2, const std::vector< std::shared_ptr< SymbolicExpr > > &p3, ComputationContext &context)
PlaneSymbolic plane_general(std::shared_ptr< SymbolicExpr > a, std::shared_ptr< SymbolicExpr > b, std::shared_ptr< SymbolicExpr > c, std::shared_ptr< SymbolicExpr > d)
由一般方程系数构造平面 ax + by + cz = d。
__attribute__((visibility("default"))) VectorCalculusExprResult curve_integral_scalar_checked(const std __attribute__((visibility("default"))) VectorCalculusExprResult curve_integral_scalar_checked(const std __attribute__((visibility("default"))) std const VectorField const std::string const std::shared_ptr< SymbolicExpr > & a
VectorExprListResult line_plane_intersection_checked(const LineSymbolic &line, const PlaneSymbolic &plane, ComputationContext &context)
ExpressionResult point_plane_distance_checked(const std::vector< std::shared_ptr< SymbolicExpr > > &point, const PlaneSymbolic &plane, ComputationContext &context)
std::vector< std::shared_ptr< SymbolicExpr > > normal
法向量。
ExpressionResult dihedral_angle_checked(const PlaneSymbolic &p1, const PlaneSymbolic &p2, ComputationContext &context)
__attribute__((visibility("default"))) LineSymbolicResult line_from_two_points_checked(const std __attribute__((visibility("default"))) LineSymbolicResult line_from_two_points_checked(const std __attribute__((visibility("default"))) PlaneSymbolicResult plane_from_three_points_checked(const std __attribute__((visibility("default"))) PlaneSymbolicResult plane_from_three_points_checked(const std const PlaneSymbolic & p2
Result< LineSymbolic > LineSymbolicResult
Result< std::vector< std::shared_ptr< SymbolicExpr > > > VectorExprListResult
std::vector< std::shared_ptr< SymbolicExpr > > direction
方向向量。
ExpressionResult skew_lines_distance_checked(const LineSymbolic &l1, const LineSymbolic &l2, ComputationContext &context)
std::shared_ptr< SymbolicExpr > d
常数项。
由一点和方向向量定义的符号直线。
由法向量和常数 d 定义的符号平面 ax + by + cz = d。