Analysis Software
Documentation for
sPHENIX
simulation software
Home page
Related Pages
Modules
Namespaces
Classes
Files
Examples
External Links
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
ConvexPolygonBounds.cpp
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file ConvexPolygonBounds.cpp
1
// This file is part of the Acts project.
2
//
3
// Copyright (C) 2016-2020 CERN for the benefit of the Acts project
4
//
5
// This Source Code Form is subject to the terms of the Mozilla Public
6
// License, v. 2.0. If a copy of the MPL was not distributed with this
7
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
8
9
#include "
Acts/Surfaces/ConvexPolygonBounds.hpp
"
10
11
#include <algorithm>
12
#include <ostream>
13
14
std::ostream&
Acts::ConvexPolygonBoundsBase::toStream
(std::ostream& sl)
const
{
15
std::vector<Vector2> vtxs =
vertices
();
16
sl <<
"Acts::ConvexPolygonBounds<"
<< vtxs.size() <<
">: vertices: [x, y]\n"
;
17
for
(
size_t
i
= 0;
i
< vtxs.size();
i
++) {
18
const
auto
& vtx = vtxs[
i
];
19
if
(
i
> 0) {
20
sl <<
","
;
21
sl <<
"\n"
;
22
}
23
sl <<
"["
<< vtx.x() <<
", "
<< vtx.y() <<
"]"
;
24
}
25
return
sl;
26
}
27
28
std::vector<double>
Acts::ConvexPolygonBoundsBase::values
()
const
{
29
std::vector<double>
values
;
30
for
(
const
auto
& vtx :
vertices
()) {
31
values.push_back(vtx.x());
32
values.push_back(vtx.y());
33
}
34
return
values
;
35
}
36
37
Acts::ConvexPolygonBounds<Acts::PolygonDynamic>::ConvexPolygonBounds
(
38
const
std::vector<Vector2>&
vertices
)
39
: m_vertices(vertices.
begin
(), vertices.
end
()),
40
m_boundingBox(makeBoundingBox(vertices)) {}
41
42
Acts::SurfaceBounds::BoundsType
43
Acts::ConvexPolygonBounds<Acts::PolygonDynamic>::type
()
const
{
44
return
SurfaceBounds::eConvexPolygon
;
45
}
46
47
bool
Acts::ConvexPolygonBounds<Acts::PolygonDynamic>::inside
(
48
const
Acts::Vector2
& lposition,
const
Acts::BoundaryCheck
& bcheck)
const
{
49
return
bcheck.
isInside
(lposition, m_vertices);
50
}
51
52
std::vector<Acts::Vector2>
Acts::ConvexPolygonBounds
<
53
Acts::PolygonDynamic
>
::vertices
(
unsigned
int
/*lseg*/
)
const
{
54
return
{m_vertices.begin(), m_vertices.end()};
55
}
56
57
const
Acts::RectangleBounds
&
58
Acts::ConvexPolygonBounds<Acts::PolygonDynamic>::boundingBox
()
const
{
59
return
m_boundingBox;
60
}
61
62
void
Acts::ConvexPolygonBounds<Acts::PolygonDynamic>::checkConsistency
() const
63
noexcept(
false
) {
64
convex_impl(m_vertices);
65
}
acts
blob
sPHENIX
Core
src
Surfaces
ConvexPolygonBounds.cpp
Built by
Jin Huang
. updated:
Sat Feb 17 2024 22:17:36
using
1.8.2 with
sPHENIX GitHub integration