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
Jakob Randow
ogs
Commits
19646797
Commit
19646797
authored
12 years ago
by
Tom Fischer
Browse files
Options
Downloads
Patches
Plain Diff
Moved TemplatePoint from GeoLib folder to MathLib folder.
parent
c548054e
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
MathLib/TemplatePoint.h
+20
-16
20 additions, 16 deletions
MathLib/TemplatePoint.h
with
20 additions
and
16 deletions
Geo
Lib/TemplatePoint.h
→
Math
Lib/TemplatePoint.h
+
20
−
16
View file @
19646797
...
...
@@ -17,13 +17,13 @@
#include
<cassert>
#include
<iostream>
#include
<string>
#include
<sstream>
#include
<string>
#include
"GeoObject.h"
namespace
GeoLib
{
namespace
GeoLib
{
/**
* \ingroup GeoLib
*
...
...
@@ -37,19 +37,19 @@ public:
TemplatePoint
();
/** constructor - constructs a TemplatePoint object
\param x1 value for the first coordinate
\param x2 value for the second coordinate
\param x3 value for the third coordinate
\param x1 value for the first coordinate
\param x2 value for the second coordinate
\param x3 value for the third coordinate
*/
TemplatePoint
(
T
x1
,
T
x2
,
T
x3
);
/** constructor - constructs a TemplatePoint object
\param x values for three coordinates
\param x values for three coordinates
*/
TemplatePoint
(
T
const
*
x
);
/** virtual destructor */
virtual
~
TemplatePoint
()
{}
;
virtual
~
TemplatePoint
()
{}
/** \brief const access operator
* The access to the point coordinates is like the access to a field. Code example:
...
...
@@ -57,15 +57,17 @@ public:
* Point<double> point (1.0, 2.0, 3.0);
* double sqrNrm2 = point[0] * point[0] + point[1] * point[1] + point[2] + point[2];
* \endcode
*/
const
T
&
operator
[]
(
std
::
size_t
idx
)
const
{
*/
const
T
&
operator
[]
(
std
::
size_t
idx
)
const
{
assert
(
idx
<=
2
);
return
_x
[
idx
];
}
/** \brief access operator (see book Effektiv C++ programmieren - subsection 1.3.2 ).
* \sa const T& operator[] (std::size_t idx) const
*/
T
&
operator
[]
(
std
::
size_t
idx
)
{
T
&
operator
[]
(
std
::
size_t
idx
)
{
return
const_cast
<
T
&>
(
static_cast
<
const
TemplatePoint
&>
(
*
this
)[
idx
]);
}
...
...
@@ -74,13 +76,15 @@ public:
/** write point coordinates into stream (used from operator<<)
* \param os a standard output stream
*/
virtual
void
write
(
std
::
ostream
&
os
)
const
{
*/
virtual
void
write
(
std
::
ostream
&
os
)
const
{
os
<<
_x
[
0
]
<<
" "
<<
_x
[
1
]
<<
" "
<<
_x
[
2
]
<<
std
::
flush
;
}
/** read point coordinates into stream (used from operator>>) */
virtual
void
read
(
std
::
istream
&
is
)
{
virtual
void
read
(
std
::
istream
&
is
)
{
is
>>
_x
[
0
]
>>
_x
[
1
]
>>
_x
[
2
];
}
...
...
@@ -107,7 +111,8 @@ template <class T> TemplatePoint<T>::TemplatePoint(T x1, T x2, T x3) :
template
<
class
T
>
TemplatePoint
<
T
>::
TemplatePoint
(
T
const
*
x
)
:
GeoObject
()
{
for
(
std
::
size_t
k
(
0
);
k
<
3
;
k
++
)
_x
[
k
]
=
x
[
k
];
for
(
std
::
size_t
k
(
0
);
k
<
3
;
k
++
)
_x
[
k
]
=
x
[
k
];
}
/** overload the output operator for class Point */
...
...
@@ -125,7 +130,6 @@ std::istream& operator>> (std::istream &is, TemplatePoint<T> &p)
p
.
read
(
is
);
return
is
;
}
}
// end namespace GEO
#endif
/* TEMPLATEPOINT_H_ */
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