summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeuin <[email protected]>2022-04-20 02:58:37 +0800
committerKeuin <[email protected]>2022-04-20 02:58:37 +0800
commit4758cf763f7f762dd8110fd6ed2b3de4a68cbd94 (patch)
tree3dac9461f51bedc053e14d90f8f52592ad189f27
parentd8947e7a22e15c8f6b55fc0f38c9549be1e1df7e (diff)
Assert screen and image are of the same aspect in aa_viewport::aa_viewport and basic_viewport::basic_viewport.
-rw-r--r--aa.h1
-rw-r--r--viewport.h4
2 files changed, 4 insertions, 1 deletions
diff --git a/aa.h b/aa.h
index 9622696..a1bb51e 100644
--- a/aa.h
+++ b/aa.h
@@ -48,6 +48,7 @@ public:
samples(samples),
threads((threads > 0) ? threads : (int) std::thread::hardware_concurrency()) {
assert(samples >= 1);
+ assert(std::abs(1.0 * image_width / image_height - 1.0 * screen_hw / screen_hh) < 1e-8);
}
aa_viewport(const vec3<V> &cxyz,
diff --git a/viewport.h b/viewport.h
index 02c1466..85f63c4 100644
--- a/viewport.h
+++ b/viewport.h
@@ -75,7 +75,9 @@ public:
cxyz{cxyz}, screen_center{screen_center}, image_width{image_width}, image_height{image_height},
screen_hw{screen_hw},
screen_hh{screen_hh},
- world{world} {}
+ world{world} {
+ assert(std::abs(1.0 * image_width / image_height - 1.0 * screen_hw / screen_hh) < 1e-8);
+ }
/**
* Generate the image seen on given viewpoint.