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
816d22f5
Commit
816d22f5
authored
9 years ago
by
Dmitri Naumov
Browse files
Options
Downloads
Patches
Plain Diff
[MaL] Move TemplatePoint functions.
... into TemplatePoint header file.
parent
80295ba2
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
MathLib/MathTools.h
+0
-19
0 additions, 19 deletions
MathLib/MathTools.h
MathLib/TemplatePoint.h
+21
-0
21 additions, 0 deletions
MathLib/TemplatePoint.h
with
21 additions
and
19 deletions
MathLib/MathTools.h
+
0
−
19
View file @
816d22f5
...
...
@@ -107,14 +107,6 @@ void crossProd (const double u[3], const double v[3], double r[3]);
double
calcProjPntToLineAndDists
(
const
double
p
[
3
],
const
double
a
[
3
],
const
double
b
[
3
],
double
&
lambda
,
double
&
d0
);
template
<
typename
T
,
std
::
size_t
DIM
>
bool
operator
==
(
TemplatePoint
<
T
,
DIM
>
const
&
a
,
TemplatePoint
<
T
,
DIM
>
const
&
b
)
{
T
const
sqr_dist
(
sqrDist
(
a
,
b
));
auto
const
eps
=
std
::
numeric_limits
<
T
>::
epsilon
();
return
(
sqr_dist
<
eps
*
eps
);
}
/// Computes the squared dist between the two points p0 and p1.
inline
double
sqrDist
(
MathLib
::
Point3d
const
&
p0
,
MathLib
::
Point3d
const
&
p1
)
...
...
@@ -131,17 +123,6 @@ double sqrDist(const double* p0, const double* p1)
return
scalarProduct
<
double
,
3
>
(
v
,
v
);
}
/** Distance between points p0 and p1 in the maximum norm. */
template
<
typename
T
>
T
maxNormDist
(
const
MathLib
::
TemplatePoint
<
T
>*
p0
,
const
MathLib
::
TemplatePoint
<
T
>*
p1
)
{
const
T
x
=
fabs
((
*
p1
)[
0
]
-
(
*
p0
)[
0
]);
const
T
y
=
fabs
((
*
p1
)[
1
]
-
(
*
p0
)[
1
]);
const
T
z
=
fabs
((
*
p1
)[
2
]
-
(
*
p0
)[
2
]);
return
std
::
max
(
x
,
std
::
max
(
y
,
z
));
}
/**
* Let \f$p_0, p_1, p_2 \in R^3\f$. The function getAngle
* computes the angle between the edges \f$(p_0,p_1)\f$ and \f$(p_1,p_2)\f$
...
...
This diff is collapsed.
Click to expand it.
MathLib/TemplatePoint.h
+
21
−
0
View file @
816d22f5
...
...
@@ -101,6 +101,27 @@ TemplatePoint<T,DIM>::TemplatePoint(std::array<T,DIM> const& x) :
_x
(
x
)
{}
/** Equality of TemplatePoint's up to an epsilon.
*/
template
<
typename
T
,
std
::
size_t
DIM
>
bool
operator
==
(
TemplatePoint
<
T
,
DIM
>
const
&
a
,
TemplatePoint
<
T
,
DIM
>
const
&
b
)
{
T
const
sqr_dist
(
sqrDist
(
a
,
b
));
auto
const
eps
=
std
::
numeric_limits
<
T
>::
epsilon
();
return
(
sqr_dist
<
eps
*
eps
);
}
/** Distance between points p0 and p1 in the maximum norm. */
template
<
typename
T
>
T
maxNormDist
(
const
MathLib
::
TemplatePoint
<
T
>*
p0
,
const
MathLib
::
TemplatePoint
<
T
>*
p1
)
{
const
T
x
=
fabs
((
*
p1
)[
0
]
-
(
*
p0
)[
0
]);
const
T
y
=
fabs
((
*
p1
)[
1
]
-
(
*
p0
)[
1
]);
const
T
z
=
fabs
((
*
p1
)[
2
]
-
(
*
p0
)[
2
]);
return
std
::
max
(
x
,
std
::
max
(
y
,
z
));
}
/** overload the output operator for class Point */
template
<
typename
T
,
std
::
size_t
DIM
>
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
const
TemplatePoint
<
T
,
DIM
>
&
p
)
...
...
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