Project
Loading...
Searching...
No Matches
GPUCommonTransform3D.h
Go to the documentation of this file.
1// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
11
14
15#ifndef GPUCOMMONTRANSFORM3D_H
16#define GPUCOMMONTRANSFORM3D_H
17
18#include "GPUCommonDef.h"
19
20namespace o2::gpu
21{
23{
24 public:
25 Transform3D() = default;
26 Transform3D(float* v)
27 {
28 for (int32_t i = 0; i < 12; i++) {
29 m[i] = v[i];
30 }
31 }
32
33 GPUd() void Apply(const float* in, float* out) const
34 {
35 out[0] = m[kXX] * in[0] + m[kXY] * in[1] + m[kXZ] * in[2] + m[kDX];
36 out[1] = m[kYX] * in[0] + m[kYY] * in[1] + m[kYZ] * in[2] + m[kDY];
37 out[2] = m[kZX] * in[0] + m[kZY] * in[1] + m[kZZ] * in[2] + m[kDZ];
38 }
39
40 GPUd() void ApplyVector(const float* in, float* out) const
41 {
42 out[0] = m[kXX] * in[0] + m[kXY] * in[1] + m[kXZ] * in[2];
43 out[1] = m[kYX] * in[0] + m[kYY] * in[1] + m[kYZ] * in[2];
44 out[2] = m[kZX] * in[0] + m[kZY] * in[1] + m[kZZ] * in[2];
45 }
46
47 GPUd() void ApplyInverse(const float* in, float* out) const
48 {
49 const float tmp[3] = {in[0] - m[kDX], in[1] - m[kDY], in[2] - m[kDZ]};
50 out[0] = m[kXX] * tmp[0] + m[kYX] * tmp[1] + m[kZX] * tmp[2];
51 out[1] = m[kXY] * tmp[0] + m[kYY] * tmp[1] + m[kZY] * tmp[2];
52 out[2] = m[kXZ] * tmp[0] + m[kYZ] * tmp[1] + m[kZZ] * tmp[2];
53 }
54
55 GPUd() void ApplyInverseVector(const float* in, float* out) const
56 {
57 out[0] = m[kXX] * in[0] + m[kYX] * in[1] + m[kZX] * in[2];
58 out[1] = m[kXY] * in[0] + m[kYY] * in[1] + m[kZY] * in[2];
59 out[2] = m[kXZ] * in[0] + m[kYZ] * in[1] + m[kZZ] * in[2];
60 }
61
62 GPUd() void LocalToMaster(const float* in, float* out) const { ApplyInverse(in, out); }
63
64 private:
65 float m[12];
66
67 enum Transform3DMatrixIndex { kXX = 0,
68 kXY = 1,
69 kXZ = 2,
70 kDX = 3,
71 kYX = 4,
72 kYY = 5,
73 kYZ = 6,
74 kDY = 7,
75 kZX = 8,
76 kZY = 9,
77 kZZ = 10,
78 kDZ = 11 };
79};
80} // namespace o2::gpu
81
82#endif
int32_t i
GPUd() void ApplyInverse(const float *in
GPUd() void ApplyInverseVector(const float *in
GPUd() void LocalToMaster(const float *in
GPUd() void ApplyVector(const float *in
GPUd() void Apply(const float *in
const GLfloat * m
Definition glcorearb.h:4066
const GLdouble * v
Definition glcorearb.h:832
typedef void(APIENTRYP PFNGLCULLFACEPROC)(GLenum mode)
tB100 LocalToMaster(o2::math_utils::Point3D< double >{0, 0, 0}, poB)