本文整理汇总了C++中TPoint类的典型用法代码示例。如果您正苦于以下问题:C++ TPoint类的具体用法?C++ TPoint怎么用?C++ TPoint使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TPoint类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: operator
inline double operator()(const TPoint& x, const TPoint& y) const {
VectorType xv = x.GetVnlVector();
VectorType yv = y.GetVnlVector();
VectorType r = yv - xv;
return exp(-dot_product(r, r) / m_sigma2);
}
示例2: GetPoint
TPoint TBisector::GetPoint(double t) const {
TPoint tmp;
tmp.SetCoord(t * *U);
tmp = tmp + *X0;
return tmp;
}
示例3: return
//
// equality operator
//
bool TPoint::operator==(const TPoint &inPt) const {
if ((inPt.X() == m_X) &&
(inPt.Y() == m_Y))
{
return (true);
}
return (false);
}
示例4: Intersects
bool Intersects(const TSegment<T> &segment) const
{
TPoint<T> p1=Point1();
TPoint<T> p2=Point2();
TPoint<T> p3=segment.Point1();
TPoint<T> p4=segment.Point2();
return(BoundingBox(p1.X(),p2.X(),p3.X(),p4.X())&&BoundingBox(p1.Y(),p2.Y(),p3.Y(),p4.Y())&&((Area(p1,p2,p3)*Area(p1,p2,p4))<=0)&&((Area(p3,p4,p1)*Area(p3,p4,p2))<=0));
}
示例5: GetScroll
void TWindow::SimulateMouseMoved()
{
TPoint mouse;
const TPoint& scroll = GetScroll();
mouse.Set(fLastMouseMovedLocation.h + scroll.h, fLastMouseMovedLocation.v + scroll.v);
HandleMouseMoved(mouse, fLastMouseMovedModifiers);
}
示例6: scroll
void WebScrollingDeceleratorGH::scroll()
{
if (!m_decelelatorSwitch) return;
// X = Vst*t - 0.5*a*(t * t)
TPoint dist;
TReal32 intervalInSec = static_cast<TReal32>(KScrollIntervalTimeout) / 1000000;
TReal32 t = (m_numscrollsteps++) * intervalInSec;
TReal32 dx = 0.0;
TReal32 dy = 0.0;
TReal32 vx = 0.0;
TReal32 vy = 0.0;
TReal32 accelX = 0.0;
TReal32 accelY = 0.0;
if (m_initSpeed.iX) {
accelX = (m_initSpeed.iX > 0) ? KDecceleration : (-1) * KDecceleration;
vx = m_initSpeed.iX + accelX * t;
dx = m_initSpeed.iX * t + 0.5 * accelX * (t * t);
}
if (m_initSpeed.iY) {
accelY = (m_initSpeed.iY > 0) ? KDecceleration : (-1) * KDecceleration;
vy = m_initSpeed.iY + accelY * t;
dy = m_initSpeed.iY * t + 0.5 * accelY * (t * t);
}
dist.SetXY(static_cast<TInt>(dx), static_cast<TInt>(dy));
WebFrameView* scrollingView = m_webView.pageScrollHandler()->currentScrollingFrameView();
TPoint cpos = scrollingView->contentPos();
dist = scrollingView->toDocCoords(dist);
TPoint pos = m_startPos + dist;
WebPageScrollHandler* handler = m_webView.pageScrollHandler();
if ((vx * m_initSpeed.iX < 0) || (vy * m_initSpeed.iY < 0) || (vx + vy == 0) ||
(m_numscrollsteps > 1 && !scrollingView->needScroll(pos) &&
!handler->currentScrollingElement())) {
if (m_scrollbarDrawer) {
m_scrollbarDrawer->fadeScrollbar();
}
m_decelTimer->Cancel();
handler->clearScrollingElement();
m_webView.setViewIsScrolling(false);
m_webView.toggleRepaintTimer(true);
}
else {
TPoint scrollDelta = pos - m_lastPos;
handler->scrollContent(scrollDelta);
m_lastPos = pos;
}
}
示例7: ExtendWithProducts
int ExtendWithProducts(TMatrix input, unsigned int upToPower, TMatrix *output){
unsigned int n = input.size();
output->resize(n);
for (unsigned int i = 0; i < n; i++){
for(unsigned int j = 1; j <= upToPower; j++){
TPoint extension;
GetProducts(input[i], j, &extension);
TPoint::iterator it;
it = (*output)[i].end();
(*output)[i].insert(it, extension.begin(), extension.end());
}
}
return 0;
}
示例8: distance
double TLine :: distance ( TPoint & P )
{
double Min , l;
l = A.distance ( B );
Min = fabs ( ( A.x - P.x ) * ( B.y - P.y ) - ( A.y - P.y ) * ( B.x - P.x ) );
return Min / l;
}
示例9: GetProducts
static int GetProducts(TPoint values, unsigned int power, TPoint *output){
int d = values.size();
if (power == 1){
output->resize(d);
for (int i = 0; i < d; i++){(*output)[i] = values[i];}
return 0;
}
output->resize(0);
TVariables indices(power);
unsigned int counter = 0;
while(indices[0] < d){
output->push_back(1);
for (unsigned int i = 0; i < power; i++){
(*output)[counter] *= values[indices[i]];
}
counter++;
int lastArray = power - 1;
while(lastArray > 0 && indices[lastArray] == d - 1){lastArray--;}
indices[lastArray]++;
for (unsigned int i = lastArray; i < power; i++){
indices[i] = indices[lastArray];
}
}
return 0;
}
示例10: CALLSTACKITEM_N
void CRecognizerContainer::PictureUpdateL(
CFbsBitmap& aBitmap,
RPointerArray<CCodeInfo>* aCodes,
const TPoint& aTranslation,
TInt /*aMinDiffTranslation*/,
TInt /*aRotation*/,
TInt /*aMinDiffRotation*/)
{
CALLSTACKITEM_N(_CL("CRecognizerContainer"), _CL("PictureUpdateL"));
iTranslation.SetXY(aTranslation.iX, aTranslation.iY);
if (aCodes != NULL) {
iCurrentCode = iVCS->FindClosestCode(iTarget);
if (iCurrentCode >= 0) {
CCodeInfo* ci = (*aCodes)[iCurrentCode];
TPoint p = ci->GetTilting();
iTilting.SetXY(p.iX, p.iY);
if (ci->IsCodeValid()) {
iInvalid=false;
delete iCurrentCodeInfo; iCurrentCodeInfo=0;
iCurrentCodeInfo=new (ELeave) CCodeInfo;
iCurrentCodeInfo->ConstructL(*ci);
} else {
iInvalid=true;
}
}
}
iBitmap=&aBitmap;
DrawImage(&aBitmap);
}
示例11: minor2Pot
CGameSpriteFrame::CGameSpriteFrame(const TFileName& filename, TUint32 id, const CGameRect& r, CFbsBitmap* loader){
loader->Load(filename, id, 0);
TInt i,j;
TInt h = loader->SizeInPixels().iHeight;
TInt w = loader->SizeInPixels().iWidth;
h = (h<r.h)?h:r.h;
w = (w<r.w)?w:r.w;
TInt H = minor2Pot(h);
TInt W = minor2Pot(w);
if(H>W)W=H;
else H=W;
this->texDim = H;
TRgb color;
TPoint point;
this->pixels = new TUint32[W*H];
for(i=0;i<w;i++){
for(j=0;j<h;j++){
point.SetXY(i,j);
loader->GetPixel(color,point);
this->pixels[i+j*W] = color.Value();
}
}
glGenTextures(1, &(this->texId));
glBindTexture(GL_TEXTURE_2D, this->texId);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
GLint format = GL_RGBA;
glTexImage2D(GL_TEXTURE_2D, 0, format, W, H, 0,
format, GL_UNSIGNED_BYTE, this->pixels);
}
示例12: XTranslateCoordinates
void TWindow::LocalToRoot(TPoint& point) const
{
int x, y;
Window childWindow;
XTranslateCoordinates(sDisplay, fWindow, gApplication->GetRootWindow(),
0, 0, &x, &y, &childWindow);
const TPoint& scroll = GetScroll();
point.Offset(x - scroll.h, y - scroll.v);
}
示例13: objectUtil
void TDrawer::DrawReturnArrow(CWsBitmap* aBackUpBitmap, CWsBitmap* aResourceBitmap, TRect aWorldPointRect,
TRect aBitMapRect)
{
//根据WorldPointRect大小 和 aBitMapRect的大小 设置新的returnRect的大小
TPoint center;
center.SetXY((aWorldPointRect.iBr.iX + aWorldPointRect.iTl.iX) / 2, (aWorldPointRect.iBr.iY
+ aWorldPointRect.iTl.iY) / 2);
TInt iHalfHigh = (aBitMapRect.iBr.iY - aBitMapRect.iTl.iY) / 2;
TInt iHalfWidth = (aBitMapRect.iBr.iX - aBitMapRect.iTl.iX) / 2;
TRect centerRect;
centerRect.SetRect(center.iX - iHalfWidth, center.iY - iHalfHigh, center.iX + iHalfWidth, center.iY + iHalfHigh);
TBitmapUtil objectUtil(aResourceBitmap);
TBitmapUtil backUpUtil(aBackUpBitmap);
//
objectUtil.Begin(TPoint(0, 0));
backUpUtil.Begin(TPoint(0, 0));
R8G8B8* addr1 = (R8G8B8*) aResourceBitmap->DataAddress();// 对象
R8G8B8* addr2 = (R8G8B8*) aBackUpBitmap->DataAddress();// 背景
TSize desSize = aBackUpBitmap->SizeInPixels();
TSize srcSize = aResourceBitmap->SizeInPixels();
R8G8B8* addr22;
R8G8B8* addr11;
addr22 = addr2 + (centerRect.iTl.iY - 1) * desSize.iWidth + centerRect.iTl.iX;
TSize newSize = centerRect.Size();
addr11 = addr1 + aBitMapRect.iTl.iY * srcSize.iWidth + aBitMapRect.iTl.iX;
//每画完一行,arrd11要前进的距离
TInt iWidthSpan = srcSize.iWidth - newSize.iWidth;
TInt iScreenWidthSpan = desSize.iWidth - newSize.iWidth;
for (TInt j = 0; j < newSize.iHeight; j++)
{
for (TInt i = 0; i < newSize.iWidth; i++)
{
*addr22 = *addr11;
addr22++;
addr11++;
}
addr11 = addr11 + iWidthSpan;
addr22 = addr22 + iScreenWidthSpan;
}
backUpUtil.End();
objectUtil.End();
}
示例14: TPoint
void CAwardContainer::SetGameState()
{
//iData->iGameState = TEnum::EControlMainMenu;
//设置MainMenu下的对象初始状态
TRect iLeftTopRect = iData->ipBitMapPosition->GetPosition(TBitMapPosition::HighlightReturnEdge, 0);
TPoint point;
point.SetXY(FIRST_MENU_POSITION, FIRST_MENU_HEIGHT);
point.iY = 610;
iReturn.SetBitMapRect(iData->ipBitMapPosition->GetPosition(TBitMapPosition::FontReturn, 0));
iReturn.SetStartAndEndPoint(point, TPoint(270, point.iY));
iReturn.SetHighLightRect(iLeftTopRect, TRect(180, 610 - 27, 359, 610 + 27));
iReturn.ReSet();
point.SetXY(180, 60);
iNavAward.SetBitMapRect(iData->ipBitMapPosition->GetPosition(TBitMapPosition::FontAward, 0));
iNavAward.SetStartAndEndPoint(point, point);
iNavAward.ReSet();
iNavAward.UpdateObjectByCenter();
}
示例15: Print_Line
void TFuncSpecView::Print_Line(TDC& dc, TPoint origin, const TFuncSpecView::XPosVector& xpos, char* data) const
{
XPosVector::size_type i, count=xpos.size()-1; // subtract one for end marker
char text[]="+";
for(i=0; i<count; i++) {
text[0]=data[i];
dc.TextOut(origin.OffsetBy(xpos[i].x, 0), text, 1);
}
}