Skip to content

Add check in Extrude(), replace replace codecvt_utf8_utf16 #1282

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 19 commits into from
Mar 31, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ examples/nodejs/*.ifc
tests/ifcfiles/private/*.ifc
tests/ifcfiles/private/*.stl
tests/ifcfiles/created.ifc
src/cpp/_deps/
yarn.lock

#external dependencies downloaded by Cmake
src/cpp/_deps/cdt-src/
Expand All @@ -67,4 +69,4 @@ src/cpp/_deps/fastfloat-src/
src/cpp/_deps/glm-src/
src/cpp/_deps/spdlog-src/
src/cpp/_deps/tinycpptest-src/
src/cpp/_deps/tinynurbs-src/
src/cpp/_deps/tinynurbs-src/
12 changes: 8 additions & 4 deletions src/cpp/web-ifc/geometry/IfcGeometryProcessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1044,6 +1044,7 @@ namespace webifc::geometry
return mesh;
}
case schema::IFCGEOMETRICSET:
case schema::IFCGEOMETRICCURVESET:
{
_loader.MoveToArgumentOffset(expressID, 0);
auto items = _loader.GetSetArgument();
Expand Down Expand Up @@ -1138,8 +1139,7 @@ namespace webifc::geometry
case schema::IFCTEXTLITERALWITHEXTENT:
// TODO: save string of the text literal in IfcComposedMesh
return mesh;

default:
default:
spdlog::error("[GetMesh()] unexpected mesh type {}", expressID, lineType);
break;
}
Expand Down Expand Up @@ -1536,15 +1536,19 @@ namespace webifc::geometry
return IfcSurface();
}

IfcFlatMesh IfcGeometryProcessor::GetFlatMesh(uint32_t expressID)
IfcFlatMesh IfcGeometryProcessor::GetFlatMesh(uint32_t expressID, bool applyLinearScalingFactor)
{
spdlog::debug("[GetFlatMesh({})]",expressID);
IfcFlatMesh flatMesh;
flatMesh.expressID = expressID;

IfcComposedMesh composedMesh = GetMesh(expressID);

glm::dmat4 mat = glm::scale(glm::dvec3(_geometryLoader.GetLinearScalingFactor()));
glm::dmat4 mat = glm::dmat4(1);
if (applyLinearScalingFactor)
{
mat = glm::scale(glm::dvec3(_geometryLoader.GetLinearScalingFactor()));;
}

AddComposedMeshToFlatMesh(flatMesh, composedMesh, _transformation * NormalizeIFC * mat);

Expand Down
2 changes: 1 addition & 1 deletion src/cpp/web-ifc/geometry/IfcGeometryProcessor.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ namespace webifc::geometry
IfcGeometryProcessor(const webifc::parsing::IfcLoader &loader,const webifc::schema::IfcSchemaManager &schemaManager,uint16_t circleSegments,bool coordinateToOrigin);
IfcGeometry &GetGeometry(uint32_t expressID);
IfcGeometryLoader GetLoader() const;
IfcFlatMesh GetFlatMesh(uint32_t expressID);
IfcFlatMesh GetFlatMesh(uint32_t expressID, bool applyLinearScalingFactor = true);
IfcComposedMesh GetMesh(uint32_t expressID);
void SetTransformation(const std::array<double, 16> &val);
std::array<double, 16> GetFlatCoordinationMatrix() const;
Expand Down
8 changes: 4 additions & 4 deletions src/cpp/web-ifc/geometry/nurbs.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ namespace tinynurbs{

namespace webifc::geometry{

class IfcGeometry;
class IfcBound3D;
class BSpline;
class IfcSurface;
struct IfcGeometry;
struct IfcBound3D;
struct BSpline;
struct IfcSurface;

constexpr double rotations { 6.0 };
constexpr auto pi {glm::pi<double>()};
Expand Down
18 changes: 14 additions & 4 deletions src/cpp/web-ifc/geometry/operations/geometryutils.h
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,9 @@ namespace webifc::geometry
// this is bad news, as it nans the points added to the final mesh
// also, it's hard to bail out now :/
// see curve.add() for more info on how this is currently "solved"
#if defined(_DEBUG)
printf("NaN perp!\n");
#endif
}

glm::dvec3 u1 = glm::normalize(glm::cross(n1, p));
Expand Down Expand Up @@ -363,7 +365,9 @@ namespace webifc::geometry
// this is bad news, as it nans the points added to the final mesh
// also, it's hard to bail out now :/
// see curve.add() for more info on how this is currently "solved"
#if defined(_DEBUG)
printf("NaN perp!\n");
#endif
}

glm::dvec3 u1 = glm::normalize(glm::cross(n1, p));
Expand Down Expand Up @@ -824,6 +828,12 @@ namespace webifc::geometry
IfcGeometry geom;
std::vector<bool> holesIndicesHash;

// check if first point is equal to last point, otherwise the outer loop of the shape is not closed
glm::dvec3 lastToFirstPoint = profile.curve.points.front() - profile.curve.points.back();
if (glm::length(lastToFirstPoint) > 1e-8) {
profile.curve.points.push_back(profile.curve.points.front());
}

// build the caps
{
using Point = std::array<double, 2>;
Expand Down Expand Up @@ -951,12 +961,12 @@ namespace webifc::geometry

// this winding should be correct
geom.AddFace(geom.GetPoint(tl),
geom.GetPoint(br),
geom.GetPoint(bl));
geom.GetPoint(br),
geom.GetPoint(bl));

geom.AddFace(geom.GetPoint(tl),
geom.GetPoint(tr),
geom.GetPoint(br));
geom.GetPoint(tr),
geom.GetPoint(br));
}

return geom;
Expand Down
21 changes: 17 additions & 4 deletions src/cpp/web-ifc/geometry/operations/mesh_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -184,10 +184,23 @@ namespace webifc::geometry
for (int r = 0; r < numRots - 1; r++)
{
int r1 = r + 1;
for (size_t s = 0; s < newPoints[r].size() - 1; s++)
{
geometry.AddFace(newPoints[r][s], newPoints[r][s + 1], newPoints[r1][s]);
geometry.AddFace(newPoints[r1][s], newPoints[r][s + 1], newPoints[r1][s + 1]);
if (r1 >= newPoints.size()) {
break;
}
const std::vector<glm::dvec3>& newPointsR = newPoints[r];
const std::vector<glm::dvec3>& newPointsR1 = newPoints[r1];
if (newPointsR.size() > 0) {
for (size_t s = 0; s < newPointsR.size() - 1; s++)
{
if (s + 1 >= newPointsR.size()) {
break;
}
if (s + 1 >= newPointsR1.size()) {
break;
}
geometry.AddFace(newPointsR[s], newPointsR[s + 1], newPointsR1[s]);
geometry.AddFace(newPointsR1[s], newPointsR[s + 1], newPointsR1[s + 1]);
}
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/cpp/web-ifc/geometry/representation/IfcGeometry.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ namespace webifc::geometry {
std::vector<uint32_t> indexData;
std::vector<uint32_t> planeData;
std::vector<Plane> planes;

bool hasPlanes = false;

bool isPolygon = false;
bool hasPlanes = false;
uint32_t numPoints = 0;
uint32_t numFaces = 0;

Expand Down
1 change: 1 addition & 0 deletions src/cpp/web-ifc/parsing/IfcLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -673,6 +673,7 @@ namespace webifc::parsing {
GetSetArgument();
noArguments++;
continue;

}
if (t == IfcTokenType::STRING || t == IfcTokenType::INTEGER || t == IfcTokenType::REAL || t == IfcTokenType::LABEL || t == IfcTokenType::ENUM) {
uint16_t length = _tokenStream->Read<uint16_t>();
Expand Down
2 changes: 1 addition & 1 deletion tests/regression/results.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"tests/ifcfiles/public/AC20-FZK-Haus.ifc":"6bf7a4d4e18776a6952914fd03acd96f81623ca5da6e5a7876fe4e64fd8df22e","tests/ifcfiles/public/C20-Institute-Var-2.ifc":"288a7ba65b562e1bdd6548f60f0e2339306578625cb445670f0bbf1c8a4560c3","tests/ifcfiles/public/FM_ARC_DigitalHub.ifc":"84426eba85d565dc882022c5a41f17e82bc96d859ed9ca906fbf42b4461f28c6","tests/ifcfiles/public/ISSUE_005_haus.ifc":"6bf7a4d4e18776a6952914fd03acd96f81623ca5da6e5a7876fe4e64fd8df22e","tests/ifcfiles/public/ISSUE_021_Mini Project.ifc":"b5076f409b371d847cb453a9ab9a8d9de9d1c0eb27748ba7adc65571e0555a37","tests/ifcfiles/public/ISSUE_034_HouseZ.ifc":"ef512e88e26c916849445d3b741dd7979ee8a0dbf79ca788502092f84ea8f92b","tests/ifcfiles/public/ISSUE_044_test_IFCCOMPOSITEPROFILEDEF.ifc":"1b10710a3237960ed421ed8069bfd7ba2fa42cf15a52ef2139c8b3ed887e9b85","tests/ifcfiles/public/ISSUE_053_20181220Holter_Tower_10.ifc":"5a7a3711e8841135cc86bf92ba0ae9acc7e97b7a069927a64678c17653d3e609","tests/ifcfiles/public/ISSUE_068_ARK_NUS_skolebygg.ifc":"cd3081a53bd5667173caf391b17c5b1878fef4bfc252ef8330556e39afbd7c0d","tests/ifcfiles/public/ISSUE_102_M3D-CON-CD.ifc":"6e9612de56c08323e96b21e8f4097e42964bdf93066d460ddb0e7c184abdd15b","tests/ifcfiles/public/ISSUE_102_M3D-CON.ifc":"c83a0f31c6a52928fb9797456689c69c63d156c5bdf53cb49a83ed10d9e5bc23","tests/ifcfiles/public/ISSUE_126_model.ifc":"78e336de53ec658f2cd8fb51d5e2797ae1b5832cdadcdc22e7d0330a275a9545","tests/ifcfiles/public/ISSUE_129_N1540_17_EXE_MOD_448200_02_09_11SMC_IGC_V17.ifc":"a36fc248e0a8012045cd11f54ad0e9ed9fd7d7e7729a100599742fa8b06b4971","tests/ifcfiles/public/ISSUE_159_kleine_Wohnung_R22.ifc":"54d99140a79b693ebfbf92cab677e8579ad9b1a07f0654613b0bd519c4a8eafb","tests/ifcfiles/public/ISSUE_171_IfcSurfaceCurveSweptAreaSolid.ifc":"f2db8111ba05365cc54a6bcf8aade27764acfb615889f9302088aa1f1aa57c50","tests/ifcfiles/public/IfcOpenHouse_IFC4.ifc":"a9d854a4e47646bdc613aeca3c385474e851ac22b98bb8b7d783f7fee2f42c60","tests/ifcfiles/public/KIT-Simple-Road-Test-Web-IFC4x3_RC2.ifc":"3d8707ee9d70e2aeb67b8bebdc96016a1eceb30afd9a25e9cf6c258d978a6fe6","tests/ifcfiles/public/Office_A_20110811.ifc":"347c5e27081f0e29460124352781054ad2e00c0c09316b20f1981ae4e86a22ee","tests/ifcfiles/public/S_Office_Integrated Design Archi.ifc":"62cb878a60d880d989797a00f0faacdf5ad01a7f9ee1131e6804977366fb509a","tests/ifcfiles/public/Sample_entities.ifc":"270a55940a77ebb4f245cabf8c7429dc8fc7044baf9c9434fc747842f602d792","tests/ifcfiles/public/advanced_model.ifc":"c3247ec09d381688bb901d3bd85ae51a01dba70105cd9274b8cfd194ba94da12","tests/ifcfiles/public/dental_clinic.ifc":"757f4eccbbf9cd59806bee813e902cb13b6ace71bac106e4bce109764a79fbb2","tests/ifcfiles/public/duplex.ifc":"1da1e60682e4be608affcc697e79d24b76b984d7cc9cd465c3b97499a3a681ed","tests/ifcfiles/public/example.ifc":"4b9ab3d47e0b8e82fe2cb9a69ef452192204891528a291e989ccbc02aae27391","tests/ifcfiles/public/ifcbridge-model01.ifc":"00c016be5509e4145b3662dbdeedd67e7e60e6648ad1c247d6a41e41657b7e33","tests/ifcfiles/public/schependomlaan.ifc":"a0c7e4f336323a772f2dde464ed8919c4c5d3b3d4b62342129a4da73f5526880","tests/ifcfiles/public/tested_sample_project.ifc":"c4bf6c87a2e09795f0d854dc2c6eeb92829790c565ff86b1e03007648729bb26"}
{"tests/ifcfiles/public/AC20-FZK-Haus.ifc":"6bf7a4d4e18776a6952914fd03acd96f81623ca5da6e5a7876fe4e64fd8df22e","tests/ifcfiles/public/C20-Institute-Var-2.ifc":"288a7ba65b562e1bdd6548f60f0e2339306578625cb445670f0bbf1c8a4560c3","tests/ifcfiles/public/FM_ARC_DigitalHub.ifc":"84426eba85d565dc882022c5a41f17e82bc96d859ed9ca906fbf42b4461f28c6","tests/ifcfiles/public/ISSUE_005_haus.ifc":"6bf7a4d4e18776a6952914fd03acd96f81623ca5da6e5a7876fe4e64fd8df22e","tests/ifcfiles/public/ISSUE_021_Mini Project.ifc":"b5076f409b371d847cb453a9ab9a8d9de9d1c0eb27748ba7adc65571e0555a37","tests/ifcfiles/public/ISSUE_034_HouseZ.ifc":"ef512e88e26c916849445d3b741dd7979ee8a0dbf79ca788502092f84ea8f92b","tests/ifcfiles/public/ISSUE_044_test_IFCCOMPOSITEPROFILEDEF.ifc":"1b10710a3237960ed421ed8069bfd7ba2fa42cf15a52ef2139c8b3ed887e9b85","tests/ifcfiles/public/ISSUE_053_20181220Holter_Tower_10.ifczip":"5a7a3711e8841135cc86bf92ba0ae9acc7e97b7a069927a64678c17653d3e609","tests/ifcfiles/public/ISSUE_068_ARK_NUS_skolebygg.ifc":"cd3081a53bd5667173caf391b17c5b1878fef4bfc252ef8330556e39afbd7c0d","tests/ifcfiles/public/ISSUE_102_M3D-CON-CD.ifc":"6e9612de56c08323e96b21e8f4097e42964bdf93066d460ddb0e7c184abdd15b","tests/ifcfiles/public/ISSUE_102_M3D-CON.ifc":"c83a0f31c6a52928fb9797456689c69c63d156c5bdf53cb49a83ed10d9e5bc23","tests/ifcfiles/public/ISSUE_126_model.ifc":"78e336de53ec658f2cd8fb51d5e2797ae1b5832cdadcdc22e7d0330a275a9545","tests/ifcfiles/public/ISSUE_129_N1540_17_EXE_MOD_448200_02_09_11SMC_IGC_V17.ifc":"6c310c323e8291cbfc0d05b0afa33f98249a14c8274a089eb9350f9cd03a214e","tests/ifcfiles/public/ISSUE_159_kleine_Wohnung_R22.ifc":"54d99140a79b693ebfbf92cab677e8579ad9b1a07f0654613b0bd519c4a8eafb","tests/ifcfiles/public/ISSUE_171_IfcSurfaceCurveSweptAreaSolid.ifc":"f2db8111ba05365cc54a6bcf8aade27764acfb615889f9302088aa1f1aa57c50","tests/ifcfiles/public/IfcOpenHouse_IFC4.ifc":"a9d854a4e47646bdc613aeca3c385474e851ac22b98bb8b7d783f7fee2f42c60","tests/ifcfiles/public/KIT-Simple-Road-Test-Web-IFC4x3_RC2.ifc":"3d8707ee9d70e2aeb67b8bebdc96016a1eceb30afd9a25e9cf6c258d978a6fe6","tests/ifcfiles/public/Office_A_20110811.ifc":"347c5e27081f0e29460124352781054ad2e00c0c09316b20f1981ae4e86a22ee","tests/ifcfiles/public/S_Office_Integrated Design Archi.ifc":"62cb878a60d880d989797a00f0faacdf5ad01a7f9ee1131e6804977366fb509a","tests/ifcfiles/public/Sample_entities.ifc":"270a55940a77ebb4f245cabf8c7429dc8fc7044baf9c9434fc747842f602d792","tests/ifcfiles/public/advanced_model.ifc":"c3247ec09d381688bb901d3bd85ae51a01dba70105cd9274b8cfd194ba94da12","tests/ifcfiles/public/dental_clinic.ifc":"757f4eccbbf9cd59806bee813e902cb13b6ace71bac106e4bce109764a79fbb2","tests/ifcfiles/public/duplex.ifc":"1da1e60682e4be608affcc697e79d24b76b984d7cc9cd465c3b97499a3a681ed","tests/ifcfiles/public/example.ifc":"4b9ab3d47e0b8e82fe2cb9a69ef452192204891528a291e989ccbc02aae27391","tests/ifcfiles/public/ifcbridge-model01.ifc":"00c016be5509e4145b3662dbdeedd67e7e60e6648ad1c247d6a41e41657b7e33","tests/ifcfiles/public/schependomlaan.ifc":"a0c7e4f336323a772f2dde464ed8919c4c5d3b3d4b62342129a4da73f5526880","tests/ifcfiles/public/tested_sample_project.ifc":"c4bf6c87a2e09795f0d854dc2c6eeb92829790c565ff86b1e03007648729bb26"}
Loading