IAP GITLAB
Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
corsika
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Issue analytics
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
Air Shower Physics
corsika
Commits
8d4a7744
Commit
8d4a7744
authored
4 years ago
by
Nikos Karastathis
Browse files
Options
Downloads
Patches
Plain Diff
Path class header and inline file in correct format
parent
49810a17
No related branches found
No related tags found
1 merge request
!313
Resolve "Geometry and environment feature updates - merge to refactored version"
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
corsika/detail/framework/geometry/Path.inl
+78
-59
78 additions, 59 deletions
corsika/detail/framework/geometry/Path.inl
corsika/framework/geometry/Path.hpp
+14
-53
14 additions, 53 deletions
corsika/framework/geometry/Path.hpp
with
92 additions
and
112 deletions
corsika/detail/framework/geometry/Path.inl
+
78
−
59
View file @
8d4a7744
///*
/*
// * (c) Copyright 2020 CORSIKA Project, corsika-project@lists.kit.edu
* (c) Copyright 2020 CORSIKA Project, corsika-project@lists.kit.edu
// *
*
// * This software is distributed under the terms of the GNU General Public
* This software is distributed under the terms of the GNU General Public
// * Licence version 3 (GPL Version 3). See file LICENSE for a full version of
* Licence version 3 (GPL Version 3). See file LICENSE for a full version of
// * the license.
* the license.
// */
*/
//
//#pragma once
#pragma once
//
//#include <deque>
#include
<deque>
//#include <corsika/framework/geometry/Point.hpp>
#include
<corsika/framework/geometry/Point.hpp>
//
//namespace corsika {
namespace
corsika
{
//
// inline void AddToEnd(Point const& point) {
Path
::
Path
(
Point
const
&
point
)
{
// length_ += (point - points_.back()).getNorm();
points_
.
push_front
(
point
);
// points_.push_back(point);
}
// }
//
Path
::
Path
(
std
::
deque
<
Point
>
const
&
points
)
//
:
points_
(
points
)
{
// inline void RemoveFromEnd() {
int
dequesize_
=
points
.
size
();
// auto lastpoint_ = points_.back();
if
(
dequesize_
==
0
||
dequesize_
==
1
)
{
// points_.pop_back();
length_
=
LengthType
::
zero
();
// int dequesize_ = points_.size();
}
// if (dequesize_ == 0 || dequesize_ == 1) {
else
if
(
dequesize_
==
2
)
{
// length_ = LengthType::zero();
length_
=
(
points
.
back
()
-
points
.
front
()).
getNorm
();
// }
}
// else if (dequesize_ == 2) {
else
{
// length_ = (points_.back() - points_.front()).getNorm();
for
(
auto
point
=
points
.
begin
();
point
!=
points
.
end
()
-
1
;
++
point
)
{
// }
auto
point_next
=
*
(
point
+
1
);
// else { length_ -= (lastpoint_ - points_.back()).getNorm(); }
auto
point_now
=
*
(
point
);
// }
length_
+=
(
point_next
-
point_now
).
getNorm
();
//
}
//
}
// inline LengthType GetLength() const {
}
// return length_;
// }
inline
void
Path
::
AddToEnd
(
Point
const
&
point
)
{
//
length_
+=
(
point
-
points_
.
back
()).
getNorm
();
//
points_
.
push_back
(
point
);
// inline Point GetStart() const {
}
// return points_.front();
// }
inline
void
Path
::
RemoveFromEnd
()
{
//
auto
lastpoint_
=
points_
.
back
();
//
points_
.
pop_back
();
// inline Point GetEnd() const {
int
dequesize_
=
points_
.
size
();
// return points_.back();
if
(
dequesize_
==
0
||
dequesize_
==
1
)
{
// }
length_
=
LengthType
::
zero
();
//
}
//
else
if
(
dequesize_
==
2
)
{
// inline Point GetPoint(std::size_t const index) const {
length_
=
(
points_
.
back
()
-
points_
.
front
()).
getNorm
();
// return points_.at(index);
}
// }
else
{
length_
-=
(
lastpoint_
-
points_
.
back
()).
getNorm
();
}
//
}
//
//
inline
LengthType
Path
::
GetLength
()
const
{
// inline int GetNSegments() const { return points_.size() - 1; }
return
length_
;
//
}
//} // namespace corsika
\ No newline at end of file
inline
Point
Path
::
GetStart
()
const
{
return
points_
.
front
();
}
inline
Point
Path
::
GetEnd
()
const
{
return
points_
.
back
();
}
inline
Point
Path
::
GetPoint
(
std
::
size_t
const
index
)
const
{
return
points_
.
at
(
index
);
}
inline
auto
Path
::
begin
()
{
return
points_
.
begin
();
}
inline
auto
Path
::
end
()
{
return
points_
.
end
();
}
inline
int
Path
::
GetNSegments
()
const
{
return
points_
.
size
()
-
1
;
}
}
// namespace corsika
\ No newline at end of file
This diff is collapsed.
Click to expand it.
corsika/framework/geometry/Path.hpp
+
14
−
53
View file @
8d4a7744
...
@@ -24,101 +24,62 @@ namespace corsika {
...
@@ -24,101 +24,62 @@ namespace corsika {
/**
/**
* Create a Path with a given starting Point.
* Create a Path with a given starting Point.
*/
*/
Path
(
Point
const
&
point
)
{
Path
(
Point
const
&
point
);
points_
.
push_front
(
point
);
}
/**
/**
* Initialize a Path from an existing collection of Points.
* Initialize a Path from an existing collection of Points.
*/
*/
Path
(
std
::
deque
<
Point
>
const
&
points
)
Path
(
std
::
deque
<
Point
>
const
&
points
);
:
points_
(
points
)
{
int
dequesize_
=
points
.
size
();
if
(
dequesize_
==
0
||
dequesize_
==
1
)
{
length_
=
LengthType
::
zero
();
}
else
if
(
dequesize_
==
2
)
{
length_
=
(
points
.
back
()
-
points
.
front
()).
getNorm
();
}
else
{
for
(
auto
point
=
points
.
begin
();
point
!=
points
.
end
()
-
1
;
++
point
)
{
auto
point_next
=
*
(
point
+
1
);
auto
point_now
=
*
(
point
);
length_
+=
(
point_next
-
point_now
).
getNorm
();
}
}
}
/**
/**
* Add a new Point to the end of the path.
* Add a new Point to the end of the path.
*/
*/
void
AddToEnd
(
Point
const
&
point
)
{
inline
void
AddToEnd
(
Point
const
&
point
);
length_
+=
(
point
-
points_
.
back
()).
getNorm
();
points_
.
push_back
(
point
);
}
/**
/**
* Remove a point from the end of the path.
* Remove a point from the end of the path.
*/
*/
void
RemoveFromEnd
()
{
inline
void
RemoveFromEnd
();
auto
lastpoint_
=
points_
.
back
();
points_
.
pop_back
();
int
dequesize_
=
points_
.
size
();
if
(
dequesize_
==
0
||
dequesize_
==
1
)
{
length_
=
LengthType
::
zero
();
}
else
if
(
dequesize_
==
2
)
{
length_
=
(
points_
.
back
()
-
points_
.
front
()).
getNorm
();
}
else
{
length_
-=
(
lastpoint_
-
points_
.
back
()).
getNorm
();
}
}
/**
/**
* Get the total length of the path.
* Get the total length of the path.
*/
*/
LengthType
GetLength
()
const
{
inline
LengthType
GetLength
()
const
;
return
length_
;
}
/**
/**
* Get the starting point of the path.
* Get the starting point of the path.
*/
*/
Point
GetStart
()
const
{
inline
Point
GetStart
()
const
;
return
points_
.
front
();
}
/**
/**
* Get the end point of the path.
* Get the end point of the path.
*/
*/
Point
GetEnd
()
const
{
inline
Point
GetEnd
()
const
;
return
points_
.
back
();
}
/**
/**
* Get a specific point of the path.
* Get a specific point of the path.
*/
*/
Point
GetPoint
(
std
::
size_t
const
index
)
const
{
inline
Point
GetPoint
(
std
::
size_t
const
index
)
const
;
return
points_
.
at
(
index
);
}
/**
/**
* Return an iterator to the start of the Path.
* Return an iterator to the start of the Path.
*/
*/
auto
begin
()
{
return
points_
.
begin
();
}
inline
auto
begin
();
/**
/**
* Return an iterator to the end of the Path.
* Return an iterator to the end of the Path.
*/
*/
auto
end
()
{
return
points_
.
end
();
}
inline
auto
end
()
;
/**
/**
* Get the number of steps in the path.
* Get the number of steps in the path.
*
* This is one less than the number of points that
* This is one less than the number of points that
* defines the path.
* defines the path.
*/
*/
int
GetNSegments
()
const
{
return
points_
.
size
()
-
1
;
}
inline
int
GetNSegments
()
const
;
};
// class Path
};
// class Path
}
// namespace corsika
}
// namespace corsika
\ No newline at end of file
#include
<corsika/detail/framework/geometry/Path.inl>
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Nikos Karastathis
@Nikos
mentioned in commit
6a99bfc8
·
3 years ago
mentioned in commit
6a99bfc8
mentioned in commit 6a99bfc838bc61f2e961e11bbb6ba7b4ada199c2
Toggle commit list
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