AGX Dynamics 2.38.0.2
Loading...
Searching...
No Matches
TrajectoryCalculator.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
9having been advised so by Algoryx Simulation AB for a time limited evaluation,
10or having purchased a valid 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 AGXTERRAIN_TRAJECTORYCALCULATOR_H
18#define AGXTERRAIN_TRAJECTORYCALCULATOR_H
19
20#include <queue>
21#include <numeric>
22
23#include <agxTerrain/export.h>
24
26#include <agxData/agxData.h>
27
29#include <agxCollide/Geometry.h>
30#include <agxCollide/Line.h>
31#include <agxCollide/Contacts.h>
33
34namespace agxTerrain
35{
45
47 {
48 public:
51
54 void setCutDepth(agx::Real cutDepth);
55 void setCutAngle(agx::Real cutAngle);
56 void setBladeSpeed(agx::Real bladeSpeed);
57 void setGoalHeight(agx::Real goalHeight);
58 void setResolution(agx::Real resolution);
59 void setTimestep(agx::Real timestep);
60
68
71
72 void createTrajectory(const agx::Vec2& startPoint, const agx::Vec2& endPoint);
77
78 // Debug rendering methods
82
83 private:
84 agx::RealVector applyFilters(const agx::RealVector& heightCurve);
85 void computeHeightCurve(const agx::Vec2& startPoint, const agx::Vec2& endPoint);
86 void computeTrajectory(const agx::RealVector& heightCurve);
87 void computeVelocities();
88
89 agx::RealVector movingAverageStddev(const agx::RealVector& data, const size_t range);
90 agx::RealVector movingAverageFilter(const agx::RealVector& data, const size_t range);
91 agx::RealVector movingAverageFilterLowSlope(const agx::RealVector& data, size_t range, const agx::Real threshold);
92 agx::Real interpolate(agx::Real x, const agx::RealVector& xDiscrete, const agx::RealVector& yDiscrete);
93 agx::RealVector computeArcLength(const agx::RealVector& x, const agx::RealVector& y);
94 agx::Real computeInverseArcLength(agx::Real distance, const agx::RealVector& x, const agx::RealVector& arcLength);
95
96 // Heightfield and resulting 2D heightcurve
97 agxCollide::HeightFieldRef m_heightField;
98 agx::RealVector m_heightCurve;
100
101 // Settings
102 TrajectorySettings m_settings;
103
104 // Start and endpoint in xy-plane along with rotation matrix for velocities
105 agx::Vec2 m_startPoint;
106 agx::Vec2 m_endPoint;
107 agx::Matrix4x4 m_rotateMatrix;
108
109 // Resulting trajectory and velocities
110 agx::RealVector m_trajectory;
111 std::queue<agx::Vec3> m_velocities;
112
113 // Boolean for valid trajectory
114 agx::Bool m_validTrajectory;
115 };
116}
117
118#endif
#define AGXTERRAIN_EXPORT
A HeightField is a collision shape that can be created from a grid structure, like an image.
void setCutDepth(agx::Real cutDepth)
void createTrajectory(const agx::Vec2 &startPoint, const agx::Vec2 &endPoint)
void setTrajectorySettings(const TrajectorySettings &settings)
void setResolution(agx::Real resolution)
void setCutAngle(agx::Real cutAngle)
void setBladeSpeed(agx::Real bladeSpeed)
void setHeightField(agxCollide::HeightField *heightField)
TrajectoryCalculator(agxCollide::HeightField *heightField, const TrajectorySettings &settings)
TrajectorySettings getTrajectorySettings() const
void setTimestep(agx::Real timestep)
agx::Bool hasHeightField() const
void setGoalHeight(agx::Real goalHeight)
The agxTerrain namespace contains a 3D model for a dynamic deformable Terrain and related classes.
Definition Geometry.h:59
bool Bool
Definition Integer.h:40
double Real
Definition Real.h:42