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
 Returns the size of this SRange (i.e., |s1() - s0()|). More...
 
bool WithS () const
 Returns 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...
 
std::optional< SRangeGetIntersection (const SRange &s_range, double tolerance) const
 Returns 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].

Exceptions
common::assertion_errorWhen 's0' is negative.
common::assertion_errorWhen 's1' is negative.

Member Function Documentation

◆ GetIntersection()

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

Returns 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 tolerance and reducing the minimum each range. When tolerance is negative, it shrinks both ranges.

◆ 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 tolerance and reducing the minimum each range. When tolerance is negative, it shrinks both ranges.

◆ MALIPUT_DEFAULT_COPY_AND_MOVE_AND_ASSIGN()

MALIPUT_DEFAULT_COPY_AND_MOVE_AND_ASSIGN ( SRange  )

◆ s0()

double s0 ( ) const

Gets s0 value.

◆ s1()

double s1 ( ) const

Gets s1 value.

◆ set_s0()

void set_s0 ( double  s0)

Sets s0 value.

Exceptions
common::assertion_errorWhen 's0' is negative.

◆ set_s1()

void set_s1 ( double  s1)

Sets s1 value.

Exceptions
common::assertion_errorWhen 's1' is negative.

◆ size()

double size ( ) const

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

◆ WithS()

bool WithS ( ) const

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


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