openCASCADE 两个平面的交线求解

本文介绍了如何利用IntAna_QuadQuadGeo类在OpenCASCADE中计算两个平面以及平面与曲面的交线,通过提供代码示例展示了其实现方法和注意事项。
摘要由CSDN通过智能技术生成

使用IntAna_QuadQuadGeo这个类可以实现,下面是一段代码示例。

/// the instersection line of the two plane
gp_Pnt pnt_in_plane1(point_estimates[0](0),point_estimates[0](1),point_estimates[0](2));
gp_Pnt pnt_in_plane2(point_estimates[1](0),point_estimates[1](1),point_estimates[1](2));
gp_Dir dir_to_plane1(normal_estimates[0](0),normal_estimates[0](1),normal_estimates[0](2));
gp_Dir dir_to_plane2(normal_estimates[1](0),normal_estimates[1](1),normal_estimates[1](2));

//构建两个平面:用平面内一点和平面的法向量
gp_Pln plane1(pnt_in_plane1,dir_to_plane1);
gp_Pln plane2(pnt_in_plane2,dir_to_plane2);

IntAna_QuadQuadGeo inter_plane2plane(plane1,plane2,0.1,0.1);
gp_Lin inter_line;
if(inter_plane2plane.IsDone()){
    //检查是否有相交结果
    if(inter_plane2plane.NbSolutions()>0){
        //注意:openCASCADE是从1开始计数,所以下面的1表示第0个点哈!!
        inter_line = inter_plane2plane.Line(1);
        
    }else{
            JH_INFO_TRACE("inter_plane2plane.NbSolutions()==0");
            return false;
    }
}else{
        JH_INFO_TRACE("inter_plane2plane.IsDone() error");
        return false;
}

IntAna_QuadQuadGeo这个类不仅仅可以求解平面相交,看他的头文件里面还有各种曲面和曲面,平面和曲面求交线。大家可以通过简单的代码实现去测试

  • 6
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值