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
6f1b4978
Commit
6f1b4978
authored
2 years ago
by
Tom Fischer
Browse files
Options
Downloads
Patches
Plain Diff
[GL] Use Point3d::asEigenVector3d().
parent
16318e82
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
GeoLib/AnalyticalGeometry.cpp
+8
-14
8 additions, 14 deletions
GeoLib/AnalyticalGeometry.cpp
GeoLib/MinimalBoundingSphere.cpp
+8
-14
8 additions, 14 deletions
GeoLib/MinimalBoundingSphere.cpp
with
16 additions
and
28 deletions
GeoLib/AnalyticalGeometry.cpp
+
8
−
14
View file @
6f1b4978
...
...
@@ -152,10 +152,10 @@ bool lineSegmentIntersect(GeoLib::LineSegment const& s0,
return
false
;
}
auto
const
a
=
s0
.
getBeginPoint
().
asEigenVector3d
();
auto
const
b
=
s0
.
getEndPoint
().
asEigenVector3d
();
auto
const
c
=
s1
.
getBeginPoint
().
asEigenVector3d
();
auto
const
d
=
s1
.
getEndPoint
().
asEigenVector3d
();
auto
const
&
a
=
s0
.
getBeginPoint
().
asEigenVector3d
();
auto
const
&
b
=
s0
.
getEndPoint
().
asEigenVector3d
();
auto
const
&
c
=
s1
.
getBeginPoint
().
asEigenVector3d
();
auto
const
&
d
=
s1
.
getEndPoint
().
asEigenVector3d
();
Eigen
::
Vector3d
const
v
=
b
-
a
;
Eigen
::
Vector3d
const
w
=
d
-
c
;
...
...
@@ -369,16 +369,10 @@ std::unique_ptr<GeoLib::Point> triangleLineIntersection(
MathLib
::
Point3d
const
&
c
,
MathLib
::
Point3d
const
&
p
,
MathLib
::
Point3d
const
&
q
)
{
auto
const
va
=
a
.
asEigenVector3d
();
auto
const
vb
=
b
.
asEigenVector3d
();
auto
const
vc
=
c
.
asEigenVector3d
();
auto
const
vp
=
p
.
asEigenVector3d
();
auto
const
vq
=
q
.
asEigenVector3d
();
Eigen
::
Vector3d
const
pq
=
vq
-
vp
;
Eigen
::
Vector3d
const
pa
=
va
-
vp
;
Eigen
::
Vector3d
const
pb
=
vb
-
vp
;
Eigen
::
Vector3d
const
pc
=
vc
-
vp
;
Eigen
::
Vector3d
const
pq
=
q
.
asEigenVector3d
()
-
p
.
asEigenVector3d
();
Eigen
::
Vector3d
const
pa
=
a
.
asEigenVector3d
()
-
p
.
asEigenVector3d
();
Eigen
::
Vector3d
const
pb
=
b
.
asEigenVector3d
()
-
p
.
asEigenVector3d
();
Eigen
::
Vector3d
const
pc
=
c
.
asEigenVector3d
()
-
p
.
asEigenVector3d
();
double
u
=
pq
.
cross
(
pc
).
dot
(
pb
);
if
(
u
<
0
)
...
...
This diff is collapsed.
Click to expand it.
GeoLib/MinimalBoundingSphere.cpp
+
8
−
14
View file @
6f1b4978
...
...
@@ -34,13 +34,11 @@ MinimalBoundingSphere::MinimalBoundingSphere(MathLib::Point3d const& p,
MathLib
::
Point3d
const
&
q
)
:
_radius
(
std
::
numeric_limits
<
double
>::
epsilon
()),
_center
(
p
)
{
auto
const
&
vp
=
p
.
asEigenVector3d
();
auto
const
&
vq
=
q
.
asEigenVector3d
();
Eigen
::
Vector3d
const
a
=
vq
-
vp
;
Eigen
::
Vector3d
const
a
=
q
.
asEigenVector3d
()
-
p
.
asEigenVector3d
();
Eigen
::
Vector3d
o
=
a
/
2
;
_radius
=
o
.
norm
()
+
std
::
numeric_limits
<
double
>::
epsilon
();
o
+=
v
p
;
o
+=
p
.
asEigenVector3d
()
;
_center
=
MathLib
::
Point3d
{{
o
[
0
],
o
[
1
],
o
[
2
]}};
}
...
...
@@ -49,10 +47,8 @@ MinimalBoundingSphere::MinimalBoundingSphere(MathLib::Point3d const& p,
MathLib
::
Point3d
const
&
r
)
{
auto
const
&
vp
=
p
.
asEigenVector3d
();
auto
const
&
vq
=
q
.
asEigenVector3d
();
auto
const
&
vr
=
r
.
asEigenVector3d
();
Eigen
::
Vector3d
const
a
=
vr
-
vp
;
Eigen
::
Vector3d
const
b
=
vq
-
vp
;
Eigen
::
Vector3d
const
a
=
r
.
asEigenVector3d
()
-
vp
;
Eigen
::
Vector3d
const
b
=
q
.
asEigenVector3d
()
-
vp
;
Eigen
::
Vector3d
const
axb
=
a
.
cross
(
b
);
if
(
axb
.
squaredNorm
()
>
0
)
...
...
@@ -85,11 +81,9 @@ MinimalBoundingSphere::MinimalBoundingSphere(MathLib::Point3d const& p,
MathLib
::
Point3d
const
&
r
,
MathLib
::
Point3d
const
&
s
)
{
auto
const
&
vp
=
p
.
asEigenVector3d
();
Eigen
::
Vector3d
const
va
=
q
.
asEigenVector3d
()
-
vp
;
Eigen
::
Vector3d
const
vb
=
r
.
asEigenVector3d
()
-
vp
;
Eigen
::
Vector3d
const
vc
=
s
.
asEigenVector3d
()
-
vp
;
Eigen
::
Vector3d
const
va
=
q
.
asEigenVector3d
()
-
p
.
asEigenVector3d
();
Eigen
::
Vector3d
const
vb
=
r
.
asEigenVector3d
()
-
p
.
asEigenVector3d
();
Eigen
::
Vector3d
const
vc
=
s
.
asEigenVector3d
()
-
p
.
asEigenVector3d
();
if
(
!
MathLib
::
isCoplanar
(
p
,
q
,
r
,
s
))
{
...
...
@@ -100,7 +94,7 @@ MinimalBoundingSphere::MinimalBoundingSphere(MathLib::Point3d const& p,
denom
;
_radius
=
o
.
norm
()
+
std
::
numeric_limits
<
double
>::
epsilon
();
o
+=
v
p
;
o
+=
p
.
asEigenVector3d
()
;
_center
=
MathLib
::
Point3d
({
o
[
0
],
o
[
1
],
o
[
2
]});
}
else
...
...
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