|
AnyCAD Rapid API 2026
Help you to create a better world!
|
三维右手坐标系模板类 更多...
Public 成员函数 | |
| AAx2 (global::System.IntPtr cPtr, bool cMemoryOwn) | |
| 仅供内部使用 | |
| void | Dispose () |
| AAx2 () | |
| 默认构造函数 | |
| AAx2 (AAx2 rhs) | |
| 拷贝构造函数 | |
| AAx2 (Vector3d theLocation, Vector3d theDirection) | |
| 通过原点和主方向构造坐标系 | |
| AAx2 (Vector3d theLocation, Vector3d theDirection, Vector3d theXDirection) | |
| 通过原点、主方向和X方向构造坐标系 | |
| void | setAxis (Vector3d theLocation, Vector3d theDirection) |
| 设置坐标系的主轴(原点和主方向) | |
| void | setDirection (Vector3d theDirection) |
| 设置主方向(Z轴方向) | |
| void | setDirectionAuto (Vector3d theDirection) |
| 自动设置主方向并计算X和Y方向 | |
| void | setLocation (Vector3d theLocation) |
| 设置原点位置 | |
| void | setXDirection (Vector3d theXDirection) |
| 设置X轴方向 | |
| void | setYDirection (Vector3d theYDirection) |
| 设置Y轴方向 | |
| void | setDirections (Vector3d theDirection, Vector3d theXDirection) |
| 同时设置主方向和X方向 | |
| double | angle (AAx2 theOther) |
| 计算两个坐标系主方向之间的夹角 | |
| Vector3d | getDirection () |
| 获取主方向(Z轴方向) | |
| Vector3d | getLocation () |
| 获取原点位置 | |
| Vector3d | getXDirection () |
| 获取X轴方向 | |
| Vector3d | getYDirection () |
| 获取Y轴方向 | |
| bool | isCoplanar (AAx2 theOther, double linearTolerance, double angularTolerance) |
| 判断两个坐标系是否共面 | |
| bool | isCoplanar (AAx2 theOther, double linearTolerance) |
| 判断两个坐标系是否共面 | |
| bool | isCoplanar (AAx2 theOther) |
| 判断两个坐标系是否共面 | |
| void | mirror (Vector3d thePoint) |
| 关于点进行对称变换(镜像) | |
| AAx2 | mirrored (Vector3d thePoint) |
| 关于点进行对称变换并返回新坐标系 | |
| void | mirror (Vector3d theAxisLocation, Vector3d theAxisDirection) |
| 关于轴进行对称变换(镜像) | |
| AAx2 | mirrored (Vector3d theAxisLocation, Vector3d theAxisDirection) |
| 关于轴进行对称变换并返回新坐标系 | |
| void | rotate (Vector3d theAxisLocation, Vector3d theAxisDirection, double theAngle) |
| 绕轴旋转 | |
| AAx2 | rotated (Vector3d theAxisLocation, Vector3d theAxisDirection, double theAngle) |
| 绕轴旋转并返回新坐标系 | |
| void | scale (Vector3d theCenter, double theScale) |
| 缩放变换 | |
| AAx2 | scaled (Vector3d theCenter, double theScale) |
| 缩放变换并返回新坐标系 | |
| void | transform (Matrix4d theMatrix) |
| 应用4x4变换矩阵 | |
| AAx2 | transformed (Matrix4d theMatrix) |
| 应用4x4变换矩阵并返回新坐标系 | |
| void | translate (Vector3d theVector) |
| 平移变换 | |
| AAx2 | translated (Vector3d theVector) |
| 平移变换并返回新坐标系 | |
| void | translate (Vector3d theFrom, Vector3d theTo) |
| 从一点平移到另一点 | |
| AAx2 | translated (Vector3d theFrom, Vector3d theTo) |
| 从一点平移到另一点并返回新坐标系 | |
| Matrix4d | transformationTo (AAx2 targetCoord) |
| 计算从当前坐标系到目标坐标系的变换矩阵 | |
| Matrix4d | toWorld () |
| 转换为世界坐标系 | |
静态 Public 成员函数 | |
| static Matrix4d | transformationFrom (AAx2 sourceCoord, AAx2 targetCoord) |
| 计算从源坐标系到当前坐标系的变换矩阵 | |
三维右手坐标系模板类
在 3D 空间中,坐标系由以下要素定义: - 原点(Location point) - 三个正交单位向量:X方向、Y方向和主方向(Z方向/Direction)
主方向(Direction)也称为 Z 方向,是坐标系的"主轴"。 当修改主方向时,X方向和Y方向会重新计算;但修改X或Y方向时,主方向保持不变。 由于是右手坐标系,主方向始终等于 X方向 × Y方向 的叉积。 (要定义左手坐标系,需要使用其他类) 坐标系用于:
| AnyCAD.Foundation.AAx2.AAx2 | ( | ) |
默认构造函数
初始化为标准坐标系(OXYZ),原点在(0,0,0), X轴为(1,0,0),Y轴为(0,1,0),Z轴为(0,0,1)
| AnyCAD.Foundation.AAx2.AAx2 | ( | AAx2 | rhs | ) |
拷贝构造函数
| rhs | 源坐标系对象 |
通过原点和主方向构造坐标系
X方向和Y方向会自动计算
| theLocation | 坐标系原点 |
| theDirection | 主方向(Z轴方向) |
会自动计算垂直于主方向的X方向和Y方向 找到主方向分量绝对值最小的轴,构造垂直向量
通过原点、主方向和X方向构造坐标系
| theLocation | 坐标系原点 |
| theDirection | 主方向(Z轴方向) |
| theXDirection | X轴方向 |
Y方向会通过叉积自动计算:Y = Z × X 如果X方向与主方向平行,会自动调整
| double AnyCAD.Foundation.AAx2.angle | ( | AAx2 | theOther | ) |
计算两个坐标系主方向之间的夹角
| theOther | 另一个坐标系 |
| Vector3d AnyCAD.Foundation.AAx2.getDirection | ( | ) |
获取主方向(Z轴方向)
| Vector3d AnyCAD.Foundation.AAx2.getLocation | ( | ) |
获取原点位置
| Vector3d AnyCAD.Foundation.AAx2.getXDirection | ( | ) |
获取X轴方向
| Vector3d AnyCAD.Foundation.AAx2.getYDirection | ( | ) |
获取Y轴方向
| bool AnyCAD.Foundation.AAx2.isCoplanar | ( | AAx2 | theOther | ) |
判断两个坐标系是否共面
| theOther | 另一个坐标系 |
共面条件: 1. 原点之间的距离在容差范围内 2. 主方向平行(在角度容差内)
| bool AnyCAD.Foundation.AAx2.isCoplanar | ( | AAx2 | theOther, |
| double | linearTolerance ) |
判断两个坐标系是否共面
| theOther | 另一个坐标系 |
| linearTolerance | 线性容差 |
共面条件: 1. 原点之间的距离在容差范围内 2. 主方向平行(在角度容差内)
| bool AnyCAD.Foundation.AAx2.isCoplanar | ( | AAx2 | theOther, |
| double | linearTolerance, | ||
| double | angularTolerance ) |
判断两个坐标系是否共面
| theOther | 另一个坐标系 |
| linearTolerance | 线性容差 |
| angularTolerance | 角度容差(弧度) |
共面条件: 1. 原点之间的距离在容差范围内 2. 主方向平行(在角度容差内)
关于轴进行对称变换(镜像)
| theAxisLocation | 轴上的点 |
| theAxisDirection | 轴的方向 |
会对X和Y方向进行变换,然后重新计算主方向 以保持右手坐标系性质
| void AnyCAD.Foundation.AAx2.mirror | ( | Vector3d | thePoint | ) |
关于点进行对称变换(镜像)
| thePoint | 镜像中心点 |
变换后: - 主方向不变 - X方向和Y方向反向 - 保持右手坐标系性质
关于轴进行对称变换并返回新坐标系
| theAxisLocation | 轴上的点 |
| theAxisDirection | 轴的方向 |
关于点进行对称变换并返回新坐标系
| thePoint | 镜像中心点 |
| void AnyCAD.Foundation.AAx2.rotate | ( | Vector3d | theAxisLocation, |
| Vector3d | theAxisDirection, | ||
| double | theAngle ) |
绕轴旋转
| theAxisLocation | 轴上的点 |
| theAxisDirection | 轴的方向 |
| theAngle | 旋转角度(弧度) |
会对原点、X方向和Y方向进行旋转,然后重新计算主方向
| AAx2 AnyCAD.Foundation.AAx2.rotated | ( | Vector3d | theAxisLocation, |
| Vector3d | theAxisDirection, | ||
| double | theAngle ) |
绕轴旋转并返回新坐标系
| theAxisLocation | 轴上的点 |
| theAxisDirection | 轴的方向 |
| theAngle | 旋转角度(弧度) |
| void AnyCAD.Foundation.AAx2.scale | ( | Vector3d | theCenter, |
| double | theScale ) |
缩放变换
| theCenter | 缩放中心 |
| theScale | 缩放因子 |
如果缩放因子为负,X和Y方向会反向以保持右手坐标系
缩放变换并返回新坐标系
| theCenter | 缩放中心 |
| theScale | 缩放因子 |
设置坐标系的主轴(原点和主方向)
| theLocation | 原点位置 |
| theDirection | 主方向 |
会重新计算X方向和Y方向
| void AnyCAD.Foundation.AAx2.setDirection | ( | Vector3d | theDirection | ) |
设置主方向(Z轴方向)
| theDirection | 新的主方向 |
会重新计算X方向和Y方向以保持正交性 新的X方向计算方式:X_new = V × (X_old × V)
| void AnyCAD.Foundation.AAx2.setDirectionAuto | ( | Vector3d | theDirection | ) |
自动设置主方向并计算X和Y方向
| theDirection | 新的主方向 |
算法: 1. 找到主方向分量绝对值最小的轴 2. 构造一个与主方向垂直的向量作为初始X方向 3. 通过叉积计算Y方向
同时设置主方向和X方向
| theDirection | 主方向(Z轴) |
| theXDirection | X轴方向 |
Y方向会通过叉积自动计算
| void AnyCAD.Foundation.AAx2.setLocation | ( | Vector3d | theLocation | ) |
设置原点位置
| theLocation | 新的原点位置 |
| void AnyCAD.Foundation.AAx2.setXDirection | ( | Vector3d | theXDirection | ) |
设置X轴方向
| theXDirection | 新的X轴方向 |
主方向不变,Y方向会重新计算 如果X方向不与主方向垂直,会自动投影到垂直平面
| void AnyCAD.Foundation.AAx2.setYDirection | ( | Vector3d | theYDirection | ) |
设置Y轴方向
| theYDirection | 新的Y轴方向 |
主方向不变,X方向会重新计算 如果Y方向不与主方向垂直,会自动投影到垂直平面
| Matrix4d AnyCAD.Foundation.AAx2.toWorld | ( | ) |
转换为世界坐标系
| void AnyCAD.Foundation.AAx2.transform | ( | Matrix4d | theMatrix | ) |
应用4x4变换矩阵
| theMatrix | 4x4变换矩阵 |
会对原点、X方向和Y方向进行变换,然后重新计算主方向
计算从源坐标系到当前坐标系的变换矩阵
| sourceCoord | 源坐标系 |
等价于:this->inverse() * sourceCoord.toMatrix()
计算从当前坐标系到目标坐标系的变换矩阵
| targetCoord | 目标坐标系 |
算法: 该变换将点从 FromA1 坐标系变换到 ToA2 坐标系 数学原理:M = ToA2^(-1) * FromA1
应用4x4变换矩阵并返回新坐标系
| theMatrix | 4x4变换矩阵 |
从一点平移到另一点
| theFrom | 起始点 |
| theTo | 目标点 |
| void AnyCAD.Foundation.AAx2.translate | ( | Vector3d | theVector | ) |
平移变换
| theVector | 平移向量 |
从一点平移到另一点并返回新坐标系
| theFrom | 起始点 |
| theTo | 目标点 |