- Ifc: [openings] more fine-tuning and some debugging aid.
parent
1a60697282
commit
d4bcd3ab69
|
@ -1631,11 +1631,12 @@ void FindLikelyCrossingLines(ContourVector::iterator current)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
void CloseWindows(ContourVector& contours,
|
size_t CloseWindows(ContourVector& contours,
|
||||||
const IfcMatrix4& minv,
|
const IfcMatrix4& minv,
|
||||||
OpeningRefVector& contours_to_openings,
|
OpeningRefVector& contours_to_openings,
|
||||||
TempMesh& curmesh)
|
TempMesh& curmesh)
|
||||||
{
|
{
|
||||||
|
size_t closed = 0;
|
||||||
// For all contour points, check if one of the assigned openings does
|
// For all contour points, check if one of the assigned openings does
|
||||||
// already have points assigned to it. In this case, assume this is
|
// already have points assigned to it. In this case, assume this is
|
||||||
// the other side of the wall and generate connections between
|
// the other side of the wall and generate connections between
|
||||||
|
@ -1747,6 +1748,7 @@ void CloseWindows(ContourVector& contours,
|
||||||
curmesh.verts.push_back(cit == cbegin ? bestv : world_point);
|
curmesh.verts.push_back(cit == cbegin ? bestv : world_point);
|
||||||
|
|
||||||
curmesh.vertcnt.push_back(4);
|
curmesh.vertcnt.push_back(4);
|
||||||
|
++closed;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cit == cbegin) {
|
if (cit == cbegin) {
|
||||||
|
@ -1764,6 +1766,7 @@ void CloseWindows(ContourVector& contours,
|
||||||
// Check if the final connection (last to first element) is itself
|
// Check if the final connection (last to first element) is itself
|
||||||
// a border edge that needs to be dropped.
|
// a border edge that needs to be dropped.
|
||||||
if (drop_this_edge) {
|
if (drop_this_edge) {
|
||||||
|
--closed;
|
||||||
curmesh.vertcnt.pop_back();
|
curmesh.vertcnt.pop_back();
|
||||||
curmesh.verts.pop_back();
|
curmesh.verts.pop_back();
|
||||||
curmesh.verts.pop_back();
|
curmesh.verts.pop_back();
|
||||||
|
@ -1774,6 +1777,11 @@ void CloseWindows(ContourVector& contours,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BOOST_FOREACH(TempOpening* opening, refs) {
|
||||||
|
opening->wallPoints.clear();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
|
@ -1789,6 +1797,7 @@ void CloseWindows(ContourVector& contours,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return closed;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
|
@ -2001,10 +2010,10 @@ bool GenerateOpenings(std::vector<TempOpening>& openings,
|
||||||
const IfcVector3& v = m * x;
|
const IfcVector3& v = m * x;
|
||||||
IfcVector2 vv(v.x, v.y);
|
IfcVector2 vv(v.x, v.y);
|
||||||
|
|
||||||
if(check_intersection) {
|
//if(check_intersection) {
|
||||||
dmin = std::min(dmin, v.z);
|
dmin = std::min(dmin, v.z);
|
||||||
dmax = std::max(dmax, v.z);
|
dmax = std::max(dmax, v.z);
|
||||||
}
|
//}
|
||||||
|
|
||||||
// sanity rounding
|
// sanity rounding
|
||||||
vv = std::max(vv,IfcVector2());
|
vv = std::max(vv,IfcVector2());
|
||||||
|
@ -2041,7 +2050,6 @@ bool GenerateOpenings(std::vector<TempOpening>& openings,
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// TODO: This epsilon may be too large
|
// TODO: This epsilon may be too large
|
||||||
const IfcFloat epsilon = fabs(dmax-dmin) * 0.0001;
|
const IfcFloat epsilon = fabs(dmax-dmin) * 0.0001;
|
||||||
if (check_intersection && (0 < dmin-epsilon || 0 > dmax+epsilon)) {
|
if (check_intersection && (0 < dmin-epsilon || 0 > dmax+epsilon)) {
|
||||||
|
@ -2176,6 +2184,7 @@ bool GenerateOpenings(std::vector<TempOpening>& openings,
|
||||||
// Generate window caps to connect the symmetric openings on both sides
|
// Generate window caps to connect the symmetric openings on both sides
|
||||||
// of the wall.
|
// of the wall.
|
||||||
if (generate_connection_geometry) {
|
if (generate_connection_geometry) {
|
||||||
|
|
||||||
CloseWindows(contours, minv, contours_to_openings, curmesh);
|
CloseWindows(contours, minv, contours_to_openings, curmesh);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -2197,6 +2206,9 @@ void ProcessExtrudedAreaSolid(const IfcExtrudedAreaSolid& solid, TempMesh& resul
|
||||||
ConvertDirection(dir,solid.ExtrudedDirection);
|
ConvertDirection(dir,solid.ExtrudedDirection);
|
||||||
|
|
||||||
dir *= solid.Depth;
|
dir *= solid.Depth;
|
||||||
|
if(conv.collect_openings) {
|
||||||
|
dir *= 1000.0;
|
||||||
|
}
|
||||||
|
|
||||||
// Outline: assuming that `meshout.verts` is now a list of vertex points forming
|
// Outline: assuming that `meshout.verts` is now a list of vertex points forming
|
||||||
// the underlying profile, extrude along the given axis, forming new
|
// the underlying profile, extrude along the given axis, forming new
|
||||||
|
@ -2272,7 +2284,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,false, true)) {
|
if(GenerateOpenings(*conv.apply_openings,nors,temp,true, true)) {
|
||||||
++sides_with_openings;
|
++sides_with_openings;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2283,6 +2295,9 @@ void ProcessExtrudedAreaSolid(const IfcExtrudedAreaSolid& solid, TempMesh& resul
|
||||||
|
|
||||||
if(openings) {
|
if(openings) {
|
||||||
BOOST_FOREACH(TempOpening& opening, *conv.apply_openings) {
|
BOOST_FOREACH(TempOpening& opening, *conv.apply_openings) {
|
||||||
|
if (!opening.wallPoints.empty()) {
|
||||||
|
IFCImporter::LogError("failed to generate all window caps");
|
||||||
|
}
|
||||||
opening.wallPoints.clear();
|
opening.wallPoints.clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue