41 case FlatID:
return std::make_shared<FlatGround>();
break;
42 case BlockID:
return std::make_shared<Block>();
break;
43 case StairsID:
return std::make_shared<Stairs>();
break;
44 case GapID:
return std::make_shared<Gap>();
break;
45 case SlopeID:
return std::make_shared<Slope>();
break;
46 case ChimneyID:
return std::make_shared<Chimney>();
break;
47 case ChimneyLRID:
return std::make_shared<ChimneyLR>();
break;
48 default: assert(
false);
break;
58 default: assert(
false);
65 return GetBasis(basis, x, y).normalized();
76 default: assert(
false);
82 double x,
double y)
const 90 return dn_norm_wrt_n.cwiseProduct(dv_wrt_dim);
98 bool basis_requested = deriv.empty();
100 for (
auto dim : {
X_,
Y_}) {
107 n(
Z) = basis_requested? 1.0 : 0.0;
117 bool basis_requested = deriv.empty();
119 tx(
X) = basis_requested? 1.0 : 0.0;
132 bool basis_requested = deriv.empty();
135 ty(
Y) = basis_requested? 1.0 : 0.0;
147 return 1/v.squaredNorm()*(v.norm() * Vector3d::Unit(idx) - v(idx)*v.normalized());
152 double x,
double y)
const
Vector3d GetBasis(Direction direction, double x, double y, const DimDerivs &dim_deriv={}) const
returns either the terrain normal/tangent or its derivative.
virtual double GetHeightDerivWrtY(double x, double y) const
virtual double GetHeightDerivWrtYY(double x, double y) const
TerrainID
Terrains IDs corresponding for factory method.
Vector3d GetDerivativeOfNormalizedVectorWrtNonNormalizedIndex(const Vector3d &non_normalized, int index) const
Vector3d GetTangent1(double x, double y, const DimDerivs &={}) const
virtual double GetHeightDerivWrtYX(double x, double y) const
Vector3d GetNormalizedBasis(Direction direction, double x, double y) const
Returns either the vector normal or tangent to the terrain patch.
static HeightMap::Ptr MakeTerrain(TerrainID type)
double GetSecondDerivativeOfHeightWrt(Dim2D dim1, Dim2D dim2, double x, double y) const
Vector3d GetDerivativeOfNormalizedBasisWrt(Direction direction, Dim2D dim, double x, double y) const
How the terrain normal/tangent vectors change when moving in x or y.
virtual double GetHeightDerivWrtX(double x, double y) const
virtual double GetHeightDerivWrtXX(double x, double y) const
virtual double GetHeightDerivWrtXY(double x, double y) const
std::vector< Dim2D > DimDerivs
dimensional derivatives
double GetDerivativeOfHeightWrt(Dim2D dim, double x, double y) const
How the height value changes at a 2D position in direction dim.
Vector3d GetTangent2(double x, double y, const DimDerivs &={}) const
std::shared_ptr< HeightMap > Ptr
Vector3d GetNormal(double x, double y, const DimDerivs &={}) const