maliput
SRange Class Reference

Detailed Description

Directed, inclusive longitudinal (s value) range from s0 to s1.

#include <include/maliput/api/regions.h>

Public Member Functions

 MALIPUT_DEFAULT_COPY_AND_MOVE_AND_ASSIGN (SRange)
 
 SRange ()=default
 Default constructor: initializes s0 and s1 to zero. More...
 
 SRange (double s0, double s1)
 Constructs range [s0 --> s1]. More...
 
double s0 () const
 Gets s0 value. More...
 
double s1 () const
 Gets s1 value. More...
 
void set_s0 (double s0)
 Sets s0 value. More...
 
void set_s1 (double s1)
 Sets s1 value. More...
 
double size () const
 Computes the size of this SRange (i.e., |s1() - s0()|). More...
 
bool WithS () const
 Defines whether this SRange is in the direction of +s (i.e., s1() > s0()). More...
 
bool Intersects (const SRange &s_range, double tolerance) const
 Determines whether this SRange intersects with s_range. More...
 
bool Contains (const SRange &s_range, double tolerance) const
 Determines whether this SRange contains s_range. More...
 
std::optional< SRangeGetIntersection (const SRange &s_range, double tolerance) const
 Computes a std::optional<SRange> bearing the intersected SRange that results overlapping this SRange with s_range. More...
 

Constructor & Destructor Documentation

◆ SRange() [1/2]

SRange ( )
default

Default constructor: initializes s0 and s1 to zero.

◆ SRange() [2/2]

SRange ( double  s0,
double  s1 
)

Constructs range [s0 --> s1].

Parameters
s0The start value of the range. It must not be negative.
s1The end value of the range. It must not be negative.
Exceptions
common::assertion_errorWhen 's0' is negative.
common::assertion_errorWhen 's1' is negative.

Member Function Documentation

◆ Contains()

bool Contains ( const SRange s_range,
double  tolerance 
) const

Determines whether this SRange contains s_range.

tolerance will modify this range and s_range by increasing the maximum and reducing the minimum of each range. When tolerance is negative, it shrinks both ranges.

Parameters
s_rangeThe SRange with which to compute the intersection.
toleranceThe tolerance to use when computing the inclusion relationship.
Returns
true When s_range is contained within this SRange.

◆ GetIntersection()

std::optional< SRange > GetIntersection ( const SRange s_range,
double  tolerance 
) const

Computes a std::optional<SRange> bearing the intersected SRange that results overlapping this SRange with s_range.

When there is no common area, std::nullopt is returned.

tolerance will modify this range and s_range by increasing the maximum and reducing the minimum of each range. When tolerance is negative, it shrinks both ranges.

Parameters
s_rangeThe SRange to evaluate whether it is included into this SRange.
toleranceThe tolerance to use to evaluate the intersection.
Returns
A std::optional<SRange> with the intersected SRange.

◆ Intersects()

bool Intersects ( const SRange s_range,
double  tolerance 
) const

Determines whether this SRange intersects with s_range.

tolerance will modify this range and s_range by increasing the maximum and reducing the minimum of each range. When tolerance is negative, it shrinks both ranges.

Parameters
s_rangeA SRange to evaluate the intersection with.
toleranceThe tolerance to use when computing the intersection.
Returns
true When s_range intersects this SRange.

◆ MALIPUT_DEFAULT_COPY_AND_MOVE_AND_ASSIGN()

MALIPUT_DEFAULT_COPY_AND_MOVE_AND_ASSIGN ( SRange  )

◆ s0()

double s0 ( ) const

Gets s0 value.

Returns
s0.

◆ s1()

double s1 ( ) const

Gets s1 value.

Returns
s1.

◆ set_s0()

void set_s0 ( double  s0)

Sets s0 value.

Parameters
s0The start value of the range. It must not be negative.
Exceptions
common::assertion_errorWhen 's0' is negative.

◆ set_s1()

void set_s1 ( double  s1)

Sets s1 value.

Parameters
s1The end value of the range. It must not be negative.
Exceptions
common::assertion_errorWhen 's1' is negative.

◆ size()

double size ( ) const

Computes the size of this SRange (i.e., |s1() - s0()|).

Returns
The size of of this SRange.

◆ WithS()

bool WithS ( ) const

Defines whether this SRange is in the direction of +s (i.e., s1() > s0()).

Returns
true When this SRange is in the direction of +s.

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