Fréchet View  1.6.0
A Tool for Exploring Fréchet Distance Algorithms
frechet::reach::BoundarySegment Class Reference

Detailed Description

boundary interval in the reachability structure. Represents an interval on the boundary of the FreeSpace (bottom.left,top, or right)

Stores references to the corresponding intervals (l,h) on the opposite border.

See also
[alt95]

Implements an intrusive double-linked-list. Intrusive lists are efficient, but it is important that each object is only contained in no more than one list !

Note: we keep an eye on memory footprint. sizeof(BoundarySegment)==64 is cache-friendly. Try to avoid sizeof > 64.

Also note that LinkedListElement has NO virtual destructor, since BoundarySegment does not need a destructor (and we can save 8 bytes for the vptr).

Author
Peter Schäfer

Definition at line 285 of file boundary.h.

#include <boundary.h>

Inherits frechet::data::LinkedListElement< BoundarySegment >, frechet::data::Interval, and frechet::reach::PointerInterval.

Public Member Functions

Pointer createClone () const
 create an identical copy of this segment More...
 
Pointer clone () const
 
void clearClone () const
 disconnect from clone. Does not release any memory. More...
 
 BoundarySegment (const Interval &ival, Orientation ori, Direction dir, Type t, void *owner=nullptr)
 default constructor More...
 
void clear ()
 clears pointers, keep interval bounds More...
 
bool contains (double x) const
 containment test More...
 
bool contains (Pointer p) const
 containment test More...
 
BoundarySegmentoperator= (const PointerInterval &lh)
 assigment operator from interval More...
 
bool operator== (const BoundarySegment &that) const
 comparison operator More...
 
- Public Member Functions inherited from frechet::data::LinkedListElement< BoundarySegment >
 LinkedListElement ()
 empty constructor More...
 
BoundarySegment * prev () const
 
BoundarySegment * next () const
 
BoundarySegment * next (bool forward)
 
- Public Member Functions inherited from frechet::data::BLinkedListElement
 BLinkedListElement ()
 empty constructor More...
 
BLinkedListElement *& prev ()
 
BLinkedListElement *& next ()
 
- Public Member Functions inherited from frechet::data::Interval
 Interval ()
 Default constructor. Creates an invalid Interval. More...
 
 Interval (double lower, double upper)
 Constructor from boundary values. More...
 
 Interval (const Interval &that)
 Copy constructor. More...
 
 Interval (const Interval &that, double shift)
 Copy constructor with shift offset. More...
 
double size () const
 size of the interval (upper - lower). More...
 
bool valid () const
 validity test More...
 
bool empty () const
 empty test More...
 
 operator bool () const
 
bool operator! () const
 
double lower () const
 
double upper () const
 
double & lower ()
 
double & upper ()
 
IntervalsetLower (double value)
 update lower bound More...
 
IntervalsetUpper (double value)
 update upper bound More...
 
double mid () const
 
Intervaloperator= (const Interval &that)
 assignment operator More...
 
bool operator== (const Interval &that) const
 equality comparator More...
 
bool equals (const Interval &that, double precision) const
 equalality comparator with tolerance More...
 
bool operator!= (const Interval &that) const
 non-equality comparator More...
 
Interval normalized () const
 normalized More...
 
Intervalnormalize ()
 make sure that lower <= upper, swapping bounds, if necessary More...
 
Intervalclear ()
 make this an invalid interval More...
 
bool contains (double x) const
 containment test (assumes closed interval, bounds inclusive) More...
 
bool contains (double x, double precision) const
 containment test with tolerance (assumes closed interval, bounds inclusive) More...
 
bool contains (const Interval &that) const
 containment test (closed interval, bounds inclusive) More...
 
bool intersects (const Interval &that) const
 intersection test (closed interval, bounds inclusive) More...
 
bool intersects_proper (const Interval &that) const
 intersection test (open interval, bounds exclusive) More...
 
bool bordersTo (const Interval &that) const
 adjacency test More...
 
double mapToUnitInterval (double x) const
 re-map a value from this interval to the unit interval More...
 
double mapFromUnitInterval (double x) const
 re-map a value from the unit interval to this interval More...
 
double mapTo (double x, const Interval &other) const
 re-map a value to another interval More...
 
double mapFrom (double x, const Interval &other) const
 re-map a value from another interval to this interval More...
 
Interval operator+ (double offset) const
 shift the interval by a fixed offset More...
 
Intervaloperator+= (double offset)
 shift the interval by a fixed offset More...
 
Interval operator- (double offset) const
 shift the interval by a fixed offset More...
 
Intervaloperator-= (double offset)
 shift the interval by a fixed offset More...
 
Interval operator * (double factor) const
 multiply by a factor More...
 
Intervaloperator *= (double factor)
 multiply by a factor More...
 
Interval operator/ (double factor) const
 divide by a factor More...
 
Intervaloperator/= (double factor)
 multiply by a factor More...
 
Interval operator+ (const Interval &that) const
 union operator More...
 
Intervaloperator+= (const Interval &that)
 union operator More...
 
Interval operator- (const Interval &that) const
 difference operator More...
 
Interval operator-= (const Interval &that)
 difference operator More...
 
Interval operator & (const Interval &that) const
 intersection operator More...
 
Intervaloperator&= (const Interval &that)
 intersection operator More...
 
Intervalunion_lf (const Interval &that)
 lock-free union operator; not used and not tested More...
 
- Public Member Functions inherited from frechet::reach::PointerInterval
 PointerInterval ()
 empty constructor; constructs an invalid interval, with both pointers being nullptr More...
 
 PointerInterval (Pointer a, Pointer b)
 default constructor More...
 
 operator bool () const
 true if the interal is valid, i.e. both pointers are More...
 
bool operator! () const
 
PointerIntervaloperator= (const Pointer &p)
 assigment More...
 
PointerIntervalswap (bool doit=true)
 conditional swap More...
 
PointerInterval swapped () const
 
bool contains (Pointer p) const
 containment test More...
 
PointerInterval normalized () const
 assumes identical orientation !! More...
 
PointerInterval operator+ (const PointerInterval &that) const
 merge operator More...
 
bool operator== (const PointerInterval &that) const
 comparison operator More...
 
void clear ()
 clear both pointer (assgin nullptr) More...
 

Public Attributes

Type type
 reachability label More...
 
const Orientation ori
 horizontal or vertical More...
 
const Direction dir
 left/right or bottom/top More...
 
Pointer clone
 points to a clone of this object More...
 
Pointer _twin
 points to a segment on the opposite edge of the reachability structure. twins have the same boundary interval (but different l,h pointers) More...
 
- Public Attributes inherited from frechet::reach::PointerInterval
Pointer l
 points to the lowest segment of the interval More...
 
Pointer h
 points to the highest segment of the interval More...
 

Private Member Functions

Pointer twin (int hops)
 

Private Attributes

struct {
   union {
      Pointer   clone
 points to a clone of this object More...
 
      Pointer   _twin
 points to a segment on the opposite edge of the reachability structure. twins have the same boundary interval (but different l,h pointers) More...
 
   } 
 
temp
 temporary data used during merge and split operations More...
 

Friends

class Structure
 

Additional Inherited Members

- Static Public Member Functions inherited from frechet::data::Interval
static bool equals (double a, double b)
 equality comparator More...
 
- Static Public Attributes inherited from frechet::data::Interval
static const Interval UNIT
 the unit interval [0,1] More...
 
static const Interval INVALID = Interval ()
 an invalid interval (contains NAN values) More...
 
- Protected Attributes inherited from frechet::data::BLinkedListElement
BLinkedListElementlink [2]
 double links (previous, next) More...
 

Constructor & Destructor Documentation

◆ BoundarySegment()

BoundarySegment::BoundarySegment ( const Interval ival,
Orientation  ori,
Direction  dir,
Type  t,
void *  owner = nullptr 
)

default constructor

Parameters
ivalfree-space interval bounding this segment
oriis this a horizontal or vertical segment?
diris is located in the bottom-left part, or in the top-right part of a reachability structure
tlabel that indicates of the interval is reachable, or not
ownerfor debugging only

Definition at line 9 of file boundary.cpp.

Member Function Documentation

◆ clear()

void frechet::reach::BoundarySegment::clear ( )
inline

clears pointers, keep interval bounds

Definition at line 359 of file boundary.h.

◆ clearClone()

void frechet::reach::BoundarySegment::clearClone ( ) const
inline

disconnect from clone. Does not release any memory.

Definition at line 335 of file boundary.h.

◆ clone()

Pointer frechet::reach::BoundarySegment::clone ( ) const
inline
Returns
the clone of this object, if it exists

Definition at line 333 of file boundary.h.

◆ contains() [1/2]

bool frechet::reach::BoundarySegment::contains ( double  x) const
inline

containment test

Parameters
xa point in the free-space
Returns
true, if x is contained in this interval

Definition at line 369 of file boundary.h.

◆ contains() [2/2]

bool frechet::reach::BoundarySegment::contains ( Pointer  p) const
inline

containment test

Parameters
ppointer to an invterval
Returns
true, if the p-interval is contained in this interval

Definition at line 377 of file boundary.h.

◆ createClone()

Pointer frechet::reach::BoundarySegment::createClone ( ) const
inline

create an identical copy of this segment

Returns
a newly allocated copy

Definition at line 326 of file boundary.h.

◆ operator=()

BoundarySegment& frechet::reach::BoundarySegment::operator= ( const PointerInterval lh)
inline

assigment operator from interval

Parameters
lhan interval
Returns
reference to this, after assigment

Definition at line 385 of file boundary.h.

◆ operator==()

bool frechet::reach::BoundarySegment::operator== ( const BoundarySegment that) const
inline

comparison operator

Parameters
thatanother segment
Returns
true, if both segment have indentical properties (except temporary data)

Definition at line 395 of file boundary.h.

◆ twin()

Pointer frechet::reach::BoundarySegment::twin ( int  hops)
inlineprivate
Parameters
hopsdistance (1=opposite, 2=...)
Returns
segment on the opposite edge of the reachability structure

Definition at line 309 of file boundary.h.

Friends And Related Function Documentation

◆ Structure

friend class Structure
friend

Definition at line 291 of file boundary.h.

Member Data Documentation

◆ _twin

Pointer frechet::reach::BoundarySegment::_twin

points to a segment on the opposite edge of the reachability structure. twins have the same boundary interval (but different l,h pointers)

Definition at line 298 of file boundary.h.

◆ clone

Pointer frechet::reach::BoundarySegment::clone

points to a clone of this object

Definition at line 295 of file boundary.h.

◆ dir

const Direction frechet::reach::BoundarySegment::dir

left/right or bottom/top

Definition at line 319 of file boundary.h.

◆ ori

const Orientation frechet::reach::BoundarySegment::ori

horizontal or vertical

Definition at line 318 of file boundary.h.

◆ temp

struct { ... } frechet::reach::BoundarySegment::temp

temporary data used during merge and split operations

◆ type

Type frechet::reach::BoundarySegment::type

reachability label

Definition at line 317 of file boundary.h.


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