Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
MUG
visad
Commits
b3cb542f
Commit
b3cb542f
authored
Sep 27, 2018
by
rink
Browse files
refactor for cleaner handling of when no interpolation is true
parent
b7ba8009
Changes
3
Hide whitespace changes
Inline
Side-by-side
core/src/visad/TrajectoryManager.java
View file @
b3cb542f
...
...
@@ -94,8 +94,6 @@ public class TrajectoryManager {
boolean
trajCachingEnabled
=
false
;
boolean
trcrStreamingEnabled
;
boolean
saveTracerLocations
;
//boolean doHysplit = false;
//boolean doRK4 = true;
float
trcrSize
=
1
f
;
boolean
trcrEnabled
;
boolean
terrainFollowEnabled
;
...
...
@@ -170,7 +168,6 @@ public class TrajectoryManager {
method
=
trajParams
.
getMethod
();
direction
=
trajParams
.
getDirection
();
startPts
=
trajParams
.
getStartPoints
();
trajDoIntrp
=
trajParams
.
getDoIntrp
();
trcrSize
=
trajParams
.
getMarkerSize
();
trcrEnabled
=
trajParams
.
getMarkerEnabled
();
trajCachingEnabled
=
trajParams
.
getCachingEnabled
();
...
...
@@ -183,9 +180,6 @@ public class TrajectoryManager {
zSkip
=
trajParams
.
getZStartSkip
();
startPointType
=
trajParams
.
getStartType
();
saveTracerLocations
=
trajParams
.
getSaveTracerLocations
();
if
(!
trajDoIntrp
)
{
numIntrpPts
=
1
;
}
this
.
altToZ
=
altToZ
;
if
(
terrainFollowEnabled
)
{
...
...
@@ -297,14 +291,21 @@ public class TrajectoryManager {
}
if
(
trajParams
.
getInterpolationMethod
()
==
TrajectoryParams
.
InterpolationMethod
.
Cubic
)
{
uInterp
=
new
CubicInterpolator
(
trajDoIntrp
,
numSpatialPts
);
vInterp
=
new
CubicInterpolator
(
trajDoIntrp
,
numSpatialPts
);
wInterp
=
new
CubicInterpolator
(
trajDoIntrp
,
numSpatialPts
);
uInterp
=
new
CubicInterpolator
(
numSpatialPts
);
vInterp
=
new
CubicInterpolator
(
numSpatialPts
);
wInterp
=
new
CubicInterpolator
(
numSpatialPts
);
}
else
if
(
trajParams
.
getInterpolationMethod
()
==
TrajectoryParams
.
InterpolationMethod
.
Linear
)
{
uInterp
=
new
LinearInterpolator
(
trajDoIntrp
,
numSpatialPts
);
vInterp
=
new
LinearInterpolator
(
trajDoIntrp
,
numSpatialPts
);
wInterp
=
new
LinearInterpolator
(
trajDoIntrp
,
numSpatialPts
);
uInterp
=
new
LinearInterpolator
(
numSpatialPts
);
vInterp
=
new
LinearInterpolator
(
numSpatialPts
);
wInterp
=
new
LinearInterpolator
(
numSpatialPts
);
}
else
if
(
trajParams
.
getInterpolationMethod
()
==
TrajectoryParams
.
InterpolationMethod
.
None
)
{
uInterp
=
new
NoneInterpolator
(
numSpatialPts
);
vInterp
=
new
NoneInterpolator
(
numSpatialPts
);
wInterp
=
new
NoneInterpolator
(
numSpatialPts
);
trajDoIntrp
=
false
;
numIntrpPts
=
1
;
}
values0
=
null
;
...
...
@@ -2446,11 +2447,6 @@ public class TrajectoryManager {
trajParams
.
setManualIntrpPts
(
Boolean
.
valueOf
(
propStr
.
trim
()));
}
propStr
=
prop
.
getProperty
(
"TrajDoIntrp"
);
if
(
propStr
!=
null
)
{
trajParams
.
setDoIntrp
(
Boolean
.
valueOf
(
propStr
.
trim
()));
}
propStr
=
prop
.
getProperty
(
"TerrainFollow"
);
if
(
propStr
!=
null
)
{
trajParams
.
setTerrainFollowing
(
Boolean
.
valueOf
(
propStr
.
trim
()));
...
...
@@ -2540,6 +2536,9 @@ public class TrajectoryManager {
else
if
(
propStr
.
equals
(
"LINEAR"
))
{
trajParams
.
setInterpolationMethod
(
TrajectoryParams
.
InterpolationMethod
.
Linear
);
}
else
if
(
propStr
.
equals
(
"NONE"
))
{
trajParams
.
setInterpolationMethod
(
TrajectoryParams
.
InterpolationMethod
.
None
);
}
}
propStr
=
prop
.
getProperty
(
"Direction"
);
...
...
@@ -2731,3 +2730,44 @@ class ListenForRemove implements ScalarMapListener, DisplayListener {
}
}
class
NoneInterpolator
implements
Interpolator
{
double
x0
;
double
x1
;
double
x2
;
float
[]
values0
;
float
[]
values1
;
float
[]
values2
;
int
numSpatialPts
;
public
NoneInterpolator
(
int
numSpatialPts
)
{
this
.
numSpatialPts
=
numSpatialPts
;
}
public
void
interpolate
(
double
xt
,
float
[]
interpValues
)
{
if
(
xt
==
x0
)
{
System
.
arraycopy
(
values0
,
0
,
interpValues
,
0
,
numSpatialPts
);
}
else
if
(
xt
==
x1
)
{
System
.
arraycopy
(
values1
,
0
,
interpValues
,
0
,
numSpatialPts
);
}
else
if
(
xt
==
x2
)
{
System
.
arraycopy
(
values2
,
0
,
interpValues
,
0
,
numSpatialPts
);
}
return
;
}
public
void
next
(
double
x0
,
double
x1
,
double
x2
,
float
[]
values0
,
float
[]
values1
,
float
[]
values2
)
{
this
.
x0
=
x0
;
this
.
x1
=
x1
;
this
.
x2
=
x2
;
this
.
values0
=
values0
;
this
.
values1
=
values1
;
this
.
values2
=
values2
;
return
;
}
public
void
update
(
boolean
[]
needed
)
{
return
;
}
}
core/src/visad/TrajectoryParams.java
View file @
b3cb542f
...
...
@@ -56,7 +56,8 @@ public class TrajectoryParams {
public
static
enum
InterpolationMethod
{
Cubic
,
Linear
;
Linear
,
None
;
}
public
static
final
int
LINE
=
0
;
...
...
@@ -74,7 +75,7 @@ public class TrajectoryParams {
SmoothParams
smoothParams
=
SmoothParams
.
LIGHT
;
boolean
forward
=
true
;
int
direction
=
1
;
//1: forward, -1: backward
boolean
doIntrp
=
true
;
//
boolean doIntrp = true;
float
markerSize
=
1
f
;
boolean
markerEnabled
=
false
;
boolean
manualIntrpPts
=
false
;
...
...
@@ -111,7 +112,6 @@ public class TrajectoryParams {
this
.
smoothParams
=
params
.
getSmoothParams
();
this
.
forward
=
params
.
getDirectionFlag
();
this
.
direction
=
params
.
getDirection
();
this
.
doIntrp
=
params
.
getDoIntrp
();
this
.
markerSize
=
params
.
getMarkerSize
();
this
.
markerEnabled
=
params
.
getMarkerEnabled
();
this
.
manualIntrpPts
=
params
.
getManualIntrpPts
();
...
...
@@ -196,10 +196,6 @@ public class TrajectoryParams {
return
forward
;
}
public
void
setDoIntrp
(
boolean
yesno
)
{
this
.
doIntrp
=
yesno
;
}
public
void
setNumIntrpPts
(
int
numIntrpPts
)
{
this
.
numIntrpPts
=
numIntrpPts
;
this
.
manualIntrpPts
=
true
;
...
...
@@ -305,10 +301,6 @@ public class TrajectoryParams {
return
direction
;
}
public
boolean
getDoIntrp
()
{
return
this
.
doIntrp
;
}
public
float
getMarkerSize
()
{
return
this
.
markerSize
;
}
...
...
@@ -413,9 +405,6 @@ public class TrajectoryParams {
else
if
(
this
.
trajForm
!=
trajParams
.
trajForm
)
{
return
false
;
}
else
if
(
this
.
doIntrp
!=
trajParams
.
doIntrp
)
{
return
false
;
}
else
if
(
this
.
forward
!=
trajParams
.
forward
)
{
return
false
;
}
...
...
core/src/visad/java3d/ShadowFunctionOrSetTypeJ3D.java
View file @
b3cb542f
...
...
@@ -1432,7 +1432,7 @@ System.out.println("Texture.BASE_LEVEL_LINEAR = " + Texture.BASE_LEVEL_LINEAR);
// We don't really have a time interval defined beyond the next to last point
int
computeLength
=
dataDomainLength
-
1
;
if
(
!
trajParams
.
get
Do
Intrp
()
)
{
if
(
trajParams
.
getInt
e
rp
olationMethod
()
==
TrajectoryParams
.
InterpolationMethod
.
None
)
{
if
(
trajParams
.
getMethod
()
==
TrajectoryParams
.
Method
.
RK4
)
{
// need 3 time steps
computeLength
=
dataDomainLength
-
2
;
}
...
...
Write
Preview
Supports
Markdown
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