Skip to content

Commit e6e154e

Browse files
Styles + bugfixes (fix points order in loops) (#3)
1 parent 453c88d commit e6e154e

14 files changed

+977
-766
lines changed

CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ set( HEADERS
3535
include/ifcpp/Geometry/GeometryGenerator.h
3636
include/ifcpp/Geometry/CAdapter.h
3737
include/ifcpp/Geometry/GeometryConverter.h
38-
include/ifcpp/Geometry/PrimitivesConverter.h
38+
include/ifcpp/Geometry/PrimitiveTypesConverter.h
3939
include/ifcpp/Geometry/VectorAdapter.h
4040
include/ifcpp/Geometry/Parameters.h
4141
include/ifcpp/Geometry/CurveConverter.h
@@ -44,6 +44,8 @@ set( HEADERS
4444
include/ifcpp/Geometry/SolidConverter.h
4545
include/ifcpp/Geometry/SplineConverter.h
4646
include/ifcpp/Geometry/Extruder.h
47+
include/ifcpp/Geometry/Helpers.h
48+
include/ifcpp/Geometry/StyleConverter.h
4749
${IFC_HEADERS} )
4850

4951

include/ifcpp/Geometry/CAdapter.h

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,25 +7,30 @@
77

88
#include "ifcpp/Geometry/CVector.h"
99
#include "ifcpp/Geometry/Matrix.h"
10+
#include "ifcpp/Geometry/StyleConverter.h"
1011

1112

1213
namespace ifcpp {
1314

1415
template<typename TAdapter>
1516
concept CAdapter = CVector<typename TAdapter::TVector> &&
1617
requires( TAdapter adapter, std::vector<typename TAdapter::TVector>& vertices, std::vector<int> indices,
17-
std::shared_ptr<IFC4X3::IfcObjectDefinition> ifcObjectDifinition, std::vector<typename TAdapter::TPolygon> polygons,
18-
std::vector<typename TAdapter::TPolyline> polylines, Matrix<typename TAdapter::TVector> matrix, std::vector<typename TAdapter::TVector> loop,
19-
std::vector<typename TAdapter::TPolygon> operand1, std::vector<typename TAdapter::TPolygon> operand2 ) {
18+
std::shared_ptr<IFC4X3::IfcObjectDefinition> ifcObjectDifinition, std::vector<typename TAdapter::TTriangle> triangles,
19+
std::vector<typename TAdapter::TMesh> meshes, std::vector<typename TAdapter::TPolyline> polylines, Matrix<typename TAdapter::TVector> matrix,
20+
std::vector<typename TAdapter::TVector> loop, std::vector<typename TAdapter::TMesh> operand1, std::vector<typename TAdapter::TMesh> operand2,
21+
std::vector<std::shared_ptr<Style>> styles ) {
2022
{ adapter.CreatePolyline( vertices ) } -> std::same_as<typename TAdapter::TPolyline>;
21-
{ adapter.CreatePolygon( vertices, indices ) } -> std::same_as<typename TAdapter::TPolygon>;
22-
{ adapter.CreateEntity( ifcObjectDifinition, polygons, polylines ) } -> std::same_as<typename TAdapter::TEntity>;
23-
{ adapter.Transform( &polygons, matrix ) } -> std::same_as<void>;
23+
{ adapter.CreateTriangle( vertices, indices ) } -> std::same_as<typename TAdapter::TTriangle>;
24+
{ adapter.CreateMesh( triangles ) } -> std::same_as<typename TAdapter::TMesh>;
25+
{ adapter.CreateEntity( ifcObjectDifinition, meshes, polylines ) } -> std::same_as<typename TAdapter::TEntity>;
26+
{ adapter.Transform( &meshes, matrix ) } -> std::same_as<void>;
2427
{ adapter.Transform( &polylines, matrix ) } -> std::same_as<void>;
28+
{ adapter.AddStyles( &meshes, styles ) } -> std::same_as<void>;
29+
{ adapter.AddStyles( &polylines, styles ) } -> std::same_as<void>;
2530
{ adapter.Triangulate( loop ) } -> std::same_as<std::vector<int>>;
26-
{ adapter.ComputeUnion( operand1, operand2 ) } -> std::same_as<std::vector<typename TAdapter::TPolygon>>;
27-
{ adapter.ComputeIntersection( operand1, operand2 ) } -> std::same_as<std::vector<typename TAdapter::TPolygon>>;
28-
{ adapter.ComputeDifference( operand1, operand2 ) } -> std::same_as<std::vector<typename TAdapter::TPolygon>>;
31+
{ adapter.ComputeUnion( operand1, operand2 ) } -> std::same_as<std::vector<typename TAdapter::TMesh>>;
32+
{ adapter.ComputeIntersection( operand1, operand2 ) } -> std::same_as<std::vector<typename TAdapter::TMesh>>;
33+
{ adapter.ComputeDifference( operand1, operand2 ) } -> std::same_as<std::vector<typename TAdapter::TMesh>>;
2934
};
3035

3136
}

include/ifcpp/Geometry/CurveConverter.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#include "ifcpp/Geometry/GeomUtils.h"
55
#include "ifcpp/Geometry/Matrix.h"
66
#include "ifcpp/Geometry/Parameters.h"
7-
#include "ifcpp/Geometry/PrimitivesConverter.h"
7+
#include "ifcpp/Geometry/PrimitiveTypesConverter.h"
88
#include "ifcpp/Geometry/SplineConverter.h"
99
#include "ifcpp/Geometry/VectorAdapter.h"
1010

@@ -44,13 +44,13 @@ class CurveConverter {
4444
using AVector = VectorAdapter<TVector>;
4545
using TMatrix = Matrix<TVector>;
4646

47-
std::shared_ptr<PrimitivesConverter<TVector>> m_primitivesConverter;
47+
std::shared_ptr<PrimitiveTypesConverter<TVector>> m_primitivesConverter;
4848
std::shared_ptr<GeomUtils<TVector>> m_geomUtils;
4949
std::shared_ptr<SplineConverter<TVector>> m_splineConverter;
5050
std::shared_ptr<Parameters> m_parameters;
5151

5252
public:
53-
CurveConverter( const std::shared_ptr<PrimitivesConverter<TVector>>& primitivesConverter, const std::shared_ptr<GeomUtils<TVector>>& geomUtils,
53+
CurveConverter( const std::shared_ptr<PrimitiveTypesConverter<TVector>>& primitivesConverter, const std::shared_ptr<GeomUtils<TVector>>& geomUtils,
5454
const std::shared_ptr<SplineConverter<TVector>> splineConverter, const std::shared_ptr<Parameters>& parameters )
5555
: m_primitivesConverter( primitivesConverter )
5656
, m_geomUtils( geomUtils )

include/ifcpp/Geometry/Extruder.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class Extruder {
3030
if( profile.empty() ) {
3131
return {};
3232
}
33-
// TODO: It is not important to simplify profile here
33+
// TODO: It is not important to simplify profile heres
3434
if( asClosed ) {
3535
profile = this->m_geomUtils->SimplifyLoop( profile );
3636
profile.push_back( profile[ 0 ] );
@@ -40,7 +40,7 @@ class Extruder {
4040
std::vector<TLoop> result;
4141

4242
// TODO: Rework
43-
if( AVector::Dot( extrusion, this->m_geomUtils->ComputePlaneNormal( profile ) ) < 0 ) {
43+
if( AVector::Dot( extrusion, this->m_geomUtils->ComputePolygonNormal( profile ) ) < 0 ) {
4444
for( auto& point: profile ) {
4545
point = point + extrusion;
4646
}

0 commit comments

Comments
 (0)