add quadmesh

This commit is contained in:
AndreaRigoni
2026-03-14 10:28:16 +00:00
parent 6bf9eaf309
commit 20d4967356
13 changed files with 600 additions and 14 deletions

64
src/Math/QuadMesh.cpp Normal file
View File

@@ -0,0 +1,64 @@
/*//////////////////////////////////////////////////////////////////////////////
// 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.
//////////////////////////////////////////////////////////////////////////////*/
#include "QuadMesh.h"
namespace uLib {
void QuadMesh::PrintSelf(std::ostream &o)
{
o << " // ------- QUAD MESH ------- // \n" ;
o << " #Points : " << m_Points.size() << "\n";
o << " #Quads : " << m_Quads.size() << "\n";
for(int i=0; i < m_Quads.size(); ++i ) {
o << " - quad[" << i << "]" <<
" " << m_Quads[i](0) << "->(" << m_Points[m_Quads[i](0)].transpose() << ") " <<
" " << m_Quads[i](1) << "->(" << m_Points[m_Quads[i](1)].transpose() << ") " <<
" " << m_Quads[i](2) << "->(" << m_Points[m_Quads[i](2)].transpose() << ") " <<
" " << m_Quads[i](3) << "->(" << m_Points[m_Quads[i](3)].transpose() << ") " <<
" \n";
}
o << " // ------------------------- // \n";
}
void QuadMesh::AddPoint(const Vector3f &pt)
{
this->m_Points.push_back(pt);
}
void QuadMesh::AddQuad(const Id_t *id)
{
Vector4i quad(id[0],id[1],id[2],id[3]);
this->m_Quads.push_back(quad);
}
void QuadMesh::AddQuad(const Vector4i &id)
{
this->m_Quads.push_back(id);
}
}