AGX Dynamics  2.37.3.2
SoilWedge.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 #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,
46  };
47 
48  static const std::array<Side, 3> SideIterable;
49 
50  SoilWedge();
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 
74  agx::Real getFailureAngle() const;
75 
77 
79 
81 
83 
85 
86  const agxCollide::Convex* getMesh() const;
87 
89 
90  bool hasIntersectingSideNormals() const;
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 
100  void setFailureAngle(agx::Real angle);
101 
102  void setTerrainInclination(agx::Real angle);
103 
104  void setToolInclination(agx::Real angle);
105 
106  void setMesh(agxCollide::Convex* convex);
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 }
void setTopPoint(const agx::Vec3 &point, Side side)
void setMesh(agxCollide::Convex *convex)
agx::Vec3 & getTopPoint(Side side)
Definition: SoilWedge.h:146
void setBorderProjected(bool isBorderProjected)
void setTerrainInclination(agx::Real angle)
void setToolInclination(agx::Real angle)
The agxTerrain namespace contains a 3D model for a dynamic deformable Terrain and related classes...
Definition: Geometry.h:59
A convex class for geometric intersection tests.
Definition: Convex.h:36
agx::Real & getFailureAngle()
agx::Real & getTerrainInclination()
static const std::array< Side, 3 > SideIterable
Definition: SoilWedge.h:48
agx::Vec3 & getCuttingPoint(Side side)
Definition: SoilWedge.h:132
Templated vector class.
Definition: Vector.h:52
agx::Vec3 & getFailurePoint(Side side)
Definition: SoilWedge.h:160
void setFailureAngle(agx::Real angle)
void setPlanes(const std::array< agx::Plane, 3 > &planes)
agxCollide::Convex * getMesh()
agx::Real & getToolInclination()
bool isBorderProjected() const
void constructTriangleArrayAndIndices(agx::Vec3Vector &vertices, agx::UInt32Vector &indices) const
double Real
Definition: Real.h:42
void setFailurePoint(const agx::Vec3 &point, Side side)
agx::Vector< SoilWedge > SoilWedgeVector
Definition: SoilWedge.h:127
uint32_t UInt32
Definition: Integer.h:40
void setEnable(bool enabled)
bool hasIntersectingSideNormals() const
std::array< agx::Plane, 3 > & getPlanes()
void setCuttingPoint(const agx::Vec3 &point, Side side)
bool getEnable() const