35 #include <type_traits>
42 #define HF_THICKNESS 0.05
48 const dHeightfieldDataID odeHeightfieldId,
50 const std::size_t& width,
51 const std::size_t& height,
52 const Eigen::Vector3d& scale,
53 typename std::enable_if<std::is_same<float, S>::value>::
type* = 0)
57 if ((width < 2) || (height < 2))
59 dtwarn <<
"Cannot create height field of dimensions " << width <<
"x"
60 << height <<
", needs to be at least 2" << std::endl;
63 dGeomHeightfieldDataBuildSingle(
67 (width - 1) * scale.x(),
68 (height - 1) * scale.y(),
81 const dHeightfieldDataID odeHeightfieldId,
83 const std::size_t& width,
84 const std::size_t& height,
85 const Eigen::Vector3d& scale,
86 typename std::enable_if<std::is_same<double, S>::value>::
type* = 0)
90 if ((width < 2) || (height < 2))
92 dtwarn <<
"Cannot create height field of dimensions " << width <<
"x"
93 << height <<
", needs to be at least 2" << std::endl;
97 dGeomHeightfieldDataBuildDouble(
101 (width - 1) * scale.x(),
102 (height - 1) * scale.y(),
112 template <
typename S>
121 const Eigen::Vector3d& scale = heightMap->
getScale();
136 dGeomHeightfieldDataSetBounds(
150 dGeomSetQuaternion(
mGeomId, q);
156 dtdbg <<
"ODE Heightfield AABB: min = {" << aabb[0] <<
", " << aabb[2] <<
", "
157 << aabb[4] <<
"} max = {" << aabb[1] <<
", " << aabb[3] <<
", "
158 << aabb[5] <<
"}" << std::endl;
162 template <
typename S>
165 dGeomHeightfieldDataDestroy(mOdeHeightfieldId);
166 dGeomDestroy(mGeomId);
#define dtwarn
Output a warning message.
Definition: Console.hpp:46
#define dtdbg
Output a debug message.
Definition: Console.hpp:43
#define HF_THICKNESS
Definition: OdeHeightmap-impl.hpp:42
std::string type
Definition: SdfParser.cpp:82
Definition: OdeCollisionObject.hpp:49
Definition: OdeGeom.hpp:46
dGeomID mGeomId
ODE geom ID associated with this object.
Definition: OdeGeom.hpp:76
OdeHeightmap(const OdeCollisionObject *parent, const dynamics::HeightmapShape< S > *hs)
Constructor.
Definition: OdeHeightmap-impl.hpp:113
~OdeHeightmap() override
Destructor.
Definition: OdeHeightmap-impl.hpp:163
dHeightfieldDataID mOdeHeightfieldId
Definition: OdeHeightmap.hpp:57
Shape for a height map.
Definition: HeightmapShape.hpp:47
const HeightField & getHeightField() const
Returns the height field.
Definition: HeightmapShape-impl.hpp:136
const Eigen::Vector3d & getScale() const
Returns scale of this heightmap.
Definition: HeightmapShape-impl.hpp:85
std::size_t getWidth() const
Returns the width dimension of the height field.
Definition: HeightmapShape-impl.hpp:171
std::size_t getDepth() const
Returns the height dimension of the height field.
Definition: HeightmapShape-impl.hpp:178
S getMinHeight() const
Returns the minimum height set by setHeightField()
Definition: HeightmapShape-impl.hpp:164
S getMaxHeight() const
Returns the maximum height set by setHeightField()
Definition: HeightmapShape-impl.hpp:157
void setOdeHeightfieldDetails(const dHeightfieldDataID odeHeightfieldId, const S *heights, const std::size_t &width, const std::size_t &height, const Eigen::Vector3d &scale, typename std::enable_if< std::is_same< float, S >::value >::type *=0)
Definition: OdeHeightmap-impl.hpp:47
double dQuaternion[4]
Definition: DARTCollide.cpp:65
Definition: BulletCollisionDetector.cpp:63