Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
typed-geometry
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
typed-geometry
Commits
bbab49b5
Commit
bbab49b5
authored
5 years ago
by
Philip Trettner
Browse files
Options
Downloads
Plain Diff
Merge branch 'kschuster' into 'develop'
angle_between fix. See merge request
!36
parents
da1698af
9c2e24d4
No related branches found
No related tags found
1 merge request
!36
angle_between fix.
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/typed-geometry/functions/angle.hh
+7
-5
7 additions, 5 deletions
src/typed-geometry/functions/angle.hh
with
7 additions
and
5 deletions
src/typed-geometry/functions/angle.hh
+
7
−
5
View file @
bbab49b5
...
...
@@ -15,9 +15,11 @@ namespace tg
template
<
int
D
,
class
ScalarT
>
TG_NODISCARD
constexpr
angle_t
<
fractional_result
<
ScalarT
>>
angle_between
(
vec
<
D
,
ScalarT
>
const
&
a
,
vec
<
D
,
ScalarT
>
const
&
b
)
{
constexpr
auto
lower
=
decltype
(
dot
(
normalize_safe
(
a
),
normalize_safe
(
b
)))(
-
1
);
constexpr
auto
upper
=
decltype
(
dot
(
normalize_safe
(
a
),
normalize_safe
(
b
)))(
1
);
auto
a_unit
=
normalize_safe
(
a
);
auto
b_unit
=
normalize_safe
(
b
);
return
acos
(
saturate
(
dot
(
a_unit
,
b_unit
)));
return
acos
(
clamp
(
dot
(
a_unit
,
b_unit
)
,
lower
,
upper
));
}
// returns the (smaller) angle between two directions, i.e. the result is in 0..pi (0°..180°)
...
...
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