summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohannes Hofmann <Johannes.Hofmann@gmx.de>2006-12-17 17:24:50 +0100
committerJohannes Hofmann <Johannes.Hofmann@gmx.de>2006-12-17 17:24:50 +0100
commit3a621992b292d97f5d45d2d342b19dd2194011cc (patch)
tree590d3430561406f24c3fa6da51a15be874e9eb07 /src
parent615a27e3124e8f4eeac86f7e1f6107c66c186d1e (diff)
fix visibility test; fix stitching
Diffstat (limited to 'src')
-rw-r--r--src/Panorama.H3
-rw-r--r--src/Panorama.cxx30
-rw-r--r--src/ProjectionCylindrical.H4
-rw-r--r--src/ProjectionLSQ.H2
-rw-r--r--src/ProjectionLSQ.cxx5
-rw-r--r--src/ProjectionRectilinear.H4
6 files changed, 30 insertions, 18 deletions
diff --git a/src/Panorama.H b/src/Panorama.H
index 5dd670f..fc27e43 100644
--- a/src/Panorama.H
+++ b/src/Panorama.H
@@ -18,7 +18,6 @@ class Panorama {
double view_phi, view_lam, view_height;
char *view_name;
double height_dist_ratio;
- double view_angle;
double hide_value;
Hills *mountains;
Hills *close_mountains;
@@ -58,6 +57,8 @@ class Panorama {
double get_value(Hills *p);
+ int is_visible(double a_alph);
+
double pi_d, deg2rad;
public:
diff --git a/src/Panorama.cxx b/src/Panorama.cxx
index 784c6ed..b6c0c10 100644
--- a/src/Panorama.cxx
+++ b/src/Panorama.cxx
@@ -230,13 +230,12 @@ Panorama::set_projection(ProjectionLSQ::Projection_t p) {
switch(projection_type) {
case ProjectionLSQ::RECTILINEAR:
proj = new ProjectionRectilinear();
- view_angle = pi_d / 3.0;
break;
case ProjectionLSQ::CYLINDRICAL:
proj = new ProjectionCylindrical();
- view_angle = pi_d * 2.0;
break;
}
+
update_angles();
}
@@ -400,7 +399,6 @@ Panorama::update_close_mountains() {
void
Panorama::update_visible_mountains() {
int i;
- double a_view;
Hill *m;
visible_mountains->clear();
@@ -408,14 +406,7 @@ Panorama::update_visible_mountains() {
for (i=0; i<close_mountains->get_num(); i++) {
m = close_mountains->get(i);
- a_view = m->alph - parms.a_center;
- if (a_view > pi_d) {
- a_view -= 2.0*pi_d;
- } else if (a_view < -pi_d) {
- a_view += 2.0*pi_d;
- }
-
- if (a_view < view_angle && a_view > - view_angle) {
+ if (is_visible(m->alph)) {
visible_mountains->add(m);
m->flags |= Hill::VISIBLE;
} else {
@@ -510,9 +501,22 @@ Panorama::get_real_distance(Hill *m) {
}
int
+Panorama::is_visible(double a_alph) {
+ double center_dist;
+
+ center_dist = fabs(fmod(a_alph - parms.a_center, 2.0 * pi_d));
+
+ return center_dist < proj->get_view_angle();
+}
+
+int
Panorama::get_coordinates(double a_alph, double a_nick, double *x, double *y) {
- proj->get_coordinates(a_alph, a_nick, &parms, x, y);
- return 0;
+ if (is_visible(a_alph)) {
+ proj->get_coordinates(a_alph, a_nick, &parms, x, y);
+ return 0;
+ } else {
+ return 1;
+ }
}
diff --git a/src/ProjectionCylindrical.H b/src/ProjectionCylindrical.H
index d7d8779..432d868 100644
--- a/src/ProjectionCylindrical.H
+++ b/src/ProjectionCylindrical.H
@@ -12,8 +12,9 @@
class ProjectionCylindrical : public ProjectionLSQ {
public:
-#define ARGS double c_view, double c_nick, double c_tilt, double scale, double k0, double k1, double m_view, double m_nick
+ virtual double get_view_angle() {return 6.2831853;}; /* 360 deg */
+#define ARGS double c_view, double c_nick, double c_tilt, double scale, double k0, double k1, double m_view, double m_nick
virtual double mac_x(ARGS);
virtual double mac_y(ARGS);
virtual double mac_x_dc_view(ARGS);
@@ -24,7 +25,6 @@ class ProjectionCylindrical : public ProjectionLSQ {
virtual double mac_y_dc_nick(ARGS);
virtual double mac_y_dc_tilt(ARGS);
virtual double mac_y_dscale(ARGS);
-
#undef ARGS
};
diff --git a/src/ProjectionLSQ.H b/src/ProjectionLSQ.H
index 6e4021a..54ab641 100644
--- a/src/ProjectionLSQ.H
+++ b/src/ProjectionLSQ.H
@@ -32,6 +32,8 @@ class ProjectionLSQ {
int comp_params(const Hills *h, ViewParams *parms);
+ virtual double get_view_angle();
+
#define ARGS double c_view, double c_nick, double c_tilt, double scale, double k0, double k1, double m_view, double m_nick
virtual double mac_x(ARGS);
virtual double mac_y(ARGS);
diff --git a/src/ProjectionLSQ.cxx b/src/ProjectionLSQ.cxx
index 69a196a..7841ef6 100644
--- a/src/ProjectionLSQ.cxx
+++ b/src/ProjectionLSQ.cxx
@@ -26,6 +26,11 @@ ProjectionLSQ::sec(double a) {
return 1.0 / cos(a);
}
+double
+ProjectionLSQ::get_view_angle() {
+ return 0.0;
+}
+
int
ProjectionLSQ::comp_params(const Hills *h, ViewParams *parms) {
const Hill *tmp, *m1, *m2;
diff --git a/src/ProjectionRectilinear.H b/src/ProjectionRectilinear.H
index 1fc7417..e68851e 100644
--- a/src/ProjectionRectilinear.H
+++ b/src/ProjectionRectilinear.H
@@ -12,8 +12,9 @@
class ProjectionRectilinear : public ProjectionLSQ {
public:
-#define ARGS double c_view, double c_nick, double c_tilt, double scale, double k0, double k1, double m_view, double m_nick
+ virtual double get_view_angle() {return 1.0471976;}; /* 60 deg */
+#define ARGS double c_view, double c_nick, double c_tilt, double scale, double k0, double k1, double m_view, double m_nick
virtual double mac_x(ARGS);
virtual double mac_y(ARGS);
virtual double mac_x_dc_view(ARGS);
@@ -28,7 +29,6 @@ class ProjectionRectilinear : public ProjectionLSQ {
virtual double mac_y_dscale(ARGS);
virtual double mac_y_dk0(ARGS);
virtual double mac_y_dk1(ARGS);
-
#undef ARGS
};