Răsfoiți Sursa

- Ifc: more opening tweaks.

Alexander Gessler 12 ani în urmă
părinte
comite
1a60697282
1 a modificat fișierele cu 8 adăugiri și 7 ștergeri
  1. 8 7
      code/IFCGeometry.cpp

+ 8 - 7
code/IFCGeometry.cpp

@@ -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;
 			}
 			}