🛰️航天仿真算法库 SpaceAST 0.0.1
载入中...
搜索中...
未找到
ast::Interval类 参考

#include <Interval.hpp>

Public 成员函数

double start () const
 
double stop () const
 
double & start ()
 
double & stop ()
 
double duration () const
 
bool isEmpty () const
 
bool isPoint () const
 
bool isDegenerate () const
 
bool isValid () const
 
bool isNonEmpty () const
 
bool contains (double t) const
 
void setBounds (double start, double stop)
 
void setEmpty ()
 
void setWhole ()
 
DoubleRange discretize (double step) const
 
size_t discretizedCount (double step) const
 
Intervalunite (const Interval &other)
 
Interval united (const Interval &other) const
 
Intervalintersect (const Interval &other)
 
Interval intersected (const Interval &other) const
 
bool intersects (const Interval &other) const
 
Intervaloperator|= (const Interval &other)
 
Interval operator| (const Interval &other) const
 
Intervaloperator&= (const Interval &other)
 
Interval operator& (const Interval &other) const
 

静态 Public 成员函数

static Interval Empty ()
 

Public 属性

double start_
 
double stop_
 

详细描述

相对时间区间

相对时间区间类,用于表示时间区间的开始时间和结束时间

警告
在使用相对时间区间时,需要明确相对时间区间的基准时间点(epoch)

成员函数说明

◆ discretize()

DoubleRange ast::Interval::discretize ( double step) const
inline

将相对时间区间离散化

对 [start, stop] 闭区间按 step 步长采样,返回惰性可迭代的秒偏移范围。 内部相邻点间距恒为 step,但末尾强制把 stop 并入输出(最后一段间距可能 小于 step),因此并非均匀网格。当 step <= 0.0 或区间为空(isEmpty())时 返回空范围;点区间(start == stop)返回 1 个采样点。

参数
step离散化步长(秒)
返回
离散化秒偏移范围

◆ discretizedCount()

size_t ast::Interval::discretizedCount ( double step) const
inline

计算离散化采样点数量

返回 discretize(step) 所生成的采样点数(含首尾端点)。当 step > 0.0 且区间非空(!isEmpty())时为 ceil(duration()/step) + 1, 点区间(start == stop)返回 1,否则返回 0。

参数
step离散化步长(秒)
返回
采样点数

◆ intersect()

Interval & ast::Interval::intersect ( const Interval & other)
inline

原地交集

参数
other另一个时间区间
返回
*this
注解
不相交或 NaN 时结果为规范空区间({+∞,-∞},isEmpty());相切时结果为点区间(start == stop,非空)。

◆ intersected()

Interval ast::Interval::intersected ( const Interval & other) const
inline

交集(返回副本)

参数
other另一个时间区间
返回
交集(不修改当前对象)
注解
不相交或 NaN 时结果为规范空区间({+∞,-∞},isEmpty());相切时结果为点区间(start == stop,非空)。

◆ intersects()

bool ast::Interval::intersects ( const Interval & other) const
inline

判断两个区间是否相交(非空交集,含仅相切产生的点区间)

参数
other另一个时间区间
返回
是否相交

◆ setBounds()

void ast::Interval::setBounds ( double start,
double stop )
inline

设置时间区间的开始时间和结束时间

参数
start开始时间
stop结束时间
注解
不钳制 start > stop(反向区间作为空区间存储,见 isEmpty()

◆ unite()

Interval & ast::Interval::unite ( const Interval & other)
inline

原地并集:将另一个区间并入自身(凸包)

参数
other另一个时间区间
返回
*this
警告
凸包会桥接不相交区间的空隙;如需保留空隙的集合并集,请使用 IntervalList::united。

◆ united()

Interval ast::Interval::united ( const Interval & other) const
inline

并集(返回副本):凸包

参数
other另一个时间区间
返回
并集(不修改当前对象)

该类的文档由以下文件生成: