Skip to content

Commit b2a5466

Browse files
committed
improve geometry processing
1 parent d28b77d commit b2a5466

File tree

134 files changed

+9682
-9156
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

134 files changed

+9682
-9156
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,4 @@ IfcPlusPlus/src/ifcpp--
5050
IfcPlusPlus/src/ifcpp---/
5151
IfcPlusPlus/src/ifcpp----/
5252
examples/LoadFileExample/dump_mesh_debug.txt
53+
examples/CreateIfcWallAndWriteFile/example.ifc

IfcPlusPlus/IfcPlusPlus.vcxproj

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,8 @@
258258
<EnableParallelCodeGeneration>true</EnableParallelCodeGeneration>
259259
<FloatingPointExceptions>true</FloatingPointExceptions>
260260
<RuntimeTypeInfo>true</RuntimeTypeInfo>
261-
<OpenMPSupport>true</OpenMPSupport>
261+
<OpenMPSupport>
262+
</OpenMPSupport>
262263
<WholeProgramOptimization>true</WholeProgramOptimization>
263264
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
264265
<AdditionalOptions>
@@ -398,6 +399,9 @@
398399
<ClInclude Include="src\ifcpp\geometry\GeometryInputData.h" />
399400
<ClInclude Include="src\ifcpp\geometry\GeomUtils.h" />
400401
<ClInclude Include="src\ifcpp\geometry\IncludeCarveHeaders.h" />
402+
<ClInclude Include="src\ifcpp\geometry\MeshNormalizer.h" />
403+
<ClInclude Include="src\ifcpp\geometry\MeshOps.h" />
404+
<ClInclude Include="src\ifcpp\geometry\MeshSimplifier.h" />
401405
<ClInclude Include="src\ifcpp\geometry\PlacementConverter.h" />
402406
<ClInclude Include="src\ifcpp\geometry\PointConverter.h" />
403407
<ClInclude Include="src\ifcpp\geometry\ProfileCache.h" />
@@ -411,6 +415,8 @@
411415
<ClInclude Include="src\ifcpp\geometry\GeometrySettings.h" />
412416
<ClInclude Include="src\ifcpp\geometry\SceneGraphUtils.h" />
413417
<ClInclude Include="src\ifcpp\geometry\StylesConverter.h" />
418+
<ClInclude Include="src\ifcpp\IFC4X3\EntityFactory.h" />
419+
<ClInclude Include="src\ifcpp\IFC4X3\TypeFactory.h" />
414420
<ClInclude Include="src\ifcpp\IFC4\EntityFactory.h" />
415421
<ClInclude Include="src\ifcpp\IFC4\TypeFactory.h" />
416422
<ClInclude Include="src\ifcpp\model\AttributeObject.h" />

IfcPlusPlus/IfcPlusPlus.vcxproj.filters

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,21 @@
153153
<ClInclude Include="src\ifcpp\reader\AbstractReader.h">
154154
<Filter>Headerdateien</Filter>
155155
</ClInclude>
156+
<ClInclude Include="src\ifcpp\geometry\MeshSimplifier.h">
157+
<Filter>Headerdateien</Filter>
158+
</ClInclude>
159+
<ClInclude Include="src\ifcpp\geometry\MeshOps.h">
160+
<Filter>Headerdateien</Filter>
161+
</ClInclude>
162+
<ClInclude Include="src\ifcpp\geometry\MeshNormalizer.h">
163+
<Filter>Headerdateien</Filter>
164+
</ClInclude>
165+
<ClInclude Include="src\ifcpp\IFC4X3\EntityFactory.h">
166+
<Filter>Headerdateien</Filter>
167+
</ClInclude>
168+
<ClInclude Include="src\ifcpp\IFC4X3\TypeFactory.h">
169+
<Filter>Headerdateien</Filter>
170+
</ClInclude>
156171
</ItemGroup>
157172
<ItemGroup>
158173
<ClCompile Include="src\ifcpp\model\UnitConverter.cpp">
@@ -185,7 +200,6 @@
185200
<ClCompile Include="src\ifcpp\IFC4X3\TypeFactory.cpp">
186201
<Filter>Quelldateien</Filter>
187202
</ClCompile>
188-
189203
<ClCompile Include="src\external\Carve\src\common\geometry.cpp">
190204
<Filter>Quelldateien</Filter>
191205
</ClCompile>

IfcPlusPlus/src/external/Carve/src/common/write_ply.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,20 +68,20 @@ struct vertex_component : public gloop::stream::writer<double> {
6868
};
6969

7070
struct mesh_face : public gloop::stream::null_writer {
71-
std::vector<const carve::mesh::MeshSet<3>::face_t*> faces;
71+
std::vector<const carve::mesh::Face<3>*> faces;
7272
int i;
7373
mesh_face(const carve::mesh::MeshSet<3>* poly) : faces(), i(-1) {
7474
std::copy(poly->faceBegin(), poly->faceEnd(), std::back_inserter(faces));
7575
}
7676
void next() override { ++i; }
7777
int length() override { return faces.size(); }
78-
const carve::mesh::MeshSet<3>::face_t* curr() const { return faces[i]; }
78+
const carve::mesh::Face<3>* curr() const { return faces[i]; }
7979
};
8080

8181
struct mesh_face_idx : public gloop::stream::writer<size_t> {
8282
mesh_face& r;
83-
const carve::mesh::MeshSet<3>::face_t* f;
84-
carve::mesh::MeshSet<3>::face_t::const_edge_iter_t i;
83+
const carve::mesh::Face<3>* f;
84+
carve::mesh::Face<3>::const_edge_iter_t i;
8585
gloop::stream::Type data_type;
8686
int max_length;
8787

@@ -98,7 +98,7 @@ struct mesh_face_idx : public gloop::stream::writer<size_t> {
9898
int maxLength() override { return max_length; }
9999

100100
size_t value() override {
101-
const carve::mesh::MeshSet<3>::vertex_t* v = (*i++).vert;
101+
const carve::mesh::Vertex<3>* v = (*i++).vert;
102102
return v - &f->mesh->meshset->vertex_storage[0];
103103
}
104104
};

IfcPlusPlus/src/external/Carve/src/include/carve/aabb.hpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -80,12 +80,12 @@ struct aabb {
8080

8181
double maxAxisSeparation(const aabb<ndim>& other) const;
8282

83-
bool intersects(const aabb<ndim>& other) const;
84-
bool intersects(const sphere<ndim>& s) const;
85-
bool intersects(const plane<ndim>& plane) const;
86-
bool intersects(const ray<ndim>& ray) const;
87-
bool intersects(tri<ndim> tri) const;
88-
bool intersects(const linesegment<ndim>& ls) const;
83+
bool intersects(const aabb<ndim>& other, double eps) const;
84+
bool intersects(const sphere<ndim>& s, double eps) const;
85+
bool intersects(const plane<ndim>& plane, double eps) const;
86+
bool intersects(const ray<ndim>& ray, double eps) const;
87+
bool intersects(tri<ndim> tri, double eps) const;
88+
bool intersects(const linesegment<ndim>& ls, double eps) const;
8989

9090
std::pair<double, double> rangeInDirection( const carve::geom::vector<ndim>& v) const;
9191

IfcPlusPlus/src/external/Carve/src/include/carve/aabb_impl.hpp

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -208,12 +208,18 @@ namespace carve {
208208
}
209209

210210
template <unsigned ndim>
211-
bool aabb<ndim>::intersects(const aabb<ndim>& other) const {
212-
return maxAxisSeparation(other) <= 0.0;
211+
bool aabb<ndim>::intersects(const aabb<ndim>& other, double epsilon) const
212+
{
213+
double distance = maxAxisSeparation(other);
214+
if (distance <= epsilon)
215+
{
216+
return true;
217+
}
218+
return false;
213219
}
214220

215221
template <unsigned ndim>
216-
bool aabb<ndim>::intersects(const sphere<ndim>& s) const {
222+
bool aabb<ndim>::intersects(const sphere<ndim>& s, double eps) const {
217223
double r = 0.0;
218224
for( unsigned i = 0; i < ndim; ++i ) {
219225
double t = fabs(s.C[i] - pos[i]) - extent[i];
@@ -225,14 +231,14 @@ namespace carve {
225231
}
226232

227233
template <unsigned ndim>
228-
bool aabb<ndim>::intersects(const plane<ndim>& plane) const {
234+
bool aabb<ndim>::intersects(const plane<ndim>& plane, double eps) const {
229235
double d1 = fabs(distance(plane, pos));
230236
double d2 = dot(abs(plane.N), extent);
231237
return d1 <= d2;
232238
}
233239

234240
template <unsigned ndim>
235-
bool aabb<ndim>::intersects(const linesegment<ndim>& ls) const {
241+
bool aabb<ndim>::intersects(const linesegment<ndim>& ls, double eps) const {
236242
return intersectsLineSegment(ls.v1, ls.v2);
237243
}
238244

@@ -377,7 +383,7 @@ namespace carve {
377383
}
378384

379385
template <>
380-
inline bool aabb<3>::intersects(const ray<3>& ray) const {
386+
inline bool aabb<3>::intersects(const ray<3>& ray, double eps) const {
381387
vector<3> t = pos - ray.v;
382388
double r;
383389

@@ -475,7 +481,8 @@ namespace carve {
475481
}
476482

477483
template <>
478-
inline bool aabb<3>::intersects(tri<3> tri) const {
484+
inline bool aabb<3>::intersects(tri<3> tri, double eps) const
485+
{
479486
tri.v[0] -= pos;
480487
tri.v[1] -= pos;
481488
tri.v[2] -= pos;

0 commit comments

Comments
 (0)