2015-05-19 03:48:29 +00:00
|
|
|
/*
|
|
|
|
Open Asset Import Library (assimp)
|
|
|
|
----------------------------------------------------------------------
|
|
|
|
|
2022-01-10 20:13:43 +00:00
|
|
|
Copyright (c) 2006-2022, assimp team
|
2018-01-28 18:42:05 +00:00
|
|
|
|
2015-05-19 03:48:29 +00:00
|
|
|
All rights reserved.
|
|
|
|
|
2015-05-19 03:52:10 +00:00
|
|
|
Redistribution and use of this software in source and binary forms,
|
|
|
|
with or without modification, are permitted provided that the
|
2015-05-19 03:48:29 +00:00
|
|
|
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.
|
|
|
|
|
|
|
|
* Neither the name of the assimp team, nor the names of its
|
|
|
|
contributors may be used to endorse or promote products
|
|
|
|
derived from this software without specific prior
|
|
|
|
written permission of the assimp team.
|
|
|
|
|
2015-05-19 03:52:10 +00:00
|
|
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
|
|
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
2015-05-19 03:48:29 +00:00
|
|
|
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
2015-05-19 03:52:10 +00:00
|
|
|
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
2015-05-19 03:48:29 +00:00
|
|
|
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
2015-05-19 03:52:10 +00:00
|
|
|
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
2015-05-19 03:48:29 +00:00
|
|
|
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
2015-05-19 03:52:10 +00:00
|
|
|
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
|
2015-05-19 03:48:29 +00:00
|
|
|
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
|
|
|
|
----------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
|
2023-09-09 17:29:15 +00:00
|
|
|
/// @file IFCUtil.cpp
|
|
|
|
/// @brief Implementation of conversion routines for some common Ifc helper entities.
|
2015-05-19 03:48:29 +00:00
|
|
|
|
|
|
|
#ifndef ASSIMP_BUILD_NO_IFC_IMPORTER
|
|
|
|
|
2020-05-02 13:14:38 +00:00
|
|
|
#include "AssetLib/IFC/IFCUtil.h"
|
2019-06-10 21:26:00 +00:00
|
|
|
#include "Common/PolyTools.h"
|
2023-05-04 18:57:20 +00:00
|
|
|
#include "Geometry/GeometryUtils.h"
|
2019-06-10 21:26:00 +00:00
|
|
|
#include "PostProcessing/ProcessHelper.h"
|
2015-05-19 03:48:29 +00:00
|
|
|
|
|
|
|
namespace Assimp {
|
2019-06-10 21:26:00 +00:00
|
|
|
namespace IFC {
|
2015-05-19 03:48:29 +00:00
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2019-06-10 21:26:00 +00:00
|
|
|
void TempOpening::Transform(const IfcMatrix4& mat) {
|
2015-05-19 03:57:13 +00:00
|
|
|
if(profileMesh) {
|
|
|
|
profileMesh->Transform(mat);
|
|
|
|
}
|
|
|
|
if(profileMesh2D) {
|
|
|
|
profileMesh2D->Transform(mat);
|
|
|
|
}
|
|
|
|
extrusionDir *= IfcMatrix3(mat);
|
2015-05-19 03:48:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2023-09-09 17:29:15 +00:00
|
|
|
aiMesh* TempMesh::ToMesh() {
|
2018-01-13 09:27:45 +00:00
|
|
|
ai_assert(mVerts.size() == std::accumulate(mVertcnt.begin(),mVertcnt.end(),size_t(0)));
|
2015-05-19 03:48:29 +00:00
|
|
|
|
2018-01-13 09:27:45 +00:00
|
|
|
if (mVerts.empty()) {
|
2020-06-23 19:05:42 +00:00
|
|
|
return nullptr;
|
2015-05-19 03:57:13 +00:00
|
|
|
}
|
2015-05-19 03:48:29 +00:00
|
|
|
|
2016-04-05 20:56:11 +00:00
|
|
|
std::unique_ptr<aiMesh> mesh(new aiMesh());
|
2015-05-19 03:48:29 +00:00
|
|
|
|
2015-05-19 03:57:13 +00:00
|
|
|
// copy vertices
|
2018-01-13 09:27:45 +00:00
|
|
|
mesh->mNumVertices = static_cast<unsigned int>(mVerts.size());
|
2015-05-19 03:57:13 +00:00
|
|
|
mesh->mVertices = new aiVector3D[mesh->mNumVertices];
|
2018-01-13 09:27:45 +00:00
|
|
|
std::copy(mVerts.begin(),mVerts.end(),mesh->mVertices);
|
2015-05-19 03:48:29 +00:00
|
|
|
|
2015-05-19 03:57:13 +00:00
|
|
|
// and build up faces
|
2018-01-13 09:27:45 +00:00
|
|
|
mesh->mNumFaces = static_cast<unsigned int>(mVertcnt.size());
|
2015-05-19 03:57:13 +00:00
|
|
|
mesh->mFaces = new aiFace[mesh->mNumFaces];
|
2015-05-19 03:48:29 +00:00
|
|
|
|
2015-05-19 03:57:13 +00:00
|
|
|
for(unsigned int i = 0,n=0, acc = 0; i < mesh->mNumFaces; ++n) {
|
|
|
|
aiFace& f = mesh->mFaces[i];
|
2018-01-13 09:27:45 +00:00
|
|
|
if (!mVertcnt[n]) {
|
2015-05-19 03:57:13 +00:00
|
|
|
--mesh->mNumFaces;
|
|
|
|
continue;
|
|
|
|
}
|
2015-05-19 03:48:29 +00:00
|
|
|
|
2018-01-13 09:27:45 +00:00
|
|
|
f.mNumIndices = mVertcnt[n];
|
2015-05-19 03:57:13 +00:00
|
|
|
f.mIndices = new unsigned int[f.mNumIndices];
|
|
|
|
for(unsigned int a = 0; a < f.mNumIndices; ++a) {
|
|
|
|
f.mIndices[a] = acc++;
|
|
|
|
}
|
2015-05-19 03:48:29 +00:00
|
|
|
|
2015-05-19 03:57:13 +00:00
|
|
|
++i;
|
|
|
|
}
|
2015-05-19 03:48:29 +00:00
|
|
|
|
2015-05-19 03:57:13 +00:00
|
|
|
return mesh.release();
|
2015-05-19 03:48:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2023-09-09 17:29:15 +00:00
|
|
|
void TempMesh::Clear() {
|
2018-01-13 09:27:45 +00:00
|
|
|
mVerts.clear();
|
|
|
|
mVertcnt.clear();
|
2015-05-19 03:48:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2023-09-09 17:29:15 +00:00
|
|
|
void TempMesh::Transform(const IfcMatrix4& mat) {
|
2018-01-13 09:27:45 +00:00
|
|
|
for(IfcVector3& v : mVerts) {
|
2015-05-19 03:57:13 +00:00
|
|
|
v *= mat;
|
|
|
|
}
|
2015-05-19 03:48:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------
|
2023-09-09 17:29:15 +00:00
|
|
|
IfcVector3 TempMesh::Center() const {
|
|
|
|
return mVerts.empty() ? IfcVector3(0.0f, 0.0f, 0.0f) : (std::accumulate(mVerts.begin(),mVerts.end(),IfcVector3()) / static_cast<IfcFloat>(mVerts.size()));
|
2015-05-19 03:48:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2023-09-09 17:29:15 +00:00
|
|
|
void TempMesh::Append(const TempMesh& other) {
|
2018-01-13 09:27:45 +00:00
|
|
|
mVerts.insert(mVerts.end(),other.mVerts.begin(),other.mVerts.end());
|
|
|
|
mVertcnt.insert(mVertcnt.end(),other.mVertcnt.begin(),other.mVertcnt.end());
|
2015-05-19 03:48:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2023-09-09 17:29:15 +00:00
|
|
|
void TempMesh::RemoveDegenerates() {
|
2015-05-19 03:57:13 +00:00
|
|
|
// The strategy is simple: walk the mesh and compute normals using
|
|
|
|
// Newell's algorithm. The length of the normals gives the area
|
|
|
|
// of the polygons, which is close to zero for lines.
|
2015-05-19 03:48:29 +00:00
|
|
|
|
2015-05-19 03:57:13 +00:00
|
|
|
std::vector<IfcVector3> normals;
|
|
|
|
ComputePolygonNormals(normals, false);
|
2015-05-19 03:48:29 +00:00
|
|
|
|
2015-05-19 03:57:13 +00:00
|
|
|
bool drop = false;
|
|
|
|
size_t inor = 0;
|
2015-05-19 03:48:29 +00:00
|
|
|
|
2018-01-13 09:27:45 +00:00
|
|
|
std::vector<IfcVector3>::iterator vit = mVerts.begin();
|
|
|
|
for (std::vector<unsigned int>::iterator it = mVertcnt.begin(); it != mVertcnt.end(); ++inor) {
|
2015-05-19 03:57:13 +00:00
|
|
|
const unsigned int pcount = *it;
|
2015-05-19 03:52:10 +00:00
|
|
|
|
2015-05-19 03:57:13 +00:00
|
|
|
if (normals[inor].SquareLength() < 1e-10f) {
|
2018-01-13 09:27:45 +00:00
|
|
|
it = mVertcnt.erase(it);
|
|
|
|
vit = mVerts.erase(vit, vit + pcount);
|
2015-05-19 03:48:29 +00:00
|
|
|
|
2015-05-19 03:57:13 +00:00
|
|
|
drop = true;
|
|
|
|
continue;
|
|
|
|
}
|
2015-05-19 03:48:29 +00:00
|
|
|
|
2015-05-19 03:57:13 +00:00
|
|
|
vit += pcount;
|
|
|
|
++it;
|
|
|
|
}
|
2015-05-19 03:48:29 +00:00
|
|
|
|
2015-05-19 03:57:13 +00:00
|
|
|
if(drop) {
|
2020-05-18 10:55:14 +00:00
|
|
|
IFCImporter::LogVerboseDebug("removing degenerate faces");
|
2015-05-19 03:57:13 +00:00
|
|
|
}
|
2015-05-19 03:48:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2023-09-09 17:29:15 +00:00
|
|
|
IfcVector3 TempMesh::ComputePolygonNormal(const IfcVector3* vtcs, size_t cnt, bool normalize) {
|
2015-05-19 03:57:13 +00:00
|
|
|
std::vector<IfcFloat> temp((cnt+2)*3);
|
2023-09-09 17:29:15 +00:00
|
|
|
for( size_t vofs = 0, i = 0; vofs < cnt; ++vofs ) {
|
2015-05-19 03:57:13 +00:00
|
|
|
const IfcVector3& v = vtcs[vofs];
|
|
|
|
temp[i++] = v.x;
|
|
|
|
temp[i++] = v.y;
|
|
|
|
temp[i++] = v.z;
|
|
|
|
}
|
|
|
|
|
|
|
|
IfcVector3 nor;
|
2016-11-19 14:13:55 +00:00
|
|
|
NewellNormal<3, 3, 3>(nor, static_cast<int>(cnt), &temp[0], &temp[1], &temp[2]);
|
2015-05-19 03:57:13 +00:00
|
|
|
return normalize ? nor.Normalize() : nor;
|
2015-05-19 03:48:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-05-19 03:52:10 +00:00
|
|
|
void TempMesh::ComputePolygonNormals(std::vector<IfcVector3>& normals,
|
2023-09-09 17:29:15 +00:00
|
|
|
bool normalize,
|
|
|
|
size_t ofs) const {
|
2015-05-19 03:57:13 +00:00
|
|
|
size_t max_vcount = 0;
|
2018-01-13 09:27:45 +00:00
|
|
|
std::vector<unsigned int>::const_iterator begin = mVertcnt.begin()+ofs, end = mVertcnt.end(), iit;
|
2015-05-19 03:57:13 +00:00
|
|
|
for(iit = begin; iit != end; ++iit) {
|
|
|
|
max_vcount = std::max(max_vcount,static_cast<size_t>(*iit));
|
|
|
|
}
|
|
|
|
|
|
|
|
std::vector<IfcFloat> temp((max_vcount+2)*4);
|
2018-01-13 09:27:45 +00:00
|
|
|
normals.reserve( normals.size() + mVertcnt.size()-ofs );
|
2015-05-19 03:57:13 +00:00
|
|
|
|
|
|
|
// `NewellNormal()` currently has a relatively strange interface and need to
|
|
|
|
// re-structure things a bit to meet them.
|
2018-01-13 09:27:45 +00:00
|
|
|
size_t vidx = std::accumulate(mVertcnt.begin(),begin,0);
|
2015-05-19 03:57:13 +00:00
|
|
|
for(iit = begin; iit != end; vidx += *iit++) {
|
|
|
|
if (!*iit) {
|
2022-08-23 15:41:49 +00:00
|
|
|
normals.emplace_back();
|
2015-05-19 03:57:13 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
for(size_t vofs = 0, cnt = 0; vofs < *iit; ++vofs) {
|
2018-01-13 09:27:45 +00:00
|
|
|
const IfcVector3& v = mVerts[vidx+vofs];
|
2015-05-19 03:57:13 +00:00
|
|
|
temp[cnt++] = v.x;
|
|
|
|
temp[cnt++] = v.y;
|
|
|
|
temp[cnt++] = v.z;
|
2015-05-19 03:48:29 +00:00
|
|
|
#ifdef ASSIMP_BUILD_DEBUG
|
2015-05-19 03:57:13 +00:00
|
|
|
temp[cnt] = std::numeric_limits<IfcFloat>::quiet_NaN();
|
2015-05-19 03:48:29 +00:00
|
|
|
#endif
|
2015-05-19 03:57:13 +00:00
|
|
|
++cnt;
|
|
|
|
}
|
|
|
|
|
2022-08-23 15:41:49 +00:00
|
|
|
normals.emplace_back();
|
2015-05-19 03:57:13 +00:00
|
|
|
NewellNormal<4,4,4>(normals.back(),*iit,&temp[0],&temp[1],&temp[2]);
|
|
|
|
}
|
|
|
|
|
|
|
|
if(normalize) {
|
2016-04-05 20:53:54 +00:00
|
|
|
for(IfcVector3& n : normals) {
|
2015-05-19 03:57:13 +00:00
|
|
|
n.Normalize();
|
|
|
|
}
|
|
|
|
}
|
2015-05-19 03:48:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
// Compute the normal of the last polygon in the given mesh
|
2022-02-16 19:07:27 +00:00
|
|
|
IfcVector3 TempMesh::ComputeLastPolygonNormal(bool normalize) const {
|
2018-01-13 09:27:45 +00:00
|
|
|
return ComputePolygonNormal(&mVerts[mVerts.size() - mVertcnt.back()], mVertcnt.back(), normalize);
|
2015-05-19 03:48:29 +00:00
|
|
|
}
|
|
|
|
|
2022-02-16 19:07:27 +00:00
|
|
|
struct CompareVector {
|
|
|
|
bool operator () (const IfcVector3& a, const IfcVector3& b) const {
|
2015-05-19 03:57:13 +00:00
|
|
|
IfcVector3 d = a - b;
|
2023-05-04 18:57:20 +00:00
|
|
|
constexpr IfcFloat eps = ai_epsilon;
|
2015-05-19 03:57:13 +00:00
|
|
|
return d.x < -eps || (std::abs(d.x) < eps && d.y < -eps) || (std::abs(d.x) < eps && std::abs(d.y) < eps && d.z < -eps);
|
|
|
|
}
|
2015-05-19 03:48:29 +00:00
|
|
|
};
|
2022-02-16 19:07:27 +00:00
|
|
|
|
|
|
|
struct FindVector {
|
2015-05-19 03:57:13 +00:00
|
|
|
IfcVector3 v;
|
|
|
|
FindVector(const IfcVector3& p) : v(p) { }
|
2022-02-16 19:07:27 +00:00
|
|
|
bool operator()(const IfcVector3 &p) {
|
|
|
|
return FuzzyVectorCompare(ai_epsilon)(p, v);
|
|
|
|
}
|
2015-05-19 03:48:29 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2023-09-09 17:29:15 +00:00
|
|
|
void TempMesh::FixupFaceOrientation() {
|
2015-05-19 03:57:13 +00:00
|
|
|
const IfcVector3 vavg = Center();
|
|
|
|
|
|
|
|
// create a list of start indices for all faces to allow random access to faces
|
2018-01-13 09:27:45 +00:00
|
|
|
std::vector<size_t> faceStartIndices(mVertcnt.size());
|
2023-09-09 17:29:15 +00:00
|
|
|
for( size_t i = 0, a = 0; a < mVertcnt.size(); i += mVertcnt[a], ++a ) {
|
2015-05-19 03:57:13 +00:00
|
|
|
faceStartIndices[a] = i;
|
2023-09-09 17:29:15 +00:00
|
|
|
}
|
2015-05-19 03:57:13 +00:00
|
|
|
|
|
|
|
// list all faces on a vertex
|
|
|
|
std::map<IfcVector3, std::vector<size_t>, CompareVector> facesByVertex;
|
2023-09-09 17:29:15 +00:00
|
|
|
for( size_t a = 0; a < mVertcnt.size(); ++a ) {
|
|
|
|
for( size_t b = 0; b < mVertcnt[a]; ++b ) {
|
2018-01-13 09:27:45 +00:00
|
|
|
facesByVertex[mVerts[faceStartIndices[a] + b]].push_back(a);
|
2023-09-09 17:29:15 +00:00
|
|
|
}
|
2015-05-19 03:57:13 +00:00
|
|
|
}
|
|
|
|
// determine neighbourhood for all polys
|
2018-01-13 09:27:45 +00:00
|
|
|
std::vector<size_t> neighbour(mVerts.size(), SIZE_MAX);
|
2015-05-19 03:57:13 +00:00
|
|
|
std::vector<size_t> tempIntersect(10);
|
2023-09-09 17:29:15 +00:00
|
|
|
for( size_t a = 0; a < mVertcnt.size(); ++a ) {
|
|
|
|
for( size_t b = 0; b < mVertcnt[a]; ++b ) {
|
2018-01-13 09:27:45 +00:00
|
|
|
size_t ib = faceStartIndices[a] + b, nib = faceStartIndices[a] + (b + 1) % mVertcnt[a];
|
|
|
|
const std::vector<size_t>& facesOnB = facesByVertex[mVerts[ib]];
|
|
|
|
const std::vector<size_t>& facesOnNB = facesByVertex[mVerts[nib]];
|
2015-05-19 03:57:13 +00:00
|
|
|
// there should be exactly one or two faces which appear in both lists. Our face and the other side
|
|
|
|
std::vector<size_t>::iterator sectstart = tempIntersect.begin();
|
|
|
|
std::vector<size_t>::iterator sectend = std::set_intersection(
|
|
|
|
facesOnB.begin(), facesOnB.end(), facesOnNB.begin(), facesOnNB.end(), sectstart);
|
|
|
|
|
2023-09-09 17:29:15 +00:00
|
|
|
if( std::distance(sectstart, sectend) != 2 ) {
|
2015-05-19 03:57:13 +00:00
|
|
|
continue;
|
2023-09-09 17:29:15 +00:00
|
|
|
}
|
|
|
|
if( *sectstart == a ) {
|
2015-05-19 03:57:13 +00:00
|
|
|
++sectstart;
|
2023-09-09 17:29:15 +00:00
|
|
|
}
|
2015-05-19 03:57:13 +00:00
|
|
|
neighbour[ib] = *sectstart;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// now we're getting started. We take the face which is the farthest away from the center. This face is most probably
|
|
|
|
// facing outwards. So we reverse this face to point outwards in relation to the center. Then we adapt neighbouring
|
|
|
|
// faces to have the same winding until all faces have been tested.
|
2018-01-13 09:27:45 +00:00
|
|
|
std::vector<bool> faceDone(mVertcnt.size(), false);
|
2023-09-09 17:29:15 +00:00
|
|
|
while( std::count(faceDone.begin(), faceDone.end(), false) != 0 ) {
|
2015-05-19 03:57:13 +00:00
|
|
|
// find the farthest of the remaining faces
|
|
|
|
size_t farthestIndex = SIZE_MAX;
|
|
|
|
IfcFloat farthestDistance = -1.0;
|
2023-09-09 17:29:15 +00:00
|
|
|
for( size_t a = 0; a < mVertcnt.size(); ++a ) {
|
|
|
|
if( faceDone[a] ) {
|
2015-05-19 03:57:13 +00:00
|
|
|
continue;
|
2023-09-09 17:29:15 +00:00
|
|
|
}
|
2018-01-13 09:27:45 +00:00
|
|
|
IfcVector3 faceCenter = std::accumulate(mVerts.begin() + faceStartIndices[a],
|
|
|
|
mVerts.begin() + faceStartIndices[a] + mVertcnt[a], IfcVector3(0.0)) / IfcFloat(mVertcnt[a]);
|
2015-05-19 03:57:13 +00:00
|
|
|
IfcFloat dst = (faceCenter - vavg).SquareLength();
|
|
|
|
if( dst > farthestDistance ) { farthestDistance = dst; farthestIndex = a; }
|
|
|
|
}
|
|
|
|
|
|
|
|
// calculate its normal and reverse the poly if its facing towards the mesh center
|
2018-01-13 09:27:45 +00:00
|
|
|
IfcVector3 farthestNormal = ComputePolygonNormal(mVerts.data() + faceStartIndices[farthestIndex], mVertcnt[farthestIndex]);
|
|
|
|
IfcVector3 farthestCenter = std::accumulate(mVerts.begin() + faceStartIndices[farthestIndex],
|
|
|
|
mVerts.begin() + faceStartIndices[farthestIndex] + mVertcnt[farthestIndex], IfcVector3(0.0))
|
|
|
|
/ IfcFloat(mVertcnt[farthestIndex]);
|
2018-05-13 14:35:03 +00:00
|
|
|
// We accept a bit of negative orientation without reversing. In case of doubt, prefer the orientation given in
|
2015-05-19 03:57:13 +00:00
|
|
|
// the file.
|
2023-09-09 17:29:15 +00:00
|
|
|
if( (farthestNormal * (farthestCenter - vavg).Normalize()) < -0.4 ) {
|
2018-01-13 09:27:45 +00:00
|
|
|
size_t fsi = faceStartIndices[farthestIndex], fvc = mVertcnt[farthestIndex];
|
|
|
|
std::reverse(mVerts.begin() + fsi, mVerts.begin() + fsi + fvc);
|
2015-05-19 03:57:13 +00:00
|
|
|
std::reverse(neighbour.begin() + fsi, neighbour.begin() + fsi + fvc);
|
|
|
|
// because of the neighbour index belonging to the edge starting with the point at the same index, we need to
|
|
|
|
// cycle the neighbours through to match the edges again.
|
|
|
|
// Before: points A - B - C - D with edge neighbour p - q - r - s
|
|
|
|
// After: points D - C - B - A, reversed neighbours are s - r - q - p, but the should be
|
|
|
|
// r q p s
|
|
|
|
for( size_t a = 0; a < fvc - 1; ++a )
|
|
|
|
std::swap(neighbour[fsi + a], neighbour[fsi + a + 1]);
|
|
|
|
}
|
|
|
|
faceDone[farthestIndex] = true;
|
|
|
|
std::vector<size_t> todo;
|
|
|
|
todo.push_back(farthestIndex);
|
|
|
|
|
|
|
|
// go over its neighbour faces recursively and adapt their winding order to match the farthest face
|
2023-09-09 17:29:15 +00:00
|
|
|
while( !todo.empty() ) {
|
2015-05-19 03:57:13 +00:00
|
|
|
size_t tdf = todo.back();
|
2018-01-13 09:27:45 +00:00
|
|
|
size_t vsi = faceStartIndices[tdf], vc = mVertcnt[tdf];
|
2015-05-19 03:57:13 +00:00
|
|
|
todo.pop_back();
|
|
|
|
|
|
|
|
// check its neighbours
|
2023-09-09 17:29:15 +00:00
|
|
|
for( size_t a = 0; a < vc; ++a ) {
|
2015-05-19 03:57:13 +00:00
|
|
|
// ignore neighbours if we already checked them
|
|
|
|
size_t nbi = neighbour[vsi + a];
|
2023-09-09 17:29:15 +00:00
|
|
|
if( nbi == SIZE_MAX || faceDone[nbi] ) {
|
2015-05-19 03:57:13 +00:00
|
|
|
continue;
|
2023-09-09 17:29:15 +00:00
|
|
|
}
|
2015-05-19 03:57:13 +00:00
|
|
|
|
2018-01-13 09:27:45 +00:00
|
|
|
const IfcVector3& vp = mVerts[vsi + a];
|
|
|
|
size_t nbvsi = faceStartIndices[nbi], nbvc = mVertcnt[nbi];
|
|
|
|
std::vector<IfcVector3>::iterator it = std::find_if(mVerts.begin() + nbvsi, mVerts.begin() + nbvsi + nbvc, FindVector(vp));
|
|
|
|
ai_assert(it != mVerts.begin() + nbvsi + nbvc);
|
|
|
|
size_t nb_vidx = std::distance(mVerts.begin() + nbvsi, it);
|
2015-05-19 03:57:13 +00:00
|
|
|
// two faces winded in the same direction should have a crossed edge, where one face has p0->p1 and the other
|
|
|
|
// has p1'->p0'. If the next point on the neighbouring face is also the next on the current face, we need
|
|
|
|
// to reverse the neighbour
|
|
|
|
nb_vidx = (nb_vidx + 1) % nbvc;
|
|
|
|
size_t oursideidx = (a + 1) % vc;
|
2022-02-16 19:07:27 +00:00
|
|
|
if (FuzzyVectorCompare(ai_epsilon)(mVerts[vsi + oursideidx], mVerts[nbvsi + nb_vidx])) {
|
2018-01-13 09:27:45 +00:00
|
|
|
std::reverse(mVerts.begin() + nbvsi, mVerts.begin() + nbvsi + nbvc);
|
2015-05-19 03:57:13 +00:00
|
|
|
std::reverse(neighbour.begin() + nbvsi, neighbour.begin() + nbvsi + nbvc);
|
2020-03-01 12:15:45 +00:00
|
|
|
for (size_t aa = 0; aa < nbvc - 1; ++aa) {
|
|
|
|
std::swap(neighbour[nbvsi + aa], neighbour[nbvsi + aa + 1]);
|
|
|
|
}
|
2015-05-19 03:57:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// either way we're done with the neighbour. Mark it as done and continue checking from there recursively
|
|
|
|
faceDone[nbi] = true;
|
|
|
|
todo.push_back(nbi);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// no more faces reachable from this part of the surface, start over with a disjunct part and its farthest face
|
|
|
|
}
|
2015-05-19 03:48:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2018-01-13 09:27:45 +00:00
|
|
|
void TempMesh::RemoveAdjacentDuplicates() {
|
2015-05-19 03:57:13 +00:00
|
|
|
bool drop = false;
|
2018-01-13 09:27:45 +00:00
|
|
|
std::vector<IfcVector3>::iterator base = mVerts.begin();
|
|
|
|
for(unsigned int& cnt : mVertcnt) {
|
2015-05-19 03:57:13 +00:00
|
|
|
if (cnt < 2){
|
|
|
|
base += cnt;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
IfcVector3 vmin,vmax;
|
|
|
|
ArrayBounds(&*base, cnt ,vmin,vmax);
|
|
|
|
|
|
|
|
const IfcFloat epsilon = (vmax-vmin).SquareLength() / static_cast<IfcFloat>(1e9);
|
2023-09-09 17:29:15 +00:00
|
|
|
|
2015-05-19 03:57:13 +00:00
|
|
|
// drop any identical, adjacent vertices. this pass will collect the dropouts
|
|
|
|
// of the previous pass as a side-effect.
|
|
|
|
FuzzyVectorCompare fz(epsilon);
|
|
|
|
std::vector<IfcVector3>::iterator end = base+cnt, e = std::unique( base, end, fz );
|
|
|
|
if (e != end) {
|
|
|
|
cnt -= static_cast<unsigned int>(std::distance(e, end));
|
2018-01-13 09:27:45 +00:00
|
|
|
mVerts.erase(e,end);
|
2015-05-19 03:57:13 +00:00
|
|
|
drop = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
// check front and back vertices for this polygon
|
|
|
|
if (cnt > 1 && fz(*base,*(base+cnt-1))) {
|
2018-01-13 09:27:45 +00:00
|
|
|
mVerts.erase(base+ --cnt);
|
2015-05-19 03:57:13 +00:00
|
|
|
drop = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
// removing adjacent duplicates shouldn't erase everything :-)
|
|
|
|
ai_assert(cnt>0);
|
|
|
|
base += cnt;
|
|
|
|
}
|
|
|
|
if(drop) {
|
2020-05-18 10:55:14 +00:00
|
|
|
IFCImporter::LogVerboseDebug("removing duplicate vertices");
|
2015-05-19 03:57:13 +00:00
|
|
|
}
|
2015-05-19 03:48:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2023-09-09 17:29:15 +00:00
|
|
|
void TempMesh::Swap(TempMesh& other) {
|
2018-01-13 09:27:45 +00:00
|
|
|
mVertcnt.swap(other.mVertcnt);
|
|
|
|
mVerts.swap(other.mVerts);
|
2015-05-19 03:48:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2023-09-09 17:29:15 +00:00
|
|
|
bool IsTrue(const ::Assimp::STEP::EXPRESS::BOOLEAN& in) {
|
2015-05-19 03:57:13 +00:00
|
|
|
return (std::string)in == "TRUE" || (std::string)in == "T";
|
2015-05-19 03:48:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2023-09-09 17:29:15 +00:00
|
|
|
IfcFloat ConvertSIPrefix(const std::string& prefix) {
|
2015-05-19 03:57:13 +00:00
|
|
|
if (prefix == "EXA") {
|
|
|
|
return 1e18f;
|
2023-09-09 17:29:15 +00:00
|
|
|
} else if (prefix == "PETA") {
|
2015-05-19 03:57:13 +00:00
|
|
|
return 1e15f;
|
2023-09-09 17:29:15 +00:00
|
|
|
} else if (prefix == "TERA") {
|
2015-05-19 03:57:13 +00:00
|
|
|
return 1e12f;
|
2023-09-09 17:29:15 +00:00
|
|
|
} else if (prefix == "GIGA") {
|
2015-05-19 03:57:13 +00:00
|
|
|
return 1e9f;
|
2023-09-09 17:29:15 +00:00
|
|
|
} else if (prefix == "MEGA") {
|
2015-05-19 03:57:13 +00:00
|
|
|
return 1e6f;
|
2023-09-09 17:29:15 +00:00
|
|
|
} else if (prefix == "KILO") {
|
2015-05-19 03:57:13 +00:00
|
|
|
return 1e3f;
|
2023-09-09 17:29:15 +00:00
|
|
|
} else if (prefix == "HECTO") {
|
2015-05-19 03:57:13 +00:00
|
|
|
return 1e2f;
|
2023-09-09 17:29:15 +00:00
|
|
|
} else if (prefix == "DECA") {
|
2015-05-19 03:57:13 +00:00
|
|
|
return 1e-0f;
|
2023-09-09 17:29:15 +00:00
|
|
|
} else if (prefix == "DECI") {
|
2015-05-19 03:57:13 +00:00
|
|
|
return 1e-1f;
|
2023-09-09 17:29:15 +00:00
|
|
|
} else if (prefix == "CENTI") {
|
2015-05-19 03:57:13 +00:00
|
|
|
return 1e-2f;
|
2023-09-09 17:29:15 +00:00
|
|
|
} else if (prefix == "MILLI") {
|
2015-05-19 03:57:13 +00:00
|
|
|
return 1e-3f;
|
2023-09-09 17:29:15 +00:00
|
|
|
} else if (prefix == "MICRO") {
|
2015-05-19 03:57:13 +00:00
|
|
|
return 1e-6f;
|
2023-09-09 17:29:15 +00:00
|
|
|
} else if (prefix == "NANO") {
|
2015-05-19 03:57:13 +00:00
|
|
|
return 1e-9f;
|
2023-09-09 17:29:15 +00:00
|
|
|
} else if (prefix == "PICO") {
|
2015-05-19 03:57:13 +00:00
|
|
|
return 1e-12f;
|
2023-09-09 17:29:15 +00:00
|
|
|
} else if (prefix == "FEMTO") {
|
2015-05-19 03:57:13 +00:00
|
|
|
return 1e-15f;
|
2023-09-09 17:29:15 +00:00
|
|
|
} else if (prefix == "ATTO") {
|
2015-05-19 03:57:13 +00:00
|
|
|
return 1e-18f;
|
2023-09-09 17:29:15 +00:00
|
|
|
} else {
|
2021-05-13 11:05:31 +00:00
|
|
|
IFCImporter::LogError("Unrecognized SI prefix: ", prefix);
|
2015-05-19 03:57:13 +00:00
|
|
|
return 1;
|
|
|
|
}
|
2015-05-19 03:48:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2023-09-09 17:29:15 +00:00
|
|
|
void ConvertColor(aiColor4D& out, const Schema_2x3::IfcColourRgb& in) {
|
2015-05-19 03:57:13 +00:00
|
|
|
out.r = static_cast<float>( in.Red );
|
|
|
|
out.g = static_cast<float>( in.Green );
|
|
|
|
out.b = static_cast<float>( in.Blue );
|
|
|
|
out.a = static_cast<float>( 1.f );
|
2015-05-19 03:48:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2023-09-09 17:29:15 +00:00
|
|
|
void ConvertColor(aiColor4D& out,
|
|
|
|
const Schema_2x3::IfcColourOrFactor& in,
|
|
|
|
ConversionData& conv,
|
|
|
|
const aiColor4D* base) {
|
2018-01-13 09:27:45 +00:00
|
|
|
if (const ::Assimp::STEP::EXPRESS::REAL* const r = in.ToPtr<::Assimp::STEP::EXPRESS::REAL>()) {
|
2015-05-19 03:57:13 +00:00
|
|
|
out.r = out.g = out.b = static_cast<float>(*r);
|
|
|
|
if(base) {
|
|
|
|
out.r *= static_cast<float>( base->r );
|
|
|
|
out.g *= static_cast<float>( base->g );
|
|
|
|
out.b *= static_cast<float>( base->b );
|
|
|
|
out.a = static_cast<float>( base->a );
|
2023-09-09 17:29:15 +00:00
|
|
|
} else {
|
|
|
|
out.a = 1.0;
|
2015-05-19 03:57:13 +00:00
|
|
|
}
|
2023-09-09 17:29:15 +00:00
|
|
|
} else if (const Schema_2x3::IfcColourRgb* const rgb = in.ResolveSelectPtr<Schema_2x3::IfcColourRgb>(conv.db)) {
|
2015-05-19 03:57:13 +00:00
|
|
|
ConvertColor(out,*rgb);
|
2023-09-09 17:29:15 +00:00
|
|
|
} else {
|
2015-05-19 03:57:13 +00:00
|
|
|
IFCImporter::LogWarn("skipping unknown IfcColourOrFactor entity");
|
|
|
|
}
|
2015-05-19 03:48:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2023-09-09 17:29:15 +00:00
|
|
|
void ConvertCartesianPoint(IfcVector3& out, const Schema_2x3::IfcCartesianPoint& in) {
|
2015-05-19 03:57:13 +00:00
|
|
|
out = IfcVector3();
|
|
|
|
for(size_t i = 0; i < in.Coordinates.size(); ++i) {
|
2016-11-19 14:13:55 +00:00
|
|
|
out[static_cast<unsigned int>(i)] = in.Coordinates[i];
|
2015-05-19 03:57:13 +00:00
|
|
|
}
|
2015-05-19 03:48:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2023-09-09 17:29:15 +00:00
|
|
|
void ConvertVector(IfcVector3& out, const Schema_2x3::IfcVector& in) {
|
2015-05-19 03:57:13 +00:00
|
|
|
ConvertDirection(out,in.Orientation);
|
|
|
|
out *= in.Magnitude;
|
2015-05-19 03:48:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2023-09-09 17:29:15 +00:00
|
|
|
void ConvertDirection(IfcVector3& out, const Schema_2x3::IfcDirection& in) {
|
2015-05-19 03:57:13 +00:00
|
|
|
out = IfcVector3();
|
|
|
|
for(size_t i = 0; i < in.DirectionRatios.size(); ++i) {
|
2016-11-19 14:13:55 +00:00
|
|
|
out[static_cast<unsigned int>(i)] = in.DirectionRatios[i];
|
2015-05-19 03:57:13 +00:00
|
|
|
}
|
|
|
|
const IfcFloat len = out.Length();
|
2022-02-16 19:07:27 +00:00
|
|
|
if (len < ai_epsilon) {
|
2015-05-19 03:57:13 +00:00
|
|
|
IFCImporter::LogWarn("direction vector magnitude too small, normalization would result in a division by zero");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
out /= len;
|
2015-05-19 03:48:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2023-09-09 17:29:15 +00:00
|
|
|
void AssignMatrixAxes(IfcMatrix4& out, const IfcVector3& x, const IfcVector3& y, const IfcVector3& z) {
|
2015-05-19 03:57:13 +00:00
|
|
|
out.a1 = x.x;
|
|
|
|
out.b1 = x.y;
|
|
|
|
out.c1 = x.z;
|
2015-05-19 03:48:29 +00:00
|
|
|
|
2015-05-19 03:57:13 +00:00
|
|
|
out.a2 = y.x;
|
|
|
|
out.b2 = y.y;
|
|
|
|
out.c2 = y.z;
|
2015-05-19 03:48:29 +00:00
|
|
|
|
2015-05-19 03:57:13 +00:00
|
|
|
out.a3 = z.x;
|
|
|
|
out.b3 = z.y;
|
|
|
|
out.c3 = z.z;
|
2015-05-19 03:48:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2023-09-09 17:29:15 +00:00
|
|
|
void ConvertAxisPlacement(IfcMatrix4& out, const Schema_2x3::IfcAxis2Placement3D& in) {
|
2015-05-19 03:57:13 +00:00
|
|
|
IfcVector3 loc;
|
|
|
|
ConvertCartesianPoint(loc,in.Location);
|
2015-05-19 03:48:29 +00:00
|
|
|
|
2015-05-19 03:57:13 +00:00
|
|
|
IfcVector3 z(0.f,0.f,1.f),r(1.f,0.f,0.f),x;
|
2015-05-19 03:48:29 +00:00
|
|
|
|
2015-05-19 03:57:13 +00:00
|
|
|
if (in.Axis) {
|
|
|
|
ConvertDirection(z,*in.Axis.Get());
|
|
|
|
}
|
|
|
|
if (in.RefDirection) {
|
|
|
|
ConvertDirection(r,*in.RefDirection.Get());
|
|
|
|
}
|
2015-05-19 03:48:29 +00:00
|
|
|
|
2015-05-19 03:57:13 +00:00
|
|
|
IfcVector3 v = r.Normalize();
|
|
|
|
IfcVector3 tmpx = z * (v*z);
|
2015-05-19 03:48:29 +00:00
|
|
|
|
2015-05-19 03:57:13 +00:00
|
|
|
x = (v-tmpx).Normalize();
|
|
|
|
IfcVector3 y = (z^x);
|
2015-05-19 03:48:29 +00:00
|
|
|
|
2015-05-19 03:57:13 +00:00
|
|
|
IfcMatrix4::Translation(loc,out);
|
|
|
|
AssignMatrixAxes(out,x,y,z);
|
2015-05-19 03:48:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2023-09-09 17:29:15 +00:00
|
|
|
void ConvertAxisPlacement(IfcMatrix4& out, const Schema_2x3::IfcAxis2Placement2D& in) {
|
2015-05-19 03:57:13 +00:00
|
|
|
IfcVector3 loc;
|
|
|
|
ConvertCartesianPoint(loc,in.Location);
|
2015-05-19 03:48:29 +00:00
|
|
|
|
2015-05-19 03:57:13 +00:00
|
|
|
IfcVector3 x(1.f,0.f,0.f);
|
|
|
|
if (in.RefDirection) {
|
|
|
|
ConvertDirection(x,*in.RefDirection.Get());
|
|
|
|
}
|
2015-05-19 03:48:29 +00:00
|
|
|
|
2015-05-19 03:57:13 +00:00
|
|
|
const IfcVector3 y = IfcVector3(x.y,-x.x,0.f);
|
2015-05-19 03:48:29 +00:00
|
|
|
|
2015-05-19 03:57:13 +00:00
|
|
|
IfcMatrix4::Translation(loc,out);
|
|
|
|
AssignMatrixAxes(out,x,y,IfcVector3(0.f,0.f,1.f));
|
2015-05-19 03:48:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2023-09-09 17:29:15 +00:00
|
|
|
void ConvertAxisPlacement(IfcVector3& axis, IfcVector3& pos, const Schema_2x3::IfcAxis1Placement& in) {
|
2015-05-19 03:57:13 +00:00
|
|
|
ConvertCartesianPoint(pos,in.Location);
|
|
|
|
if (in.Axis) {
|
|
|
|
ConvertDirection(axis,in.Axis.Get());
|
2023-09-09 17:29:15 +00:00
|
|
|
} else {
|
2015-05-19 03:57:13 +00:00
|
|
|
axis = IfcVector3(0.f,0.f,1.f);
|
|
|
|
}
|
2015-05-19 03:48:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2023-09-09 17:29:15 +00:00
|
|
|
void ConvertAxisPlacement(IfcMatrix4& out, const Schema_2x3::IfcAxis2Placement& in, ConversionData& conv) {
|
2018-01-13 09:27:45 +00:00
|
|
|
if(const Schema_2x3::IfcAxis2Placement3D* pl3 = in.ResolveSelectPtr<Schema_2x3::IfcAxis2Placement3D>(conv.db)) {
|
2015-05-19 03:57:13 +00:00
|
|
|
ConvertAxisPlacement(out,*pl3);
|
2023-09-09 17:29:15 +00:00
|
|
|
} else if(const Schema_2x3::IfcAxis2Placement2D* pl2 = in.ResolveSelectPtr<Schema_2x3::IfcAxis2Placement2D>(conv.db)) {
|
2015-05-19 03:57:13 +00:00
|
|
|
ConvertAxisPlacement(out,*pl2);
|
2023-09-09 17:29:15 +00:00
|
|
|
} else {
|
2015-05-19 03:57:13 +00:00
|
|
|
IFCImporter::LogWarn("skipping unknown IfcAxis2Placement entity");
|
|
|
|
}
|
2015-05-19 03:48:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2023-09-09 17:29:15 +00:00
|
|
|
void ConvertTransformOperator(IfcMatrix4& out, const Schema_2x3::IfcCartesianTransformationOperator& op) {
|
2015-05-19 03:57:13 +00:00
|
|
|
IfcVector3 loc;
|
|
|
|
ConvertCartesianPoint(loc,op.LocalOrigin);
|
|
|
|
|
|
|
|
IfcVector3 x(1.f,0.f,0.f),y(0.f,1.f,0.f),z(0.f,0.f,1.f);
|
|
|
|
if (op.Axis1) {
|
|
|
|
ConvertDirection(x,*op.Axis1.Get());
|
|
|
|
}
|
|
|
|
if (op.Axis2) {
|
|
|
|
ConvertDirection(y,*op.Axis2.Get());
|
|
|
|
}
|
2018-01-13 09:27:45 +00:00
|
|
|
if (const Schema_2x3::IfcCartesianTransformationOperator3D* op2 = op.ToPtr<Schema_2x3::IfcCartesianTransformationOperator3D>()) {
|
2015-05-19 03:57:13 +00:00
|
|
|
if(op2->Axis3) {
|
|
|
|
ConvertDirection(z,*op2->Axis3.Get());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
IfcMatrix4 locm;
|
|
|
|
IfcMatrix4::Translation(loc,locm);
|
|
|
|
AssignMatrixAxes(out,x,y,z);
|
|
|
|
|
|
|
|
IfcVector3 vscale;
|
2018-01-13 09:27:45 +00:00
|
|
|
if (const Schema_2x3::IfcCartesianTransformationOperator3DnonUniform* nuni = op.ToPtr<Schema_2x3::IfcCartesianTransformationOperator3DnonUniform>()) {
|
2015-05-19 03:57:13 +00:00
|
|
|
vscale.x = nuni->Scale?op.Scale.Get():1.f;
|
|
|
|
vscale.y = nuni->Scale2?nuni->Scale2.Get():1.f;
|
|
|
|
vscale.z = nuni->Scale3?nuni->Scale3.Get():1.f;
|
2023-09-09 17:29:15 +00:00
|
|
|
} else {
|
2015-05-19 03:57:13 +00:00
|
|
|
const IfcFloat sc = op.Scale?op.Scale.Get():1.f;
|
|
|
|
vscale = IfcVector3(sc,sc,sc);
|
|
|
|
}
|
|
|
|
|
|
|
|
IfcMatrix4 s;
|
|
|
|
IfcMatrix4::Scaling(vscale,s);
|
|
|
|
|
|
|
|
out = locm * out * s;
|
2015-05-19 03:48:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
} // ! IFC
|
|
|
|
} // ! Assimp
|
|
|
|
|
2023-09-09 17:29:15 +00:00
|
|
|
#endif // ASSIMP_BUILD_NO_IFC_IMPORTER
|