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
f267b0d2
Commit
f267b0d2
authored
4 years ago
by
Karsten Rink
Browse files
Options
Downloads
Patches
Plain Diff
using existing method to test if AABB contains point
parent
e1c8636a
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
+5
-17
5 additions, 17 deletions
Applications/Utils/MeshEdit/AddFaultToVoxelGrid.cpp
with
5 additions
and
17 deletions
Applications/Utils/MeshEdit/AddFaultToVoxelGrid.cpp
+
5
−
17
View file @
f267b0d2
...
@@ -26,21 +26,6 @@
...
@@ -26,21 +26,6 @@
static
std
::
string
mat_name
=
"MaterialIDs"
;
static
std
::
string
mat_name
=
"MaterialIDs"
;
// tests if point p is located outside of given AABB
bool
testPointOutsideAABB
(
MathLib
::
Point3d
const
&
p
,
MathLib
::
Point3d
const
&
min_pnt
,
MathLib
::
Point3d
const
&
max_pnt
)
{
for
(
std
::
size_t
i
=
0
;
i
<
3
;
++
i
)
{
if
(
p
[
i
]
<
min_pnt
[
i
]
||
p
[
i
]
>
max_pnt
[
i
])
{
return
true
;
}
}
return
false
;
}
// tests if a plane and an AABB are intersecting
// tests if a plane and an AABB are intersecting
// (based on Christer Ericson "Real Time Collision Detection" 5.2.3)
// (based on Christer Ericson "Real Time Collision Detection" 5.2.3)
bool
testAABBIntersectingPlane
(
Eigen
::
Vector3d
const
&
aabb_centre
,
bool
testAABBIntersectingPlane
(
Eigen
::
Vector3d
const
&
aabb_centre
,
...
@@ -138,7 +123,7 @@ void markFaults(MeshLib::Mesh& mesh, MeshLib::Mesh const& fault,
...
@@ -138,7 +123,7 @@ void markFaults(MeshLib::Mesh& mesh, MeshLib::Mesh const& fault,
auto
const
&
fnodes
=
fault
.
getNodes
();
auto
const
&
fnodes
=
fault
.
getNodes
();
auto
const
&
felems
=
fault
.
getElements
();
auto
const
&
felems
=
fault
.
getElements
();
std
::
size_t
const
n_felems
=
fault
.
getNumberOfElements
();
std
::
size_t
const
n_felems
=
fault
.
getNumberOfElements
();
GeoLib
::
AABB
fault_aabb
(
fnodes
.
cbegin
(),
fnodes
.
cend
());
GeoLib
::
AABB
const
fault_aabb
(
fnodes
.
cbegin
(),
fnodes
.
cend
());
auto
min_pnt
=
fault_aabb
.
getMinPoint
();
auto
min_pnt
=
fault_aabb
.
getMinPoint
();
auto
max_pnt
=
fault_aabb
.
getMaxPoint
();
auto
max_pnt
=
fault_aabb
.
getMaxPoint
();
...
@@ -148,6 +133,9 @@ void markFaults(MeshLib::Mesh& mesh, MeshLib::Mesh const& fault,
...
@@ -148,6 +133,9 @@ void markFaults(MeshLib::Mesh& mesh, MeshLib::Mesh const& fault,
min_pnt
[
i
]
-=
half_cell_size
[
i
];
min_pnt
[
i
]
-=
half_cell_size
[
i
];
max_pnt
[
i
]
+=
half_cell_size
[
i
];
max_pnt
[
i
]
+=
half_cell_size
[
i
];
}
}
std
::
array
<
MathLib
::
Point3d
,
2
>
const
fault_extent
{{
min_pnt
,
max_pnt
}};
GeoLib
::
AABB
const
fault_aabb_ext
(
fault_extent
.
cbegin
(),
fault_extent
.
cend
());
// test each voxel grid element vs each fault triangle
// test each voxel grid element vs each fault triangle
Eigen
::
Vector3d
const
extent
(
Eigen
::
Vector3d
const
extent
(
...
@@ -156,7 +144,7 @@ void markFaults(MeshLib::Mesh& mesh, MeshLib::Mesh const& fault,
...
@@ -156,7 +144,7 @@ void markFaults(MeshLib::Mesh& mesh, MeshLib::Mesh const& fault,
{
{
// test if bounding box of fault is intersecting voxel
// test if bounding box of fault is intersecting voxel
auto
const
&
centre_pnt
=
MeshLib
::
getCenterOfGravity
(
*
elems
[
j
]);
auto
const
&
centre_pnt
=
MeshLib
::
getCenterOfGravity
(
*
elems
[
j
]);
if
(
testPointOutsideAABB
(
centre_pnt
,
min_pnt
,
max_pnt
))
if
(
!
fault_aabb_ext
.
containsPoint
(
centre_pnt
,
0
))
{
{
continue
;
continue
;
}
}
...
...
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