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
6f26e77a
Commit
6f26e77a
authored
Feb 17, 2020
by
Julian Schakib
Browse files
latest tg, intersection tests
parent
c05ad188
Pipeline
#13597
failed with stage
in 6 minutes and 30 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
typed-geometry
@
e0afd840
Subproject commit
c9770990d6869740cc2f79a88727d838e382a36f
Subproject commit
e0afd8407e862fb4af2e0705f3ec5cf9d98754f7
tests/feature/intersections/plane-intersect.cc
View file @
6f26e77a
...
@@ -49,7 +49,7 @@ TG_FUZZ_TEST(Plane, Intersect)
...
@@ -49,7 +49,7 @@ TG_FUZZ_TEST(Plane, Intersect)
CHECK
(
!
intersects
(
pm
,
to
,
-
eps
));
CHECK
(
!
intersects
(
pm
,
to
,
-
eps
));
}
}
// plane3 - inf_c
one
3_boundary
// plane3 - inf_c
ylinder
3_boundary
{
{
auto
const
box
=
tg
::
aabb3
(
tg
::
pos3
(
-
10.0
f
),
tg
::
pos3
(
10.0
f
));
auto
const
box
=
tg
::
aabb3
(
tg
::
pos3
(
-
10.0
f
),
tg
::
pos3
(
10.0
f
));
...
@@ -124,15 +124,38 @@ TG_FUZZ_TEST(Plane, Intersect)
...
@@ -124,15 +124,38 @@ TG_FUZZ_TEST(Plane, Intersect)
// random cylinder and planes
// random cylinder and planes
// check if ellipse properties are meaningful
// check if ellipse properties are meaningful
auto
const
c
=
tg
::
inf_cylinder_boundary
<
3
,
tg
::
f32
>
(
tg
::
line3
(
tg
::
uniform
(
rng
,
box
),
tg
::
uniform
<
tg
::
dir3
>
(
rng
)),
tg
::
uniform
(
rng
,
0.5
f
,
10.0
f
));
// TODO tests struggle with small radii!!
auto
const
c
=
tg
::
inf_cylinder_boundary
<
3
,
tg
::
f32
>
(
tg
::
line3
(
tg
::
uniform
(
rng
,
box
),
tg
::
uniform
<
tg
::
dir3
>
(
rng
)),
tg
::
uniform
(
rng
,
5.0
f
,
10.0
f
));
auto
const
p
=
tg
::
plane3
(
tg
::
uniform
<
tg
::
dir3
>
(
rng
),
tg
::
uniform
(
rng
,
box
));
auto
const
p
=
tg
::
plane3
(
tg
::
uniform
<
tg
::
dir3
>
(
rng
),
tg
::
uniform
(
rng
,
box
));
auto
const
ellipse
=
tg
::
intersection
(
p
,
c
);
// existing axes
// if (tg::abs(dot(p.normal, c.axis.dir)) < 0.95)
CHECK
(
length
(
ellipse
.
axisA
)
>
0
);
{
CHECK
(
length
(
ellipse
.
axisB
)
>
0
);
auto
const
ellipse
=
tg
::
intersection
(
p
,
c
);
// existing axes
CHECK
(
length
(
ellipse
.
axisA
)
>
0
);
CHECK
(
length
(
ellipse
.
axisB
)
>
0
);
}
}
}
}
}
// plane3 - inf_cone3_boundary
{
auto
const
box
=
tg
::
aabb3
(
tg
::
pos3
(
-
10.0
f
),
tg
::
pos3
(
10.0
f
));
auto
const
center
=
uniform
(
rng
,
box
);
auto
const
d
=
tg
::
uniform
<
tg
::
dir3
>
(
rng
);
auto
p
=
tg
::
plane3
(
d
,
center
+
d
);
auto
const
c
=
tg
::
inf_cone
<
3
,
tg
::
f32
>
(
center
,
d
,
tg
::
degree
(
30.0
f
));
CHECK
(
intersects
(
c
,
p
));
p
=
tg
::
plane3
(
d
,
center
-
d
*
100
);
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