AGX Dynamics  2.35.0.1
SoilWedge.h
Go to the documentation of this file.
1 /*
2 Copyright 2007-2022. 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 #pragma once
18 
19 #include <agx/agx.h>
20 #include <agx/Plane.h>
21 
22 #include <agxCollide/Geometry.h>
24 #include <agxCollide/Convex.h>
25 
26 namespace agxTerrain
27 {
28  class SoilWedge
29  {
30  public:
31  enum Side
32  {
33  MID = 0,
34  LEFT = 1,
35  RIGHT = 2
36  };
37 
39  {
44  TOP_LEFT = 4,
45  TOP_RIGHT = 5
46  };
47 
48  static const std::array<Side, 3> SideIterable;
49 
51 
52  bool getEnable() const;
53 
54  void setEnable(bool enabled);
55 
57 
58  const agx::Vec3& getCuttingPoint(Side side) const;
59 
60  agx::Vec3& getTopPoint(Side side);
61 
62  const agx::Vec3& getTopPoint(Side side) const;
63 
65 
66  const agx::Vec3& getFailurePoint(Side side) const;
67 
68  std::array<agx::Plane, 3>& getPlanes();
69 
70  const std::array<agx::Plane, 3>& getPlanes() const;
71 
73 
75 
77 
79 
81 
83 
85 
86  const agxCollide::Convex* getMesh() const;
87 
89 
91 
92  void setCuttingPoint(const agx::Vec3& point, Side side);
93 
94  void setTopPoint(const agx::Vec3& point, Side side);
95 
96  void setFailurePoint(const agx::Vec3& point, Side side);
97 
98  void setPlanes(const std::array<agx::Plane, 3>& planes);
99 
101 
103 
105 
107 
109 
110  bool isBorderProjected() const;
111 
112  private:
113 
114  private:
115  bool m_enabled;
116  std::array<agx::Vec3, 3> m_cutPoints;
117  std::array<agx::Vec3, 3> m_topPoints;
118  std::array<agx::Vec3, 3> m_failPoints;
119  std::array<agx::Plane, 3> m_planes;
120  agx::Real m_failureAngle;
121  agx::Real m_terrainInclination;
122  agx::Real m_toolInclination;
123  bool m_isBorderProjected = false;
124  agxCollide::ConvexRef m_mesh;
125  };
126 
128 
129 
130 
131 
133  {
134  return m_cutPoints[side];
135  }
136 
137 
138 
139  inline const agx::Vec3& SoilWedge::getCuttingPoint(Side side) const
140  {
141  return m_cutPoints[side];
142  }
143 
144 
145 
147  {
148  return m_topPoints[side];
149  }
150 
151 
152 
153  inline const agx::Vec3& SoilWedge::getTopPoint(Side side) const
154  {
155  return m_topPoints[side];
156  }
157 
158 
159 
161  {
162  return m_failPoints[side];
163  }
164 
165 
166 
167  inline const agx::Vec3& SoilWedge::getFailurePoint(Side side) const
168  {
169  return m_failPoints[side];
170  }
171 
172 
173 
174 
175 }
A convex class for geometric intersection tests.
Definition: Convex.h:38
void setEnable(bool enabled)
const agxCollide::Convex * getMesh() const
void constructTriangleArrayAndIndices(agx::Vec3Vector &vertices, agx::UInt32Vector &indices) const
agx::Vec3 & getFailurePoint(Side side)
Definition: SoilWedge.h:160
agx::Real getFailureAngle() const
bool isBorderProjected() const
void setPlanes(const std::array< agx::Plane, 3 > &planes)
void setFailureAngle(agx::Real angle)
agx::Real & getToolInclination()
void setTerrainInclination(agx::Real angle)
std::array< agx::Plane, 3 > & getPlanes()
agx::Real getToolInclination() const
agxCollide::Convex * getMesh()
bool getEnable() const
static const std::array< Side, 3 > SideIterable
Definition: SoilWedge.h:48
agx::Vec3 & getTopPoint(Side side)
Definition: SoilWedge.h:146
void setBorderProjected(bool isBorderProjected)
agx::Real getTerrainInclination() const
void setMesh(agxCollide::Convex *convex)
void setCuttingPoint(const agx::Vec3 &point, Side side)
bool hasIntersectingSideNormals() const
void setFailurePoint(const agx::Vec3 &point, Side side)
agx::Vec3 & getCuttingPoint(Side side)
Definition: SoilWedge.h:132
void setToolInclination(agx::Real angle)
agx::Real & getFailureAngle()
const std::array< agx::Plane, 3 > & getPlanes() const
agx::Real & getTerrainInclination()
void setTopPoint(const agx::Vec3 &point, Side side)
Templated vector class.
Definition: agx/Vector.h:53
The agxTerrain namespace contains a 3D model for a dynamic deformable Terrain and related classes.
Definition: Geometry.h:60
agx::Vector< SoilWedge > SoilWedgeVector
Definition: SoilWedge.h:127
uint32_t UInt32
Definition: Integer.h:40
double Real
Definition: Real.h:42