fw4spl
core/fwDataTools/include/fwDataTools/Mesh.hpp
1 /* ***** BEGIN LICENSE BLOCK *****
2  * FW4SPL - Copyright (C) IRCAD, 2009-2018.
3  * Distributed under the terms of the GNU Lesser General Public License (LGPL) as
4  * published by the Free Software Foundation.
5  * ****** END LICENSE BLOCK ****** */
6 
7 #pragma once
8 
9 #include "fwDataTools/config.hpp"
10 #include "fwDataTools/Vector.hxx"
11 #include <fwDataTools/helper/Mesh.hpp>
12 
13 #include <fwCore/base.hpp>
14 
15 #include <fwData/Mesh.hpp>
16 #include <fwData/TransformationMatrix3D.hpp>
17 
18 namespace fwDataTools
19 {
20 
24 class Mesh
25 {
26 
27 public:
28 
29  typedef std::map<Point, ::fwData::Mesh::Id> PointsMapType;
30  typedef std::array<double, 3> PositionType;
31  typedef std::array<size_t, 3> OrganizationType;
32 
36  FWDATATOOLS_API static void initRand();
37 
43  FWDATATOOLS_API static void generateCellNormals(::fwData::Mesh::sptr mesh);
44 
50  FWDATATOOLS_API static void generatePointNormals(::fwData::Mesh::sptr mesh);
51 
60  FWDATATOOLS_API static void shakeNormals(::fwData::Array::sptr array);
61 
67  FWDATATOOLS_API static void shakePointNormals(::fwData::Mesh::sptr mesh);
68 
74  FWDATATOOLS_API static void shakeCellNormals(::fwData::Mesh::sptr mesh);
75 
81  FWDATATOOLS_API static void shakePoint(::fwData::Mesh::sptr mesh);
82 
88  FWDATATOOLS_API static void colorizeMeshPoints(::fwData::Mesh::sptr mesh);
89 
95  FWDATATOOLS_API static void colorizeMeshCells(::fwData::Mesh::sptr mesh);
96 
103  FWDATATOOLS_API static bool hasUniqueCellType(::fwData::Mesh::csptr mesh, ::fwData::Mesh::CellTypes cell);
104 
106  FWDATATOOLS_API static void transform(fwData::Mesh::csptr inMesh, ::fwData::Mesh::sptr outMesh,
107  ::fwData::TransformationMatrix3D::csptr t );
108 
110  FWDATATOOLS_API static void transform( ::fwData::Mesh::sptr mesh, ::fwData::TransformationMatrix3D::csptr t );
111 
117  FWDATATOOLS_API static void colorizeMeshPoints(const ::fwData::Mesh::sptr& mesh, const std::uint8_t colorR,
118  const std::uint8_t colorG, const std::uint8_t colorB,
119  const std::uint8_t colorA = 255);
120 
126  FWDATATOOLS_API static void colorizeMeshPoints(const ::fwData::Mesh::sptr& _mesh,
127  const std::vector<size_t>& _vectorNumTriangle,
128  const std::uint8_t _colorR, const std::uint8_t colorG,
129  const std::uint8_t colorB, const std::uint8_t _colorA = 255);
130 
136  FWDATATOOLS_API static void colorizeMeshCells(const ::fwData::Mesh::sptr& mesh, const std::uint8_t colorR,
137  const std::uint8_t colorG, const std::uint8_t colorB,
138  const std::uint8_t _colorA = 255);
144  FWDATATOOLS_API static void colorizeMeshCells(const ::fwData::Mesh::sptr& mesh,
145  const std::vector<size_t>& triangleIndexVector,
146  const std::uint8_t colorR,
147  const std::uint8_t colorG, const std::uint8_t colorB,
148  const std::uint8_t _colorA = 255);
149 
150 };
151 
152 } // namespace fwDataTools
static FWDATATOOLS_API void shakeCellNormals(::fwData::Mesh::sptr mesh)
Shake cell Normals.
static FWDATATOOLS_API void shakePointNormals(::fwData::Mesh::sptr mesh)
Shake point Normals.
static FWDATATOOLS_API void generateCellNormals(::fwData::Mesh::sptr mesh)
Generate cell normals for the mesh.
The namespace fwDataTools contains classes which provide helpers to manipulate fwData::Object. *.
static FWDATATOOLS_API void shakeNormals(::fwData::Array::sptr array)
Shake Array of Normals.
static FWDATATOOLS_API void colorizeMeshCells(::fwData::Mesh::sptr mesh)
Colorize mesh (cell color).
static FWDATATOOLS_API void generatePointNormals(::fwData::Mesh::sptr mesh)
Generate point normals for the mesh.
static FWDATATOOLS_API void transform(fwData::Mesh::csptr inMesh,::fwData::Mesh::sptr outMesh,::fwData::TransformationMatrix3D::csptr t)
Apply a transformation 4x4 from an input mesh to an output mesh.
static FWDATATOOLS_API void initRand()
Initialize &#39;rand&#39; seed.
static FWDATATOOLS_API void shakePoint(::fwData::Mesh::sptr mesh)
Shake points of the mesh.
static FWDATATOOLS_API void colorizeMeshPoints(::fwData::Mesh::sptr mesh)
Colorize mesh (vertex point color).
This helper generates a mesh using specified structure (quad or triangle).
static FWDATATOOLS_API bool hasUniqueCellType(::fwData::Mesh::csptr mesh,::fwData::Mesh::CellTypes cell)