mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-12 06:32:09 +00:00
79 lines
3.2 KiB
C++
79 lines
3.2 KiB
C++
/********************************************************************************
|
|
* *
|
|
* This file is part of IfcOpenShell. *
|
|
* *
|
|
* IfcOpenShell is free software: you can redistribute it and/or modify *
|
|
* it under the terms of the Lesser GNU General Public License as published by *
|
|
* the Free Software Foundation, either version 3.0 of the License, or *
|
|
* (at your option) any later version. *
|
|
* *
|
|
* IfcOpenShell is distributed in the hope that it will be useful, *
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|
* Lesser GNU General Public License for more details. *
|
|
* *
|
|
* You should have received a copy of the Lesser GNU General Public License *
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
|
* *
|
|
********************************************************************************/
|
|
|
|
#ifndef CGALCONVERSIONRESULT_H
|
|
#define CGALCONVERSIONRESULT_H
|
|
|
|
#include "../../../ifcgeom/ConversionResult.h"
|
|
|
|
namespace IfcGeom {
|
|
|
|
class CgalPlacement : public ConversionResultPlacement {
|
|
public:
|
|
CgalPlacement(const cgal_placement_t& trsf)
|
|
: trsf_(trsf)
|
|
{}
|
|
|
|
const cgal_placement_t& trsf() const { return trsf_; }
|
|
operator const cgal_placement_t& () { return trsf_; }
|
|
|
|
virtual double Value(int i, int j) const {
|
|
// TODO: Check
|
|
// std::cout << "Getting CgalPlacement with i = " << i << " and j = " << j << std::endl;
|
|
return CGAL::to_double(trsf_.cartesian(i-1, j-1));
|
|
}
|
|
virtual void Multiply(const ConversionResultPlacement* other) {
|
|
// TODO: Check
|
|
trsf_ = ((CgalPlacement *)other)->trsf_ * trsf_;
|
|
}
|
|
virtual void PreMultiply(const ConversionResultPlacement* other) {
|
|
// TODO: Check
|
|
trsf_ = trsf_ * ((CgalPlacement *)other)->trsf_;
|
|
}
|
|
virtual ConversionResultPlacement* clone() const {
|
|
return new CgalPlacement(trsf_);
|
|
}
|
|
private:
|
|
cgal_placement_t trsf_;
|
|
};
|
|
|
|
class CgalShape : public ConversionResultShape {
|
|
public:
|
|
CgalShape(const cgal_shape_t& shape)
|
|
: shape_(shape)
|
|
{}
|
|
|
|
const cgal_shape_t& shape() const { return shape_; }
|
|
operator const cgal_shape_t& () { return shape_; }
|
|
|
|
virtual void Triangulate(const IfcGeom::IteratorSettings & settings, const IfcGeom::ConversionResultPlacement * place, IfcGeom::Representation::Triangulation<double>* t, int surface_style_id) const;
|
|
virtual void Serialize(std::string&) const {
|
|
throw std::runtime_error("Not implemented");
|
|
}
|
|
virtual ConversionResultShape* clone() const {
|
|
return new CgalShape(shape_);
|
|
}
|
|
private:
|
|
cgal_shape_t shape_;
|
|
};
|
|
|
|
}
|
|
|
|
#endif
|