DGtal  0.6.devel
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Public Types | Public Member Functions | Data Fields
DGtal::ClosedIntegerHalfPlane< TSpace > Struct Template Reference

#include <ClosedIntegerHalfPlane.h>

Public Types

typedef ClosedIntegerHalfPlane
< TSpace > 
Self
typedef TSpace Space
typedef Space::Integer Integer
typedef Space::Point Point
typedef Space::Vector Vector

Public Member Functions

 BOOST_CONCEPT_ASSERT ((CSpace< TSpace >))
 ~ClosedIntegerHalfPlane ()
 ClosedIntegerHalfPlane (const Vector &aN, const Integer &aC)
 ClosedIntegerHalfPlane (const Point &A, const Point &B, const Point &inP, IntegerComputer< Integer > &ic)
bool operator() (const Point &p) const
bool isOnBoundary (const Point &p) const
Vector tangent () const
void negate ()
void selfDisplay (std::ostream &out) const
bool isValid () const

Data Fields

Vector N
Integer c

Detailed Description

template<typename TSpace>
struct DGtal::ClosedIntegerHalfPlane< TSpace >

Aim: A half-space specified by a vector N and a constant c. The half-space is the set \( \{ P \in Z^2, N.P \le c \} \).

Description of template class 'ClosedIntegerHalfPlane'

A model of boost::DefaultConstructible, boost::CopyConstructible, boost::Assignable, CPointPredicate.

Examples:
arithmetic/lower-integer-convex-hull.cpp.

Definition at line 63 of file ClosedIntegerHalfPlane.h.


Member Typedef Documentation

template<typename TSpace>
typedef Space::Integer DGtal::ClosedIntegerHalfPlane< TSpace >::Integer

Definition at line 69 of file ClosedIntegerHalfPlane.h.

template<typename TSpace>
typedef Space::Point DGtal::ClosedIntegerHalfPlane< TSpace >::Point

Definition at line 70 of file ClosedIntegerHalfPlane.h.

template<typename TSpace>
typedef ClosedIntegerHalfPlane<TSpace> DGtal::ClosedIntegerHalfPlane< TSpace >::Self

Definition at line 65 of file ClosedIntegerHalfPlane.h.

template<typename TSpace>
typedef TSpace DGtal::ClosedIntegerHalfPlane< TSpace >::Space

Definition at line 68 of file ClosedIntegerHalfPlane.h.

template<typename TSpace>
typedef Space::Vector DGtal::ClosedIntegerHalfPlane< TSpace >::Vector

Definition at line 71 of file ClosedIntegerHalfPlane.h.


Constructor & Destructor Documentation

template<typename TSpace >
DGtal::ClosedIntegerHalfPlane< TSpace >::~ClosedIntegerHalfPlane ( )
inline

Destructor.

Definition at line 44 of file ClosedIntegerHalfPlane.ih.

{}
template<typename TSpace >
DGtal::ClosedIntegerHalfPlane< TSpace >::ClosedIntegerHalfPlane ( const Vector aN,
const Integer aC 
)
inline

Constructor from normal and constant.

Parameters:
aNa vector that defines the normal direction to the half-plane.
aCthe constant that defines the bound.

Definition at line 50 of file ClosedIntegerHalfPlane.ih.

: N( aN ), c( aC )
{}
template<typename TSpace >
DGtal::ClosedIntegerHalfPlane< TSpace >::ClosedIntegerHalfPlane ( const Point A,
const Point B,
const Point inP,
IntegerComputer< Integer > &  ic 
)
inline

Constructor. Computes the half-space of the form N.P<=c whose supporting line passes through A and B such that the point inP satisfies the constraint.

Parameters:
Aany point.
Bany point different from A.
inPany point not on the straight line (AB).
icany compatible integer computer.
Returns:
the corresponding half-space.

Definition at line 95 of file ClosedIntegerHalfPlane.ih.

References DGtal::IntegerComputer< TInteger >::floorDiv(), DGtal::IntegerComputer< TInteger >::gcd(), and DGtal::IntegerComputer< TInteger >::getDotProduct().

{
N[ 0 ] = A[ 1 ] - B[ 1 ];
N[ 1 ] = B[ 0 ] - A[ 0 ];
ic.getDotProduct( c, N, A );
Integer c1;
ic.getDotProduct( c1, N, inP );
if ( c1 > c )
{
N.negate();
c = -c;
}
//simplification of the constraint
Integer g = ic.gcd( N[ 0 ], N[ 1 ] );
N /= g;
ic.floorDiv( c, g );
}

Member Function Documentation

template<typename TSpace>
DGtal::ClosedIntegerHalfPlane< TSpace >::BOOST_CONCEPT_ASSERT ( (CSpace< TSpace >)  )
template<typename TSpace >
bool DGtal::ClosedIntegerHalfPlane< TSpace >::isOnBoundary ( const Point p) const
inline
Parameters:
pany point in the plane.
Returns:
'true' if p is on the boundary of the half-space (i.e. N.p == c ).

Definition at line 67 of file ClosedIntegerHalfPlane.ih.

Referenced by DGtal::LatticePolytope2D< TSpace, TSequence >::getAllPointsOfHull(), and DGtal::LatticePolytope2D< TSpace, TSequence >::getFirstPointsOfHull().

{
return N.dot( p ) == c;
}
template<typename TSpace >
bool DGtal::ClosedIntegerHalfPlane< TSpace >::isValid ( ) const
inline

Checks the validity/consistency of the object.

Returns:
'true' if the object is valid, 'false' otherwise.

Definition at line 136 of file ClosedIntegerHalfPlane.ih.

{
return true;
}
template<typename TSpace >
void DGtal::ClosedIntegerHalfPlane< TSpace >::negate ( )
inline

Negates the half-space. Only the boundary is common.

Definition at line 85 of file ClosedIntegerHalfPlane.ih.

References DGtal::ClosedIntegerHalfPlane< TSpace >::negate().

Referenced by DGtal::LatticePolytope2D< TSpace, TSequence >::getIncludedDigitalPoints(), DGtal::LatticePolytope2D< TSpace, TSequence >::halfSpace(), and DGtal::ClosedIntegerHalfPlane< TSpace >::negate().

{
N.negate(); // = Point( -N[ 0 ], -N[ 1 ] );
c = -c;
}
template<typename TSpace >
bool DGtal::ClosedIntegerHalfPlane< TSpace >::operator() ( const Point p) const
inline
Parameters:
pany point in the plane.
Returns:
'true' if p is inside the half-space (i.e. N.p <= c ).

Definition at line 58 of file ClosedIntegerHalfPlane.ih.

{
return N.dot( p ) <= c;
}
template<typename TSpace >
void DGtal::ClosedIntegerHalfPlane< TSpace >::selfDisplay ( std::ostream &  out) const
inline

Writes/Displays the object on an output stream.

Parameters:
outthe output stream where the object is written.

Definition at line 124 of file ClosedIntegerHalfPlane.ih.

{
out << "[ClosedIntegerHalfPlane N=" << N << " c=" << c << " ]";
}
template<typename TSpace >
DGtal::ClosedIntegerHalfPlane< TSpace >::Vector DGtal::ClosedIntegerHalfPlane< TSpace >::tangent ( ) const
inline
Returns:
the tangent vector to the half-plane boundary (ie. ( -N.y, N.x ) ).

Definition at line 76 of file ClosedIntegerHalfPlane.ih.

Referenced by DGtal::LatticePolytope2D< TSpace, TSequence >::getFirstPointsOfHull().

{
return Vector( -N[ 1 ], N[ 0 ] );
}

Field Documentation

template<typename TSpace>
Integer DGtal::ClosedIntegerHalfPlane< TSpace >::c
template<typename TSpace>
Vector DGtal::ClosedIntegerHalfPlane< TSpace >::N

The documentation for this struct was generated from the following files: