AGX Dynamics 2.38.0.2
Loading...
Searching...
No Matches
WindAndWaterUtils.h
Go to the documentation of this file.
1/*
2Copyright 2007-2024. Algoryx Simulation AB.
3
4All AGX source code, intellectual property, documentation, sample code,
5tutorials, scene files and technical white papers, are copyrighted, proprietary
6and confidential material of Algoryx Simulation AB. You may not download, read,
7store, distribute, publish, copy or otherwise disseminate, use or expose this
8material unless having a written signed agreement with Algoryx Simulation AB, or having been
9advised so by Algoryx Simulation AB for a time limited evaluation, or having purchased a
10valid commercial license from Algoryx Simulation AB.
11
12Algoryx Simulation AB disclaims all responsibilities for loss or damage caused
13from using this software, unless otherwise stated in written agreements with
14Algoryx 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
25namespace agxModel
26{
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
76
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
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
152
154 {
155 return (state & CLIPPED) != 0;
156 }
157
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
#define AGXMODEL_EXPORT
Vector containing 'raw' data.
Definition agx/Vector.h:246
Templated vector class.
Definition agx/Vector.h:53
#define agxAssert(expr)
Definition debug.h:143
#define AGX_FORCE_INLINE
Definition macros.h:58
Contain classes for higher level modeling primitives, such as Tree, Terrain etc.
Definition FlowUnit.h:37
int32_t Int32
Definition Integer.h:37
bool Bool
Definition Integer.h:40
AGXCORE_EXPORT const Real REAL_SQRT_EPSILON
uint64_t UInt
Definition Integer.h:27
double Real
Definition Real.h:42
Global triangle data (mapped with agxCollide::Mesh object) holding vertex indices.
const TriangleData & getClipped(size_t i) const
If isClipped() == true, access i'th clipped triangle (three of them).
agx::Vector< GlobalTriangleData > Container
agxModel::TriangleData::Container clipped
Container with clipped triangles if this global triangle has been clipped.
Triangle data for a normal or a clipped triangle.
agx::Int32 state
Current state of this triangle.
agx::Bool isBelowSurface() const
agx::Bool isClipped() const
agx::Vec3 worldNormal
Normal to this triangle given in world coordinate system.
agx::Real area
Area of this triangle.
agxModel::VertexData vertices[3]
Vertices of this triangle.
const agxModel::VertexData & getVertex(size_t i) const
There are three vertices in this triangle.
agx::Bool isCalculationsEnable() const
agx::VectorPOD< TriangleData > Container
agx::Vec3 calculateNormal() const
agx::Real calculateArea() const
Vertex data for all global vertices in a mesh.
agx::VectorPOD< VertexData > Container
agx::Real heightFromSurface
Height from surface, negative if below the surface.
agx::Real pressure
Hydro- or aerostatic pressure.
agx::Real totalPressure() const
agx::Vec3 worldPosition
World position of this vertex.
agx::Real dynamicPressure
Hydro- or aerostatic dynamic (drag, lift etc) pressure.
agx::Bool isBelowSurface() const
agx::Vec3 worldVelocityOfMedium
Velocity of the medium this vertex is in (water current or wind velocity).
agx::Vec3 worldVelocity
Velocity of this vertex given in world coordinate system.
agx::Bool isOnSurface(agx::Real threshold=agx::REAL_SQRT_EPSILON) const