From 9a05c58324dd538ca916d6340eefc92df95bd02a Mon Sep 17 00:00:00 2001 From: dhilvert Date: Thu, 19 Jan 2006 22:23:00 +0000 Subject: [PATCH] Add subspace candidate resolution checking code to d3::scene. darcs-hash:20060119222308-789c2-d9d1ddfa25c73a03352dda267210530e45c815b9.gz --- d3/pt.h | 23 ++++++++++++----------- d3/scene.h | 19 ++++++++++++++++++- 2 files changed, 30 insertions(+), 12 deletions(-) diff --git a/d3/pt.h b/d3/pt.h index 8397cdd..6b356ab 100644 --- a/d3/pt.h +++ b/d3/pt.h @@ -316,7 +316,7 @@ public: ale_pos trilinear_coordinate(point w, ale_pos diagonal) { calculate_diag_per_depth(); - ale_pos depth = wc(w)[2]; + ale_pos depth = fabs(wc(w)[2]); ale_pos coord = log(diagonal / (depth * diag_per_depth)) / log(2); @@ -343,7 +343,7 @@ public: ale_pos diagonal_distance(point w, ale_pos coordinate) { calculate_diag_per_depth(); - ale_pos depth = wc(w)[2]; + ale_pos depth = fabs(wc(w)[2]); ale_pos diagonal = pow(2, coordinate) * depth * diag_per_depth; return diagonal; @@ -353,7 +353,7 @@ public: * Get the 3D diagonal for a given depth and trilinear coordinate. */ ale_pos diagonal_distance_3d(ale_pos depth, ale_pos coordinate) { - return pow(2, coordinate) * depth * diag_per_depth * sqrt(3) / sqrt(2); + return pow(2, coordinate) * fabs(depth) * diag_per_depth * sqrt(3) / sqrt(2); } /* @@ -408,14 +408,7 @@ public: * Get the in-bounds centroid for a subspace, if one exists. */ - point centroid(const space::traverse &t) { - point bb[2]; - - get_view_local_bb(t, bb); - - point min = bb[0]; - point max = bb[1]; - + point centroid(point min, point max) { for (int d = 0; d < 2; d++) if (min[d] > max[d]) return point::undefined(); @@ -426,6 +419,14 @@ public: return (bb[0] + bb[1]) / 2; } + point centroid(const space::traverse &t) { + point bb[2]; + + get_view_local_bb(t, bb); + + return centroid(bb[0], bb[1]); + } + /* * Get the local space origin in world space. */ diff --git a/d3/scene.h b/d3/scene.h index 8ffd695..174810d 100644 --- a/d3/scene.h +++ b/d3/scene.h @@ -2511,12 +2511,29 @@ public: return pt_visible(align::projective(f), min, max); } + int fails_output_resolution_bound(point min, point max, const std::vector &pt_outputs) { + assert(0); + } + /* * Check lower-bound resolution constraints */ int exceeds_resolution_lower_bounds(unsigned int f1, unsigned int f2, point min, point max, const std::vector &pt_outputs) { - assert(0); + + pt _pt = al->get(f1)->get_t(0); + point p = _pt.centroid(min, max); + + if ((min - max).norm() < _pt.diagonal_distance_3d(p[2], input_decimation_lower)) + return 1; + + if (fails_output_resolution_bound(min, max, pt_outputs)) + return 0; + + if ((min - max).norm() < _pt.diagonal_distance_3d(p[2], primary_decimation_upper)) + return 1; + + return 0; } /* -- 2.11.4.GIT