📄 aoishifter.h
字号:
//-----------------------------------------------------------------------------
// (c) 2002 by Basler Vision Technologies
// Section: Vision Components
// Project: BCAM
// $Header: AoiShifter.h, 3, 19.09.2002 15:16:08, Nebelung, H.$
//-----------------------------------------------------------------------------
/**
\file AoiShifter.h
\brief moves the area of interest around
*/
#pragma once
//! Computes the position of the AOI so that it bounces around
class CAoiBouncer
{
public:
//! Default Constructor
CAoiBouncer()
{
}
//! Initlaizes the object
void Initialize(
CSize ImagerSize, //!< Size of the imager
CSize AoiSize, //!< Size of the AOI
CPoint Start, //!< Start point for the upper left corner of the AOI
CPoint Speed //!< Speed vector
)
{
m_ImagerSize = ImagerSize;
m_AoiSize = AoiSize;
m_Start = Start;
m_Speed = Speed;
}
//! Computes the AOI postition at a given cycle count value
void GetAoiPosition(unsigned long CycleCount, CPoint &AoiPosition)
{
/** Deal with the x-coordinate **/
// x = x0 + v * t
AoiPosition.x = m_Start.x + m_Speed.x * CycleCount;
// limit to 2 x imager width
AoiPosition.x = AoiPosition.x % (2 * (m_ImagerSize.cx - m_AoiSize.cx));
// Need to reeflect?
if( AoiPosition.x > (m_ImagerSize.cx - m_AoiSize.cx) )
AoiPosition.x = 2 * (m_ImagerSize.cx - m_AoiSize.cx) - AoiPosition.x;
/** Deal with the y-coordinate **/
// y = y0 + v * t
AoiPosition.y = m_Start.y + m_Speed.y * CycleCount;
// limit to 2 x imager height
AoiPosition.y = AoiPosition.y % (2 * (m_ImagerSize.cy - m_AoiSize.cy));
// Need to reeflect?
if( AoiPosition.y > (m_ImagerSize.cy - m_AoiSize.cy) )
AoiPosition.y = 2 * (m_ImagerSize.cy - m_AoiSize.cy) - AoiPosition.y;
}
protected:
//! The size of the Imager
CSize m_ImagerSize;
//! The size of the AOI
CSize m_AoiSize;
//! The Start point for the upper left corner of the AOI
CPoint m_Start;
//! The Speed vector
CPoint m_Speed;
};
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -