Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
tg-samples
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
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
Philip Trettner
tg-samples
Merge requests
!23
Tests for ray projection and uniforms on circles and disks
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Tests for ray projection and uniforms on circles and disks
agrabowy
into
develop
Overview
0
Commits
5
Pipelines
2
Changes
2
Merged
Aaron Grabowy
requested to merge
agrabowy
into
develop
5 years ago
Overview
0
Commits
5
Pipelines
2
Changes
2
Expand
0
0
Merge request reports
Compare
develop
version 1
ca084707
5 years ago
develop (base)
and
latest version
latest version
fc5195b7
5 commits,
5 years ago
version 1
ca084707
4 commits,
5 years ago
2 files
+
83
−
0
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
2
Search (e.g. *.vue) (Ctrl+P)
tests/functions/project.cc
+
20
−
0
Options
@@ -57,4 +57,24 @@ TG_FUZZ_TEST(TypedGeometry, Project)
auto
dist1
=
tg
::
distance_sqr
(
p
,
pn
);
CHECK
(
dist1
==
doctest
::
Approx
(
0.0
f
));
}
{
// ray
auto
pos
=
uniform
(
rng
,
range3
);
auto
dir
=
tg
::
vec3
();
while
(
length_sqr
(
dir
)
==
0
)
dir
=
tg
::
vec3
(
uniform
(
rng
,
range3
));
auto
dirN
=
normalize
(
dir
);
auto
line
=
tg
::
line3
(
pos
,
dirN
);
auto
ray
=
tg
::
ray3
(
pos
,
dirN
);
auto
p
=
uniform
(
rng
,
range3
);
auto
projLine
=
tg
::
project
(
p
,
line
);
auto
projRay
=
tg
::
project
(
p
,
ray
);
// The projection onto the ray is the same as onto the line if in positive direction, otherwise at the ray origin
auto
diff
=
tg
::
distance_sqr
(
projRay
,
dot
(
p
-
pos
,
dir
)
>
0
?
projLine
:
pos
);
CHECK
(
diff
==
doctest
::
Approx
(
0.0
f
));
}
}
Loading