MADNESS  version 0.9
Public Member Functions | Protected Attributes | List of all members
madness::SDFRectangle Class Reference

A rectangle (2 dimensions) More...

#include <sdf_shape_2D.h>

Inheritance diagram for madness::SDFRectangle:
Inheritance graph
[legend]
Collaboration diagram for madness::SDFRectangle:
Collaboration graph
[legend]

Public Member Functions

 SDFRectangle (const coord_2d &length, const coord_2d &center)
 Constructor for rectangle. More...
 
double sdf (const coord_2d &pt) const
 Computes the normal distance. More...
 
coord_2d grad_sdf (const coord_2d &pt) const
 
- Public Member Functions inherited from madness::SignedDFInterface< 2 >
virtual double sdf (const Vector< double, NDIM > &x) const =0
 Returns the signed distance from the surface,. More...
 
virtual Vector< double, NDIMgrad_sdf (const Vector< double, NDIM > &x) const =0
 Returns the gradient of the signed distance from the surface (i.e., dsdf(x)/dx[i] ) More...
 
virtual ~SignedDFInterface ()
 

Protected Attributes

const coord_2d lengths
 Half the length of each side. More...
 
const coord_2d center
 the center More...
 

Detailed Description

A rectangle (2 dimensions)

This SDF naively uses contours, and should be improved for serious usage.

Note
LIMIT – the 2 primary axes must be x and y

Constructor & Destructor Documentation

madness::SDFRectangle::SDFRectangle ( const coord_2d length,
const coord_2d center 
)
inline

Constructor for rectangle.

Parameters
lengthThe lengths of the rectangle
centerThe center of the rectangle

Member Function Documentation

coord_2d madness::SDFRectangle::grad_sdf ( const coord_2d pt) const
inline

Computes the gradient of the SDF.

Parameters
ptPoint at which to compute the gradient
Returns
the gradient

References MADNESS_EXCEPTION.

double madness::SDFRectangle::sdf ( const coord_2d pt) const
inline

Computes the normal distance.

Parameters
ptPoint at which to compute the distance from the surface
Returns
The signed distance from the surface

References mpfr::fabs(), and max.

Member Data Documentation

const coord_2d madness::SDFRectangle::center
protected

the center

const coord_2d madness::SDFRectangle::lengths
protected

Half the length of each side.


The documentation for this class was generated from the following file: