Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat!: (fix + chore) streamline nSegments usage #3419

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
206d595
fix segmented view sectors
asalzburger Jul 18, 2024
a4df8c8
fixing polygon drawing
asalzburger Jul 19, 2024
863cc15
enable tests
asalzburger Jul 19, 2024
a83e9dc
Merge branch 'main' into fix-display-vertices-annulus-bounds
asalzburger Jul 19, 2024
dbaa93d
change nSegment handling in Polyhedron and Visualization
asalzburger Jul 22, 2024
bb5fc06
Merge branch 'main' into fix-display-vertices-annulus-bounds
asalzburger Jul 22, 2024
6376ad6
spelling mistake
asalzburger Jul 23, 2024
301da02
spelling
asalzburger Jul 23, 2024
32f5b8d
Merge branch 'main' into fix-display-vertices-annulus-bounds
asalzburger Jul 23, 2024
18bc323
spelling
asalzburger Jul 23, 2024
cb44f59
Merge branch 'main' into fix-display-vertices-annulus-bounds
asalzburger Jul 23, 2024
9df0717
Update TGeoITkModuleSplitter.hpp
asalzburger Jul 23, 2024
805c8d5
Merge branch 'main' into fix-display-vertices-annulus-bounds
asalzburger Jul 23, 2024
41ac65a
Merge branch 'main' into fix-display-vertices-annulus-bounds
asalzburger Jul 24, 2024
ca1843f
Update Core/include/Acts/Surfaces/AnnulusBounds.hpp
asalzburger Jul 24, 2024
4749f85
Update Core/include/Acts/Surfaces/AnnulusBounds.hpp
asalzburger Jul 24, 2024
896b44f
Update Core/include/Acts/Surfaces/CylinderSurface.hpp
asalzburger Jul 24, 2024
efa9a36
Update Core/include/Acts/Surfaces/detail/VerticesHelper.hpp
asalzburger Jul 24, 2024
af64e64
Update Core/include/Acts/Surfaces/detail/VerticesHelper.hpp
asalzburger Jul 24, 2024
45dcdef
Update Core/src/Surfaces/ConeSurface.cpp
asalzburger Jul 24, 2024
ba816e1
Update Examples/Python/src/Obj.cpp
asalzburger Jul 24, 2024
a7dffff
Update Examples/Python/src/Obj.cpp
asalzburger Jul 24, 2024
8928e65
Update Examples/Python/src/Obj.cpp
asalzburger Jul 24, 2024
7fd3779
Update Tests/UnitTests/Fatras/Digitization/SegmentizerTests.cpp
asalzburger Jul 24, 2024
28145d2
Update Tests/UnitTests/Fatras/Digitization/SegmentizerTests.cpp
asalzburger Jul 24, 2024
07f190f
Update Core/src/Surfaces/CylinderBounds.cpp
asalzburger Jul 24, 2024
b7939b1
Update Core/src/Surfaces/CylinderBounds.cpp
asalzburger Jul 24, 2024
94f95a9
Update Core/src/Surfaces/PlaneSurface.cpp
asalzburger Jul 24, 2024
97d517e
Update Core/src/Surfaces/PlaneSurface.cpp
asalzburger Jul 24, 2024
64ac57e
Merge branch 'main' into fix-display-vertices-annulus-bounds
asalzburger Jul 24, 2024
5212e6c
Update Core/include/Acts/Surfaces/detail/VerticesHelper.hpp
asalzburger Jul 25, 2024
163e26e
Update Core/src/Surfaces/detail/VerticesHelper.cpp
asalzburger Jul 26, 2024
2b54a85
Update VerticesHelper.cpp
asalzburger Jul 26, 2024
2d6a660
Update Core/src/Surfaces/PlaneSurface.cpp
asalzburger Jul 26, 2024
c75254d
Merge branch 'main' into fix-display-vertices-annulus-bounds
asalzburger Jul 26, 2024
37812f2
addressing PR comments
asalzburger Jul 26, 2024
1e7803c
fixing CI
asalzburger Jul 26, 2024
57e61ac
Merge branch 'main' into fix-display-vertices-annulus-bounds
asalzburger Jul 29, 2024
dc39ca2
Merge remote-tracking branch 'origin/main' into fix-display-vertices-…
paulgessinger Oct 3, 2024
7dce2f6
update after merge
paulgessinger Oct 3, 2024
a2bf7cc
compile fixes
paulgessinger Oct 3, 2024
d3ba2c1
Merge branch 'main' into fix-display-vertices-annulus-bounds
kodiakhq[bot] Oct 3, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions Core/include/Acts/Detector/LayerStructureBuilder.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,9 @@ class LayerStructureBuilder : public IInternalStructureBuilder {
/// Minimum number of surfaces to build an internal structure
/// - otherwise the tryAll options is used
unsigned int nMinimalSurfaces = 4u;
/// Polyhedron approximations
unsigned int nSegments = 1u;
/// Polyhedron approximations: number of segments to be used
/// to approximate a quarter of a circle
unsigned int quarterSegments = 1u;
/// Extra information, mainly for screen output
std::string auxiliary = "";
};
Expand Down
1 change: 1 addition & 0 deletions Core/include/Acts/Geometry/Polyhedron.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ struct Polyhedron {
/// @param facesIn List of lists of indices for faces.
/// @param triangularMeshIn List of lists of indices for a triangular mesh
/// @param isExact A dedicated flag if this is exact or not
///
/// @note This creates copies of the input vectors
Polyhedron(const std::vector<Vector3>& verticesIn,
const std::vector<FaceType>& facesIn,
Expand Down
15 changes: 8 additions & 7 deletions Core/include/Acts/Surfaces/AnnulusBounds.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,19 +133,20 @@ class AnnulusBounds : public DiscBounds {
std::vector<Vector2> corners() const;

/// This method returns the xy coordinates of the four corners of the
/// bounds in module coordinates (in x/y)
/// bounds in module coordinates (in x/y), and if quarterSegments is bigger or
/// equal to 0, the curved part of the segment is included and approximated
/// by the corresponding number of segments.
///
/// Starting from the upper right (max R, pos locX) and proceeding clock-wise
/// i.e. (max R; pos locX), (min R; pos locX), (min R; neg loc X), (max R: neg
/// locX)
///
/// @param lseg the number of segments used to approximate
/// and eventually curved line
///
/// @note that that if @c lseg > 0, the extrema points are given,
/// which may slightly alter the number of segments returned
/// @param quarterSegments the number of segments used to approximate
/// a quarter of a circle
///
/// @return vector for vertices in 2D
std::vector<Vector2> vertices(unsigned int lseg) const override;
std::vector<Vector2> vertices(
unsigned int quarterSegments = 2u) const override;

/// This method returns inner radius
double rMin() const final;
Expand Down
15 changes: 8 additions & 7 deletions Core/include/Acts/Surfaces/ConeSurface.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -200,15 +200,16 @@ class ConeSurface : public RegularSurface {
/// Return a Polyhedron for the surfaces
///
/// @param gctx The current geometry context object, e.g. alignment
/// @param lseg Number of segments along curved lines, it represents
/// the full 2*M_PI coverange, if lseg is set to 1 only the extrema
/// are given
/// @note that a surface transform can invalidate the extrema
/// in the transformed space
/// @param quarterSegments Number of segments used to approximate a quarter
///
/// @note The phi extrema points at (-pi, -1/2 pi, 0, 1/2 pi) that fall within
/// the surface will be inserted to guarantee an appropriate extent
/// measurement in x and y
///
/// @return A list of vertices and a face/facett description of it
Polyhedron polyhedronRepresentation(const GeometryContext& gctx,
std::size_t lseg) const override;
Polyhedron polyhedronRepresentation(
const GeometryContext& gctx,
unsigned int quarterSegments = 2u) const override;

/// Return properly formatted class name for screen output
std::string name() const override;
Expand Down
4 changes: 2 additions & 2 deletions Core/include/Acts/Surfaces/ConvexPolygonBounds.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,13 +114,13 @@ class ConvexPolygonBounds : public ConvexPolygonBoundsBase {

/// Return the vertices
///
/// @param lseg the number of segments used to approximate
/// @param ignoredSegments the number of segments used to approximate
/// and eventually curved line
///
/// @note the number of segments is ignored in this representation
///
/// @return vector for vertices in 2D
std::vector<Vector2> vertices(unsigned int lseg = 1) const final;
std::vector<Vector2> vertices(unsigned int ignoredSegments = 0u) const final;
asalzburger marked this conversation as resolved.
Show resolved Hide resolved

/// Return a rectangle bounds object that encloses this polygon.
/// @return The rectangular bounds
Expand Down
2 changes: 1 addition & 1 deletion Core/include/Acts/Surfaces/ConvexPolygonBounds.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ bool Acts::ConvexPolygonBounds<N>::inside(

template <int N>
std::vector<Acts::Vector2> Acts::ConvexPolygonBounds<N>::vertices(
unsigned int /*lseg*/) const {
unsigned int /*ignoredSegments*/) const {
return {m_vertices.begin(), m_vertices.end()};
}

Expand Down
16 changes: 11 additions & 5 deletions Core/include/Acts/Surfaces/CylinderBounds.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,18 @@ class CylinderBounds : public SurfaceBounds {
/// Returns true for full phi coverage
bool coversFullAzimuth() const;

/// Create the bows/circles on either side of the cylinder
/// Create the bow/circle vertices on either side of the cylinder
///
/// @param trans is the global transform
/// @param lseg are the numbero if phi segments
std::vector<Vector3> createCircles(const Transform3 trans,
std::size_t lseg) const;
/// @param transform is the global transform
/// @param quarterSegments is the number of segments to approximate a quarter
/// of a circle. In order to symmetrize fully closed and sectoral cylinders,
/// also in the first case the two end points are given (albeit they overlap)
/// in -pi / pi
///
/// @return a singlevector containing the vertices from one side and then
/// from the other side consecutively
std::vector<Vector3> circleVertices(const Transform3 transform,
unsigned int quarterSegments) const;

/// Output Method for std::ostream
std::ostream& toStream(std::ostream& sl) const final;
Expand Down
16 changes: 11 additions & 5 deletions Core/include/Acts/Surfaces/CylinderSurface.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -214,14 +214,20 @@ class CylinderSurface : public RegularSurface {

/// Return a Polyhedron for a cylinder
///
/// This method represents the cylinder as a polyhedron with a given number
/// of segments to represent a quarter of a full circle. The polyedron will
/// consist of the vertices of the cylinder on both sides, and faces between
/// them, both as rectangular faces and as triangular faces.
///
/// @param gctx The current geometry context object, e.g. alignment
/// @param lseg Number of segments along curved lines, it represents
/// the full 2*M_PI coverange, if lseg is set to 1 only the extrema
/// are given
/// @param quarterSegments The number of segments to approximate a quarter of the
/// full circle; it's chosen to be 1, only the extrema points (-pi, -0.5pi,
/// 0., 0.5pi) are inserted to capture the correct extent in the x-y plane
///
/// @return A list of vertices and a face/facett description of it
Polyhedron polyhedronRepresentation(const GeometryContext& gctx,
std::size_t lseg) const override;
Polyhedron polyhedronRepresentation(
const GeometryContext& gctx,
unsigned int quarterSegments = 2u) const override;

/// Calculate the derivative of path length at the geometry constraint or
/// point-of-closest-approach w.r.t. alignment parameters of the surface (i.e.
Expand Down
10 changes: 4 additions & 6 deletions Core/include/Acts/Surfaces/DiamondBounds.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,15 +90,13 @@ class DiamondBounds : public PlanarBounds {
bool inside(const Vector2& lposition,
const BoundaryTolerance& boundaryTolerance) const final;

/// Return the vertices
/// Return the vertices that describe this shape
///
/// @param lseg the number of segments used to approximate
/// and eventually curved line
///
/// @note the number of segments is ignored for this representation
/// @param ignoredSegments is an ignored parameter only used for
/// curved bound segments
///
/// @return vector for vertices in 2D
std::vector<Vector2> vertices(unsigned int lseg = 1) const final;
std::vector<Vector2> vertices(unsigned int ignoredSegments = 0u) const final;

// Bounding box representation
const RectangleBounds& boundingBox() const final;
Expand Down
11 changes: 5 additions & 6 deletions Core/include/Acts/Surfaces/DiscBounds.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,13 @@ class DiscBounds : public SurfaceBounds {

/// Return the vertices
///
/// @param lseg the number of segments used to approximate
/// and eventually curved line, the number refers to full 2*PI
///
/// @note that the extremas are given, which may slightly alter the
/// number of segments returned
/// @param quarterSegments The number of segments used to describe a quarter
/// of a circle, if it is 1, then only the extrema points in phi are inserted
/// next to the segment corners
///
/// @return vector for vertices in 2D
virtual std::vector<Vector2> vertices(unsigned int lseg) const = 0;
virtual std::vector<Vector2> vertices(
unsigned int quarterSegments = 2u) const = 0;

/// Returns a reference radius for binning
virtual double binningValueR() const = 0;
Expand Down
9 changes: 4 additions & 5 deletions Core/include/Acts/Surfaces/DiscSurface.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -312,13 +312,12 @@ class DiscSurface : public RegularSurface {
/// Return a Polyhedron for the surfaces
///
/// @param gctx The current geometry context object, e.g. alignment
/// @param lseg Number of segments along curved lines, it represents
/// the full 2*M_PI coverange, if lseg is set to 1 only the extrema
/// are given
/// @param quarterSegments Number of segments used to describe the
/// quarter of a full circle
///
/// @return A list of vertices and a face/facett description of it
Polyhedron polyhedronRepresentation(const GeometryContext& gctx,
std::size_t lseg) const override;
Polyhedron polyhedronRepresentation(
const GeometryContext& gctx, unsigned int quarterSegments) const override;

/// Calculate the derivative of bound track parameters local position w.r.t.
/// position in local 3D Cartesian coordinates
Expand Down
8 changes: 3 additions & 5 deletions Core/include/Acts/Surfaces/DiscTrapezoidBounds.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,13 +123,11 @@ class DiscTrapezoidBounds : public DiscBounds {
/// This method returns the xy coordinates of the four corners of the
/// bounds in module coorindates (in xy)
///
/// @param lseg the number of segments used to approximate
/// and eventually curved line
///
/// @note that the number of segments are ignored for this surface
/// @param ignoredSegments is an ignored parameter only used for
/// curved bound segments
///
/// @return vector for vertices in 2D
std::vector<Vector2> vertices(unsigned int lseg) const final;
std::vector<Vector2> vertices(unsigned int ignoredSegments = 0u) const final;

private:
std::array<double, eSize> m_values;
Expand Down
11 changes: 5 additions & 6 deletions Core/include/Acts/Surfaces/EllipseBounds.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,14 +92,13 @@ class EllipseBounds : public PlanarBounds {

/// Return the vertices
///
/// @param lseg the number of segments used to approximate
/// and eventually curved line, here it refers to the full 2PI Ellipse
///
/// @note the number of segments to may be altered by also providing
/// the extremas in all direction
/// @param quarterSegments is the number of segments to approximate a quarter
/// of a circle. In order to symmetrize fully closed and sectoral cylinders,
/// also in the first case the two end points are given (albeit they overlap)
/// in -pi / pi
///
/// @return vector for vertices in 2D
std::vector<Vector2> vertices(unsigned int lseg) const final;
std::vector<Vector2> vertices(unsigned int quarterSegments) const final;

// Bounding box representation
const RectangleBounds& boundingBox() const final;
Expand Down
4 changes: 2 additions & 2 deletions Core/include/Acts/Surfaces/PerigeeSurface.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,11 @@ class PerigeeSurface : public LineSurface {
/// Return a Polyhedron for the surfaces
///
/// @param gctx The current geometry context object, e.g. alignment
/// @param lseg is ignored for a perigee @note ignored
/// @param ingoreSegments is an ignored parameter
///
/// @return A list of vertices and a face/facett description of it
Polyhedron polyhedronRepresentation(const GeometryContext& gctx,
std::size_t lseg) const final;
unsigned int ingoreSegments) const final;

protected:
/// Output Method for std::ostream
Expand Down
11 changes: 6 additions & 5 deletions Core/include/Acts/Surfaces/PlanarBounds.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,15 @@ class PlanarBounds : public SurfaceBounds {
public:
/// Return the vertices
///
/// @param lseg the number of segments used to approximate
/// and eventually curved line
/// @param quarterSegments is the number of segments used to describe curved
/// segments in a quarter of the phi range. If it is 1, then only the extrema
/// points in phi are inserted next to the segment corners.
///
/// @note that the extremas are given, which may slightly alter the
/// number of segments returned
/// @note for planar bounds without curved segments @c quarterSegments is ignored
///
/// @return vector for vertices in 2D
virtual std::vector<Vector2> vertices(unsigned int lseg = 1) const = 0;
virtual std::vector<Vector2> vertices(
unsigned int quarterSegments = 2u) const = 0;

/// Bounding box parameters
///
Expand Down
12 changes: 7 additions & 5 deletions Core/include/Acts/Surfaces/PlaneSurface.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -198,13 +198,15 @@ class PlaneSurface : public RegularSurface {
/// Return a Polyhedron for the surfaces
///
/// @param gctx The current geometry context object, e.g. alignment
/// @param lseg Number of segments along curved lines, it represents
/// the full 2*M_PI coverange, if lseg is set to 1 only the extrema
/// are given
/// @param quarterSegments is the number of segments used to describe curved
/// segments in a quarter of the phi range. If it is 1, then only the extrema
/// points in phi are inserted next to the segment corners.
///
/// @note for planar surfaces without curved segments @c quarterSegments is ignored
///
/// @return A list of vertices and a face/facett description of it
Polyhedron polyhedronRepresentation(const GeometryContext& gctx,
std::size_t lseg) const override;
Polyhedron polyhedronRepresentation(
const GeometryContext& gctx, unsigned int quarterSegments) const override;

/// Return properly formatted class name for screen output
std::string name() const override;
Expand Down
7 changes: 3 additions & 4 deletions Core/include/Acts/Surfaces/RectangleBounds.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,12 @@ class RectangleBounds : public PlanarBounds {

/// Return the vertices
///
/// @param lseg the number of segments used to approximate
/// and eventually curved line
///
/// @param quarterSegments is the number of segments used to describe curved
/// segments in a quarter of the phi range.
/// @note the number of segments is ignored in this representation
///
/// @return vector for vertices in 2D
std::vector<Vector2> vertices(unsigned int lseg = 1) const final;
std::vector<Vector2> vertices(unsigned int quarterSegments = 0u) const final;

// Bounding box representation
const RectangleBounds& boundingBox() const final;
Expand Down
8 changes: 4 additions & 4 deletions Core/include/Acts/Surfaces/StrawSurface.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,13 +92,13 @@ class StrawSurface : public LineSurface {
/// Return a Polyhedron for the surfaces
///
/// @param gctx The current geometry context object, e.g. alignment
/// @param lseg Number of segments along curved lines, it represents
/// the full 2*M_PI coverange, if lseg is set to 1 only the extrema
/// are given @note if lseg is set to 1 then only the straw is created
/// @param quarterSegments is the number of segments used to describe curved
/// segments in a quarter of the phi range. If it is 1, then only the extrema
/// points in phi are inserted next to the segment corners.
///
/// @return A list of vertices and a face/facett description of it
Polyhedron polyhedronRepresentation(const GeometryContext& gctx,
std::size_t lseg) const final;
unsigned int quarterSegments) const final;
};

inline Surface::SurfaceType StrawSurface::type() const {
Expand Down
15 changes: 8 additions & 7 deletions Core/include/Acts/Surfaces/Surface.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -418,20 +418,21 @@ class Surface : public virtual GeometryObject,
/// Return properly formatted class name
virtual std::string name() const = 0;

/// Return a Polyhedron for this object
/// Return a Polyhedron for surface objects
///
/// @param gctx The current geometry context object, e.g. alignment
/// @param lseg Number of segments along curved lines, if the lseg
/// is set to one, only the corners and the extrema are given,
/// otherwise it represents the number of segments for a full 2*M_PI
/// circle and is scaled to the relevant sector
/// @param quarterSegments The number of segemtns to approximate a 0.5*pi sector,
/// which represents a quarter of the full circle
///
/// @note In order to symmetrize the code between sectoral and closed cylinders
/// in case of closed cylinders, both (-pi, pi) are given as separate vertices
asalzburger marked this conversation as resolved.
Show resolved Hide resolved
///
/// @note An internal surface transform can invalidate the extrema
/// in the transformed space
///
/// @return A list of vertices and a face/facett description of it
virtual Polyhedron polyhedronRepresentation(const GeometryContext& gctx,
std::size_t lseg) const = 0;
virtual Polyhedron polyhedronRepresentation(
const GeometryContext& gctx, unsigned int quarterSegments = 2u) const = 0;

/// The derivative of bound track parameters w.r.t. alignment
/// parameters of its reference surface (i.e. local frame origin in
Expand Down
2 changes: 1 addition & 1 deletion Core/include/Acts/Surfaces/SurfaceConcept.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ concept SurfaceConcept = requires(S s, const S cs, S s2, const S cs2,
{ cs.name() } -> std::same_as<std::string>;

{
cs.polyhedronRepresentation(gctx, std::declval<std::size_t>())
cs.polyhedronRepresentation(gctx, std::declval<unsigned int>())
} -> std::same_as<Polyhedron>;

{
Expand Down
6 changes: 3 additions & 3 deletions Core/include/Acts/Surfaces/TrapezoidBounds.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,13 +108,13 @@ class TrapezoidBounds : public PlanarBounds {

/// Return the vertices
///
/// @param lseg the number of segments used to approximate
/// and eventually curved line
/// @param ignoredSegments is and ignored parameter used to describe
/// the number of segments to approximate curved sectors.
///
/// @note the number of segments is ignored in this representation
///
/// @return vector for vertices in 2D
std::vector<Vector2> vertices(unsigned int lseg = 1) const final;
std::vector<Vector2> vertices(unsigned int ignoredSegments = 0u) const final;

// Bounding box representation
const RectangleBounds& boundingBox() const final;
Expand Down
Loading
Loading