Terra 1.0
TerraGaussian Class Reference

A Gaussian primitive. More...

#include <archestree.h>

Inheritance diagram for TerraGaussian:
HeightNode

Public Member Functions

 TerraGaussian ()
 Empty.
 TerraGaussian (const double &, const double &, const FrameScaled2 &=Frame2::Id)
 Create a Gaussian primitive.
virtual double Value (const Vector2 &) const
 Compute the elevation and weight.
Public Member Functions inherited from HeightNode
virtual double K () const
 Lipschitz constant of the elevation function.
virtual double K (const Box2 &) const
 Lipschitz constant of the elevation function restricted to a box.

Protected Attributes

FrameScaled2 frame = Frame2::Id
 Local frame.
double height = 0.0
 Height.
double sigma = 1.0
 Radius.
double isigma = 1.0
 Inverse squared sigma.
Protected Attributes inherited from HeightNode
Box2 box = Box2::Infinity
 Bounding box.
double k = 1.0
 Lipschitz constant of the elevation function.

Detailed Description

A Gaussian primitive.

The elevation is defined in a local frame by

\[ f(p) = h \, e^{-\lambda \, \|q\|^2}, \qquad q = S^{-1} R^T (p - t), \qquad \lambda = \frac{1}{r^2}, \]

where \(h\) is the height, \(r\) the radius given to the constructor ( \(\lambda\) is the member isigma), and \(R\), \(t\), \(S = \mathrm{diag}(s_x, s_y)\) are the rotation, translation and scale of the frame.

Lipschitz constant

The Lipschitz constant \(K\) returned by HeightNode::K() is an upper bound of the norm of the gradient of \(f\), since by the mean value theorem \(|f(a)-f(b)| \le \sup\|\nabla f\| \, \|a-b\|\) for a \(C^1\) function. It is computed once in the constructor in three steps.

1. Gradient in the local frame. With \(s = \|q\|\),

\[ \nabla_q f = -2 h \lambda \, q \, e^{-\lambda s^2} \quad\Rightarrow\quad \|\nabla_q f\| = g(s) = 2 |h| \lambda \, s \, e^{-\lambda s^2}. \]

2. Maximum of the gradient norm. The derivative \( g'(s) = 2 |h| \lambda \, e^{-\lambda s^2} (1 - 2 \lambda s^2) \) vanishes for \( s^\star = 1/\sqrt{2\lambda} \) (the inflection point of the Gaussian), where

\[ g(s^\star) = |h| \sqrt{\frac{2\lambda}{e}} = \sqrt{\frac{2}{e}} \, \frac{|h|}{r} \approx 0.8578 \, \frac{|h|}{r}. \]

This is the global maximum, as \(g(0) = 0\) and \(g(s) \to 0\) when \(s \to \infty\).

3. Change of frame. We have \( q = M (p - t) \) with \( M = S^{-1} R^T \), so that \( \nabla_p f = M^T \nabla_q f \) and \( \|\nabla_p f\| \le \|M\|_2 \, \|\nabla_q f\| \). As \(R\) is orthogonal, \(\|M\|_2 = \|S^{-1}\|_2 = 1 / \min(|s_x|, |s_y|)\). Therefore

\[ K = \frac{|h|}{\min(|s_x|, |s_y|)} \sqrt{\frac{2\lambda}{e}}. \]

The bound is tight for an isotropic scale ( \(|s_x| = |s_y|\)); for an anisotropic scale it is attained along the direction of the smallest scale. A scale with a null component gives an infinite constant.

Constructor & Destructor Documentation

◆ TerraGaussian() [1/2]

TerraGaussian::TerraGaussian ( )
explicit

Empty.

The height is null, so is the Lipschitz constant.

References HeightNode::k.

◆ TerraGaussian() [2/2]

TerraGaussian::TerraGaussian ( const double & r,
const double & h,
const FrameScaled2 & f = Frame2::Id )
explicit

Create a Gaussian primitive.

The Lipschitz constant (see Lipschitz constant) is computed and stored in HeightNode::k.

Parameters
rRadius, such that the elevation is \(h \, e^{-\|q\|^2/r^2}\) in the local frame.
hHeight.
fLocal frame (rotation, translation and scale).

References frame, height, isigma, HeightNode::k, FrameScaled2::S(), and sigma.

Member Function Documentation

◆ Value()

double TerraGaussian::Value ( const Vector2 & p) const
virtual

Compute the elevation and weight.

Parameters
pPoint.

Reimplemented from HeightNode.

References frame, height, FrameScaled2::InverseTransform(), and isigma.