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
089a9778
Commit
089a9778
authored
7 years ago
by
Tom Fischer
Browse files
Options
Downloads
Patches
Plain Diff
[GL] GaussAlgorithm -> Eigen partialPivLu - part I.
parent
c3e323b4
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
GeoLib/Triangle.cpp
+10
-11
10 additions, 11 deletions
GeoLib/Triangle.cpp
with
10 additions
and
11 deletions
GeoLib/Triangle.cpp
+
10
−
11
View file @
089a9778
...
...
@@ -10,10 +10,11 @@
#include
"Triangle.h"
#include
<Eigen/Dense>
#include
"Point.h"
#include
"AnalyticalGeometry.h"
#include
"MathLib/LinAlg/Solvers/GaussAlgorithm.h"
#include
"MathLib/GeometricBasics.h"
namespace
GeoLib
{
...
...
@@ -49,15 +50,15 @@ bool Triangle::containsPoint2D (Point const& pnt) const
GeoLib
::
Point
const
&
c
(
*
(
_pnts
[
_pnt_ids
[
2
]]));
// criterion: p-a = u0 * (b-a) + u1 * (c-a); 0 <= u0, u1 <= 1, u0+u1 <= 1
MathLib
::
DenseMatrix
<
double
>
mat
(
2
,
2
)
;
Eigen
::
Matrix2d
mat
;
mat
(
0
,
0
)
=
b
[
0
]
-
a
[
0
];
mat
(
0
,
1
)
=
c
[
0
]
-
a
[
0
];
mat
(
1
,
0
)
=
b
[
1
]
-
a
[
1
];
mat
(
1
,
1
)
=
c
[
1
]
-
a
[
1
];
double
y
[
2
]
=
{
pnt
[
0
]
-
a
[
0
],
pnt
[
1
]
-
a
[
1
]};
Eigen
::
Vector2d
y
;
y
<<
pnt
[
0
]
-
a
[
0
],
pnt
[
1
]
-
a
[
1
];
MathLib
::
GaussAlgorithm
<
MathLib
::
DenseMatrix
<
double
>
,
double
*>
gauss
;
gauss
.
solve
(
mat
,
y
,
true
);
y
=
mat
.
partialPivLu
().
solve
(
y
);
const
double
delta
(
std
::
numeric_limits
<
double
>::
epsilon
());
const
double
upper
(
1
+
delta
);
...
...
@@ -72,7 +73,7 @@ void getPlaneCoefficients(Triangle const& tri, double c[3])
GeoLib
::
Point
const
&
p0
(
*
(
tri
.
getPoint
(
0
)));
GeoLib
::
Point
const
&
p1
(
*
(
tri
.
getPoint
(
1
)));
GeoLib
::
Point
const
&
p2
(
*
(
tri
.
getPoint
(
2
)));
MathLib
::
DenseMatrix
<
double
>
mat
(
3
,
3
)
;
Eigen
::
Matrix3d
mat
;
mat
(
0
,
0
)
=
p0
[
0
];
mat
(
0
,
1
)
=
p0
[
1
];
mat
(
0
,
2
)
=
1.0
;
...
...
@@ -82,12 +83,10 @@ void getPlaneCoefficients(Triangle const& tri, double c[3])
mat
(
2
,
0
)
=
p2
[
0
];
mat
(
2
,
1
)
=
p2
[
1
];
mat
(
2
,
2
)
=
1.0
;
c
[
0
]
=
p0
[
2
];
c
[
1
]
=
p1
[
2
];
c
[
2
]
=
p2
[
2
];
Eigen
::
Vector3d
y
;
y
<<
p0
[
2
],
p1
[
2
],
p2
[
2
];
MathLib
::
GaussAlgorithm
<
MathLib
::
DenseMatrix
<
double
>
,
double
*>
gauss
;
gauss
.
solve
(
mat
,
c
);
Eigen
::
Map
<
Eigen
::
Vector3d
>
(
c
,
3
)
=
mat
.
partialPivLu
().
solve
(
y
);
}
}
// end namespace GeoLib
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