- Ifc: more opening tweaks.

pull/19/head
Alexander Gessler 2013-01-25 05:55:32 +01:00
parent 302fad13b0
commit 1a60697282
1 changed files with 8 additions and 7 deletions

View File

@ -1633,7 +1633,7 @@ void FindLikelyCrossingLines(ContourVector::iterator current)
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void CloseWindows(ContourVector& contours, void CloseWindows(ContourVector& contours,
const IfcMatrix4& minv, const IfcMatrix4& minv,
OpeningRefVector contours_to_openings, OpeningRefVector& contours_to_openings,
TempMesh& curmesh) TempMesh& curmesh)
{ {
// For all contour points, check if one of the assigned openings does // For all contour points, check if one of the assigned openings does
@ -1648,7 +1648,7 @@ void CloseWindows(ContourVector& contours,
// wrong geometry may be generated. // wrong geometry may be generated.
for (ContourVector::iterator it = contours.begin(), end = contours.end(); it != end; ++it) { for (ContourVector::iterator it = contours.begin(), end = contours.end(); it != end; ++it) {
if ((*it).IsInvalid()) { if ((*it).IsInvalid()) {
//continue; continue;
} }
OpeningRefs& refs = contours_to_openings[std::distance(contours.begin(), it)]; OpeningRefs& refs = contours_to_openings[std::distance(contours.begin(), it)];
@ -1660,8 +1660,6 @@ void CloseWindows(ContourVector& contours,
} }
} }
const Contour::const_iterator cbegin = (*it).contour.begin(), cend = (*it).contour.end();
if (has_other_side) { if (has_other_side) {
ContourRefVector adjacent_contours; ContourRefVector adjacent_contours;
@ -1701,7 +1699,7 @@ void CloseWindows(ContourVector& contours,
IfcVector2 last_proj; IfcVector2 last_proj;
//const IfcVector2& first_proj; //const IfcVector2& first_proj;
IfcVector3 perp; const Contour::const_iterator cbegin = (*it).contour.begin(), cend = (*it).contour.end();
bool drop_this_edge = false; bool drop_this_edge = false;
for (Contour::const_iterator cit = cbegin; cit != cend; ++cit, drop_this_edge = *skipit++) { for (Contour::const_iterator cit = cbegin; cit != cend; ++cit, drop_this_edge = *skipit++) {
@ -1778,7 +1776,10 @@ void CloseWindows(ContourVector& contours,
} }
} }
else { else {
const Contour::const_iterator cbegin = (*it).contour.begin(), cend = (*it).contour.end();
BOOST_FOREACH(TempOpening* opening, refs) { BOOST_FOREACH(TempOpening* opening, refs) {
ai_assert(opening->wallPoints.empty());
opening->wallPoints.reserve(opening->wallPoints.capacity() + (*it).contour.size()); opening->wallPoints.reserve(opening->wallPoints.capacity() + (*it).contour.size());
for (Contour::const_iterator cit = cbegin; cit != cend; ++cit) { for (Contour::const_iterator cit = cbegin; cit != cend; ++cit) {
@ -1941,7 +1942,7 @@ bool GenerateOpenings(std::vector<TempOpening>& openings,
nor.Normalize(); nor.Normalize();
// Obtain inverse transform for getting back to world space later on // Obtain inverse transform for getting back to world space later on
const IfcMatrix4& minv = IfcMatrix4(m).Inverse(); const IfcMatrix4 minv = IfcMatrix4(m).Inverse();
// Compute bounding boxes for all 2D openings in projection space // Compute bounding boxes for all 2D openings in projection space
ContourVector contours; ContourVector contours;
@ -2271,7 +2272,7 @@ void ProcessExtrudedAreaSolid(const IfcExtrudedAreaSolid& solid, TempMesh& resul
out.push_back(in[next]); out.push_back(in[next]);
if(openings) { if(openings) {
if(GenerateOpenings(*conv.apply_openings,nors,temp,true, true)) { if(GenerateOpenings(*conv.apply_openings,nors,temp,false, true)) {
++sides_with_openings; ++sides_with_openings;
} }