现在的位置: 首页 > 综合 > 正文

轨迹(locus)

2012年09月24日 ⁄ 综合 ⁄ 共 644字 ⁄ 字号 评论关闭
轨迹是一个物体移动的 时间-位置 函数
locus(t) = (x,y)
通过给定时间t可以得到一个坐标(x,y),由于得到的是二维的坐标,这个轨迹称为二维轨迹
如果得到坐标是三维的,那么这个轨迹是一个三维的轨迹。
同样的,如果得到的结果是一个多维的数据,那么这个轨迹可以描述更多的信息。
比如,除了三维坐标之外,还可以描述物体的方向,旋转角度,甚至缩放,透明度等等。

这样,把轨迹描述为一个模板

template< class Point >
class Locus
{
public:
    
struct Node
    
{
        
int m_time;
        Point m_p;
        
bool operator < (int time) const
        
{
            
return m_time < time;
        }

    }
;
    
void loadData(const char *data);
    
virtual int getInterval(int time, Point &result) = 0;
protected:
    Locus(LocusType type);
    
const LocusType mc_type;
    
int m_time;
    ::std::vector
< Node > m_data;
}
;

具体的轨迹,例如:直线,B样条...都继承这个模板类。重载getInterval函数,得到不同的映射关系。

抱歉!评论已关闭.