75 lines
1.6 KiB
C++
75 lines
1.6 KiB
C++
#include "AbstractMesh.h"
|
|
|
|
void AbstractMesh::addConstantNodeVectorAttribute(const std::string& tag, const std::vector<double>& values)
|
|
{
|
|
|
|
}
|
|
|
|
std::vector<std::vector<double> > AbstractMesh::getNodeVectorAttributes(const std::string& tag)
|
|
{
|
|
std::vector<std::vector<double> > attribs(mNodes.size());
|
|
return attribs;
|
|
}
|
|
|
|
void AbstractMesh::addVectorAttribute(const std::string& tag, const std::vector<double>& values)
|
|
{
|
|
mVectorAttributes[tag] = values;
|
|
}
|
|
|
|
bool AbstractMesh::hasVectorAttribute(const std::string& tag) const
|
|
{
|
|
return mVectorAttributes.find(tag) != mVectorAttributes.end();
|
|
}
|
|
|
|
unsigned AbstractMesh::getNumNodes() const
|
|
{
|
|
return unsigned(mNodes.size());
|
|
}
|
|
|
|
const VecNodes& AbstractMesh::getNodes() const
|
|
{
|
|
return mNodes;
|
|
}
|
|
|
|
std::vector<double> AbstractMesh::getVectorAttribute(const std::string& tag) const
|
|
{
|
|
auto iter = mVectorAttributes.find(tag);
|
|
if (iter != mVectorAttributes.end())
|
|
{
|
|
return iter->second;
|
|
}
|
|
return {};
|
|
}
|
|
|
|
void AbstractMesh::scale(double scaleX, double scaleY)
|
|
{
|
|
Transform transform({ 0.0, 0.0 }, scaleX, scaleY);
|
|
|
|
for (auto& node : mNodes)
|
|
{
|
|
node->apply(transform);
|
|
}
|
|
}
|
|
|
|
void AbstractMesh::transform(const Transform& transform)
|
|
{
|
|
for (auto& node : mNodes)
|
|
{
|
|
node->apply(transform);
|
|
}
|
|
}
|
|
|
|
void AbstractMesh::translate(double offsetX, double offsetY, double offsetZ)
|
|
{
|
|
const Point loc {-offsetX, -offsetY, -offsetZ};
|
|
Transform transform(loc);
|
|
for (auto& node : mNodes)
|
|
{
|
|
node->apply(transform);
|
|
}
|
|
}
|
|
|
|
void AbstractMesh::translate(const Point& offset)
|
|
{
|
|
translate(offset.getX(), offset.getY(), offset.getZ());
|
|
}
|