Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
OpenWalnut
OpenWalnut Modules
Commits
a76c656d
Commit
a76c656d
authored
Jun 26, 2015
by
Alexander Wiebel
Browse files
[STYLE #42] fixed long lines and include order
parent
067731c1
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
40 additions
and
31 deletions
+40
-31
TransferCalcToolbox/src/WToolkit.cpp
TransferCalcToolbox/src/WToolkit.cpp
+3
-2
TransferCalcToolbox/src/interaction/WGetMatrixCallback.h
TransferCalcToolbox/src/interaction/WGetMatrixCallback.h
+2
-2
TransferCalcToolbox/src/interaction/WViewEventHandler.h
TransferCalcToolbox/src/interaction/WViewEventHandler.h
+2
-2
TransferCalcToolbox/src/transferCalc/WMTransferCalc.cpp
TransferCalcToolbox/src/transferCalc/WMTransferCalc.cpp
+33
-25
No files found.
TransferCalcToolbox/src/WToolkit.cpp
View file @
a76c656d
...
...
@@ -22,18 +22,19 @@
//
//---------------------------------------------------------------------------
#include <boost/shared_ptr.hpp>
#include <core/kernel/WModule.h>
#include <boost/shared_ptr.hpp>
#include "transferCalc/WMTransferCalc.h"
#include "WToolkit.h"
// This file's purpose is to provide a list of modules as entry point for OpenWalnut's module loader.
// Add your modules here. If you miss this step, OpenWalnut will not be able to load your modules.
extern
"C"
void
WLoadModule
(
WModuleList
&
m
)
// NOLINT
{
m
.
push_back
(
boost
::
shared_ptr
<
WModule
>
(
new
WMTransferCalc
)
);
}
TransferCalcToolbox/src/interaction/WGetMatrixCallback.h
View file @
a76c656d
...
...
@@ -25,12 +25,13 @@
#ifndef WGETMATRIXCALLBACK_H
#define WGETMATRIXCALLBACK_H
#include <core/common/WProperties.h>
#include <osg/ref_ptr>
#include <osg/NodeCallback>
#include <osg/NodeVisitor>
#include <osg/Node>
#include <core/common/WProperties.h>
/**
* This is a simple cull callback which grabs the view or projection matrix information for a certain node. It provides these matrices and camera
...
...
@@ -176,4 +177,3 @@ private:
};
#endif // WGETMATRIXCALLBACK_H
TransferCalcToolbox/src/interaction/WViewEventHandler.h
View file @
a76c656d
...
...
@@ -25,6 +25,8 @@
#ifndef WVIEWEVENTHANDLER_H
#define WVIEWEVENTHANDLER_H
#include <core/common/math/linearAlgebra/WVectorFixed.h>
#include <boost/signals2/signal.hpp>
#include <boost/function.hpp>
#include <boost/bind.hpp>
...
...
@@ -35,7 +37,6 @@
#include <osgGA/GUIEventAdapter>
#include <osgGA/GUIEventHandler>
#include <core/common/math/linearAlgebra/WVectorFixed.h>
/**
* Class to handle events in a WGEView/widget.
...
...
@@ -106,4 +107,3 @@ private:
};
#endif // WVIEWEVENTHANDLER_H
TransferCalcToolbox/src/transferCalc/WMTransferCalc.cpp
View file @
a76c656d
...
...
@@ -29,22 +29,23 @@
// * External Lib headers (like OSG or Boost headers)
// * headers of other classes inside OpenWalnut
// * your own header file
#define _USE_MATH_DEFINES
#define _USE_MATH_DEFINES
#include <string>
#include <sstream>
#include <vector>
#include <algorithm>
#include <cstdlib>
#include <ctime>
#include <stdlib.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <limits>
#include <algorithm>
#include <cmath>
#include <
math.h
>
#include <
iostream
>
#include <
cstdlib
>
#include <
ctime
>
#include <fstream>
#include <iostream>
#include <limits>
#include <sstream>
#include <string>
#include <vector>
#include <osg/ShapeDrawable>
#include <osg/Group>
...
...
@@ -55,6 +56,7 @@
#include <Eigen/Eigen>
#include "core/kernel/WKernel.h"
#include "core/common/WColor.h"
#include "core/common/WPathHelper.h"
...
...
@@ -658,8 +660,8 @@ void WMTransferCalc::onClick( WVector2i mousePos )
WVector4d
ax2_4
(
ax2
.
x
(),
ax2
.
y
(),
ax2
.
z
(),
0.0
);
// calculate random ray
WVector4d
vicPoint
=
ray
.
start
()
+
(
ax1_4
*
sqrt
(
random_rad
)
*
std
::
cos
(
angle
)
*
radius
)
+
WVector4d
vicPoint
=
ray
.
start
()
+
(
ax1_4
*
sqrt
(
random_rad
)
*
std
::
cos
(
angle
)
*
radius
)
+
(
ax2_4
*
sqrt
(
random_rad
)
*
std
::
sin
(
angle
)
*
radius
);
WRay
vicinity
(
vicPoint
,
ray
.
direction
()
);
m_profiles
.
push_back
(
castRay
(
vicinity
,
interval
,
rayGeode
)
);
...
...
@@ -693,7 +695,7 @@ WRayProfile WMTransferCalc::castRay( WRay ray, double interval, osg::ref_ptr< os
}
double
start_t
=
bounds
.
minimum_t
;
double
end_t
=
bounds
.
maximum_t
;
// debugLog() << "Start:" << start_t;
// debugLog() << "End :" << end_t;
...
...
@@ -891,13 +893,13 @@ WVector4d WMTransferCalc::getGradient( const WVector4d& position )
// central difference quotient in each direction
x_val
=
(
(
interpolate
(
position
+
WVector4d
(
dist_x
,
0.0
,
0.0
,
0.0
),
m_grid
,
m_dataSet
)
)
-
(
interpolate
(
position
-
WVector4d
(
dist_x
,
0.0
,
0.0
,
0.0
),
m_grid
,
m_dataSet
)
)
)
-
(
interpolate
(
position
-
WVector4d
(
dist_x
,
0.0
,
0.0
,
0.0
),
m_grid
,
m_dataSet
)
)
)
/
2
*
dist_x
;
y_val
=
(
(
interpolate
(
position
+
WVector4d
(
0.0
,
dist_y
,
0.0
,
0.0
),
m_grid
,
m_dataSet
)
)
-
(
interpolate
(
position
-
WVector4d
(
0.0
,
dist_y
,
0.0
,
0.0
),
m_grid
,
m_dataSet
)
)
)
-
(
interpolate
(
position
-
WVector4d
(
0.0
,
dist_y
,
0.0
,
0.0
),
m_grid
,
m_dataSet
)
)
)
/
2
*
dist_y
;
z_val
=
(
(
interpolate
(
position
+
WVector4d
(
0.0
,
0.0
,
dist_z
,
0.0
),
m_grid
,
m_dataSet
)
)
-
(
interpolate
(
position
-
WVector4d
(
0.0
,
0.0
,
dist_z
,
0.0
),
m_grid
,
m_dataSet
)
)
)
-
(
interpolate
(
position
-
WVector4d
(
0.0
,
0.0
,
dist_z
,
0.0
),
m_grid
,
m_dataSet
)
)
)
/
2
*
dist_z
;
return
WVector4d
(
x_val
,
y_val
,
z_val
,
0
);
...
...
@@ -1215,12 +1217,18 @@ void WMTransferCalc::calculateCurvature()
derivIds
[
4
]
=
m_deriGrid
->
getVoxelNum
(
position
+
WVector3d
(
0
,
0
,
-
dist_z
)
);
derivIds
[
5
]
=
m_deriGrid
->
getVoxelNum
(
position
+
WVector3d
(
0
,
0
,
dist_z
)
);
// get gradient vectors for each neighbour if this neighbour is inside the grid
derivDirection
[
0
]
=
static_cast
<
WVector3d
>
(
m_deriDataSet
->
getValueSet
()
->
getWValueDouble
(
(
derivIds
[
0
]
==
-
1
)
?
id
:
derivIds
[
0
]
)
);
derivDirection
[
1
]
=
static_cast
<
WVector3d
>
(
m_deriDataSet
->
getValueSet
()
->
getWValueDouble
(
(
derivIds
[
1
]
==
-
1
)
?
id
:
derivIds
[
1
]
)
);
derivDirection
[
2
]
=
static_cast
<
WVector3d
>
(
m_deriDataSet
->
getValueSet
()
->
getWValueDouble
(
(
derivIds
[
2
]
==
-
1
)
?
id
:
derivIds
[
2
]
)
);
derivDirection
[
3
]
=
static_cast
<
WVector3d
>
(
m_deriDataSet
->
getValueSet
()
->
getWValueDouble
(
(
derivIds
[
3
]
==
-
1
)
?
id
:
derivIds
[
3
]
)
);
derivDirection
[
4
]
=
static_cast
<
WVector3d
>
(
m_deriDataSet
->
getValueSet
()
->
getWValueDouble
(
(
derivIds
[
4
]
==
-
1
)
?
id
:
derivIds
[
4
]
)
);
derivDirection
[
5
]
=
static_cast
<
WVector3d
>
(
m_deriDataSet
->
getValueSet
()
->
getWValueDouble
(
(
derivIds
[
5
]
==
-
1
)
?
id
:
derivIds
[
5
]
)
);
derivDirection
[
0
]
=
static_cast
<
WVector3d
>
(
m_deriDataSet
->
getValueSet
()
->
getWValueDouble
(
(
derivIds
[
0
]
==
-
1
)
?
id
:
derivIds
[
0
]
)
);
derivDirection
[
1
]
=
static_cast
<
WVector3d
>
(
m_deriDataSet
->
getValueSet
()
->
getWValueDouble
(
(
derivIds
[
1
]
==
-
1
)
?
id
:
derivIds
[
1
]
)
);
derivDirection
[
2
]
=
static_cast
<
WVector3d
>
(
m_deriDataSet
->
getValueSet
()
->
getWValueDouble
(
(
derivIds
[
2
]
==
-
1
)
?
id
:
derivIds
[
2
]
)
);
derivDirection
[
3
]
=
static_cast
<
WVector3d
>
(
m_deriDataSet
->
getValueSet
()
->
getWValueDouble
(
(
derivIds
[
3
]
==
-
1
)
?
id
:
derivIds
[
3
]
)
);
derivDirection
[
4
]
=
static_cast
<
WVector3d
>
(
m_deriDataSet
->
getValueSet
()
->
getWValueDouble
(
(
derivIds
[
4
]
==
-
1
)
?
id
:
derivIds
[
4
]
)
);
derivDirection
[
5
]
=
static_cast
<
WVector3d
>
(
m_deriDataSet
->
getValueSet
()
->
getWValueDouble
(
(
derivIds
[
5
]
==
-
1
)
?
id
:
derivIds
[
5
]
)
);
// derivate in each direction again (central differential quotient) to get hessian matrix
Eigen
::
Matrix3d
hesse
;
...
...
@@ -1244,8 +1252,8 @@ void WMTransferCalc::calculateCurvature()
// normal n = -g/|g|
// P = E - nn^T
// nabla-n^T = -PH / |g| (where H is the hessian matrix)
WVector3d
g
=
static_cast
<
WVector3d
>
(
m_deriDataSet
->
getValueSet
()
->
getWValueDouble
(
m_deriGrid
->
getVoxelNum
(
position
)
)
WVector3d
g
=
static_cast
<
WVector3d
>
(
m_deriDataSet
->
getValueSet
()
->
getWValueDouble
(
m_deriGrid
->
getVoxelNum
(
position
)
)
);
double
g_weight
=
length
(
g
);
WVector3d
n
=
(
g
*
-
1
)
/
g_weight
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment