Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
eos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Richard Torenvliet
eos
Commits
5aac7bec
Commit
5aac7bec
authored
Dec 02, 2016
by
Patrik Huber
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added consts in ray_triangle_intersect
It didn't really results in a performance improvement, but it may help.
parent
e2809f13
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
10 deletions
+10
-10
include/eos/fitting/closest_edge_fitting.hpp
include/eos/fitting/closest_edge_fitting.hpp
+10
-10
No files found.
include/eos/fitting/closest_edge_fitting.hpp
View file @
5aac7bec
...
...
@@ -74,12 +74,12 @@ inline std::pair<bool, boost::optional<float>> ray_triangle_intersect(const glm:
using
glm
::
vec3
;
const
float
epsilon
=
1e-6
f
;
vec3
v0v1
=
v1
-
v0
;
vec3
v0v2
=
v2
-
v0
;
const
vec3
v0v1
=
v1
-
v0
;
const
vec3
v0v2
=
v2
-
v0
;
vec3
pvec
=
glm
::
cross
(
ray_direction
,
v0v2
);
const
vec3
pvec
=
glm
::
cross
(
ray_direction
,
v0v2
);
float
det
=
glm
::
dot
(
v0v1
,
pvec
);
const
float
det
=
glm
::
dot
(
v0v1
,
pvec
);
if
(
enable_backculling
)
{
// If det is negative, the triangle is back-facing.
...
...
@@ -92,19 +92,19 @@ inline std::pair<bool, boost::optional<float>> ray_triangle_intersect(const glm:
if
(
std
::
abs
(
det
)
<
epsilon
)
return
{
false
,
boost
::
none
};
}
float
inv_det
=
1
/
det
;
const
float
inv_det
=
1
/
det
;
vec3
tvec
=
ray_origin
-
v0
;
auto
u
=
glm
::
dot
(
tvec
,
pvec
)
*
inv_det
;
const
vec3
tvec
=
ray_origin
-
v0
;
const
auto
u
=
glm
::
dot
(
tvec
,
pvec
)
*
inv_det
;
if
(
u
<
0
||
u
>
1
)
return
{
false
,
boost
::
none
};
vec3
qvec
=
glm
::
cross
(
tvec
,
v0v1
);
auto
v
=
glm
::
dot
(
ray_direction
,
qvec
)
*
inv_det
;
const
vec3
qvec
=
glm
::
cross
(
tvec
,
v0v1
);
const
auto
v
=
glm
::
dot
(
ray_direction
,
qvec
)
*
inv_det
;
if
(
v
<
0
||
u
+
v
>
1
)
return
{
false
,
boost
::
none
};
auto
t
=
glm
::
dot
(
v0v2
,
qvec
)
*
inv_det
;
const
auto
t
=
glm
::
dot
(
v0v2
,
qvec
)
*
inv_det
;
return
{
true
,
t
};
};
...
...
Write
Preview
Markdown
is supported
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