Class HeightFieldGeometry#

Inheritance Relationships#

Base Type#

Class Documentation#

class HeightFieldGeometry : public Karana::Scene::AbstractStaticGeometry#

Center-origin 2D heightfield with fixed X/Y extents and sampled Z values.

The local origin is at the center of the X/Y extent. Grid sample (0, 0) is located at (size_x / 2, size_y / 2). Increasing the column index advances toward -X; increasing the row index advances toward -Y. Consequently, the heightfield occupies [-size_x / 2, size_x / 2] x [-size_y / 2, size_y / 2] in its local frame. This convention matches the centered local bounds of coal::HeightField.

See Scene layer for more discussion on the scene layer.

Public Types

using Float2Grid = Eigen::Matrix<float, Eigen::Dynamic, Eigen::Dynamic>#

2-D grid with the same layout type as Coal.

Public Functions

HeightFieldGeometry(float size_x, float size_y, const Float2Grid &heights)#

Construct a center-origin heightfield.

Parameters:
  • size_x – Side length in the X direction; finite and positive.

  • size_y – Side length in the Y direction; finite and positive.

  • heights – Height grid with at least two rows and columns. Entry (0, 0) is at local (+size_x / 2, +size_y / 2); columns advance toward -X and rows advance toward -Y.

HeightFieldGeometry(const HeightFieldGeometry&)#

Copy constructor.

HeightFieldGeometry &operator=(const HeightFieldGeometry&) = delete#
HeightFieldGeometry(HeightFieldGeometry&&) = delete#
HeightFieldGeometry &operator=(HeightFieldGeometry&&) = delete#
virtual Karana::Core::ks_ptr<StaticMeshGeometry> computeMesh() const override#
Returns:

A triangle mesh using the same centered local frame.

virtual Karana::Math::AABB aabb() const override#
Returns:

Centered local bounds of the heightfield samples.

Public Members

const float size_x#

Side length in the X direction.

const float size_y#

Side length in the Y direction.

const Float2Grid heights#

Height samples over the centered X/Y extent.

Public Static Functions

static Karana::Core::ks_ptr<HeightFieldGeometry> create(float size_x, float size_y, const Float2Grid &heights)#

Create a center-origin heightfield.

Parameters:
  • size_x – Side length in the X direction; finite and positive.

  • size_y – Side length in the Y direction; finite and positive.

  • heights – Height grid with at least two rows and columns. Entry (0, 0) is at local (+size_x / 2, +size_y / 2); columns advance toward -X and rows advance toward -Y.

Returns:

A pointer to the new heightfield geometry.