Commit f2fc939c authored by Andrey Filippov's avatar Andrey Filippov

working snapshot

parent 66969e94
......@@ -264,8 +264,9 @@ public class CuasMotion {
private final GPUTileProcessor gpuTileProcessor;
private CLTParameters clt_parameters=null;
private QuadCLT parentCLT = null;
private double [] noise_map = null;
// private double [] noise_map = null;
private double [] noise_map8 = null;
private int [] noise_neibs = null;
private int debugLevel = 0;
private GpuQuad gpuQuad = null;
private ImageDtt image_dtt = null;
......@@ -283,13 +284,18 @@ public class CuasMotion {
private int start_frame = 0;
public double [] getNoiseMap () {
return noise_map;
}
// public double [] getNoiseMap () {
// return noise_map;
// }
public double [] getNoiseMap8 () {
return noise_map8;
}
public int [] getNoiseNeibs () {
return noise_neibs;
}
public UasLogReader getUasLogReader() {
return uasLogReader;
......@@ -419,7 +425,7 @@ public class CuasMotion {
corr_offset = clt_parameters.imp.cuas_corr_offset;
corr_pairs = clt_parameters.imp.cuas_corr_pairs;
double scale_window = clt_parameters.imp.cuas_scale_wnd; // = 2.0; //; When building noise map, scale search window range from original -8..+7 (2.0 -> -16..+15)
double noisemax8 = clt_parameters. imp.cuas_noisemax8;
// int start_frame = 0;
int num_corr_samples = (scene_titles.length - getSeqLength() - start_frame) / getCorrInc();
slice_titles = new String [num_corr_samples];
......@@ -513,12 +519,20 @@ public class CuasMotion {
}
}
}
/*
noise_map = getNoiseMap(
scale_window, // final double scale_window, // 1.0->8, 2.0 - 16.
fpixels_avg); // final float [] fpixels_avg)
*/
noise_map8 = getNoiseMap(
1.0, // final double scale_window, // 1.0->8, 2.0 - 16.
fpixels_avg); // final float [] fpixels_avg)
noise_neibs = getNoiseNeibs(
noise_map8, // final double [] noise8, // null - do not filter by noise
noisemax8, // final double noise_max,
tilesX); // final int tilesX);
return;
}
......@@ -1789,7 +1803,6 @@ public class CuasMotion {
ImageDtt.startAndJoin(threads);
}
}
*/
private static void setBadHorizon(
final double [][][] target_sequence,
final double horizon_y, // <0 - do not filter by horizon
......@@ -1828,6 +1841,77 @@ public class CuasMotion {
ImageDtt.startAndJoin(threads);
}
}
*/
private static void setBadHorizon(
final double [][][] target_sequence,
final double horizon_y, // <0 - do not filter by horizon
final int [] noise_neibs, // which neighbor is good (&=(1 << dir), 1 << 8 - this one itself)
final int tilesX){
final int num_seq = target_sequence.length;
final int num_tiles = target_sequence[0].length;
final int tilesY = num_tiles/tilesX;
final int ihorizon = (horizon_y > 0) ?( (int) Math.ceil(horizon_y/GPUTileProcessor.DTT_SIZE)) : -1; // tiles with tileY >= ihorizon are removed
final int ntile_horizon = (ihorizon > 0) ? (ihorizon * tilesX) : num_tiles;
if ((ihorizon > 0) || (noise_neibs != null)){
final Thread[] threads = ImageDtt.newThreadArray();
final AtomicInteger ai = new AtomicInteger(0);
for (int ithread = 0; ithread < threads.length; ithread++) {
threads[ithread] = new Thread() {
public void run() {
for (int nSeq = ai.getAndIncrement(); nSeq < num_seq; nSeq = ai.getAndIncrement()) {
if (noise_neibs != null) {
for (int ntile = 0; ntile < ntile_horizon; ntile++) if (noise_neibs[ntile] == 0) {
target_sequence[nSeq][ntile] = null;
}
}
if (ihorizon > 0) {
for (int tileY = ihorizon; tileY < tilesY; tileY++) {
int ntile = tileY*tilesX;
for (int tileX = 0; tileX < tilesX; tileX++) {
target_sequence[nSeq][ntile++] = null;
}
}
}
}
}
};
}
ImageDtt.startAndJoin(threads);
}
}
public static int [] getNoiseNeibs(
final double [] noise8, // null - do not filter by noise
final double noise_max,
final int tilesX){
int [] noise_neibs = new int [noise8.length];
final int tilesY = noise8.length/tilesX;
final Thread[] threads = ImageDtt.newThreadArray();
final AtomicInteger ai = new AtomicInteger(0);
for (int ithread = 0; ithread < threads.length; ithread++) {
threads[ithread] = new Thread() {
public void run() {
TileNeibs tn = new TileNeibs(tilesX, tilesY);
for (int nTile = ai.getAndIncrement(); nTile < noise8.length; nTile = ai.getAndIncrement()) if(noise8[nTile] <= noise_max) {
int neibs = 0;
for (int dir = 0; dir <=8; dir++) { // 8 is self;
int ntile1 = tn.getNeibIndex(nTile, dir);
if ((ntile1>=0) && (noise8[ntile1] <= noise_max)) {
neibs |= 1 << dir;
}
}
noise_neibs[nTile] = neibs;
}
}
};
}
ImageDtt.startAndJoin(threads);
return noise_neibs;
}
private static double getEffectiveStrengthMV(
......@@ -2082,8 +2166,8 @@ public class CuasMotion {
final int corr_offset_eff = corr_offset * Math.max(1, Math.min(corr_offset_scale, corr_pairs_ref / corr_offset));
// Hard-coded debug selectors: set >= 0 to enable per-scan/per-tile visualisation
final int dbg_nseq = 97; // 40; // 41; // 157; // -(116); // 57; // 20; // -1;
final int dbg_tile = 54+38*80; //52+38*80; // 50+38*80; // 55+38*80; // -(17 + 33*80); // 48+32*80; // 50+38*80; // -1;
final int dbg_nseq = 36; // 28; // 97; // 40; // 41; // 157; // -(116); // 57; // 20; // -1;
final int dbg_tile = 51+38*80; // 54+38*80; //52+38*80; // 50+38*80; // 55+38*80; // -(17 + 33*80); // 48+32*80; // 50+38*80; // -1;
final int corr_offset_scale_eff = corr_offset_eff / corr_offset; // actual scale after clamping
if (debugLevel >= 0) {
System.out.println("refineMotionVectors(): corr_offset="+corr_offset+", corr_offset_scale="+corr_offset_scale+
......@@ -2322,6 +2406,7 @@ public class CuasMotion {
"refineMotionVectors-CORR2D-boost"+recalc_mv_boost+"-n"+dbg_iter_index+dbg_suffix,
slice_titles_ref).show();
}
return;
}
/**
......@@ -6446,6 +6531,38 @@ public class CuasMotion {
return new int[] {adup.get(), adup_good.get()};
}
public static void trimTargets( // limit number of targets per tile
final double [][][][] target_multi,
final int max_targets) {
final int num_seq = target_multi.length;
final int num_tiles = target_multi[0].length;
final Thread[] threads = ImageDtt.newThreadArray();
final AtomicInteger ai = new AtomicInteger(0);
final AtomicInteger adup = new AtomicInteger(0);
final AtomicInteger adup_good = new AtomicInteger(0);
for (int ithread = 0; ithread < threads.length; ithread++) {
threads[ithread] = new Thread() {
public void run() {
for (int nSeq = ai.getAndIncrement(); nSeq < num_seq; nSeq = ai.getAndIncrement()) {
for (int ntile = 0; ntile < num_tiles; ntile++) {
double [][] targets = target_multi[nSeq][ntile];
if ((targets != null) && (targets.length > max_targets)){
double [][] targets_trimmed = new double[max_targets][];
System.arraycopy(
targets, 0,
targets_trimmed, 0, max_targets);
target_multi[nSeq][ntile]=targets_trimmed;
}
}
}
}
};
}
ImageDtt.startAndJoin(threads);
return;
}
......@@ -7450,13 +7567,19 @@ public class CuasMotion {
parentCLT.saveImagePlusInModelDirectory(imp_corr2d); // ImagePlus imp)
}
}
/*
setBadHorizon(
target_sequence, // final double [][][] target_sequence,
target_horizon, // final double horizon_y,
cuasMotion.getNoiseMap8(), // final double [] noise8, // null - do not filter by noise
noisemax8, // final double noise_max,
cuasMotion.tilesX); // final int tilesX)
*/
setBadHorizon(
target_sequence, // final double [][][] target_sequence,
target_horizon, // final double horizon_y,
cuasMotion.getNoiseNeibs(), // final double [] noise8, // null - do not filter by noise
cuasMotion.tilesX); // final int tilesX)
// After this target_sequence should not be null-ed, failure status should only change from NaN to 0/>0 values
if (intermed_low ) {
......@@ -8026,8 +8149,9 @@ public class CuasMotion {
slow_fast_mismatch,// final double slow_fast_mismatch, // // 1.5; allow larger mismatch between slow and fast
fail_mismatch, // final boolean fail_mismatch,
offcenter, // final double offcenter,
cuasMotion.getNoiseMap(), // final double [] noise_map,
noisemax, // final double noise_max,
cuasMotion.getNoiseNeibs(), // final int [] noise_neibs,
// cuasMotion.getNoiseMap(), // final double [] noise_map,
// noisemax, // final double noise_max,
target_horizon, // final double lma_horizon, // horizon as maximal pixel Y
cuasMotion.tilesX); // final int tilesX,
getScore(
......@@ -8221,44 +8345,7 @@ public class CuasMotion {
cuasMotion.tilesX); // int tilesX) {
parentCLT.saveImagePlusInModelDirectory(imp_novl);
}
/*
// Andrey 05/05/2026 moved here (earlier) so shiftAndRenderAccumulate() will use updated motion vector
// By Claude on 05/05/2026 — re-correlate with spatial mask around known target
if (recalc_mv) {
refineMotionVectors(
clt_parameters, // CLTParameters clt_parameters,
batch_mode, // boolean batch_mode,
cuasMotion, // CuasMotion cuasMotion,
recalc_mv_boost, // double recalc_mv_boost,
recalc_mv_r0, // double recalc_mv_r0,
recalc_mv_r1, // double recalc_mv_r1,
fpixels_refine, // By Claude on 05/07/2026: LPF'd with precorr_ra (was fpixels_tum)
targets_nonoverlap, // double [][][] targets_nonoverlap,
frame0, // int frame0,
corr_inc, // int corr_inc,
half_accum_range, // int half_accum_range,
smooth, // boolean smooth,
corr_offset, // int corr_offset,
niter - niter0, // int dbg_iter_index,
debugLevel); // -1); // debugLevel); // int debugLevel)
}
double [][][] extended_scan = extendMotionScan(
targets_nonoverlap, // final double [][][] motion_scan,
null, // filter5, // final boolean [][] filtered, // centers, should be non-overlapped
cuasMotion.tilesX, // final int tilesX)
2, // final int range, // 1 or 2
null); // remain); // final int [] remain)
if (save_filtered_low && debug_more) {
ImagePlus imp_ext = showTargetSequence(
extended_scan, // double [][][] vector_fields_sequence,
slice_titles, // String [] titles, // all slices*frames titles or just slice titles or null
model_prefix+"-EXTENDED-CENTERED-n"+niter,// String title,
!batch_mode, // boolean show,
cuasMotion.tilesX); // int tilesX) {
parentCLT.saveImagePlusInModelDirectory(imp_ext);
}
*/
// double [][][][] targets_new_multi = null;
int num_new = 0;
if (accum_boosted) {
// Andrey 05/05/2026 moved here (earlier) so shiftAndRenderAccumulate() will use updated motion vector
......@@ -8604,6 +8691,15 @@ public class CuasMotion {
!batch_mode, // boolean show,
cuasMotion.tilesX); // int tilesX) {
parentCLT.saveImagePlusInModelDirectory(imp_good); // ImagePlus imp)
ImagePlus imp_good_only = showTargetSequence(// tried 80*64*243815 slices
target_sequence_multi, // double [][][] vector_fields_sequence,
slice_titles, // String [] titles, // all slices*frames titles or just slice titles or null
model_prefix+"-ROUND_TWO_GOOD",// String title,
true, // final boolean good_only,
false, // final boolean show_empty, // show scenes with no (valid) targets
!batch_mode, // boolean show,
cuasMotion.tilesX); // int tilesX) {
parentCLT.saveImagePlusInModelDirectory(imp_good_only); // ImagePlus imp)
}
return target_sequence_multi; // target_sequence; // contains all tiles, good or bad, their data and when they were defined
}
......@@ -8837,8 +8933,9 @@ public class CuasMotion {
slow_fast_mismatch,// final double slow_fast_mismatch, // // 1.5; allow larger mismatch between slow and fast
fail_mismatch, // final boolean fail_mismatch,
offcenter, // final double offcenter,
cuasMotion.getNoiseMap(), // final double [] noise_map,
noisemax, // final double noise_max,
cuasMotion.getNoiseNeibs(), // final int [] noise_neibs,
// cuasMotion.getNoiseMap(), // final double [] noise_map,
// noisemax, // final double noise_max,
target_horizon, // final double lma_horizon, // horizon as maximal pixel Y
cuasMotion.tilesX); // final int tilesX,
int [] remain_es_centered = getScore(
......@@ -8907,9 +9004,9 @@ public class CuasMotion {
final int [][] filter5 = new int [num_seq][num_tiles];
final Thread[] threads = ImageDtt.newThreadArray();
final AtomicInteger ai = new AtomicInteger(0);
final int dbg_tile = debug_now ?(50+38*80) : -1;
final int dbg_seq0 = debug_now ? 20: -1;
final int dbg_seq1 = debug_now ? 21: -1;
final int dbg_tile = debug_now ?(51+38*80) : -1;
final int dbg_seq0 = debug_now ? 27: -1;
final int dbg_seq1 = debug_now ? 29: -1;
final int ihorizon = (lma_horizon > 0) ?( (int) Math.ceil(lma_horizon/GPUTileProcessor.DTT_SIZE)) : -1; // tiles with tileY >= ihorizon are removed
if (dbg_tile >=0) {
System.out.println("filter5Targets()):00: use_motion="+use_motion+", select_new="+select_new+", ihorizon="+ihorizon);
......@@ -9268,17 +9365,23 @@ public class CuasMotion {
final double slow_fast_mismatch,
final boolean fail_mismatch,
final double offcenter,
final double [] noise_map,
final double noise_max,
final int [] noise_neibs,
// final double [] noise_map,
// final double noise_max,
final double lma_horizon, // horizon as maximal pixel Y
final int tilesX ) {
final int all_neibs = (1 << 9) -1; // 511
final double abs_offcenter= offcenter*GPUTileProcessor.DTT_SIZE;
// final double [] noise_map = null;
// final double noise_max = 0;
// if centroid maximum is safely good, ignore lma_a2a ratio
final double SAFE_CENT_MX = 3 * target_strength; // Find a more elegant solution
final int num_seq = target_sequence_multi.length;
final int num_tiles = target_sequence_multi[0].length;
// final double center_scale = 0.25*Math.PI/GPUTileProcessor.DTT_SIZE;
final double center_scale = 0.125*Math.PI/GPUTileProcessor.DTT_SIZE/offcenter;
final int dbg_tile = -(34 + 34*80);
final int dbg_tile = 51+38*80; // -(34 + 34*80);
final Thread[] threads = ImageDtt.newThreadArray();
final AtomicInteger ai = new AtomicInteger(0);
for (int ithread = 0; ithread < threads.length; ithread++) {
......@@ -9325,8 +9428,8 @@ public class CuasMotion {
} else {
// double ax = Math.abs(x) - 0.25*GPUTileProcessor.DTT_SIZE;
// double ay = Math.abs(y) - 0.25*GPUTileProcessor.DTT_SIZE; // was same as ax 04/09/2026
double ax = Math.abs(x) - 0.5*offcenter*GPUTileProcessor.DTT_SIZE;
double ay = Math.abs(y) - 0.5*offcenter*GPUTileProcessor.DTT_SIZE; // was same as ax 04/09/2026
double ax = Math.abs(x) - 0.5*abs_offcenter;
double ay = Math.abs(y) - 0.5*abs_offcenter; // was same as ax 04/09/2026
if (ax > 0) {
cxy *= Math.cos(ax * center_scale);
}
......@@ -9403,9 +9506,10 @@ public class CuasMotion {
if (cxy==0) {
// do not fail if average image has high variations for this tile
// near horizon allow targets far ftom the tile center. AF 04/26/2026
if ((noise_map == null) || (noise_map[ntile] < noise_max)) {
if ((noise_neibs == null) || (noise_neibs[ntile] == all_neibs) || // faster shortcut not to check direction
((noise_neibs[ntile] & (1 << TileNeibs.getDir(x,y,abs_offcenter))) != 0 )) {
lma_rslts[CuasMotionLMA.RSLT_FAIL] = CuasMotionLMA.FAIL_FAR;
break try_failures; // below horizon line
break try_failures; // There is a valid tile in that direction - it should care about this target
}
// see if it is completely outside
if ((Math.abs(x) >= (GPUTileProcessor.DTT_SIZE-1)) ||
......
......@@ -249,18 +249,29 @@ public class CuasRanging {
uasLogReader, // UasLogReader uasLogReader,
debugLevel); // int debugLevel)
if (save_noise_map) {
/*
ImagePlus imp_noise_map = ShowDoubleFloatArrays.makeArrays(
cuasMotion.getNoiseMap(), // float[][] pixels,
cuasMotion.getTilesX(), // int width,
cuasMotion.getTilesY(), // int height,
center_CLT.getImageName()+"-NOISE-MAP"); //String [] titles)
center_CLT.saveImagePlusInModelDirectory(imp_noise_map); // ImagePlus imp)
*/
ImagePlus imp_noise_map8 = ShowDoubleFloatArrays.makeArrays(
cuasMotion.getNoiseMap8(), // float[][] pixels,
cuasMotion.getTilesX(), // int width,
cuasMotion.getTilesY(), // int height,
center_CLT.getImageName()+"-NOISE-MAP8"); //String [] titles)
center_CLT.saveImagePlusInModelDirectory(imp_noise_map8); // ImagePlus imp)
ImagePlus imp_noise_neibs = ShowDoubleFloatArrays.makeArrays(
cuasMotion.getNoiseNeibs(), // float[][] pixels,
cuasMotion.getTilesX(), // int width,
cuasMotion.getTilesY(), // int height,
center_CLT.getImageName()+"-NOISE-NEIBS"); //String [] titles)
center_CLT.saveImagePlusInModelDirectory(imp_noise_neibs); // ImagePlus imp)
}
......
......@@ -816,6 +816,8 @@ min_str_neib_fpn 0.35
public int cuas_max_range = 2; // how far to extend local max: 1 3x3 neighbors, 2 - 5x5 neighbs
public int cuas_fin_range = 2; // for final filtering
public int cuas_num_cycles = 25; // number of cycles of testing and removing bad targets // will get out earlier
public int cuas_trim_first = 5; // Trim targets after first (non-centered) pass (if > 0)
// Recalculate Motion Vectors before centered \"tracking camera\"
public boolean cuas_recalc_mv = true; // Recalculate motion vectors before centered targets accumulation by masking far-from target areas
......@@ -858,6 +860,7 @@ min_str_neib_fpn 0.35
public double cuas_target_radius = 2.0; // target centroids center radius
public double cuas_target_strength =0.2; // target centroids strength
public double cuas_target_strength2 =0.2; // target centroids strength
public double [][] cuas_target_frac = {{0,0.04},{2.5,0.1},{5,0.3}};
public boolean cuas_no_border = true; // exclude targets with centers on the 16x16 tile edges
// CUAS Motion LMA parameters
......@@ -2718,9 +2721,9 @@ min_str_neib_fpn 0.35
"Do not boost if motion vector faster than this (before in code equiv 1.8 pix).");
gd.addNumericField("Increase tracking camera exposure", this.cuas_boost_accum, 5,8,"",
"If >1 increase tracking camera exposure (later - conditional).");
gd.addCheckbox ("Accumulate tracking base exposuer", this.cuas_accum_base,
gd.addCheckbox ("Accumulate tracking base exposure", this.cuas_accum_base,
"Accumulate centered targets with base \"exposure\".");
gd.addCheckbox ("Accumulate tracking boosted exposuer", this.cuas_accum_boosted,
gd.addCheckbox ("Accumulate tracking boosted exposure", this.cuas_accum_boosted,
"Accumulate centered targets with boosted \"exposure\".");
gd.addNumericField("Boost pairs for weak targets", this.cuas_boost_mstr, 5,8,"",
"Scale corr_pairs if motion strength is below, regardless of speed.");
......@@ -2751,7 +2754,9 @@ min_str_neib_fpn 0.35
gd.addNumericField("Local final max range", this.cuas_fin_range, 0,3,"",
"While filtering local correlation maximums: 0 - 1x1 (ignore neighbors), 1 - 3x3 neighbors, 2 - 5x5 ones.");
gd.addNumericField("Number of enhancement cycles", this.cuas_num_cycles, 0,3,"",
"Number of cycles of testing and removing bad targets from compoetition with weaker neighbors.");
"Number of cycles of testing and removing bad targets from competition with weaker neighbors.");
gd.addNumericField("Trim targets after non-centered pass", this.cuas_trim_first, 0,3,"",
"Trim targets after first (non-centered) pass (if > 0).");
gd.addMessage("=== Recalculate Motion Vectors before centered \"tracking camera\" ===");
// gd.addCheckbox ("Refine motion vectors", this.cuas_recalc_mv,
......@@ -4431,6 +4436,7 @@ min_str_neib_fpn 0.35
this.cuas_max_range = (int) gd.getNextNumber();
this.cuas_fin_range = (int) gd.getNextNumber();
this.cuas_num_cycles = (int) gd.getNextNumber();
this.cuas_trim_first = (int) gd.getNextNumber();
// this.cuas_recalc_mv = gd.getNextBoolean();
this.cuas_recalc_mv_num = (int) gd.getNextNumber();
......@@ -5750,8 +5756,8 @@ min_str_neib_fpn 0.35
properties.setProperty(prefix+"cuas_max_range", this.cuas_max_range+""); // int
properties.setProperty(prefix+"cuas_fin_range", this.cuas_fin_range+""); // int
properties.setProperty(prefix+"cuas_num_cycles", this.cuas_num_cycles+""); // int
properties.setProperty(prefix+"cuas_trim_first", this.cuas_trim_first+""); // int
// properties.setProperty(prefix+"cuas_recalc_mv", this.cuas_recalc_mv+""); // boolean
properties.setProperty(prefix+"cuas_recalc_mv_num", this.cuas_recalc_mv_num+""); // int
properties.setProperty(prefix+"cuas_recalc_mv_boost", this.cuas_recalc_mv_boost+"");// double
properties.setProperty(prefix+"cuas_recalc_mv_corr", this.cuas_recalc_mv_corr+""); // double
......@@ -7004,8 +7010,8 @@ min_str_neib_fpn 0.35
if (properties.getProperty(prefix+"cuas_max_range")!=null) this.cuas_max_range=Integer.parseInt(properties.getProperty(prefix+"cuas_max_range"));
if (properties.getProperty(prefix+"cuas_fin_range")!=null) this.cuas_fin_range=Integer.parseInt(properties.getProperty(prefix+"cuas_fin_range"));
if (properties.getProperty(prefix+"cuas_num_cycles")!=null) this.cuas_num_cycles=Integer.parseInt(properties.getProperty(prefix+"cuas_num_cycles"));
if (properties.getProperty(prefix+"cuas_trim_first")!=null) this.cuas_trim_first=Integer.parseInt(properties.getProperty(prefix+"cuas_trim_first"));
// if (properties.getProperty(prefix+"cuas_recalc_mv")!=null) this.cuas_recalc_mv=Boolean.parseBoolean(properties.getProperty(prefix+"cuas_recalc_mv"));
if (properties.getProperty(prefix+"cuas_recalc_mv_num")!=null) this.cuas_recalc_mv_num=Integer.parseInt(properties.getProperty(prefix+"cuas_recalc_mv_num"));
if (properties.getProperty(prefix+"cuas_recalc_mv_boost")!=null) this.cuas_recalc_mv_boost=Double.parseDouble(properties.getProperty(prefix+"cuas_recalc_mv_boost"));
if (properties.getProperty(prefix+"cuas_recalc_mv_corr")!=null) this.cuas_recalc_mv_corr=Double.parseDouble(properties.getProperty(prefix+"cuas_recalc_mv_corr"));
......@@ -8275,8 +8281,8 @@ min_str_neib_fpn 0.35
imp.cuas_max_range = this.cuas_max_range;
imp.cuas_fin_range = this.cuas_fin_range;
imp.cuas_num_cycles = this.cuas_num_cycles;
imp.cuas_trim_first = this.cuas_trim_first;
// imp.cuas_recalc_mv = this.cuas_recalc_mv;
imp.cuas_recalc_mv_num = this.cuas_recalc_mv_num;
imp.cuas_recalc_mv_boost = this.cuas_recalc_mv_boost;
imp.cuas_recalc_mv_corr = this.cuas_recalc_mv_corr;
......
......@@ -212,6 +212,33 @@ public class TileNeibs{
default: return indx;
}
}
public static int getDir(double dx, double dy, double thresh) {
if (dy < -thresh) {
if (dx < -thresh) {
return 7;
} else if (dx > thresh) {
return 1;
} else { // dx ~= 0;
return 0;
}
} else if (dy > thresh) {
if (dx < -thresh) {
return 5;
} else if (dx > thresh) {
return 3;
} else { // dx ~= 0;
return 4;
}
} else { // dy == 0
if (dx < -thresh) {
return 6;
} else if (dx > thresh) {
return 2;
} else { // dx ~= 0;
return 8;
}
}
}
public static int getDX(int dir)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment