Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Philip Trettner
tg-samples
Commits
6f48ec28
Commit
6f48ec28
authored
Mar 13, 2020
by
Julian Schakib
Browse files
obb intersection tests
parent
fc01d804
Pipeline
#13778
failed with stage
in 5 minutes and 48 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
typed-geometry
@
71aeccbb
Subproject commit
2644a88c77be3d83a79e518ffe64d7a2ce567513
Subproject commit
71aeccbb4212dc12be6b1ff4eb14827d0a53feba
tests/feature/intersections/plane-intersect.cc
View file @
6f48ec28
...
...
@@ -320,5 +320,44 @@ TG_FUZZ_TEST(Plane, Intersect)
plane
=
tg
::
plane3
(
-
normalize
(
tg
::
vec3
(
offset
)),
offset
);
CHECK
(
!
intersects
(
plane
,
box
));
}
// any plane inside the aabb (should intersect)
{
plane
=
tg
::
plane3
(
tg
::
uniform
<
tg
::
dir3
>
(
rng
),
uniform
(
rng
,
box
));
CHECK
(
intersects
(
plane
,
box
));
}
}
// plane3 - box3
{
auto
half_extents
=
tg
::
mat3
();
half_extents
[
0
]
=
tg
::
dir3
::
pos_x
;
half_extents
[
1
]
=
tg
::
dir3
::
pos_y
;
half_extents
[
2
]
=
tg
::
dir3
::
pos_z
;
auto
box
=
tg
::
box3
(
tg
::
pos3
::
zero
,
half_extents
);
{
auto
const
plane
=
tg
::
plane3
(
tg
::
uniform
<
tg
::
dir3
>
(
rng
),
tg
::
pos3
::
zero
);
CHECK
(
intersects
(
plane
,
box
));
}
{
auto
plane
=
tg
::
plane3
(
tg
::
dir3
::
pos_x
,
tg
::
pos3
(
1
,
0
,
0
));
CHECK
(
!
intersects
(
plane
,
box
));
plane
=
tg
::
plane3
(
tg
::
dir3
::
pos_x
,
tg
::
pos3
(
0.9
f
,
0
,
0
));
CHECK
(
intersects
(
plane
,
box
));
}
// random box rotation
auto
nx
=
tg
::
uniform
<
tg
::
dir3
>
(
rng
);
auto
ny
=
any_normal
(
nx
);
auto
nz
=
normalize
(
cross
(
nx
,
ny
));
// random box length
half_extents
[
0
]
=
nx
*
uniform
(
rng
,
1.0
f
,
10.0
f
);
half_extents
[
1
]
=
ny
*
uniform
(
rng
,
1.0
f
,
10.0
f
);
half_extents
[
2
]
=
nz
*
uniform
(
rng
,
1.0
f
,
10.0
f
);
}
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment