本文整理汇总了C++中HeeksObj::Intersects方法的典型用法代码示例。如果您正苦于以下问题:C++ HeeksObj::Intersects方法的具体用法?C++ HeeksObj::Intersects怎么用?C++ HeeksObj::Intersects使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HeeksObj
的用法示例。
在下文中一共展示了HeeksObj::Intersects方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: perfectly_aligned_fixture
/**
* This method looks through the symbols in the list. If they're PointType objects
* then the object's location is added to the result set. If it's a circle object
* that doesn't intersect any other element (selected) then add its centre to
* the result set. Finally, find the intersections of all of these elements and
* add the intersection points to the result vector.
*/
/* static */ std::vector<CNCPoint> CDrilling::FindAllLocations(
ObjList *parent,
const CNCPoint starting_location, // = CNCPoint(0.0, 0.0, 0.0)
const bool sort_locations, // = false
std::list<int> *pToolNumbersReferenced /* = NULL */ )
{
std::vector<CNCPoint> locations;
parent->ReloadPointers(); // Make sure our integer lists have been converted into children first.
// Look to find all intersections between all selected objects. At all these locations, create
// a drilling cycle.
std::list<HeeksObj *> lhs_children;
std::list<HeeksObj *> rhs_children;
for (HeeksObj *lhsPtr = parent->GetFirstChild(); lhsPtr != NULL; lhsPtr = parent->GetNextChild())
{
lhs_children.push_back( lhsPtr );
rhs_children.push_back( lhsPtr );
}
for (std::list<HeeksObj *>::iterator itLhs = lhs_children.begin(); itLhs != lhs_children.end(); itLhs++)
{
HeeksObj *lhsPtr = *itLhs;
bool l_bIntersectionsFound = false; // If it's a circle and it doesn't
// intersect anything else, we want to know
// about it.
if (lhsPtr->GetType() == PointType)
{
double pos[3];
lhsPtr->GetStartPoint(pos);
// Copy the results in ONLY if each point doesn't already exist.
if (std::find( locations.begin(), locations.end(), CNCPoint( pos ) ) == locations.end())
{
locations.push_back( CNCPoint( pos ) );
} // End if - then
continue; // No need to intersect a point with anything.
} // End if - then
for (std::list<HeeksObj *>::iterator itRhs = rhs_children.begin(); itRhs != rhs_children.end(); itRhs++)
{
HeeksObj *rhsPtr = *itRhs;
if (lhsPtr == rhsPtr) continue;
if (lhsPtr->GetType() == PointType) continue; // No need to intersect a point type.
std::list<double> results;
if ((lhsPtr != NULL) && (rhsPtr != NULL) && (lhsPtr->Intersects( rhsPtr, &results )))
{
l_bIntersectionsFound = true;
while (((results.size() % 3) == 0) && (results.size() > 0))
{
CNCPoint intersection;
intersection.SetX( *(results.begin()) );
results.erase(results.begin());
intersection.SetY( *(results.begin()) );
results.erase(results.begin());
intersection.SetZ( *(results.begin()) );
results.erase(results.begin());
// Copy the results in ONLY if each point doesn't already exist.
if (std::find( locations.begin(), locations.end(), intersection ) == locations.end())
{
locations.push_back(intersection);
} // End if - then
} // End while
} // End if - then
} // End for
if (! l_bIntersectionsFound)
{
// This element didn't intersect anything else. If it's a circle
// then add its centre point to the result set.
if (lhsPtr->GetType() == CircleType)
{
double pos[3];
if ((lhsPtr != NULL) && (heeksCAD->GetArcCentre( lhsPtr, pos )))
{
// Copy the results in ONLY if each point doesn't already exist.
if (std::find( locations.begin(), locations.end(), CNCPoint( pos ) ) == locations.end())
{
locations.push_back( CNCPoint( pos ) );
} // End if - then
} // End if - then
} // End if - then
//.........这里部分代码省略.........