OCC gp_Ax1源码阅读记录

gp_Ax1描述了一个三维轴。

轴包含以下内容:

- 原点(Location point)

- 单位向量(称作 "Direction" 或 "main Direction")

轴通常有以下用途:

- 描述三维几何体(例如:旋转体的轴)

- 定义几何体的转换(对称轴、旋转轴等等)

 

class gp_Ax1

{

private:

    gp_Pnt loc;    // 定位

    gp_Dir vdir;    // 方向

 

public:

    // 以下函数没啥好说的,看看就懂

    gp_Ax1() : loc(0,0,0), vdir(0,0,1) {}

    gp_Ax1(const gp_Pnt &theP, const gp_Dir &theV) : loc(theP), vdir(theV) {}

    void SetDirection(const gp_Dir &theV)  {vdir = theV;}

    void SetLocation(const gp_Pnt &theP) {loc = theP;}

    const gp_Dir &Direction() const { return vdir; }

    const gp_Pnt &Location() const { return loc; }

 

    // 以下内容大都是通过成员vdir实现的,此类中仍提供接口,应该是为了使用便利性考虑    

 

    // 是否和Other同轴

    // 同轴判定条件:1:旋转轴夹角小于 AngularTolerance

    // 2:<me>.Location到Other的距离小于 LinearTolerance 且 Other.Location到<me>的距离小于LinearTolerance

    bool IsCoaxial(const gp_Ax1 &Other, const double AngularTolerance, const double LinearTolerance) const

    {}

 

    // 判断<me>和theOther的夹角是否等于 Pi / 2

    bool IsNormal(const gp_Ax1 &theOther, const double theAngularTolerance) const

    {}

 

        // 判断两个轴是否相反 (夹角等于Pi)

        bool IsOpposite(const gp_Ax1 &theOther, const double theAngularTolerance) const

    {}

 

    // 判断两个轴是否平行 (夹角等于0或Pi)

    bool IsParallel(const gp_Ax1 &theOther, const double theAngularTolerance) const

    {}

 

    // 计算两个轴的夹角

    double Angle(const gp_Ax1 &theOther) const  

    {}

 

    // 反向

    void Reverse()

    {}

 

    // 轴关于点P镜像

    void Mirror(const gp_Pnt &P)

    {

        loc.Mirror(P);  vdir.Reverse();

    }

 

    // 轴关于另一个轴镜像

    void Mirror(const gp_Ax1 &A1)

    {}

 

    // 轴关于右手坐标系A2镜像

    void Mirror(const gp_Ax2 &A2)

    {}

 

    // 绕另一个轴旋转

    void Rotate(const gp_Ax1 &theA1, const double theAngRad)

    {}

 

     // 绕点缩放

    void Scale(const gp_Pnt &theP, const double theS)

    {}

    

    // 转换矩阵转换

    void Transform(const gp_Trsf &theT)

    {}

 

    // 平移

    void Translate(const gp_Vec &theV)

    {}

 

    

};

posted @   xl-better  阅读(213)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· winform 绘制太阳,地球,月球 运作规律
· AI与.NET技术实操系列(五):向量存储与相似性搜索在 .NET 中的实现
· 超详细:普通电脑也行Windows部署deepseek R1训练数据并当服务器共享给他人
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 上周热点回顾(3.3-3.9)
点击右上角即可分享
微信分享提示