当前位置: 首页>>代码示例>>C++>>正文


C++ INT函数代码示例

本文整理汇总了C++中INT函数的典型用法代码示例。如果您正苦于以下问题:C++ INT函数的具体用法?C++ INT怎么用?C++ INT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了INT函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: if

void EggAvatar::DrawSegment(IFTImage* pImage, int firstPoint, int secondPoint, UINT32 color)
{
    float x1 = m_FacePointXYZ[firstPoint][0];
    float y1 = m_FacePointXYZ[firstPoint][1];
    float z1 = m_FacePointXYZ[firstPoint][2];
    float x2 = m_FacePointXYZ[secondPoint][0];
    float y2 = m_FacePointXYZ[secondPoint][1];
    float z2 = m_FacePointXYZ[secondPoint][2];

    if (z1 < 0)
    {
        if (z2 > 0)
        {
            float r = z2/(z2-z1);
            x1 = x2 - r*(x2-x1);
            y1 = y2 - r*(y2-y1);
        }
        else
        {
            // Segment is completely hidden
            return;
        }
    }
    else if (z2 < 0)
    {
        if (z1 > 0)
        {
            float r = z1/(z2-z1);
            x2 = x1 + r*(x1-x2);
            y2 = y1 + r*(y1-y2);
        }
        else
        {
            // Segment is completely hidden
            return;
        }
    }
    
    POINT start = {INT(x1), INT(y1)}, end = {INT(x2), INT(y2)};
    pImage->DrawLine(start, end, color, 1);
}
开发者ID:guerre50,项目名称:FacialMusicRendering,代码行数:41,代码来源:eggavatar.cpp

示例2: obj

DisplayError DisplayHDMI::Init() {
  lock_guard<recursive_mutex> obj(recursive_mutex_);

  DisplayError error = HWInterface::Create(kHDMI, hw_info_intf_, buffer_sync_handler_,
                                           &hw_intf_);
  if (error != kErrorNone) {
    return error;
  }

  uint32_t active_mode_index;
  char value[64] = "0";
  Debug::GetProperty("sdm.hdmi.s3d_mode", value);
  HWS3DMode mode = (HWS3DMode)atoi(value);
  if (mode > kS3DModeNone && mode < kS3DModeMax) {
    active_mode_index = GetBestConfig(mode);
  } else {
    active_mode_index = GetBestConfig(kS3DModeNone);
  }

  error = hw_intf_->SetDisplayAttributes(active_mode_index);
  if (error != kErrorNone) {
    HWInterface::Destroy(hw_intf_);
  }

  error = DisplayBase::Init();
  if (error != kErrorNone) {
    HWInterface::Destroy(hw_intf_);
    return error;
  }

  GetScanSupport();
  underscan_supported_ = (scan_support_ == kScanAlwaysUnderscanned) || (scan_support_ == kScanBoth);

  s3d_format_to_mode_.insert(std::pair<LayerBufferS3DFormat, HWS3DMode>
                            (kS3dFormatNone, kS3DModeNone));
  s3d_format_to_mode_.insert(std::pair<LayerBufferS3DFormat, HWS3DMode>
                            (kS3dFormatLeftRight, kS3DModeLR));
  s3d_format_to_mode_.insert(std::pair<LayerBufferS3DFormat, HWS3DMode>
                            (kS3dFormatRightLeft, kS3DModeRL));
  s3d_format_to_mode_.insert(std::pair<LayerBufferS3DFormat, HWS3DMode>
                            (kS3dFormatTopBottom, kS3DModeTB));
  s3d_format_to_mode_.insert(std::pair<LayerBufferS3DFormat, HWS3DMode>
                            (kS3dFormatFramePacking, kS3DModeFP));

  error = HWEventsInterface::Create(INT(display_type_), this, event_list_, &hw_events_intf_);
  if (error != kErrorNone) {
    DisplayBase::Deinit();
    HWInterface::Destroy(hw_intf_);
    DLOGE("Failed to create hardware events interface. Error = %d", error);
  }

  return error;
}
开发者ID:MIPS,项目名称:hardware-qcom-display,代码行数:53,代码来源:display_hdmi.cpp

示例3: BlockForFiltLineI

/***********************************************************************
*   Returns 1-based block number for line number (i.e. first = 1)
*   Lines assumed 1-based (i.e. first = 1); 
*/
int BlockForFiltLineI(FILTER *filtPO, int line)
{
    int block;

    if( line <= filtPO->l_bof ) {
        block = 0;
    }
    else {
        block = 1 + INT((line - 1 - filtPO->l_bof) / filtPO->l_blk);
    }
    return(block);
}
开发者ID:ryantkoehler,项目名称:vertools,代码行数:16,代码来源:filter.c

示例4: R_PDCLVAR

SEXP R_PDCLVAR(SEXP X, SEXP DESCX, SEXP LSD)
{
  R_INIT;
  SEXP VAR;
  
  newRvec(VAR, INT(LSD, 0), "dbl");
  
  pdclvar_(REAL(X), INTEGER(DESCX), REAL(VAR));
  
  R_END;
  return VAR;
} 
开发者ID:RBigData,项目名称:pbdBASE,代码行数:12,代码来源:base_variance.c

示例5: SetOpt

REAL cIncEnsembleCamera::ScoreCurGen(bool WithFaux,bool CumulDeriv)
{
    SetOpt();
    REAL mMoyResidu = 0.0;
    REAL  mNbPts = 0.0;

    for 
    (
             std::list<cIncSetLiaison *>::iterator anIt = mListSl->begin(); 
             anIt != mListSl->end();
             anIt ++
    )
    {
         cIncCpleCamera * aCple = (*anIt)->Cple();
         ElPackHomologue & aPack = (*anIt)->Pack();
         for
         (
                ElPackHomologue::iterator itHoms = aPack.begin();
                itHoms != aPack.end();
                itHoms++
         )
         {
            Pt2dr aP1 = itHoms->P1();
            Pt2dr aP2 = itHoms->P2();
            REAL aPds =  itHoms->Pds();

            REAL Residu = CumulDeriv ?
                          aCple->DevL1AddEqCoPlan(aP1,aP2,aPds,*mSys):
                          aCple->ValEqCoPlan(aP1,aP2);

            mMoyResidu += ElSquare(Residu )* aPds;
            mNbPts += aPds;
         }
    }

    if (WithFaux)
    {
       for (INT aK = 0 ; aK<INT(mFoncsAux.size()) ; aK++)
       {
            cFonctrPond aFP = mFoncsAux[aK];
            
            if (CumulDeriv)
               StdAddEq(aFP.mFctr,aFP.mPds);
            else
               aFP.mFctr->ComputeValAndSetIVC();
            mMoyResidu += ElSquare(aFP.mFctr->Val(0)) * aFP.mPds;
            mNbPts +=  aFP.mPds;
       }
    }


    return mMoyResidu / mNbPts;
}
开发者ID:jakexie,项目名称:micmac-archeos,代码行数:53,代码来源:phgr_or_opt.cpp

示例6: AddDessouSansDessus

void  cElHJaFacette::AddDessouSansDessus(std::vector<cElHJaFacette *> & aTabF)
{
   for (INT aK=0 ; aK<INT(mVFRecouvrt.size()) ; aK++)
   {
       if ( mThisIsEnDessus[aK])
       {
            mVFRecouvrt[aK]->mNbThisIsEnDessous--;
            if (mVFRecouvrt[aK]->mNbThisIsEnDessous==0)
               aTabF.push_back(mVFRecouvrt[aK]);
       }
   }
}
开发者ID:jakexie,项目名称:micmac,代码行数:12,代码来源:cElHJaFacette.cpp

示例7: Rth_get_num_threads

SEXP Rth_get_num_threads()
{
  char *rth_nthreads = getenv("RTH_NUM_THREADS");
  char *omp_nthreads = getenv("OMP_NUM_THREADS");
  
  SEXP nthreads;
  PROTECT(nthreads = allocVector(INTSXP, 1));
  
  #if RTH_OMP
  if (rth_nthreads != NULL)
    INT(nthreads) = atoi(rth_nthreads);
  else if (omp_nthreads != NULL)
    INT(nthreads) = atoi(omp_nthreads);
  else
    INT(nthreads) = omp_get_max_threads(); // omp_get_max_threads
  #elif RTH_TBB
  if (rth_nthreads != NULL)
    INT(nthreads) = atoi(rth_nthreads);
  else
    INT(nthreads) = tbb::task_scheduler_init::automatic;
  #else
  INT(nthreads) = RTH_ERROR;
  #endif
  
  
  UNPROTECT(1);
  return nthreads;
}
开发者ID:fxcebx,项目名称:Rth,代码行数:28,代码来源:threads.cpp

示例8: _sub

static obj_ptr _sub(obj_ptr args, obj_ptr env)
{
    obj_ptr res = MKINT(0);
    int     ct = 0;

    for (; CONSP(args); args = CDR(args))
    {
        obj_ptr arg = CAR(args);
        ct++;

        if (NINTP(arg) && NFLOATP(arg))
        {
            res = MKERROR(MKSTRING("Expected a number in -"), arg);
            return res;
        }
        else if (ct == 1)
        {
            if (INTP(arg))
                INT(res) = INT(arg);
            else
            {
                res->type = TYPE_FLOAT;
                FLOAT(res) = FLOAT(arg);
            }
        }
        else if (INTP(arg))
        {
            if (FLOATP(res))
                FLOAT(res) -= (double)INT(arg);
            else
                INT(res) -= INT(arg);
        }
        else if (FLOATP(arg))
        {
            if (INTP(res))
            {
                int n = INT(res);
                res->type = TYPE_FLOAT;
                FLOAT(res) = (double)n;

            }
            FLOAT(res) -= FLOAT(arg);
        }
    }

    if (ct == 1)
    {
        if (INTP(res))
            INT(res) *= -1;
        else
            FLOAT(res) *= -1;
    }

    return res;
}
开发者ID:poschengband,项目名称:emrys,代码行数:55,代码来源:c-global-env.c

示例9: Handle

int OCCEdge::createSpline(OCCVertex *start, OCCVertex *end, std::vector<OCCStruct3d> points,
                           double tolerance)
{
    try {
        Standard_Boolean periodic = false;
        Standard_Real tol = tolerance;
        
        int vertices = 0;
        if (start != NULL && end != NULL) {
            vertices = 2;
        }
        
        int nbControlPoints = points.size();
        Handle(TColgp_HArray1OfPnt) ctrlPoints;
        ctrlPoints = new TColgp_HArray1OfPnt(1, nbControlPoints + vertices);
        
        int index = 1;
        
        if (vertices) {
            ctrlPoints->SetValue(index++, gp_Pnt(start->X(), start->Y(), start->Z()));  
        }
        
        for (int i = 0; i < nbControlPoints; i++) {
            gp_Pnt aP(points[i].x,points[i].y,points[i].z);
            ctrlPoints->SetValue(index++, aP);
        }
        
        if (vertices) {
            ctrlPoints->SetValue(index++, gp_Pnt(end->X(), end->Y(), end->Z()));
        }
        
        GeomAPI_Interpolate INT(ctrlPoints, periodic, tol);
        INT.Perform();
        
        Handle(Geom_BSplineCurve) curve = INT.Curve();
        if (vertices) {
            this->setShape(BRepBuilderAPI_MakeEdge(curve, start->vertex, end->vertex));
        } else {
            this->setShape(BRepBuilderAPI_MakeEdge(curve));
        }
    } catch(Standard_Failure &err) {
        Handle_Standard_Failure e = Standard_Failure::Caught();
        const Standard_CString msg = e->GetMessageString();
        if (msg != NULL && strlen(msg) > 1) {
            setErrorMessage(msg);
        } else {
            setErrorMessage("Failed to create spline");
        }
        return 0;
    }
    return 1;
}
开发者ID:erossignon,项目名称:occmodel,代码行数:52,代码来源:OCCEdge.cpp

示例10: XBUtil_GetWide

//-----------------------------------------------------------------------------
// Name: XBUtil_GetWide()
// Desc: Convert CHAR string to WCHAR string. dwMax includes the null byte.
//       Never copies more than dwMax-1 characters into strWide.
//          Ex: GetWide( "abc", strWide, 3 ) gives strWide = "ab"
//       Typical usage:
//          WCHAR strResult[MAX];
//          XBUtil_GetWide( strThin, strResult, MAX );
//-----------------------------------------------------------------------------
VOID XBUtil_GetWide( const CHAR* strThin, WCHAR* strWide, DWORD dwMax )
{
    assert( strThin != NULL );
    assert( strWide != NULL );

    // dwMax includes the null bytes, so must always be at least one.
    // Furthermore, if dwMax is 0, MultiByteToWideChar doesn't do any 
    // conversion, but returns the number of chars it *would* convert.
    assert( dwMax > 0 );

    // Determine how many characters we will convert. Can never be more
    // than dwMax-1
    INT nChars = lstrlenA( strThin );
    if( nChars > INT(dwMax) - 1 )
        nChars = INT(dwMax) - 1;

    // Perform the conversion
    INT iWide = MultiByteToWideChar( CP_ACP, 0, strThin, nChars, 
                                     strWide, dwMax );
    assert( nChars == iWide - 1 );
    (VOID)iWide; // avoid compiler warning in release mode
}
开发者ID:dpaladin,项目名称:openbor,代码行数:31,代码来源:xbutil.cpp

示例11: ASSERT

void CUserProgressDlg::SetProgress(FLOAT value)
{
	ASSERT(value >= 0.0f && value <= 1.0f);
	if (m_progressValue != value)
	{
		m_progressValue = value;
		if (m_progress.m_hWnd != NULL)
		{
			m_progress.SetPos(INT(value * 1000));
			m_progress.Invalidate();
		}
	}
}
开发者ID:KurzedMetal,项目名称:Jaangle,代码行数:13,代码来源:UserProgressDlg.cpp

示例12: MyMessageBox

STATIC NOINLINE INT MyMessageBox(HWND hWnd, LPTSTR lpMessage, LPTSTR lpCaption, UINT uFlags)
{
	STATIC INT(WINAPI* pfnMessageBox)(HWND, LPTSTR, LPTSTR, UINT) = NULL;
	if(pfnMessageBox == NULL) {
		// Load user32.dll
		HMODULE hUser32 = LoadLibraryW(L"user32.dll"); assert(hUser32 != NULL);
		// Grab our MessageBox function
		*((FARPROC*)(&pfnMessageBox)) = GetProcAddress(hUser32, XSTRA(MessageBox));
		assert(pfnMessageBox != NULL);
	}
	// Show message box
	return pfnMessageBox(hWnd, lpMessage, lpCaption, uFlags);
}
开发者ID:juntalis,项目名称:FO4EditUtils,代码行数:13,代码来源:TES5EditStub.c

示例13: match_brace

/* find the matching closed brace. */
SEXP match_brace(SEXP lines, SEXP start, SEXP open_brace, SEXP close_brace) {

int depth = 0, open = 0, line_id = INT(start) - 1;
const char *current = NULL;
const char *op = CHAR(STRING_ELT(open_brace, 0));
const char *cl = CHAR(STRING_ELT(close_brace, 0));
SEXP stop;

  do {

    /* dereference the current line. */
    current = CHAR(STRING_ELT(lines, line_id));

    /* increment the depth counter if an open brace is found. */
    if (strstr(current, op)) {

      /* be sure no to exit from the do-while loop until an open curly brace
       * has been spotted. */
      open = 1;
      depth++;

    }/*THEN*/
    /* decrement the depth counter if a closed brace is found. */
    if (strstr(current, cl))
      depth--;

    /* increment the line id. */
    line_id++;

  } while ((depth > 0) || (open == 0));

  /* allocate and assing the return value. */
  PROTECT(stop = allocVector(INTSXP, 1));
  INT(stop) = line_id;
  UNPROTECT(1);

return stop;

}/*MATCH_BRACE*/
开发者ID:gasse,项目名称:bnlearn-clone-3.0,代码行数:40,代码来源:parse.c

示例14: Metabolize

 void Metabolize (const Protein &p)
 {   INFORM (p);
     INFORM ("image-request protein received, responding...");
     ImageData *tex = FetchImageData ("images/"
                                      + INT ((page++) % 6 + 1) + ".jpg");
     if (tex)
     {   Protein response = ProteinWithDescrip ("image-result");
         AppendIngest  (response, "image-texture", tex);
         Deposit (response, poolname);
     }
     else
         WARN ("Couldn't send response because we failed to load an image.");
 }
开发者ID:kjhollen,项目名称:greenhouse-samples,代码行数:13,代码来源:imago-worker.C

示例15: _div

static obj_ptr _div(obj_ptr args, obj_ptr env)
{
    obj_ptr res = MKFLOAT(0);
    int     ct = 0;

    for (; CONSP(args); args = CDR(args))
    {
        obj_ptr arg = CAR(args);
        ct++;

        if (NINTP(arg) && NFLOATP(arg))
        {
            res = MKERROR(MKSTRING("Expected a number in /"), arg);
            return res;
        }
        else if (ct == 1)
        {
            if (INTP(arg))
                FLOAT(res) = (double)INT(arg);
            else
                FLOAT(res) = FLOAT(arg);
        }
        else if (INTP(arg))
        {
            FLOAT(res) /= (double)INT(arg);
        }
        else if (FLOATP(arg))
        {
            FLOAT(res) /= FLOAT(arg);
        }
    }

    if (ct == 1)
    {
        FLOAT(res) = 1 / FLOAT(res);
    }

    return res;
}
开发者ID:poschengband,项目名称:emrys,代码行数:39,代码来源:c-global-env.c


注:本文中的INT函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。