Skip to content

Commit

Permalink
Add a constructor from Vector3f for Vector3d
Browse files Browse the repository at this point in the history
This direction should not suffer from narrowing
  • Loading branch information
tmadlener committed Dec 11, 2023
1 parent 865ed27 commit 3c62601
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions edm4hep.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,17 @@ components:
- double y
- double z
ExtraCode:
declaration: "
constexpr Vector3d() : x(0),y(0),z(0) {}\n
constexpr Vector3d(double xx, double yy, double zz) : x(xx),y(yy),z(zz) {}\n
constexpr Vector3d(const double* v) : x(v[0]),y(v[1]),z(v[2]) {}\n
constexpr Vector3d(const float* v) : x(v[0]),y(v[1]),z(v[2]) {}\n
constexpr bool operator==(const Vector3d& v) const { return (x==v.x&&y==v.y&&z==v.z) ; }\n
constexpr double operator[](unsigned i) const { return *( &x + i ) ; }\n
"
includes: "#include <edm4hep/Vector3f.h>"
declaration: '
constexpr Vector3d() : x(0),y(0),z(0) {}
constexpr Vector3d(double xx, double yy, double zz) : x(xx),y(yy),z(zz) {}
constexpr Vector3d(const double* v) : x(v[0]),y(v[1]),z(v[2]) {}
constexpr Vector3d(const float* v) : x(v[0]),y(v[1]),z(v[2]) {}
[[ deprecated("This constructor will be removed again it is mainly here for an easier transition") ]]
constexpr Vector3d(const Vector3f& v) : x(v.x), y(v.y), z(v.z) {}
constexpr bool operator==(const Vector3d& v) const { return (x==v.x&&y==v.y&&z==v.z) ; }
constexpr double operator[](unsigned i) const { return *( &x + i ) ; }
'

# Vector2D with ints
edm4hep::Vector2i:
Expand Down

0 comments on commit 3c62601

Please sign in to comment.