Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
CppRaytracer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Yoel
CppRaytracer
Commits
dd14ae1d
Commit
dd14ae1d
authored
4 years ago
by
Yoel
Browse files
Options
Downloads
Patches
Plain Diff
Added tests for 2-dimensional-AABBs
parent
96b1e296
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
RayTracer/testing/Testing.cpp
+24
-0
24 additions, 0 deletions
RayTracer/testing/Testing.cpp
with
24 additions
and
0 deletions
RayTracer/testing/Testing.cpp
+
24
−
0
View file @
dd14ae1d
...
@@ -331,6 +331,18 @@ void axisalignedboundingbox_test() {
...
@@ -331,6 +331,18 @@ void axisalignedboundingbox_test() {
assert
(
bb
.
contains
(
util
::
Vec3
(
10
,
15
,
20
)));
assert
(
bb
.
contains
(
util
::
Vec3
(
10
,
15
,
20
)));
assert
(
bb
.
contains
(
util
::
Vec3
(
10
,
10
,
10
)));
assert
(
bb
.
contains
(
util
::
Vec3
(
10
,
10
,
10
)));
// 2-dimensional AABB contain test
util
::
AxisAlignedBoundingBox
bb0
(
util
::
Vec3
(
0
,
10
,
10
),
util
::
Vec3
(
0
,
20
,
20
));
assert
(
!
bb0
.
contains
(
util
::
Vec3
(
10
,
6
,
13
)));
assert
(
!
bb0
.
contains
(
util
::
Vec3
(
22
,
15
,
13
)));
assert
(
bb0
.
contains
(
util
::
Vec3
(
0
,
10
,
20
)));
assert
(
bb0
.
contains
(
util
::
Vec3
(
0
,
19
,
20
)));
assert
(
!
bb0
.
contains
(
util
::
Vec3
(
0
,
13
,
25
)));
assert
(
bb0
.
contains
(
util
::
Vec3
(
0
,
10
,
18
)));
assert
(
!
bb0
.
contains
(
util
::
Vec3
(
10
,
15
,
20
)));
assert
(
bb0
.
contains
(
util
::
Vec3
(
0
,
10
,
10
)));
// Infinity contain test
// Infinity contain test
util
::
AxisAlignedBoundingBox
infbb
;
util
::
AxisAlignedBoundingBox
infbb
;
assert
(
infbb
.
contains
(
util
::
Vec3
(
1243
,
1341
,
-
3151
)));
assert
(
infbb
.
contains
(
util
::
Vec3
(
1243
,
1341
,
-
3151
)));
...
@@ -400,6 +412,18 @@ void axisalignedboundingbox_test() {
...
@@ -400,6 +412,18 @@ void axisalignedboundingbox_test() {
assert
(
bb
.
intersects
(
cam
::
Ray
(
util
::
Vec3
(
21
,
21
,
21
),
assert
(
bb
.
intersects
(
cam
::
Ray
(
util
::
Vec3
(
21
,
21
,
21
),
util
::
Vec3
(
-
1
,
-
1
,
-
2
),
0
,
100
,
false
)));
util
::
Vec3
(
-
1
,
-
1
,
-
2
),
0
,
100
,
false
)));
// 2-dimensional AABB intersect test
util
::
AxisAlignedBoundingBox
bb0
(
util
::
Vec3
(
0
,
10
,
10
),
util
::
Vec3
(
0
,
20
,
20
));
assert
(
bb0
.
intersects
(
cam
::
Ray
(
util
::
Vec3
(
21
,
10
,
11
),
util
::
Vec3
(
-
1
,
0
,
0
),
0
,
100
,
false
)));
assert
(
bb0
.
intersects
(
cam
::
Ray
(
util
::
Vec3
(
-
1
,
10
,
9
),
util
::
Vec3
(
1
,
0
,
2
),
0
,
100
,
false
)));
assert
(
!
bb0
.
intersects
(
cam
::
Ray
(
util
::
Vec3
(
0
,
21
,
21
),
util
::
Vec3
(
-
1
,
-
2
,
-
2
),
0
,
100
,
false
)));
assert
(
bb0
.
intersects
(
cam
::
Ray
(
util
::
Vec3
(
-
1
,
18
,
18
),
util
::
Vec3
(
1
,
-
2
,
2
),
0
,
100
,
false
)));
// Infinity intersection test
// Infinity intersection test
util
::
AxisAlignedBoundingBox
infbb
;
util
::
AxisAlignedBoundingBox
infbb
;
assert
(
infbb
.
intersects
(
cam
::
Ray
(
assert
(
infbb
.
intersects
(
cam
::
Ray
(
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment