Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
mantid
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mantidproject
mantid
Commits
58bfc9f8
Commit
58bfc9f8
authored
9 years ago
by
Matthew D Jones
Browse files
Options
Downloads
Patches
Plain Diff
Re #11422 Scale transformation now of correct form
parent
bdbd43c7
Branches
equality_for_sample_run
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Code/Mantid/MantidPlot/src/plot2D/PowerScaleEngine.cpp
+21
-12
21 additions, 12 deletions
Code/Mantid/MantidPlot/src/plot2D/PowerScaleEngine.cpp
Code/Mantid/MantidPlot/src/plot2D/PowerScaleEngine.h
+3
-1
3 additions, 1 deletion
Code/Mantid/MantidPlot/src/plot2D/PowerScaleEngine.h
with
24 additions
and
13 deletions
Code/Mantid/MantidPlot/src/plot2D/PowerScaleEngine.cpp
+
21
−
12
View file @
58bfc9f8
...
...
@@ -4,7 +4,7 @@
--------------------------------------------------------------------
Copyright : (C) 2009 by Ion Vasilief
Email (use @ for *) : ion_vasilief*yahoo.fr
Description : Return a transformation for
reciprocal (1/t
) scales
Description : Return a transformation for
power (X^n
) scales
***************************************************************************/
...
...
@@ -141,15 +141,6 @@ void PowerScaleEngine::buildTicks(
for
(
int
i
=
0
;
i
<
QwtScaleDiv
::
NTickTypes
;
i
++
)
{
ticks
[
i
]
=
strip
(
ticks
[
i
],
interval
);
// ticks very close to 0.0 are
// explicitely set to 0.0
for
(
int
j
=
0
;
j
<
(
int
)
ticks
[
i
].
count
();
j
++
)
{
if
(
QwtScaleArithmetic
::
compareEps
(
ticks
[
i
][
j
],
0.0
,
stepSize
)
==
0
)
ticks
[
i
][
j
]
=
0.0
;
}
}
}
...
...
@@ -244,15 +235,33 @@ QwtScaleTransformation *PowerScaleTransformation::copy() const
return
new
PowerScaleTransformation
(
d_engine
);
}
/*
* Transform a value between 2 linear intervals
*
* \param s value related to the interval [s1, s2]
* \param s1 first border of scale interval
* \param s2 second border of scale interval
* \param p1 first border of target interval
* \param p2 second border of target interval
*/
double
PowerScaleTransformation
::
xForm
(
double
s
,
double
s1
,
double
s2
,
double
p1
,
double
p2
)
const
{
return
p1
+
(
p2
-
p1
)
*
s2
*
(
s1
-
s
)
/
(
s
*
(
s1
-
s2
));
return
p1
+
(
p2
-
p1
)
/
(
pow
(
s2
,
nth_power
)
-
pow
(
s1
,
nth_power
))
*
(
pow
(
s
,
nth_power
)
-
pow
(
s1
,
nth_power
));
}
/*
* Transform a value from a linear to a power scale interval
*
* \param p value related to the linear interval [p1, p2]
* \param p1 first border of linear interval
* \param p2 second border of linear interval
* \param s1 first border of logarithmic interval
* \param s2 second border of logarithmic interval
*/
double
PowerScaleTransformation
::
invXForm
(
double
p
,
double
p1
,
double
p2
,
double
s1
,
double
s2
)
const
{
return
s1
*
s2
*
(
p
2
-
p1
)
/
(
s2
*
(
p2
-
p
)
+
s1
*
(
p
-
p1
))
;
return
pow
(
(
p
-
p1
)
/
(
p2
-
p
1
)
*
(
pow
(
s2
,
nth_power
)
-
pow
(
s1
,
nth_power
)),
1.0
/
nth_power
)
*
s1
;
}
This diff is collapsed.
Click to expand it.
Code/Mantid/MantidPlot/src/plot2D/PowerScaleEngine.h
+
3
−
1
View file @
58bfc9f8
...
...
@@ -37,10 +37,12 @@
class
PowerScaleTransformation
:
public
ScaleTransformation
{
public:
PowerScaleTransformation
(
const
ScaleEngine
*
engine
)
:
ScaleTransformation
(
engine
){};
PowerScaleTransformation
(
const
ScaleEngine
*
engine
)
:
ScaleTransformation
(
engine
){
nth_power
=
2.0
;
};
virtual
double
xForm
(
double
x
,
double
,
double
,
double
p1
,
double
p2
)
const
;
virtual
double
invXForm
(
double
x
,
double
s1
,
double
s2
,
double
p1
,
double
p2
)
const
;
QwtScaleTransformation
*
copy
()
const
;
private
:
double
nth_power
;
};
/*!
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment