2011-06-14 15:58:22 +00:00
|
|
|
/*
|
2012-02-03 03:38:30 +00:00
|
|
|
Open Asset Import Library (assimp)
|
2011-06-14 15:58:22 +00:00
|
|
|
----------------------------------------------------------------------
|
|
|
|
|
2015-06-28 19:48:25 +00:00
|
|
|
Copyright (c) 2006-2015, assimp team
|
2011-06-14 15:58:22 +00:00
|
|
|
All rights reserved.
|
|
|
|
|
|
|
|
Redistribution and use of this software in source and binary forms,
|
|
|
|
with or without modification, are permitted provided that the
|
|
|
|
following conditions are met:
|
|
|
|
|
|
|
|
* Redistributions of source code must retain the above
|
|
|
|
copyright notice, this list of conditions and the
|
|
|
|
following disclaimer.
|
|
|
|
|
|
|
|
* Redistributions in binary form must reproduce the above
|
|
|
|
copyright notice, this list of conditions and the
|
|
|
|
following disclaimer in the documentation and/or other
|
|
|
|
materials provided with the distribution.
|
|
|
|
|
2012-02-03 03:38:30 +00:00
|
|
|
* Neither the name of the assimp team, nor the names of its
|
2011-06-14 15:58:22 +00:00
|
|
|
contributors may be used to endorse or promote products
|
|
|
|
derived from this software without specific prior
|
2012-02-03 03:38:30 +00:00
|
|
|
written permission of the assimp team.
|
2011-06-14 15:58:22 +00:00
|
|
|
|
|
|
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
|
|
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
|
|
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
|
|
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
|
|
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
|
|
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
|
|
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
|
|
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
|
|
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
|
|
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
|
|
|
|
----------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
|
|
|
|
/** @file IFC.cpp
|
|
|
|
* @brief Implementation of the Industry Foundation Classes loader.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef INCLUDED_IFCUTIL_H
|
|
|
|
#define INCLUDED_IFCUTIL_H
|
|
|
|
|
|
|
|
#include "IFCReaderGen.h"
|
|
|
|
#include "IFCLoader.h"
|
2015-06-28 19:48:25 +00:00
|
|
|
#include "STEPFile.h"
|
|
|
|
#include "../include/assimp/mesh.h"
|
|
|
|
#include "../include/assimp/material.h"
|
2015-04-15 23:00:17 +00:00
|
|
|
|
2015-04-15 19:22:26 +00:00
|
|
|
|
|
|
|
struct aiNode;
|
2011-06-14 15:58:22 +00:00
|
|
|
|
|
|
|
namespace Assimp {
|
|
|
|
namespace IFC {
|
|
|
|
|
2012-02-02 22:50:24 +00:00
|
|
|
typedef double IfcFloat;
|
2012-02-02 02:09:49 +00:00
|
|
|
|
|
|
|
// IfcFloat-precision math data types
|
|
|
|
typedef aiVector2t<IfcFloat> IfcVector2;
|
|
|
|
typedef aiVector3t<IfcFloat> IfcVector3;
|
|
|
|
typedef aiMatrix4x4t<IfcFloat> IfcMatrix4;
|
|
|
|
typedef aiMatrix3x3t<IfcFloat> IfcMatrix3;
|
|
|
|
typedef aiColor4t<IfcFloat> IfcColor4;
|
|
|
|
|
|
|
|
|
2013-02-07 08:51:33 +00:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
// Helper for std::for_each to delete all heap-allocated items in a container
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2011-06-14 15:58:22 +00:00
|
|
|
template<typename T>
|
|
|
|
struct delete_fun
|
|
|
|
{
|
|
|
|
void operator()(T* del) {
|
|
|
|
delete del;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2013-02-07 08:51:33 +00:00
|
|
|
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
// Helper used during mesh construction. Aids at creating aiMesh'es out of relatively few polygons.
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
struct TempMesh
|
|
|
|
{
|
|
|
|
std::vector<IfcVector3> verts;
|
|
|
|
std::vector<unsigned int> vertcnt;
|
|
|
|
|
|
|
|
// utilities
|
|
|
|
aiMesh* ToMesh();
|
|
|
|
void Clear();
|
|
|
|
void Transform(const IfcMatrix4& mat);
|
|
|
|
IfcVector3 Center() const;
|
|
|
|
void Append(const TempMesh& other);
|
|
|
|
|
|
|
|
bool IsEmpty() const {
|
|
|
|
return verts.empty() && vertcnt.empty();
|
|
|
|
}
|
|
|
|
|
|
|
|
void RemoveAdjacentDuplicates();
|
|
|
|
void RemoveDegenerates();
|
|
|
|
|
|
|
|
void FixupFaceOrientation();
|
2015-02-23 13:23:28 +00:00
|
|
|
|
|
|
|
static IfcVector3 ComputePolygonNormal(const IfcVector3* vtcs, size_t cnt, bool normalize = true);
|
2013-02-07 08:51:33 +00:00
|
|
|
IfcVector3 ComputeLastPolygonNormal(bool normalize = true) const;
|
2015-02-23 13:23:28 +00:00
|
|
|
void ComputePolygonNormals(std::vector<IfcVector3>& normals, bool normalize = true, size_t ofs = 0) const;
|
2013-02-07 08:51:33 +00:00
|
|
|
|
|
|
|
void Swap(TempMesh& other);
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2011-06-14 15:58:22 +00:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
// Temporary representation of an opening in a wall or a floor
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
struct TempOpening
|
|
|
|
{
|
2012-11-02 03:29:04 +00:00
|
|
|
const IFC::IfcSolidModel* solid;
|
2012-02-02 02:09:49 +00:00
|
|
|
IfcVector3 extrusionDir;
|
2013-01-27 20:21:30 +00:00
|
|
|
|
2011-06-14 15:58:22 +00:00
|
|
|
boost::shared_ptr<TempMesh> profileMesh;
|
2013-01-27 20:21:30 +00:00
|
|
|
boost::shared_ptr<TempMesh> profileMesh2D;
|
2011-06-14 15:58:22 +00:00
|
|
|
|
2012-10-20 23:18:48 +00:00
|
|
|
// list of points generated for this opening. This is used to
|
|
|
|
// create connections between two opposing holes created
|
|
|
|
// from a single opening instance (two because walls tend to
|
|
|
|
// have two sides). If !empty(), the other side of the wall
|
|
|
|
// has already been processed.
|
|
|
|
std::vector<IfcVector3> wallPoints;
|
|
|
|
|
2012-10-20 21:26:49 +00:00
|
|
|
// ------------------------------------------------------------------------------
|
|
|
|
TempOpening()
|
|
|
|
: solid()
|
|
|
|
, extrusionDir()
|
|
|
|
, profileMesh()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2011-06-14 15:58:22 +00:00
|
|
|
// ------------------------------------------------------------------------------
|
2013-01-27 20:21:30 +00:00
|
|
|
TempOpening(const IFC::IfcSolidModel* solid,IfcVector3 extrusionDir,
|
|
|
|
boost::shared_ptr<TempMesh> profileMesh,
|
|
|
|
boost::shared_ptr<TempMesh> profileMesh2D)
|
2011-06-14 15:58:22 +00:00
|
|
|
: solid(solid)
|
|
|
|
, extrusionDir(extrusionDir)
|
|
|
|
, profileMesh(profileMesh)
|
2013-01-27 20:21:30 +00:00
|
|
|
, profileMesh2D(profileMesh2D)
|
2011-06-14 15:58:22 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------
|
2012-02-02 02:09:49 +00:00
|
|
|
void Transform(const IfcMatrix4& mat); // defined later since TempMesh is not complete yet
|
2013-02-07 08:51:33 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------
|
|
|
|
// Helper to sort openings by distance from a given base point
|
|
|
|
struct DistanceSorter {
|
|
|
|
|
|
|
|
DistanceSorter(const IfcVector3& base) : base(base) {}
|
|
|
|
|
|
|
|
bool operator () (const TempOpening& a, const TempOpening& b) const {
|
|
|
|
return (a.profileMesh->Center()-base).SquareLength() < (b.profileMesh->Center()-base).SquareLength();
|
|
|
|
}
|
|
|
|
|
|
|
|
IfcVector3 base;
|
|
|
|
};
|
2011-06-14 15:58:22 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
// Intermediate data storage during conversion. Keeps everything and a bit more.
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
struct ConversionData
|
|
|
|
{
|
|
|
|
ConversionData(const STEP::DB& db, const IFC::IfcProject& proj, aiScene* out,const IFCImporter::Settings& settings)
|
|
|
|
: len_scale(1.0)
|
2012-07-12 00:20:28 +00:00
|
|
|
, angle_scale(-1.0)
|
2011-06-14 15:58:22 +00:00
|
|
|
, db(db)
|
|
|
|
, proj(proj)
|
|
|
|
, out(out)
|
|
|
|
, settings(settings)
|
|
|
|
, apply_openings()
|
|
|
|
, collect_openings()
|
|
|
|
{}
|
|
|
|
|
|
|
|
~ConversionData() {
|
|
|
|
std::for_each(meshes.begin(),meshes.end(),delete_fun<aiMesh>());
|
|
|
|
std::for_each(materials.begin(),materials.end(),delete_fun<aiMaterial>());
|
|
|
|
}
|
|
|
|
|
2012-02-02 02:09:49 +00:00
|
|
|
IfcFloat len_scale, angle_scale;
|
2011-06-14 15:58:22 +00:00
|
|
|
bool plane_angle_in_radians;
|
|
|
|
|
|
|
|
const STEP::DB& db;
|
|
|
|
const IFC::IfcProject& proj;
|
|
|
|
aiScene* out;
|
|
|
|
|
2012-02-02 02:09:49 +00:00
|
|
|
IfcMatrix4 wcs;
|
2011-06-14 15:58:22 +00:00
|
|
|
std::vector<aiMesh*> meshes;
|
|
|
|
std::vector<aiMaterial*> materials;
|
|
|
|
|
2015-02-23 13:23:28 +00:00
|
|
|
struct MeshCacheIndex {
|
|
|
|
const IFC::IfcRepresentationItem* item; unsigned int matindex;
|
|
|
|
MeshCacheIndex() : item(NULL), matindex(0) { }
|
|
|
|
MeshCacheIndex(const IFC::IfcRepresentationItem* i, unsigned int mi) : item(i), matindex(mi) { }
|
|
|
|
bool operator == (const MeshCacheIndex& o) const { return item == o.item && matindex == o.matindex; }
|
|
|
|
bool operator < (const MeshCacheIndex& o) const { return item < o.item || (item == o.item && matindex < o.matindex); }
|
|
|
|
};
|
|
|
|
typedef std::map<MeshCacheIndex, std::vector<unsigned int> > MeshCache;
|
2011-06-14 15:58:22 +00:00
|
|
|
MeshCache cached_meshes;
|
|
|
|
|
2015-02-23 13:23:28 +00:00
|
|
|
typedef std::map<const IFC::IfcSurfaceStyle*, unsigned int> MaterialCache;
|
|
|
|
MaterialCache cached_materials;
|
|
|
|
|
2011-06-14 15:58:22 +00:00
|
|
|
const IFCImporter::Settings& settings;
|
|
|
|
|
|
|
|
// Intermediate arrays used to resolve openings in walls: only one of them
|
|
|
|
// can be given at a time. apply_openings if present if the current element
|
|
|
|
// is a wall and needs its openings to be poured into its geometry while
|
|
|
|
// collect_openings is present only if the current element is an
|
|
|
|
// IfcOpeningElement, for which all the geometry needs to be preserved
|
|
|
|
// for later processing by a parent, which is a wall.
|
|
|
|
std::vector<TempOpening>* apply_openings;
|
|
|
|
std::vector<TempOpening>* collect_openings;
|
2013-03-29 12:33:18 +00:00
|
|
|
|
|
|
|
std::set<uint64_t> already_processed;
|
2011-06-14 15:58:22 +00:00
|
|
|
};
|
|
|
|
|
2013-02-07 08:51:33 +00:00
|
|
|
|
2011-07-17 01:09:56 +00:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
// Binary predicate to compare vectors with a given, quadratic epsilon.
|
2011-06-14 15:58:22 +00:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
struct FuzzyVectorCompare {
|
|
|
|
|
2012-02-02 02:09:49 +00:00
|
|
|
FuzzyVectorCompare(IfcFloat epsilon) : epsilon(epsilon) {}
|
|
|
|
bool operator()(const IfcVector3& a, const IfcVector3& b) {
|
2015-02-23 13:23:28 +00:00
|
|
|
return std::abs((a-b).SquareLength()) < epsilon;
|
2011-06-14 15:58:22 +00:00
|
|
|
}
|
|
|
|
|
2012-02-02 02:09:49 +00:00
|
|
|
const IfcFloat epsilon;
|
2011-06-14 15:58:22 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2013-02-07 08:51:33 +00:00
|
|
|
// Ordering predicate to totally order R^2 vectors first by x and then by y
|
2011-06-14 15:58:22 +00:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2013-02-07 08:51:33 +00:00
|
|
|
struct XYSorter {
|
|
|
|
|
|
|
|
// sort first by X coordinates, then by Y coordinates
|
|
|
|
bool operator () (const IfcVector2&a, const IfcVector2& b) const {
|
|
|
|
if (a.x == b.x) {
|
|
|
|
return a.y < b.y;
|
|
|
|
}
|
|
|
|
return a.x < b.x;
|
2012-11-02 04:46:46 +00:00
|
|
|
}
|
2011-06-14 15:58:22 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// conversion routines for common IFC entities, implemented in IFCUtil.cpp
|
2012-02-02 22:42:11 +00:00
|
|
|
void ConvertColor(aiColor4D& out, const IfcColourRgb& in);
|
|
|
|
void ConvertColor(aiColor4D& out, const IfcColourOrFactor& in,ConversionData& conv,const aiColor4D* base);
|
2012-02-02 02:09:49 +00:00
|
|
|
void ConvertCartesianPoint(IfcVector3& out, const IfcCartesianPoint& in);
|
|
|
|
void ConvertDirection(IfcVector3& out, const IfcDirection& in);
|
|
|
|
void ConvertVector(IfcVector3& out, const IfcVector& in);
|
|
|
|
void AssignMatrixAxes(IfcMatrix4& out, const IfcVector3& x, const IfcVector3& y, const IfcVector3& z);
|
|
|
|
void ConvertAxisPlacement(IfcMatrix4& out, const IfcAxis2Placement3D& in);
|
|
|
|
void ConvertAxisPlacement(IfcMatrix4& out, const IfcAxis2Placement2D& in);
|
|
|
|
void ConvertAxisPlacement(IfcVector3& axis, IfcVector3& pos, const IFC::IfcAxis1Placement& in);
|
|
|
|
void ConvertAxisPlacement(IfcMatrix4& out, const IfcAxis2Placement& in, ConversionData& conv);
|
|
|
|
void ConvertTransformOperator(IfcMatrix4& out, const IfcCartesianTransformationOperator& op);
|
2011-06-14 15:58:22 +00:00
|
|
|
bool IsTrue(const EXPRESS::BOOLEAN& in);
|
2012-02-02 02:09:49 +00:00
|
|
|
IfcFloat ConvertSIPrefix(const std::string& prefix);
|
2011-06-14 15:58:22 +00:00
|
|
|
|
|
|
|
|
|
|
|
// IFCProfile.cpp
|
|
|
|
bool ProcessProfile(const IfcProfileDef& prof, TempMesh& meshout, ConversionData& conv);
|
2015-04-13 14:01:33 +00:00
|
|
|
bool ProcessCurve(const IfcCurve& curve, TempMesh& meshout, ConversionData& conv);
|
2011-06-14 15:58:22 +00:00
|
|
|
|
|
|
|
// IFCMaterial.cpp
|
2015-02-23 13:23:28 +00:00
|
|
|
unsigned int ProcessMaterials(uint64_t id, unsigned int prevMatId, ConversionData& conv, bool forceDefaultMat);
|
2011-06-14 15:58:22 +00:00
|
|
|
|
|
|
|
// IFCGeometry.cpp
|
2013-02-07 08:51:33 +00:00
|
|
|
IfcMatrix3 DerivePlaneCoordinateSpace(const TempMesh& curmesh, bool& ok, IfcVector3& norOut);
|
2015-02-23 13:23:28 +00:00
|
|
|
bool ProcessRepresentationItem(const IfcRepresentationItem& item, unsigned int matid, std::vector<unsigned int>& mesh_indices, ConversionData& conv);
|
2011-06-14 15:58:22 +00:00
|
|
|
void AssignAddedMeshes(std::vector<unsigned int>& mesh_indices,aiNode* nd,ConversionData& /*conv*/);
|
|
|
|
|
2013-02-07 08:51:33 +00:00
|
|
|
void ProcessSweptAreaSolid(const IfcSweptAreaSolid& swept, TempMesh& meshout,
|
|
|
|
ConversionData& conv);
|
|
|
|
|
|
|
|
void ProcessExtrudedAreaSolid(const IfcExtrudedAreaSolid& solid, TempMesh& result,
|
|
|
|
ConversionData& conv, bool collect_openings);
|
|
|
|
|
|
|
|
// IFCBoolean.cpp
|
|
|
|
|
|
|
|
void ProcessBoolean(const IfcBooleanResult& boolean, TempMesh& result, ConversionData& conv);
|
|
|
|
void ProcessBooleanHalfSpaceDifference(const IfcHalfSpaceSolid* hs, TempMesh& result,
|
|
|
|
const TempMesh& first_operand,
|
|
|
|
ConversionData& conv);
|
|
|
|
|
|
|
|
void ProcessPolygonalBoundedBooleanHalfSpaceDifference(const IfcPolygonalBoundedHalfSpace* hs, TempMesh& result,
|
|
|
|
const TempMesh& first_operand,
|
|
|
|
ConversionData& conv);
|
|
|
|
void ProcessBooleanExtrudedAreaSolidDifference(const IfcExtrudedAreaSolid* as, TempMesh& result,
|
|
|
|
const TempMesh& first_operand,
|
|
|
|
ConversionData& conv);
|
|
|
|
|
|
|
|
|
|
|
|
// IFCOpenings.cpp
|
|
|
|
|
|
|
|
bool GenerateOpenings(std::vector<TempOpening>& openings,
|
|
|
|
const std::vector<IfcVector3>& nors,
|
|
|
|
TempMesh& curmesh,
|
|
|
|
bool check_intersection,
|
|
|
|
bool generate_connection_geometry,
|
|
|
|
const IfcVector3& wall_extrusion_axis = IfcVector3(0,1,0));
|
|
|
|
|
2011-07-17 01:09:56 +00:00
|
|
|
|
2013-02-07 15:31:43 +00:00
|
|
|
|
2011-07-17 01:09:56 +00:00
|
|
|
// IFCCurve.cpp
|
|
|
|
|
2011-07-18 01:13:40 +00:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
// Custom exception for use by members of the Curve class
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
class CurveError
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
CurveError(const std::string& s)
|
|
|
|
: s(s)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
std::string s;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2011-07-17 01:09:56 +00:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
// Temporary representation for an arbitrary sub-class of IfcCurve. Used to sample the curves
|
|
|
|
// to obtain a list of line segments.
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
class Curve
|
|
|
|
{
|
|
|
|
protected:
|
|
|
|
|
|
|
|
Curve(const IfcCurve& base_entity, ConversionData& conv)
|
|
|
|
: base_entity(base_entity)
|
|
|
|
, conv(conv)
|
|
|
|
{}
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
2012-02-02 02:09:49 +00:00
|
|
|
typedef std::pair<IfcFloat, IfcFloat> ParamRange;
|
2011-07-17 23:35:39 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
|
2012-04-22 22:33:43 +00:00
|
|
|
|
|
|
|
virtual ~Curve() {}
|
|
|
|
|
|
|
|
|
2011-07-17 23:35:39 +00:00
|
|
|
// check if a curve is closed
|
|
|
|
virtual bool IsClosed() const = 0;
|
|
|
|
|
2011-07-17 01:09:56 +00:00
|
|
|
// evaluate the curve at the given parametric position
|
2012-02-02 02:09:49 +00:00
|
|
|
virtual IfcVector3 Eval(IfcFloat p) const = 0;
|
2011-07-17 01:09:56 +00:00
|
|
|
|
2011-07-18 01:13:40 +00:00
|
|
|
// try to match a point on the curve to a given parameter
|
|
|
|
// for self-intersecting curves, the result is not ambiguous and
|
|
|
|
// it is undefined which parameter is returned.
|
2012-02-02 02:09:49 +00:00
|
|
|
virtual bool ReverseEval(const IfcVector3& val, IfcFloat& paramOut) const;
|
2011-07-18 01:13:40 +00:00
|
|
|
|
2011-07-17 01:09:56 +00:00
|
|
|
// get the range of the curve (both inclusive).
|
|
|
|
// +inf and -inf are valid return values, the curve is not bounded in such a case.
|
2012-02-02 02:09:49 +00:00
|
|
|
virtual std::pair<IfcFloat,IfcFloat> GetParametricRange() const = 0;
|
|
|
|
IfcFloat GetParametricRangeDelta() const;
|
2011-07-17 23:35:39 +00:00
|
|
|
|
|
|
|
// estimate the number of sample points that this curve will require
|
2012-02-02 02:09:49 +00:00
|
|
|
virtual size_t EstimateSampleCount(IfcFloat start,IfcFloat end) const;
|
2011-07-17 23:35:39 +00:00
|
|
|
|
|
|
|
// intelligently sample the curve based on the current settings
|
|
|
|
// and append the result to the mesh
|
2012-02-02 02:09:49 +00:00
|
|
|
virtual void SampleDiscrete(TempMesh& out,IfcFloat start,IfcFloat end) const;
|
2011-07-17 23:35:39 +00:00
|
|
|
|
2013-11-21 12:05:48 +00:00
|
|
|
#ifdef ASSIMP_BUILD_DEBUG
|
2011-07-17 23:35:39 +00:00
|
|
|
// check if a particular parameter value lies within the well-defined range
|
2012-02-02 02:09:49 +00:00
|
|
|
bool InRange(IfcFloat) const;
|
2011-07-17 23:35:39 +00:00
|
|
|
#endif
|
2011-07-17 01:09:56 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
static Curve* Convert(const IFC::IfcCurve&,ConversionData& conv);
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
const IfcCurve& base_entity;
|
|
|
|
ConversionData& conv;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// --------------------------------------------------------------------------------
|
|
|
|
// A BoundedCurve always holds the invariant that GetParametricRange()
|
|
|
|
// never returns infinite values.
|
|
|
|
// --------------------------------------------------------------------------------
|
|
|
|
class BoundedCurve : public Curve
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
BoundedCurve(const IfcBoundedCurve& entity, ConversionData& conv)
|
|
|
|
: Curve(entity,conv)
|
|
|
|
{}
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
2011-07-17 23:35:39 +00:00
|
|
|
bool IsClosed() const;
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
// sample the entire curve
|
2011-07-17 01:09:56 +00:00
|
|
|
void SampleDiscrete(TempMesh& out) const;
|
2011-07-17 23:35:39 +00:00
|
|
|
using Curve::SampleDiscrete;
|
2011-07-17 01:09:56 +00:00
|
|
|
};
|
|
|
|
|
2013-02-07 08:51:33 +00:00
|
|
|
// IfcProfile.cpp
|
|
|
|
bool ProcessCurve(const IfcCurve& curve, TempMesh& meshout, ConversionData& conv);
|
2011-06-14 15:58:22 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|