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
947c846e
Commit
947c846e
authored
Mar 11, 2020
by
Julian Schakib
Browse files
fix inf_cone plane intersection tests
parent
7fde57d4
Pipeline
#13750
failed with stage
in 6 minutes and 33 seconds
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
typed-geometry
@
8b84eb75
Subproject commit
e1b6ba80c076f446f7943b83ae3992ce7751fb24
Subproject commit
8b84eb7530b201630c291c88f279ff9b3321d8d9
tests/feature/intersections/plane-intersect.cc
View file @
947c846e
...
...
@@ -148,22 +148,53 @@ TG_FUZZ_TEST(Plane, Intersect)
auto
const
center
=
uniform
(
rng
,
box
);
auto
const
d
=
tg
::
uniform
<
tg
::
dir3
>
(
rng
);
auto
const
c
=
tg
::
inf_cone
<
3
,
tg
::
f32
>
(
center
,
d
,
tg
::
degree
(
uniform
(
rng
,
1.0
f
,
80.0
f
)));
auto
opening_angle
=
tg
::
degree
(
uniform
(
rng
,
1.0
f
,
89.0
f
));
auto
c
=
tg
::
inf_cone
<
3
,
tg
::
f32
>
(
center
,
d
,
opening_angle
);
// checking whether flipping the plane's normal makes a difference (should not)
{
auto
p
=
tg
::
plane3
(
d
,
center
+
d
);
CHECK
(
intersects
(
c
,
p
));
auto
c
=
tg
::
inf_cone
<
3
,
tg
::
f32
>
(
center
,
-
d
,
opening_angle
);
CHECK
(
!
intersects
(
c
,
p
));
}
p
=
tg
::
plane3
(
d
,
center
-
d
);
{
auto
p
=
tg
::
plane3
(
-
d
,
center
+
d
);
CHECK
(
intersects
(
c
,
p
));
auto
c
=
tg
::
inf_cone
<
3
,
tg
::
f32
>
(
center
,
-
d
,
opening_angle
);
CHECK
(
!
intersects
(
c
,
p
));
}
{
auto
p
=
tg
::
plane3
(
d
,
center
-
d
);
CHECK
(
!
intersects
(
c
,
p
));
auto
c
=
tg
::
inf_cone
<
3
,
tg
::
f32
>
(
center
,
-
d
,
opening_angle
);
CHECK
(
intersects
(
c
,
p
));
}
p
.
normal
=
any_normal
(
d
);
{
auto
p
=
tg
::
plane3
(
-
d
,
center
-
d
);
CHECK
(
!
intersects
(
c
,
p
));
auto
c
=
tg
::
inf_cone
<
3
,
tg
::
f32
>
(
center
,
-
d
,
opening_angle
);
CHECK
(
intersects
(
c
,
p
));
}
auto
rotation_mat
=
tg
::
rotation_around
(
any_normal
(
d
),
c
.
opening_angle
);
auto
new_normal
=
normalize
(
rotation_mat
*
d
);
new_normal
=
any_normal
(
new_normal
);
p
=
tg
::
plane3
(
new_normal
,
center
+
d
*
100
);
// rotate plane normal so that it intersects/does not intersect the cone
{
auto
rotation_mat
=
tg
::
rotation_around
(
any_normal
(
d
),
tg
::
degree
(
89
)
-
c
.
opening_angle
);
auto
new_normal
=
normalize
(
rotation_mat
*
(
-
d
));
auto
p
=
tg
::
plane3
(
new_normal
,
center
-
d
);
// TODO should not intersect! is moved away from center and normal is oriented so that the plane runs parallel to the cone (?)
CHECK
(
!
intersects
(
c
,
p
));
}
{
auto
rotation_mat
=
tg
::
rotation_around
(
any_normal
(
d
),
tg
::
degree
(
91
)
-
c
.
opening_angle
);
auto
new_normal
=
normalize
(
rotation_mat
*
(
-
d
));
auto
p
=
tg
::
plane3
(
new_normal
,
center
-
d
);
CHECK
(
intersects
(
c
,
p
));
}
}
}
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