AGX Dynamics  2.37.3.2
WindAndWaterUtils.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 having been
9 advised so by Algoryx Simulation AB for a time limited evaluation, or having purchased a
10 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 #ifndef AGXMODEL_WINDANDWATERUTILS_H
18 #define AGXMODEL_WINDANDWATERUTILS_H
19 
20 #include <agxModel/export.h>
21 
22 #include <agx/Vector.h>
23 #include <agx/Vec3.h>
24 
25 namespace agxModel
26 {
31  {
33 
37  agx::Bool isBelowSurface() const;
38 
42  agx::Bool isOnSurface( agx::Real threshold = agx::REAL_SQRT_EPSILON ) const;
43 
47  agx::Real totalPressure() const;
48 
55  };
56 
61  {
63 
64  enum State
65  {
66  BELOW_SURFACE = 1 << 0,
67  ABOVE_SURFACE = 1 << 1,
68  CLIPPED = 1 << 2,
69  CALCULATIONS_ENABLE = 1 << 3
70  };
71 
75  agx::Real calculateArea() const;
76 
80  agx::Vec3 calculateNormal() const;
81 
85  agx::Bool isClipped() const;
86 
90  agx::Bool isBelowSurface() const;
91 
95  agx::Bool isCalculationsEnable() const;
96 
97 
103  const agxModel::VertexData& getVertex( size_t i ) const;
104 
105 #ifndef SWIG
106  agxModel::VertexData vertices[ 3 ];
107 #endif
111  };
112 
117  {
119 
125  const TriangleData& getClipped( size_t i ) const;
126 
127 #ifndef SWIG
128  agx::UInt vertexIndices[ 3 ];
130 #endif
131  };
132 
134  {
135  return heightFromSurface < agx::Real( 0 );
136  }
137 
138  AGX_FORCE_INLINE agx::Bool VertexData::isOnSurface( agx::Real threshold /* = agx::REAL_SQRT_EPSILON */ ) const
139  {
140  return heightFromSurface > -threshold && heightFromSurface < threshold;
141  }
142 
144  {
145  return pressure + dynamicPressure;
146  }
147 
149  {
150  return (state & BELOW_SURFACE) != 0;
151  }
152 
154  {
155  return (state & CLIPPED) != 0;
156  }
157 
159  {
160  return (state & CALCULATIONS_ENABLE) != 0;
161  }
162 
163  inline const VertexData& TriangleData::getVertex( size_t i ) const
164  {
165  return vertices[ i ];
166  }
167 
168  inline const TriangleData& GlobalTriangleData::getClipped( size_t i ) const
169  {
170  agxAssert( isClipped() && i < 3u );
171  return clipped[ i ];
172  }
173 }
174 
175 #endif // AGXMODEL_WINDANDWATERUTILS_H
agx::Real area
Area of this triangle.
agx::Bool isClipped() const
agx::Real dynamicPressure
Hydro- or aerostatic dynamic (drag, lift etc) pressure.
int32_t Int32
Definition: Integer.h:45
bool Bool
Definition: Integer.h:48
agx::Bool isCalculationsEnable() const
agx::Vec3 worldPosition
World position of this vertex.
#define AGX_FORCE_INLINE
Definition: Object.h:59
Global triangle data (mapped with agxCollide::Mesh object) holding vertex indices.
agx::Bool isOnSurface(agx::Real threshold=agx::REAL_SQRT_EPSILON) const
agx::Int32 state
Current state of this triangle.
Contain classes for higher level modeling primitives, such as Tree, Terrain etc.
Definition: FlowUnit.h:36
uint32_t UInt
Definition: Integer.h:34
agx::Vec3 worldNormal
Normal to this triangle given in world coordinate system.
agx::Vec3 worldVelocityOfMedium
Velocity of the medium this vertex is in (water current or wind velocity).
AGXCORE_EXPORT const Real REAL_SQRT_EPSILON
agx::Vec3 worldVelocity
Velocity of this vertex given in world coordinate system.
agx::Bool isBelowSurface() const
#define agxAssert(expr)
Definition: debug.h:143
const TriangleData & getClipped(size_t i) const
If isClipped() == true, access i&#39;th clipped triangle (three of them).
agx::Real heightFromSurface
Height from surface, negative if below the surface.
agx::Real pressure
Hydro- or aerostatic pressure.
agxModel::TriangleData::Container clipped
Container with clipped triangles if this global triangle has been clipped.
agx::Bool isBelowSurface() const
Vertex data for all global vertices in a mesh.
#define AGXMODEL_EXPORT
double Real
Definition: Real.h:42
const agxModel::VertexData & getVertex(size_t i) const
There are three vertices in this triangle.
Triangle data for a normal or a clipped triangle.
agx::Vector< GlobalTriangleData > Container
agx::VectorPOD< VertexData > Container
agx::VectorPOD< TriangleData > Container
agx::Real totalPressure() const