AGX Dynamics  2.37.3.2
Clamp.h
Go to the documentation of this file.
1 /*
2 Copyright 2007-2024. Algoryx Simulation AB.
3 
4 All AGX source code, intellectual property, documentation, sample code,
5 tutorials, scene files and technical white papers, are copyrighted, proprietary
6 and confidential material of Algoryx Simulation AB. You may not download, read,
7 store, distribute, publish, copy or otherwise disseminate, use or expose this
8 material unless having a written signed agreement with Algoryx Simulation AB, or
9 having been advised so by Algoryx Simulation AB for a time limited evaluation,
10 or having purchased a valid commercial license from Algoryx Simulation AB.
11 
12 Algoryx Simulation AB disclaims all responsibilities for loss or damage caused
13 from using this software, unless otherwise stated in written agreements with
14 Algoryx Simulation AB.
15 */
16 
17 
19 // AUTOMATICALLY GENERATED, DO NOT EDIT! (except inline functions) //
21 
22 #ifndef AGXFN_MATH_CLAMP_H
23 #define AGXFN_MATH_CLAMP_H
24 
25 #include <agxData/Array.h>
26 #include <agxData/EntityPtr.h>
27 #include <agx/Integer.h>
28 #include <agx/Real.h>
29 #include <agx/Math.h>
30 #include <agx/Job.h>
31 #include <agx/Vec2.h>
32 #include <agx/Vec3.h>
33 #include <agx/Vec4.h>
34 
35 
36 namespace agx { namespace Math { } }
37 
38 namespace agxFn
39 {
40  namespace Math
41  {
51  template <typename AutoT1, typename AutoT2, typename AutoT3, typename AutoT4>
52  AGX_FORCE_INLINE void Clamp
53  (
54  /* Parameter list automatically generated, do not edit */
55  AutoT1& result,
56  const AutoT2& value,
57  const AutoT3& min,
58  const AutoT4& max
59  )
60  {
61  result = agx::clamp(value, min, max);
62  }
63 
65  template <typename AutoT1, typename AutoT2, typename AutoT3, typename AutoT4>
66  AGX_FORCE_INLINE AutoT1 Clamp
67  (
68  const AutoT2& value,
69  const AutoT3& min,
70  const AutoT4& max
71  )
72  {
73  AutoT1 result;
74  agxFn::Math::Clamp(result, value, min, max);
75  return result;
76  }
77 
78 
79 
90  template <typename AutoT1, typename AutoT2, typename AutoT3, typename AutoT4>
91  AGX_FORCE_INLINE void Clamp
92  (
93  /* Parameter list automatically generated, do not edit */
94  const agx::RangeJob& job,
96  const agxData::Array< AutoT2 >& value,
99  )
100  {
101  for (size_t i = job.range().begin(); i < job.range().end(); ++i)
102  {
103  agxFn::Math::Clamp(result[i], value[i], min[i], max[i]);
104  }
105  }
106 
107 
118  template <typename AutoT1, typename AutoT2, typename AutoT3, typename AutoT4>
119  AGX_FORCE_INLINE void Clamp
120  (
121  /* Parameter list automatically generated, do not edit */
122  const agx::RangeJob& job,
123  agxData::Array< AutoT1 >& result,
124  const agxData::Array< AutoT2 >& value,
125  const AutoT3& min,
126  const AutoT4& max
127  )
128  {
129  for (size_t i = job.range().begin(); i < job.range().end(); ++i)
130  {
131  agxFn::Math::Clamp(result[i], value[i], min, max);
132  }
133  }
134 
135 
146  template <typename AutoT1, typename AutoT2, typename AutoT3, typename AutoT4>
147  AGX_FORCE_INLINE void Clamp
148  (
149  /* Parameter list automatically generated, do not edit */
150  const agx::RangeJob& job,
151  agxData::Array< AutoT1 >& result,
152  const agxData::Array< AutoT2 >& value,
153  const AutoT3& min,
154  const agxData::Array< AutoT4 >& max
155  )
156  {
157  for (size_t i = job.range().begin(); i < job.range().end(); ++i)
158  {
159  agxFn::Math::Clamp(result[i], value[i], min, max[i]);
160  }
161  }
162 
163 
174  template <typename AutoT1, typename AutoT2, typename AutoT3, typename AutoT4>
175  AGX_FORCE_INLINE void Clamp
176  (
177  /* Parameter list automatically generated, do not edit */
178  const agx::RangeJob& job,
179  agxData::Array< AutoT1 >& result,
180  const agxData::Array< AutoT2 >& value,
181  const agxData::Array< AutoT3 >& min,
182  const AutoT4& max
183  )
184  {
185  for (size_t i = job.range().begin(); i < job.range().end(); ++i)
186  {
187  agxFn::Math::Clamp(result[i], value[i], min[i], max);
188  }
189  }
190 
191 
192  }
193 }
194 
195 #endif
IndexRange & range()
Definition: Job.h:631
Vec3T< T > min(const Vec3T< T > &lhs, const Vec3T< T > &rhs)
Definition: Vec3Template.h:861
Vec3T< T > max(const Vec3T< T > &lhs, const Vec3T< T > &rhs)
Definition: Vec3Template.h:855
#define AGX_FORCE_INLINE
Definition: Object.h:59
Type-specific Array used for fast access into the data held by a Buffer.
Definition: agxData.h:30
A range job executes a kernel implementation on a subset of the data.
Definition: Job.h:283
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
T1 clamp(T1 v, T2 minimum, T3 maximum)
Definition: Math.h:318