MeVisLab Toolbox Reference
CSOTrailRenderer.h
Go to the documentation of this file.
1 /*************************************************************************************
2 **
3 ** Copyright 2014, MeVis Medical Solutions AG
4 **
5 ** The user may use this file in accordance with the license agreement provided with
6 ** the Software or, alternatively, in accordance with the terms contained in a
7 ** written agreement between the user and MeVis Medical Solutions AG.
8 **
9 ** For further information use the contact form at https://www.mevislab.de/contact
10 **
11 **************************************************************************************/
12 
13 
15 
16 #pragma once
17 
18 #include <mlVector3.h>
19 #include <vector>
20 #include <SoCSOSystem.h>
21 #include <CSOBase/CSOBoundingBox.h>
22 
23 class SbVec3f;
24 class SbVec2f;
25 class SbColor;
26 
27 struct CSODrawView2DInfos;
28 
31 namespace SoCSOEditorTools
32 {
33  struct LineRenderSettings;
34 }
35 
38 {
40  {
41  csoPointsIndex = 0;
42  trailPointsIndex = 0;
43  }
47 };
48 typedef std::vector<CSOTrailIntersection> CSOTrailIntersections;
49 
50 
52 {
53 public:
54 
55  typedef std::vector<ml::Vector3> TrailT;
56 
58 
59  const TrailT& getTrail() const;
61  bool hasTrail() const;
62  bool hasTrailWithArea() const;
63  bool isInPlane() const;
66  std::vector<ml::Vector3>& getTrailVoxelSpace();
67  std::vector<ml::Vector3>& getSmoothedTrailVoxelSpace();
68 
69  void addToTrail(const SbVec3f& position);
70  void clearTrail();
71 
72  void setWorldToVoxelMatrix(const ml::Matrix4& worldToVoxelMatrix);
73 
74  // note: renderSetting attributes outlineColor and outlineAlpha are currently not considered
75  void setupGLForTrail(const SoCSOEditorTools::LineRenderSettings& renderSettings) const;
76  void setBackGLForTrail() const;
77 
78  void drawTrail(const CSODrawView2DInfos& view2DInfos, SoView2DCSOExtensibleEditor* editor, bool closeTrail=true) const;
79 
81  static bool segmentsArePossiblyCrossing(const ml::Vector3& trailSegmentStart,
82  const ml::Vector3& trailSegmentEnd,
83  const ml::Vector3& csoSegmentStart,
84  const ml::Vector3& csoSegmentEnd);
85 
87  static void smoothPositions(const TrailT& inputPositions, TrailT& smoothedTrail);
88 
89 protected:
91  void convertSbVec3fToVector3(const SbVec3f& original, ml::Vector3& copy) const;
92 
100 };
std::vector< CSOTrailIntersection > CSOTrailIntersections
#define SOCSO_EXPORT
Header file for system independent resolution.
Definition: SoCSOSystem.h:21
ml::Matrix4 _worldToVoxelMatrix
TrailT _smoothedTrailPositionsVoxelSpace
std::vector< ml::Vector3 > & getSmoothedTrailVoxelSpace()
bool hasTrailWithArea() const
static void smoothPositions(const TrailT &inputPositions, TrailT &smoothedTrail)
Smooths the given vector of positions by a Laplacian smoothing.
void addToTrail(const SbVec3f &position)
void setWorldToVoxelMatrix(const ml::Matrix4 &worldToVoxelMatrix)
void convertSbVec3fToVector3(const SbVec3f &original, ml::Vector3 &copy) const
void setupGLForTrail(const SoCSOEditorTools::LineRenderSettings &renderSettings) const
std::vector< ml::Vector3 > & getTrailVoxelSpace()
ml::CSOBoundingBox _projectedTrailVoxelBoundingBox
bool isInPlane() const
ml::CSOBoundingBox getVoxelBoundingBox()
std::vector< ml::Vector3 > TrailT
void computeVoxelSpaceProperties()
void drawTrail(const CSODrawView2DInfos &view2DInfos, SoView2DCSOExtensibleEditor *editor, bool closeTrail=true) const
ml::Vector3 getTrailNormal() const
bool _shouldRecomputeVoxelSpaceProperties
const TrailT & getTrail() const
ml::CSOBoundingBox getProjectedVoxelBoundingBox()
TrailT _trailPositionsVoxelSpace
bool hasTrail() const
static bool segmentsArePossiblyCrossing(const ml::Vector3 &trailSegmentStart, const ml::Vector3 &trailSegmentEnd, const ml::Vector3 &csoSegmentStart, const ml::Vector3 &csoSegmentEnd)
Returns whether the given segments are potentially crossing each other.
void setBackGLForTrail() const
ml::CSOBoundingBox _voxelBoundingBox
Base class for an editor extension for the SoView2DCSOExtensibleEditor.
The CSOBoundingBox defines an axis parallel bounding box with double precision.
Struct holding the CSO/trail point index and the computed intersection point.
ml::Vector3 intersectionPoint