Matrix multiplication in OCC rather than boost::ublas (re #211)

This commit is contained in:
Thomas Krijnen
2017-05-20 19:50:10 +02:00
parent c093dc0335
commit af2799acd4
4 changed files with 105 additions and 235 deletions
+26 -10
View File
@@ -58,15 +58,25 @@ namespace IfcGeom {
template <typename P>
class Transformation {
private:
gp_Trsf trsf;
Matrix<P> _matrix;
ElementSettings settings_;
gp_Trsf trsf_;
Matrix<P> matrix_;
public:
Transformation(const ElementSettings& settings, const gp_Trsf& trsf)
: trsf(trsf)
, _matrix(settings, trsf)
: settings_(settings)
, trsf_(trsf)
, matrix_(settings, trsf)
{}
const gp_Trsf& data() const { return trsf; }
const Matrix<P>& matrix() const { return _matrix; }
const gp_Trsf& data() const { return trsf_; }
const Matrix<P>& matrix() const { return matrix_; }
Transformation inverted() const {
return Transformation(settings_, trsf_.Inverted());
}
Transformation multiplied(const Transformation& other) const {
return Transformation(settings_, trsf_.Multiplied(other.data()));
}
};
template <typename P>
@@ -126,10 +136,15 @@ namespace IfcGeom {
, product_(product)
{
std::ostringstream oss;
try { oss << "product-" << IfcParse::IfcGlobalId(guid).formatted(); }
catch (std::exception e)
{
oss << "product-cannotfindId";
if (type == "IfcProject") {
oss << "project";
} else {
try {
oss << "product-" << IfcParse::IfcGlobalId(guid).formatted();
} catch (const std::exception&) {
oss << "product";
}
}
if (!_context.empty()) {
@@ -138,6 +153,7 @@ namespace IfcGeom {
boost::replace_all(ctx, " ", "-");
oss << "-" << ctx;
}
_unique_id = oss.str();
}
virtual ~Element() {}