75 lines
2.4 KiB
C++
75 lines
2.4 KiB
C++
/*//////////////////////////////////////////////////////////////////////////////
|
|
// CMT Cosmic Muon Tomography project //////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
Copyright (c) 2014, Universita' degli Studi di Padova, INFN sez. di Padova
|
|
All rights reserved
|
|
|
|
Authors: Andrea Rigoni Garola < andrea.rigoni@pd.infn.it >
|
|
|
|
------------------------------------------------------------------
|
|
This library is free software; you can redistribute it and/or
|
|
modify it under the terms of the GNU Lesser General Public
|
|
License as published by the Free Software Foundation; either
|
|
version 3.0 of the License, or (at your option) any later version.
|
|
|
|
This library 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 GNU
|
|
Lesser General Public License for more details.
|
|
|
|
You should have received a copy of the GNU Lesser General Public
|
|
License along with this library.
|
|
|
|
//////////////////////////////////////////////////////////////////////////////*/
|
|
|
|
#ifndef QUADMESH_H
|
|
#define QUADMESH_H
|
|
|
|
#include <vector>
|
|
|
|
#include "Math/Dense.h"
|
|
#include "Core/Object.h"
|
|
#include "Math/Transform.h"
|
|
|
|
namespace uLib {
|
|
|
|
class QuadMesh : public TRS
|
|
{
|
|
public:
|
|
uLibTypeMacro(QuadMesh, TRS)
|
|
|
|
virtual const char * GetClassName() const override { return "QuadMesh"; }
|
|
|
|
void PrintSelf(std::ostream &o);
|
|
|
|
/** @brief Adds a point in global coordinates. Stored in local coordinates. */
|
|
void AddPoint(const Vector3f &pt);
|
|
|
|
void AddQuad(const Id_t *id);
|
|
void AddQuad(const Vector4i &id);
|
|
|
|
/** @brief Returns point in global coordinates. */
|
|
Vector3f GetPoint(const Id_t id) const;
|
|
|
|
inline std::vector<Vector3f> & Points() { return this->m_Points; }
|
|
inline const std::vector<Vector3f> & Points() const { return this->m_Points; }
|
|
inline std::vector<Vector4i> & Quads() { return this->m_Quads; }
|
|
inline const std::vector<Vector4i> & Quads() const { return this->m_Quads; }
|
|
|
|
const Vector4i & GetQuad(const Id_t id) const { return m_Quads.at(id); }
|
|
Vector3f GetNormal(const Id_t id) const;
|
|
|
|
virtual void Updated() override { ULIB_SIGNAL_EMIT(QuadMesh::Updated); }
|
|
|
|
private:
|
|
std::vector<Vector3f> m_Points;
|
|
std::vector<Vector4i> m_Quads;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
#endif // QUADMESH_H
|