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
Chaofan Chen
ogs
Commits
c90c4291
Commit
c90c4291
authored
2 years ago
by
Christoph Lehmann
Browse files
Options
Downloads
Patches
Plain Diff
[MeL] Surface normal computation also for lines
parent
256744ea
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
MeshLib/Elements/Utils.h
+37
-12
37 additions, 12 deletions
MeshLib/Elements/Utils.h
with
37 additions
and
12 deletions
MeshLib/Elements/Utils.h
+
37
−
12
View file @
c90c4291
...
@@ -46,19 +46,44 @@ inline Eigen::Vector3d calculateNormalizedSurfaceNormal(
...
@@ -46,19 +46,44 @@ inline Eigen::Vector3d calculateNormalizedSurfaceNormal(
MeshLib
::
Element
const
&
bulk_element
)
MeshLib
::
Element
const
&
bulk_element
)
{
{
Eigen
::
Vector3d
surface_element_normal
;
Eigen
::
Vector3d
surface_element_normal
;
if
(
surface_element
.
getDimension
()
<
2
)
{
switch
(
surface_element
.
getDimension
())
auto
const
bulk_element_normal
=
MeshLib
::
FaceRule
::
getSurfaceNormal
(
bulk_element
);
auto
const
&
v0
=
surface_element
.
getNode
(
0
)
->
asEigenVector3d
();
auto
const
&
v1
=
surface_element
.
getNode
(
1
)
->
asEigenVector3d
();
Eigen
::
Vector3d
const
edge_vector
=
v1
-
v0
;
surface_element_normal
=
bulk_element_normal
.
cross
(
edge_vector
);
}
else
{
{
surface_element_normal
=
case
2
:
MeshLib
::
FaceRule
::
getSurfaceNormal
(
surface_element
);
surface_element_normal
=
MeshLib
::
FaceRule
::
getSurfaceNormal
(
surface_element
);
break
;
case
1
:
{
auto
const
bulk_element_normal
=
MeshLib
::
FaceRule
::
getSurfaceNormal
(
bulk_element
);
auto
const
&
v0
=
surface_element
.
getNode
(
0
)
->
asEigenVector3d
();
auto
const
&
v1
=
surface_element
.
getNode
(
1
)
->
asEigenVector3d
();
Eigen
::
Vector3d
const
edge_vector
=
v1
-
v0
;
surface_element_normal
=
-
bulk_element_normal
.
cross
(
edge_vector
);
break
;
}
case
0
:
{
assert
(
surface_element
.
getCellType
()
==
CellType
::
POINT1
);
assert
(
bulk_element
.
getCellType
()
==
CellType
::
LINE2
||
bulk_element
.
getCellType
()
==
CellType
::
LINE3
);
auto
const
&
x
=
surface_element
.
getNode
(
0
)
->
asEigenVector3d
();
// The start of the line element.
auto
const
&
a
=
bulk_element
.
getNode
(
0
)
->
asEigenVector3d
();
// The end of the line element is the 2nd base node of the line,
// which is the 2nd node.
auto
const
&
b
=
bulk_element
.
getNode
(
1
)
->
asEigenVector3d
();
// x coincides either with the start or with the end of the line.
// a + b - 2 * x evaluates to a - b or to b - a, respectively.
// The formula assumes that the line is perfectly straight, even in
// the LINE3 case.
surface_element_normal
=
a
+
b
-
2
*
x
;
}
}
}
surface_element_normal
.
normalize
();
surface_element_normal
.
normalize
();
...
...
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