MADNESS  0.10.1
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...
 
coord_2d grad_sdf (const coord_2d &pt) const
 
double sdf (const coord_2d &pt) const
 Computes the normal distance. More...
 
- Public Member Functions inherited from madness::SignedDFInterface< 2 >
virtual ~SignedDFInterface ()
 
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 double sdf (const Vector< double, NDIM > &x) const=0
 Returns the signed distance from the surface,. More...
 

Protected Attributes

const coord_2d center
 the center More...
 
const coord_2d lengths
 Half the length of each side. 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

◆ SDFRectangle()

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

◆ grad_sdf()

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.

◆ sdf()

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 center, diff(), lengths, and max.

Member Data Documentation

◆ center

const coord_2d madness::SDFRectangle::center
protected

the center

Referenced by sdf().

◆ lengths

const coord_2d madness::SDFRectangle::lengths
protected

Half the length of each side.

Referenced by sdf().


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