当前位置: 首页>>代码示例>>C++>>正文


C++ Part::BndBox方法代码示例

本文整理汇总了C++中Part::BndBox方法的典型用法代码示例。如果您正苦于以下问题:C++ Part::BndBox方法的具体用法?C++ Part::BndBox怎么用?C++ Part::BndBox使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Part的用法示例。


在下文中一共展示了Part::BndBox方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: TestContactSpotProcess

void AspMainTest::TestContactSpotProcess(MainFrame * frame, AspMainTool *tool){

	auto unitMap = tool->product->GetUnitMap();
	auto view = frame->myViewer;

	Standard_Real Gap = 0.5;
	Handle_AIS_InteractiveContext context = view->getIC();
	if (context->HasOpenedContext())
		context->CloseAllContexts();

	context->EraseAll(true);

	Standard_Integer curLC = context->OpenLocalContext();

	for (auto iter = unitMap->begin(); iter != unitMap->end(); iter++){
		Part *part = dynamic_cast<Part *>(iter->second);
		auto subItr = iter;
		for (++subItr; subItr != unitMap->end(); subItr++){
			Part *obstacle = dynamic_cast<Part *>(subItr->second);
			//==========================================
			//			Visualise current Parts
			context->ClearLocalContext(AIS_ClearMode::AIS_CM_Interactive);

			Handle_AIS_Shape shape = tool->mapOfShapes.find(part->GetUri())->second;
			context->LocalContext()->Display(shape, AIS_Shaded);
			context->SetTransparency(shape, 0.2, false);
			shape = tool->mapOfShapes.find(obstacle->GetUri())->second;;
			context->LocalContext()->Display(shape, AIS_WireFrame);
			view->getView()->Redraw();
			//==========================================
			if (obstacle->BndBox()->Distance(*part->BndBox()) < Gap)
			for (auto &sp : *part){
				if (sp.myBox.Distance(*obstacle->BndBox())<Gap)
				for (auto &obstSp : *obstacle){

					if (sp.myBox.Distance(obstSp.myBox)>Gap)
						continue;
					//==========================================
					//			Visualise current surface

					context->ClearLocalContext(AIS_ClearMode::AIS_CM_Interactive);
					tool->ShowSurface(context, sp);
					tool->ShowSurface(context, obstSp);
					view->getView()->Redraw();
					//==========================================
					
					//==========================================
					//			Launch function Contact Spot

					if (asp::DBGBuilder::NotInContact(sp, obstSp, 1, Gap))
						continue;

					ContactSpot spot(sp, obstSp, part, obstacle);
					if (spot.IsDone()){

						//==========================================
						auto vecArray1 = spot.getF1ContactAxis();
						auto vecArray2 = spot.getF2ContactAxis();

						if (vecArray1.size() && vecArray2.size()){
							for (auto &dir : vecArray1){
								Handle_ISession_Direction axis = new ISession_Direction(dir.Location(), dir.Direction(), 10);
								context->LocalContext()->Display(axis, AIS_WireFrame);
							}

							for (auto &dir : vecArray2){
								Handle_ISession_Direction axis = new ISession_Direction(dir.Location(), dir.Direction(), 10);
								context->LocalContext()->Display(axis, AIS_WireFrame);
							}
							view->getView()->Redraw();
						}
						//}
					}
				}
			}

		}
	}
	context->CloseLocalContext(curLC);

}
开发者ID:zhucci,项目名称:ASP_Project,代码行数:81,代码来源:AspMainTestClass.cpp


注:本文中的Part::BndBox方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。