Lodestar
An integrated real-time control package in C++
ls::primitives::sets::SetComplement< TTypeLeft, TTypeRight > Class Template Reference

Relative complement of two SetExpressions. More...

#include <SetComplement.hpp>

Inheritance diagram for ls::primitives::sets::SetComplement< TTypeLeft, TTypeRight >:
[legend]
Collaboration diagram for ls::primitives::sets::SetComplement< TTypeLeft, TTypeRight >:
[legend]

Public Types

using Base = SetExpression< SetComplement< TTypeLeft, TTypeRight > >
 
using ltype = TTypeLeft
 Base class.
 
using rtype = TTypeRight
 Left type.
 
using type = SetComplement< TTypeLeft, TTypeRight >
 Right type.
 
- Public Types inherited from ls::primitives::sets::SetExpression< SetComplement< TTypeLeft, TTypeRight > >
using type = SetComplement< TTypeLeft, TTypeRight >
 

Public Member Functions

 SetComplement (const TTypeLeft &left, const TTypeRight &right, bool empty=false)
 Expression type. More...
 
bool isEmpty () const
 Returns true if the expression is the empty set. More...
 
template<typename TElementType >
bool contains (const TElementType &el) const
 Returns true if this expression contains el. More...
 
template<typename TExpression >
SetUnion< type, TExpression > unionize (const SetExpression< TExpression > &expr)
 Creates a union between this expression and another SetExpression. More...
 
template<typename TDerived >
double sdf (Eigen::MatrixBase< TDerived > &p) const
 Returns signed distance to p. More...
 
const TTypeLeft & getLeft () const
 Gets the left expression. More...
 
const TTypeRight & getRight () const
 Gets the right expression. More...
 
- Public Member Functions inherited from ls::primitives::sets::SetExpression< SetComplement< TTypeLeft, TTypeRight > >
 SetExpression (const SetEnum setEnum)
 
bool operator== (const TElementType &el) const
 
bool operator!= (const TElementType &el) const
 
bool contains (const TElementType &el) const
 
bool isSubset (const TElementType &el) const
 
bool isSuperset (const TElementType &el) const
 
bool isEmpty () const
 
SetExpression< TReturnType > relComplement (const TElementType &el) const
 
SetExpression< TReturnType > unionize (const TOtherExpr &expr)
 
double sdf (Eigen::MatrixBase< Derived > &p) const
 
SetEnum getEnum () const
 

Protected Attributes

const TTypeLeft & left_
 
const TTypeRight & right_
 Left constant reference.
 
bool empty_
 Right constant reference.
 
- Protected Attributes inherited from ls::primitives::sets::SetExpression< SetComplement< TTypeLeft, TTypeRight > >
SetEnum sEnum_
 

Detailed Description

template<typename TTypeLeft, typename TTypeRight>
class ls::primitives::sets::SetComplement< TTypeLeft, TTypeRight >

Relative complement of two SetExpressions.

The syntax is as follows:

// C = A \ B
auto C = SetComplement(A, B);
Template Parameters
TTypeLeftType of the left SetExpression.
TTypeRightType of the right SetExpression.

Constructor & Destructor Documentation

◆ SetComplement()

template<typename TTypeLeft , typename TTypeRight >
ls::primitives::sets::SetComplement< TTypeLeft, TTypeRight >::SetComplement ( const TTypeLeft &  left,
const TTypeRight &  right,
bool  empty = false 
)
inline

Expression type.

Constructor for the relative complement operation.

The syntax is as follows:

// A \ B
Parameters
leftThe left operand.
rightThe right operand.
emptyIf true, the expression will be treated as the empty set.

Member Function Documentation

◆ contains()

template<typename TTypeLeft , typename TTypeRight >
template<typename TElementType >
bool ls::primitives::sets::SetComplement< TTypeLeft, TTypeRight >::contains ( const TElementType &  el) const
inline

Returns true if this expression contains el.

Template Parameters
TElementTypeType of the element.
Parameters
elElement.
Returns
True if this expression contains el, false otherwise.

◆ getLeft()

template<typename TTypeLeft , typename TTypeRight >
const TTypeLeft& ls::primitives::sets::SetComplement< TTypeLeft, TTypeRight >::getLeft ( ) const
inline

Gets the left expression.

Returns
Left expression.

◆ getRight()

template<typename TTypeLeft , typename TTypeRight >
const TTypeRight& ls::primitives::sets::SetComplement< TTypeLeft, TTypeRight >::getRight ( ) const
inline

Gets the right expression.

Returns
Right expression.

◆ isEmpty()

template<typename TTypeLeft , typename TTypeRight >
bool ls::primitives::sets::SetComplement< TTypeLeft, TTypeRight >::isEmpty ( ) const
inline

Returns true if the expression is the empty set.

Returns
True if expression is the empty set.

◆ sdf()

template<typename TTypeLeft , typename TTypeRight >
template<typename TDerived >
double ls::primitives::sets::SetComplement< TTypeLeft, TTypeRight >::sdf ( Eigen::MatrixBase< TDerived > &  p) const
inline

Returns signed distance to p.

The signed distance for the complement is computed as follows:

A \ B = A \cap B\compl = (A\compl \cup B)\compl,

which follows by an application of De Morgan's laws. This yields

A.relComplement(B).sdf(p) = - min(-A.sdf(p), B.sdf(p));
Template Parameters
TDerivedDerived MatrixBase class.
Parameters
pA point.
Returns
Signed distance.

◆ unionize()

template<typename TTypeLeft , typename TTypeRight >
template<typename TExpression >
SetUnion<type, TExpression> ls::primitives::sets::SetComplement< TTypeLeft, TTypeRight >::unionize ( const SetExpression< TExpression > &  expr)
inline

Creates a union between this expression and another SetExpression.

Template Parameters
TExpressionType of the other expression.
Parameters
exprExpression to create a union with.
Returns
Union.

The documentation for this class was generated from the following file:
ls::primitives::sets::SetComplement::SetComplement
SetComplement(const TTypeLeft &left, const TTypeRight &right, bool empty=false)
Expression type.
Definition: SetComplement.hpp:50