Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
O
ogs
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
Dmitri Naumov
ogs
Commits
6912260c
Commit
6912260c
authored
4 years ago
by
Dmitri Naumov
Browse files
Options
Downloads
Patches
Plain Diff
[App/U] Store moved node coordinates in matrix.
parent
1ea1d7e1
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Applications/Utils/MeshEdit/AddFaultToVoxelGrid.cpp
+10
-11
10 additions, 11 deletions
Applications/Utils/MeshEdit/AddFaultToVoxelGrid.cpp
with
10 additions
and
11 deletions
Applications/Utils/MeshEdit/AddFaultToVoxelGrid.cpp
+
10
−
11
View file @
6912260c
...
...
@@ -48,16 +48,14 @@ bool testTriangleIntersectingAABB(MeshLib::Node const& n0,
Eigen
::
Vector3d
const
&
e
)
{
// Translate triangle as conceptually moving AABB to origin
Eigen
::
Vector3d
const
v0
(
Eigen
::
Vector3d
(
n0
.
getCoords
())
-
c
);
Eigen
::
Vector3d
const
v1
(
Eigen
::
Vector3d
(
n1
.
getCoords
())
-
c
);
Eigen
::
Vector3d
const
v2
(
Eigen
::
Vector3d
(
n2
.
getCoords
())
-
c
);
Eigen
::
Matrix3d
tri
;
tri
<<
v0
,
v1
,
v2
;
auto
tri_nodes
=
tri
.
transpose
();
Eigen
::
Matrix3d
v
;
v
<<
Eigen
::
Vector3d
(
n0
.
getCoords
())
-
c
,
Eigen
::
Vector3d
(
n1
.
getCoords
())
-
c
,
Eigen
::
Vector3d
(
n2
.
getCoords
())
-
c
;
// Test the three axes corresponding to the face normals of AABB b
Eigen
::
Vector3d
const
min_coeff
=
tri_nodes
.
col
wise
().
minCoeff
();
Eigen
::
Vector3d
const
max_coeff
=
tri_nodes
.
col
wise
().
maxCoeff
();
Eigen
::
Vector3d
const
min_coeff
=
v
.
row
wise
().
minCoeff
();
Eigen
::
Vector3d
const
max_coeff
=
v
.
row
wise
().
maxCoeff
();
if
(
max_coeff
.
x
()
<
-
e
.
x
()
||
min_coeff
.
x
()
>
e
.
x
())
{
return
false
;
...
...
@@ -72,7 +70,8 @@ bool testTriangleIntersectingAABB(MeshLib::Node const& n0,
}
// separating axes
std
::
array
<
Eigen
::
Vector3d
,
3
>
tri_edge
{{
v1
-
v0
,
v2
-
v1
,
v0
-
v2
}};
std
::
array
<
Eigen
::
Vector3d
,
3
>
tri_edge
{
{
v
.
col
(
1
)
-
v
.
col
(
0
),
v
.
col
(
2
)
-
v
.
col
(
1
),
v
.
col
(
0
)
-
v
.
col
(
2
)}};
std
::
array
<
Eigen
::
Vector3d
,
9
>
const
axx
{
{
Eigen
::
Vector3d
({
0
,
-
tri_edge
[
0
].
z
(),
tri_edge
[
0
].
y
()}),
Eigen
::
Vector3d
({
0
,
-
tri_edge
[
1
].
z
(),
tri_edge
[
1
].
y
()}),
...
...
@@ -89,7 +88,7 @@ bool testTriangleIntersectingAABB(MeshLib::Node const& n0,
// Theorem (see C. Ericson "Real Time Collision Detection" for details)
for
(
auto
const
&
a
:
axx
)
{
Eigen
::
Vector3d
p
=
tri_nodes
*
a
;
Eigen
::
Vector3d
p
=
v
.
transpose
()
*
a
;
double
const
r
=
e
.
dot
(
a
.
cwiseAbs
());
if
(
std
::
max
(
-
p
.
maxCoeff
(),
p
.
minCoeff
())
>
r
)
{
...
...
@@ -99,7 +98,7 @@ bool testTriangleIntersectingAABB(MeshLib::Node const& n0,
// Test separating axis corresponding to triangle face normal
Eigen
::
Vector3d
const
plane_normal
(
tri_edge
[
0
].
cross
(
tri_edge
[
1
]));
double
const
pd
=
plane_normal
.
dot
(
v
0
);
double
const
pd
=
plane_normal
.
dot
(
v
.
row
(
0
)
);
return
testAABBIntersectingPlane
(
c
,
e
,
plane_normal
,
pd
);
}
...
...
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