Core 1.0
HemiSphere Class Reference

Hemispheres. More...

#include <hemisphere.h>

Public Member Functions

 HemiSphere (const Vector &, const Vector &, const double &)
 Create a hemi-sphere.
 HemiSphere (const double &)
 Create a hemi-sphere centered at the origin and with vertical direction.
 ~HemiSphere ()
 Empty.
Vector Normal (const Vector &) const
 Compute the distance vector between the hemisphere and a point.
double R (const Vector &) const
 Compute the distance between the hemisphere and a point.
double Signed (const Vector &) const
 Compute the Euclidean signed distance between the hemisphere and a point.
bool Inside (const Vector &) const
 Compute the Euclidean signed distance between the hemisphere and a point.
Box GetBox () const
 Compute the bouding box.
Vector Center () const
 Gets the center of a hemisphere.
double Radius () const
 Gets the radius of a hemisphere.
Vector GetAxis () const
 Gets the axis of the hemisphere.
Vector Fibonacci (int, int)
 Compute the i-th Fibonacci direction on the hemisphere.
QVector< VectorPoissonInside (const double &, int, int=0, Random &=Random::R239) const
 Create a Poisson Disc sampling of interioor of the hemisphere.
void Relaxation (QVector< Vector > &, int=1, const double &=1.0/8.0) const
 Perform a relaxation step over the Poisson-Disc distribution.
Vector RandomInside (Random &=Random::R239) const
 Generate a random vector inside the hemisphere.

Static Public Member Functions

static Vector FibonacciUnit (int, int)
 Compute the i-th Fibonacci direction on the vertical unit hemisphere.
static Vector RandomDirection (const Vector &, Random &=Random::R239)
 Generate a random direction.

Protected Attributes

Vector c = Vector::Null
 Center.
double r = 1.0
 Radius.
Vector axis = Vector::Z
 Axis.

Friends

std::ostream & operator<< (std::ostream &s, const HemiSphere &hemisphere)
 Overloaded output-stream operator.

Detailed Description

Hemispheres.

Constructor & Destructor Documentation

◆ HemiSphere() [1/2]

HemiSphere::HemiSphere ( const Vector & c,
const Vector & a,
const double & r )
explicit

Create a hemi-sphere.

Parameters
cCenter.
rRadius.
aAxis, should be normalized.

◆ HemiSphere() [2/2]

HemiSphere::HemiSphere ( const double & r)
explicit

Create a hemi-sphere centered at the origin and with vertical direction.

Parameters
rRadius.

Member Function Documentation

◆ Fibonacci()

Vector HemiSphere::Fibonacci ( int i,
int n )

Compute the i-th Fibonacci direction on the hemisphere.

Parameters
iPoint index.
nNumber of samples on the hemisphere.

◆ FibonacciUnit()

Vector HemiSphere::FibonacciUnit ( int i,
int n )
static

Compute the i-th Fibonacci direction on the vertical unit hemisphere.

Parameters
iPoint index.
nNumber of samples on the hemisphere.

◆ Inside()

bool HemiSphere::Inside ( const Vector & p) const

Compute the Euclidean signed distance between the hemisphere and a point.

Parameters
pPoint.

◆ Normal()

Vector HemiSphere::Normal ( const Vector & p) const

Compute the distance vector between the hemisphere and a point.

Parameters
pPoint.

◆ PoissonInside()

QVector< Vector > HemiSphere::PoissonInside ( const double & r,
int n,
int relax = 0,
Random & random = Random::R239 ) const

Create a Poisson Disc sampling of interioor of the hemisphere.

Simple dart throwing algorithm.

Parameters
rRadius of the spheres.
nMaximum number of darts thrown inside the sphere.
randomRandom number generator.

◆ R()

double HemiSphere::R ( const Vector & p) const

Compute the distance between the hemisphere and a point.

Parameters
pPoint.

◆ RandomDirection()

Vector HemiSphere::RandomDirection ( const Vector & axis,
Random & random = Random::R239 )
static

Generate a random direction.

Parameters
axisAxis.
randomRandom number generator.

◆ RandomInside()

Vector HemiSphere::RandomInside ( Random & random = Random::R239) const

Generate a random vector inside the hemisphere.

Parameters
randomRandom number generator.

◆ Relaxation()

void HemiSphere::Relaxation ( QVector< Vector > & p,
int n = 1,
const double & e = 1.0/8.0 ) const

Perform a relaxation step over the Poisson-Disc distribution.

Parameters
pSet of points.
eRelaxation coefficient, it is the fraction of the Poisson radius.
nNumber of relaxation steps.

◆ Signed()

double HemiSphere::Signed ( const Vector & p) const

Compute the Euclidean signed distance between the hemisphere and a point.

Parameters
pPoint.

◆ operator<<

std::ostream & operator<< ( std::ostream & s,
const HemiSphere & hemisphere )
friend

Overloaded output-stream operator.

Parameters
sStream.
hemisphereThe hemisphere.