bool Place(Content<_T> content) { Sort(); for( Coord::List::iterator itor = topLefts.begin(); itor != topLefts.end(); itor++ ) { content.coord = *itor; if( Fits( content ) ) { Use( content ); topLefts.erase( itor ); return true; } } // EXPERIMENTAL - TRY ROTATED? content.Rotate(); for( Coord::List::iterator itor = topLefts.begin(); itor != topLefts.end(); itor++ ) { content.coord = *itor; if( Fits( content ) ) { Use( content ); topLefts.erase( itor ); return true; } } //////////////////////////////// return false; }
bool Place(Content<_T> content) { Sort(); for( Coord::List::iterator itor = topLefts.begin(); itor != topLefts.end(); itor++ ) { content.coord = *itor; if( Fits( content ) ) { Use( content ); topLefts.erase( itor ); return true; } } return false; // yvt: BitmapAtlasGenerator doesn't support rotated contents. // EXPERIMENTAL - TRY ROTATED? // content.Rotate(); // for(Coord::List::iterator itor = topLefts.begin(); itor != topLefts.end(); itor++) // { // content.coord = *itor; // if( Fits( content ) ) // { // Use( content ); // topLefts.erase( itor ); // return true; // } // } // //////////////////////////////// // return false; }
bool BoxCollider::Fits( const CylinderCollider &c ) const { BoxCollider b; b.position = glm::vec3( c.end.x, c.end.y / c.height, c.end.z); b.SetRadius( glm::vec3( c.radius, c.height/2, c.radius ) ); return Fits( b ); }
bool GlyphTreeNode::Add(const std::shared_ptr<FontSymbol> &symbol) { if (symbol->IsEmpty()) { return true; } bool result = false; if (IsEmpty()) { if (Fits(symbol)) { CreateBranches(symbol); symbol->SetXY(this->x, this->y); result = true; } } else { if (this->leafLeft->Add(symbol)) { result = true; } else if (this->leafRight->Add(symbol)) { result = true; } } return result; }
bool BoxCollider::Fits( const SphereCollider &c ) const { BoxCollider b; b.radius[0] = c.radius/2; b.radius[1] = c.radius/2; b.radius[2] = c.radius/2; b.position = c.position; return Fits( b ); }