您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ Area函数代码示例

51自学网 2021-06-01 19:47:27
  C++
这篇教程C++ Area函数代码示例写得很实用,希望能帮到您。

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

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

示例1: ADDTOCALLSTACK

//.........这里部分代码省略.........									{										g_Log.EventDebug("Failed to get non-parent reference (multi) (DispID 0%x) (X: %d Y: %d Z: %d)/n",pMultiItem->GetDispID(),pMultiItem->m_dx+pItem->GetTopPoint().m_x,pMultiItem->m_dy+pItem->GetTopPoint().m_y,pMultiItem->m_dz+pItem->GetTopPoint().m_z);										zHeight = pItemDef->GetHeight();										wBlockThis = ( pItemDef->m_Can & CAN_I_MOVEMASK );									}									else									{										zHeight = pDupeDef->GetHeight();										wBlockThis = ( pDupeDef->m_Can & CAN_I_MOVEMASK ); //Use only Block flags, other remove - CAN flags cannot be inherited from the parent item due to bad script pack...									}								}							}							else if ( pMultiItem->GetDispID() )								CItemBase::GetItemTiledataFlags(wBlockThis,pMultiItem->GetDispID());							block.CheckTile_Item( wBlockThis, z, zHeight, pMultiItem->GetDispID() + TERRAIN_QTY );						}					}				}			}		}	}	pItemDef = NULL;	pDupeDef = NULL;	pItem = NULL;	wBlockThis = 0;	x2 = y2 = iQty = 0;	zHeight = 0;	z = 0;	// Any dynamic items here ?	// NOTE: This could just be an item that an NPC could just move ?	CWorldSearch Area( pt );	for (;;)	{		pItem = Area.GetItem();		if ( !pItem )			break;		z = pItem->GetTopZ();		if ( !block.IsUsableZ( z, block.m_zHeight ) )			continue;		// Invis items should not block ???		pItemDef = CItemBase::FindItemBase( pItem->GetDispID() );		if ( pItemDef )		{			if ( pItemDef->GetDispID() == pItem->GetDispID() )//parent item			{				zHeight = pItemDef->GetHeight();				wBlockThis = ( pItemDef->m_Can & CAN_I_MOVEMASK ); //Use only Block flags, other remove			}			else //non-parent item			{				pDupeDef = CItemBaseDupe::GetDupeRef(static_cast<ITEMID_TYPE>(pItem->GetDispID()));				if ( ! pDupeDef )				{					g_Log.EventDebug("Failed to get non-parent reference (dynamic) (DispID 0%x) (X: %d Y: %d Z: %d)/n",pItem->GetDispID(),pItem->GetTopPoint().m_x,pItem->GetTopPoint().m_y,pItem->GetTopPoint().m_z);					zHeight = pItemDef->GetHeight();					wBlockThis = ( pItemDef->m_Can & CAN_I_MOVEMASK );				}				else				{
开发者ID:leandrorenato,项目名称:Source,代码行数:67,


示例2: Process

bool HSTriangular::Process( const HSVector2dV &contour,HSVector2dV &outResult ){	/* allocate and initialize list of Vertices in polygon */		int n = contour.size();	if ( n < 3 ) return false;		int *V = new int[n];		/* we want a counter-clockwise polygon in V */		if ( 0.0f < Area(contour) )		for (int v=0; v<n; v++) V[v] = v;	else		for(int v=0; v<n; v++) V[v] = (n-1)-v;		int nv = n;		/*  remove nv-2 Vertices, creating 1 triangle every time */	int count = 2*nv;   /* error detection */		for(int m=0, v=nv-1; nv>2; )	{		/* if we loop, it is probably a non-simple polygon */		if (0 >= (count--))		{			//** Triangulate: ERROR - probable bad polygon!			return false;		}				/* three consecutive vertices in current polygon, <u,v,w> */		int u = v  ; if (nv <= u) u = 0;     /* previous */		v = u+1; if (nv <= v) v = 0;     /* new v    */		int w = v+1; if (nv <= w) w = 0;     /* next     */				if ( Snip(contour,u,v,w,nv,V) )		{			int a,b,c,s,t;						/* true names of the vertices */			a = V[u]; b = V[v]; c = V[w];						/* output Triangle */			outResult.push_back( contour[a] );			outResult.push_back( contour[b] );			outResult.push_back( contour[c] );						m++;						/* remove v from remaining polygon */			for(s=v,t=v+1;t<nv;s++,t++) V[s] = V[t]; nv--;						/* resest error detection counter */			count = 2*nv;		}	}	delete V;		return true;}
开发者ID:wanggan768q,项目名称:GameWork,代码行数:61,


示例3: Area

Area Area::getOffset( const Vec2i &offset ) const{	return Area( x1 + offset.x, y1 + offset.y, x2 + offset.x, y2 + offset.y );}
开发者ID:timmb,项目名称:HarmonicMotion,代码行数:4,


示例4: Area

Area BoundProcessor::resultArea() const{  return Area();}
开发者ID:SidneyTTW,项目名称:ImageProcessor,代码行数:4,


示例5: InRadius

 /// radius of its inscribed circle double Triangle::InRadius() const {     // r = 2*area/perimeter     return 2*Area()/Perimeter(); }
开发者ID:yantongl,项目名称:ytlib,代码行数:6,


示例6: InitTriangles

int InitTriangles(XParms xp, Parms p, int reps){    int     i, j, numPoints;    int     rows;    int     x, y;    int     size, iradius;    double  phi, phiinc, radius, delta, phi2, area, aarea;    XPoint  *curPoint;    pgc = xp->fggc;    size = p->special;    phi = 0.0;    delta = 2.0 * PI / ((double) NUM_POINTS);    if (xp->version == VERSION1_2) {	radius = ((double) size) * sqrt(3.0)/2.0;	phiinc = delta/10.0;    } else {	/* Version 1.2's radius computation was completely bogus, and resulted	   in triangles with sides about 50% longer than advertised.  However,	   this inadvertently resulted in triangles with areas just a little bit	   smaller than the triangle that covers size^2 pixels, which would	   make the area directly comparable to 10x10 rectangles and 10x10	   trapezoids.  So here's the new computation so -triangleN has the same	   area as -rectN.	 */	radius = ((double) size) * sqrt(sqrt(16.0/27.0));	phiinc = 1.75*PI / ((double) p->objects);    }    iradius = (int) (radius + 0.5);    numPoints = (p->objects) * NUM_POINTS;      points = (XPoint *)malloc(numPoints * sizeof(XPoint));    curPoint = points;    x = iradius;    y = iradius;    rows = 0;    aarea = 0.0;    for (i = 0; i != p->objects; i++) {	for (j = 0; j != NUM_POINTS; j++) {	    phi2 = phi + ((double) j) * delta;	    curPoint->x = (int) ((double)x + (radius * cos(phi2)) + 0.5);	    curPoint->y = (int) ((double)y + (radius * sin(phi2)) + 0.5);	    curPoint++;	}	area = Area(curPoint[-1], curPoint[-2], curPoint[-3]);	aarea += area;/*	printf("%6.1lf %6.1lf %6.1lf   %6.1lf/n",	    Distance(curPoint[-1], curPoint[-2]),	    Distance(curPoint[-1], curPoint[-3]),	    Distance(curPoint[-2], curPoint[-3]),	    area);*/		phi += phiinc;	y += 2 * iradius;	rows++;	if (y + iradius > HEIGHT || rows == MAXROWS) {	    rows = 0;	    y = iradius;	    x += 2 * iradius;	    if (x + iradius > WIDTH) {		x = iradius;	    }	}    }/*    printf("Average area = %6.2lf/n", aarea/p->objects); */    SetFillStyle(xp, p);    return reps;}
开发者ID:Bluerise,项目名称:bitrig-xenocara,代码行数:73,


示例7: Area

bool Polygon::IsDegenerate(float epsilon) const{    return p.size() < 3 || Area() <= epsilon;}
开发者ID:katik,项目名称:naali,代码行数:4,


示例8: area_tet

double area_tet(tetrahedron T){    double area = 0;    for(int i=0; i<4; i++) area = area + Area(Side(T,i));    return area;}
开发者ID:jgsiqueira,项目名称:usefulsourcecodes,代码行数:6,


示例9: SCOPE_CYCLE_COUNTER

void USceneCapturer::CaptureComponent( int32 CurrentHorizontalStep, int32 CurrentVerticalStep, FString Folder, USceneCaptureComponent2D* CaptureComponent, TArray<FColor>& Atlas ){	TArray<FColor> SurfaceData;	{		SCOPE_CYCLE_COUNTER( STAT_SPReadStrip );		FTextureRenderTargetResource* RenderTarget = CaptureComponent->TextureTarget->GameThread_GetRenderTargetResource();		//TODO: ikrimae: Might need to validate that this divides evenly. Might not matter		int32 CenterX = CaptureWidth / 2;		int32 CenterY = CaptureHeight / 2;		SurfaceData.AddUninitialized( StripWidth * StripHeight );		// Read pixels		FIntRect Area( CenterX - ( StripWidth / 2 ), CenterY - ( StripHeight / 2 ), CenterX + ( StripWidth / 2 ), CenterY + ( StripHeight / 2) );        auto readSurfaceDataFlags = FReadSurfaceDataFlags();        readSurfaceDataFlags.SetLinearToGamma(false);		RenderTarget->ReadPixelsPtr( SurfaceData.GetData(), readSurfaceDataFlags, Area );	}	// Copy off strip to atlas texture	CopyToUnprojAtlas( CurrentHorizontalStep, CurrentVerticalStep, Atlas, SurfaceData );	if( FStereoPanoramaManager::GenerateDebugImages->GetInt() != 0 )	{		SCOPE_CYCLE_COUNTER( STAT_SPSavePNG );		// Generate name		FString TickString = FString::Printf( TEXT( "_%05d_%04d_%04d" ), CurrentFrameCount, CurrentHorizontalStep, CurrentVerticalStep );		FString CaptureName = OutputDir / Timestamp / Folder / TickString + TEXT( ".png" );		UE_LOG( LogStereoPanorama, Log, TEXT( "Writing snapshot: %s" ), *CaptureName );		// Write out PNG        if (FStereoPanoramaManager::GenerateDebugImages->GetInt() == 2)        {            //Read Whole Capture Buffer		    IImageWrapperPtr ImageWrapper = ImageWrapperModule.CreateImageWrapper( EImageFormat::PNG );            TArray<FColor> SurfaceDataWhole;            SurfaceDataWhole.AddUninitialized(CaptureWidth * CaptureHeight);            // Read pixels            FTextureRenderTargetResource* RenderTarget = CaptureComponent->TextureTarget->GameThread_GetRenderTargetResource();            RenderTarget->ReadPixelsPtr(SurfaceDataWhole.GetData(), FReadSurfaceDataFlags());            // Force alpha value            if (bForceAlpha)            {                for (FColor& Color : SurfaceDataWhole)                {                    Color.A = 255;                }            }            ImageWrapper->SetRaw(SurfaceDataWhole.GetData(), SurfaceDataWhole.GetAllocatedSize(), CaptureWidth, CaptureHeight, ERGBFormat::BGRA, 8);            const TArray<uint8>& PNGData = ImageWrapper->GetCompressed(100);            FFileHelper::SaveArrayToFile(PNGData, *CaptureName);            ImageWrapper.Reset();        }        else        {            if (bForceAlpha)            {                for (FColor& Color : SurfaceData)                {                    Color.A = 255;                }            }            IImageWrapperPtr ImageWrapper = ImageWrapperModule.CreateImageWrapper(EImageFormat::PNG);            ImageWrapper->SetRaw(SurfaceData.GetData(), SurfaceData.GetAllocatedSize(), StripWidth, StripHeight, ERGBFormat::BGRA, 8);		    const TArray<uint8>& PNGData = ImageWrapper->GetCompressed(100);		    FFileHelper::SaveArrayToFile( PNGData, *CaptureName );		    ImageWrapper.Reset();	    }    }}
开发者ID:zhaoyizheng0930,项目名称:UnrealEngine,代码行数:79,


示例10: Area

void PlayerShip::draw(){    cinder::gl::draw( shipTexture, Area(Vec2f(SIZE*(floor(tween)+FRAMENO), 0), Vec2f(SIZE*(floor(tween)+FRAMENO) + SIZE, SIZE)), Rectf(mMouseLoc - Vec2f(SIZE/2,0), mMouseLoc + Vec2f(SIZE/2,SIZE)) );        pg.draw();}
开发者ID:pords,项目名称:FinalProject,代码行数:6,


示例11: ShowCircle

		void ShowCircle( )		{				ShowPoint( );                   // F				cout<<" Radius: "<<r<<'/t';				cout<<"Area: "<<Area( )<<endl;    //G		}
开发者ID:JohnnySun,项目名称:CPP-Study,代码行数:6,


示例12: Circumference

string Circle::ToString() const {    stringstream circleStream; // Start reading input into a stringstream    // EDIT: Added the ToString() function of the Shape class to display the ID as well.    circleStream << Shape::ToString() << ": Circle with Center at " << centre.ToString() << " and Radius = "                 << radius << "/nCircumference: " << Circumference() << "/nArea: " << Area(); // Add string to circleStream    return(circleStream.str()); // Output the string using the str() member function}
开发者ID:mistletoe999,项目名称:cpp-samples,代码行数:7,


示例13: logTraceInWith2Arguments

int peanoclaw::Area::getAreasOverlappedByRemoteGhostlayers(  const tarch::la::Vector<THREE_POWER_D_MINUS_ONE, int>& adjacentRanks,  tarch::la::Vector<THREE_POWER_D_MINUS_ONE, int>        overlapOfRemoteGhostlayers,  const tarch::la::Vector<DIMENSIONS, int>&              subdivisionFactor,  int                                                    rank,  Area                                                   areas[THREE_POWER_D_MINUS_ONE]) {  logTraceInWith2Arguments("getAreasOverlappedByRemoteGhostlayers(...)", adjacentRanks, overlapOfRemoteGhostlayers);  int  numberOfAreas = 0;  bool oneAreaCoversCompleteSubgrid = false;  for(int dimensionality = 0; dimensionality < DIMENSIONS; dimensionality++) {    int numberOfManifolds = getNumberOfManifolds(dimensionality);    for(int manifoldIndex = 0; manifoldIndex < numberOfManifolds; manifoldIndex++) {      tarch::la::Vector<DIMENSIONS, int> manifoldPosition = getManifold(dimensionality, manifoldIndex);      int manifoldEntry = linearizeManifoldPosition(manifoldPosition);      logDebug("getAreasOverlappedByRemoteGhostlayers(...)", "Manifold " << manifoldPosition << " of dimensions " << dimensionality          << ": entry=" << manifoldEntry << ", rank=" << adjacentRanks[manifoldEntry] << ", overlap=" << overlapOfRemoteGhostlayers[manifoldEntry]);      if(adjacentRanks[manifoldEntry] == rank && overlapOfRemoteGhostlayers[manifoldEntry] > 0) {        //Reduce lower-dimensional manifolds        bool canBeOmitted = checkHigherDimensionalManifoldForOverlap(          adjacentRanks,          overlapOfRemoteGhostlayers,          manifoldPosition,          dimensionality,          manifoldEntry,          rank        );        //Restrict size and offset by higher-dimensional manifolds        logDebug("getAreasOverlappedByRemoteGhostlayers(...)","Testing manifold " << manifoldPosition << " of dimensions " << dimensionality            << ": " << (canBeOmitted ? "omitting" : "consider"));        if(!canBeOmitted) {          tarch::la::Vector<DIMENSIONS, int> size;          tarch::la::Vector<DIMENSIONS, int> offset;          //Initialise size and offset          for(int d = 0; d < DIMENSIONS; d++) {            size(d) = (manifoldPosition(d) == 0) ? subdivisionFactor(d) : std::min(subdivisionFactor(d), overlapOfRemoteGhostlayers[manifoldEntry]);            offset(d) = (manifoldPosition(d) == 1) ? subdivisionFactor(d) - size(d) : 0;          }          //TODO unterweg debug//          std::cout << "offset: " << offset << ", size: " << size << std::endl;          for(int adjacentDimensionality = dimensionality - 1; adjacentDimensionality >= 0; adjacentDimensionality--) {            int numberOfAdjacentManifolds = getNumberOfAdjacentManifolds(manifoldPosition, dimensionality, adjacentDimensionality);            for(int adjacentManifoldIndex = 0; adjacentManifoldIndex < numberOfAdjacentManifolds; adjacentManifoldIndex++) {              tarch::la::Vector<DIMENSIONS, int> adjacentManifoldPosition = getIndexOfAdjacentManifold(                manifoldPosition,                dimensionality,                adjacentDimensionality,                adjacentManifoldIndex              );              //TODO unterweg debug//              std::cout << "adj. manifold " << adjacentManifoldPosition << std::endl;              int adjacentEntry = linearizeManifoldPosition(adjacentManifoldPosition);              if(adjacentRanks[adjacentEntry] == rank) {                for(int d = 0; d < DIMENSIONS; d++) {                  if(manifoldPosition(d) == 0) {                    if(adjacentManifoldPosition(d) < 0) {                      int overlap = std::max(0, overlapOfRemoteGhostlayers[adjacentEntry] - offset(d));                      offset(d) += overlap;                      size(d) -= overlap;                      //TODO unterweg debug//                      std::cout << "Reducing bottom " << overlap << std::endl;                    } else if(adjacentManifoldPosition(d) > 0) {                      assertion2(adjacentManifoldPosition(d) > 0, adjacentManifoldPosition, d);                      int overlap = std::max(0, offset(d) + size(d) - (subdivisionFactor(d) - overlapOfRemoteGhostlayers[adjacentEntry]));                      size(d) -= overlap;                      //TODO unterweg debug//                      std::cout << "Reducing top " << overlap << std::endl;                    }                  }                }              }            }          }          logDebug("getAreasOverlappedByRemoteGhostlayers(...)", "offset: " << offset << ", size: " << size << ", dimensionality=" << dimensionality << ", manifoldIndex=" << manifoldIndex << ", manifoldEntry=" << manifoldEntry);          if(tarch::la::allGreater(size, 0)) {            areas[numberOfAreas++] = Area(offset, size);            oneAreaCoversCompleteSubgrid |= (tarch::la::volume(size) >= tarch::la::volume(subdivisionFactor));            assertion1(tarch::la::allGreaterEquals(offset, 0), offset);            assertion3(tarch::la::allGreaterEquals(subdivisionFactor, offset + size), offset, size, subdivisionFactor);          }        }      }    }  }//.........这里部分代码省略.........
开发者ID:linuxcommando,项目名称:peanoclaw,代码行数:101,


示例14: defined

bool Triangulate::Process(const Vector2dVector &contour,Vector2dVector &result){#if defined(PRECISE_TRIANGULATION)    std::vector<p2t::Point*> _polyline;    for (auto _p : contour){        _polyline.push_back(new p2t::Point(_p.GetX(), _p.GetY()));    }    p2t::CDT* _cdt = new p2t::CDT(_polyline);    _cdt->Triangulate();    std::vector<p2t::Triangle*> _triangles = _cdt->GetTriangles();    for (auto _t : _triangles){        auto _pt1 = _t->GetPoint(0);        auto _pt2 = _t->GetPoint(1);        auto _pt3 = _t->GetPoint(2);        result.push_back(Vector2d(_pt1->x, _pt1->y));        result.push_back(Vector2d(_pt2->x, _pt2->y));        result.push_back(Vector2d(_pt3->x, _pt3->y));    }    delete _cdt;    for (auto _p : _polyline)        delete _p;    return true;#else    /* allocate and initialize list of Vertices in polygon */        int n = (int)contour.size();    if ( n < 3 ) return false;        int *V = new int[n];        /* we want a counter-clockwise polygon in V */        if ( 0.0f < Area(contour) )        for (int v=0; v<n; v++) V[v] = v;    else        for(int v=0; v<n; v++) V[v] = (n-1)-v;        int nv = n;        /*  remove nv-2 Vertices, creating 1 triangle every time */    int count = 2*nv;   /* error detection */        for(int m=0, v=nv-1; nv>2; )    {        /* if we loop, it is probably a non-simple polygon */        if (0 >= (count--))        {            //** Triangulate: ERROR - probable bad polygon!            return false;        }                /* three consecutive vertices in current polygon, <u,v,w> */        int u = v  ; if (nv <= u) u = 0;     /* previous */        v = u+1; if (nv <= v) v = 0;     /* new v    */        int w = v+1; if (nv <= w) w = 0;     /* next     */                if ( Snip(contour,u,v,w,nv,V) )        {            int a,b,c,s,t;                        /* true names of the vertices */            a = V[u]; b = V[v]; c = V[w];                        /* output Triangle */            result.push_back( contour[a] );            result.push_back( contour[b] );            result.push_back( contour[c] );                        m++;                        /* remove v from remaining polygon */            for(s=v,t=v+1;t<nv;s++,t++) V[s] = V[t]; nv--;                        /* resest error detection counter */            count = 2*nv;        }    }        //Danilo S Carvalho Alteration from delete to delete[]    delete[] V;        return true;#endif}
开发者ID:danskcarvalho,项目名称:rolltheball,代码行数:84,


示例15: controller

voidBorderResizer::Wrap(){	auto& controller(widget.get().GetController());	yunseq(	FetchEvent<TouchDown>(controller).Add([this](CursorEventArgs&& e){		yunseq(orig_loc = FetchGUIState().CursorLocation,			locked_bounds = GetBoundsOf(widget), focused = CheckArea(e));	}, 0xE0),	FetchEvent<TouchHeld>(controller).Add([this](CursorEventArgs&& e){		if(e.Strategy == RoutedEventArgs::Direct			&& focused != Area(BorderArea::Center, BorderArea::Center))		{			auto& st(FetchGUIState());			if(st.CheckDraggingOffset())			{				const auto offset(st.CursorLocation - orig_loc);				auto bounds(locked_bounds);				switch(focused.first)				{				case BorderArea::Left:					bounds.Width = max<SPos>(MinSize.Width,						locked_bounds.Width - offset.X);					bounds.X += locked_bounds.Width - bounds.Width;					break;				case BorderArea::Right:					bounds.Width = max<SPos>(MinSize.Width,						locked_bounds.Width + offset.X);					break;				default:					;				}				switch(focused.second)				{				case BorderArea::Up:					bounds.Height = max<SPos>(MinSize.Height,						locked_bounds.Height - offset.Y);					bounds.Y += locked_bounds.Height - bounds.Height;					break;				case BorderArea::Down:					bounds.Height = max<SPos>(MinSize.Height,						locked_bounds.Height + offset.Y);					break;				default:					;				}				YTraceDe(Notice, "BorderResizer: new bounds = %s./n",					to_string(bounds).c_str());				InvalidateParent(widget);				if(HostMode)				{					const auto& off(						bounds.GetPoint() - locked_bounds.GetPoint());					SetBoundsOf(widget, bounds);					const auto& nloc(FetchGUIState().CursorLocation - off);					if(bounds.Width != MinSize.Width)						orig_loc.X = nloc.X;					if(bounds.Height != MinSize.Height)						orig_loc.Y = nloc.Y;					locked_bounds = GetBoundsOf(widget);					locked_bounds.GetPointRef() -= off;				}				else					SetBoundsOf(widget, bounds);			}			e.Handled = true;			// XXX: Paint context target invalidated.		}	}, 0xE0),	FetchEvent<Click>(controller).Add([this](CursorEventArgs&& e){		CallEvent<ClickAcross>(widget, e);	}, 0xE0),	FetchEvent<ClickAcross>(controller).Add([this](CursorEventArgs&&){		yunseq(orig_loc = Point::Invalid, locked_bounds = Rect(),			focused = {BorderArea::Center, BorderArea::Center});	}, 0xE0)	);}
开发者ID:kis2009dsh,项目名称:YSLib,代码行数:87,


示例16: C4ValueArray

// return is to be freed by the callerC4ValueArray *C4FindObject::FindMany(const C4ObjectList &Objs, const C4LSectors &Sct){	// Trivial case	if (IsImpossible())		return new C4ValueArray();	C4Rect *pBounds = GetBounds();	if (!pBounds)		return FindMany(Objs);	// Prepare for array that may be generated	C4ValueArray *pArray; int32_t iSize;	// Check shape lists?	if (UseShapes())	{		// Get area		C4LArea Area(&::Objects.Sectors, *pBounds); C4LSector *pSct;		C4ObjectList *pLst = Area.FirstObjectShapes(&pSct);		// Check if a single-sector check is enough		if (!Area.Next(pSct))			return FindMany(pSct->ObjectShapes);		// Set up array		pArray = new C4ValueArray(32); iSize = 0;		// Create marker, search all areas		uint32_t iMarker = ::Objects.GetNextMarker();		for (; pLst; pLst=Area.NextObjectShapes(pLst, &pSct))			for (C4Object *obj : *pLst)				if (obj->Status)					if (obj->Marker != iMarker)					{						obj->Marker = iMarker;						if (Check(obj))						{							// Grow the array, if neccessary							if (iSize >= pArray->GetSize())								pArray->SetSize(iSize * 2);							// Add object							(*pArray)[iSize++] = C4VObj(obj);						}					}	}	else	{		// Set up array		pArray = new C4ValueArray(32); iSize = 0;		// Search		C4LArea Area(&::Objects.Sectors, *pBounds); C4LSector *pSct;		for (C4ObjectList *pLst=Area.FirstObjects(&pSct); pLst; pLst=Area.NextObjects(pLst, &pSct))			for (C4Object *obj : *pLst)				if (obj->Status)					if (Check(obj))					{						// Grow the array, if neccessary						if (iSize >= pArray->GetSize())							pArray->SetSize(iSize * 2);						// Add object						(*pArray)[iSize++] = C4VObj(obj);					}	}	// Shrink array	pArray->SetSize(iSize);	// Recheck object status (may shrink array again)	CheckObjectStatus(pArray);	// Apply sorting	if (pSort) pSort->SortObjects(pArray);	return pArray;}
开发者ID:772,项目名称:openclonk,代码行数:66,


示例17: f

void HalfEdgeMesh::Update() {  // Calculate and store all differentials and area  // First update all face normals and triangle areas  for(unsigned int i = 0; i < GetNumFaces(); i++){    f(i).normal = FaceNormal(i);  }  // Then update all vertex normals and curvature  for(unsigned int i = 0; i < GetNumVerts(); i++){    // Vertex normals are just weighted averages    mVerts.at(i).normal = VertexNormal(i);  }  // Then update vertex curvature  for(unsigned int i = 0; i < GetNumVerts(); i++){    mVerts.at(i).curvature = VertexCurvature(i);    //    std::cerr <<   mVerts.at(i).curvature << "/n";  }  // Finally update face curvature  for(unsigned int i = 0; i < GetNumFaces(); i++){    f(i).curvature = FaceCurvature(i);  }  std::cerr << "Area: " << Area() << "./n";  std::cerr << "Volume: " << Volume() << "./n";  // Update vertex and face colors  if (mVisualizationMode == CurvatureVertex) {    std::vector<Vertex>::iterator iter = mVerts.begin();    std::vector<Vertex>::iterator iend = mVerts.end();    float minCurvature = (std::numeric_limits<float>::max)();    float maxCurvature = -(std::numeric_limits<float>::max)();    while (iter != iend) {      if (minCurvature > (*iter).curvature)  minCurvature = (*iter).curvature;      if (maxCurvature < (*iter).curvature)  maxCurvature = (*iter).curvature;      iter++;    }    std::cerr << "Mapping color based on vertex curvature with range [" << minCurvature << "," << maxCurvature << "]" << std::endl;    iter = mVerts.begin();    while (iter != iend) {      (*iter).color = mColorMap->Map((*iter).curvature, minCurvature, maxCurvature);      iter++;    }  }  else if (mVisualizationMode == CurvatureFace) {    std::vector<Face>::iterator iter = mFaces.begin();    std::vector<Face>::iterator iend = mFaces.end();    float minCurvature = (std::numeric_limits<float>::max)();    float maxCurvature = -(std::numeric_limits<float>::max)();    while (iter != iend) {      if (minCurvature > (*iter).curvature)  minCurvature = (*iter).curvature;      if (maxCurvature < (*iter).curvature)  maxCurvature = (*iter).curvature;      iter++;    }    std::cerr << "Mapping color based on face curvature with range [" << minCurvature << "," << maxCurvature << "]" << std::endl;    iter = mFaces.begin();    while (iter != iend) {      (*iter).color = mColorMap->Map((*iter).curvature, minCurvature, maxCurvature);      iter++;    }  }}
开发者ID:jonathanbosson,项目名称:TNM079,代码行数:64,


示例18: Area

double Clipping::Area(const vector<ExPoly> &expolys){  double a=0;  for (uint i=0; i<expolys.size(); i++)    a += Area(expolys[i]);  return a;}
开发者ID:Funny-DK,项目名称:repsnapper,代码行数:6,


示例19: addArea

void SensitiveAreas::addArea(const Point & point, const Dimension & dimension) {	areas.push_back(Area(point, dimension));}
开发者ID:Ponup,项目名称:engine-desktop,代码行数:3,


示例20: Area

Area Gate::getArea() {    return Area();}
开发者ID:Natsirtt,项目名称:get-the-cheese-gen,代码行数:3,


示例21: LBASSERT

bool ROITracker::useROIFinder( const PixelViewport& pvp,                               const uint32_t       stage,                               const uint128_t&     frameID,                                     uint8_t*&      ticket ){    LBASSERT( !_needsUpdate );    ticket = 0;    const uint32_t pvpArea = pvp.getArea();    if( pvpArea < 100 )        return false;    if( _lastFrameID != frameID ) // new frame    {        stde::hash_map< uint32_t, Stage >* tmp = _prvFrame;        _prvFrame = _curFrame;        _curFrame = tmp;        _curFrame->clear();        _lastFrameID = frameID;    }    _lastStage = stage;    Stage& curStage = (*_curFrame)[ stage ];    // check if proper stage is avaliable    if( _prvFrame->find( stage ) == _prvFrame->end( )) // new stage    {        curStage.areas.push_back( Area( pvp ));        return _returnPositive( ticket );    }    //else existing stage, try to find matching area    const Area*    match     = 0;          uint32_t bestArea  = 0;    const Stage&   prvStage  = (*_prvFrame)[ stage ];    for( uint32_t i = 0; i < prvStage.areas.size(); i++ )    {        PixelViewport tmp = prvStage.areas[i].pvp;        tmp.intersect( pvp );        const uint32_t area = tmp.getArea();        if( area > bestArea )        {            bestArea = area;            match    = &prvStage.areas[i];            if( area == pvpArea ) // full match                break;        }    }    if( bestArea < pvpArea*2/3 ) // no proper match found, new area    {        curStage.areas.push_back( Area( pvp ));        return _returnPositive( ticket );    }    // else good match    if( match->skip == 0 ) // don't skip frame    {        curStage.areas.push_back( Area( pvp, match->lastSkip ));        return _returnPositive( ticket );    }    //else skip frame    curStage.areas.push_back( Area( pvp, match->lastSkip, match->skip-1 ));    return false;}
开发者ID:Angels-group,项目名称:Equalizer,代码行数:67,


示例22: Perimetre

void Circle::Print(){	cout << "Circle Perimetur: " << Perimetre()		<< "Lice: " << Area() << endl;}
开发者ID:GorinT,项目名称:OOP-exams-and-homeworks,代码行数:4,


示例23: QImage

QImage *BoundProcessor::processImage(const QImage& image) const{  QImage *result = new QImage(image.width(), image.height(), QImage::Format_ARGB32);  result->fill(qRgb(0, 0, 0));  QImage *boundImage;  if (type.testFlag(UpDown))  {    ImageAlgorithm::ConvolutionFilter *filter =        new ImageAlgorithm::ConvolutionFilter(UpDownConvolutionCore,                                              3,                                              3,                                              1,                                              0);    boundImage = ImageAlgorithm::filtImage<ImageAlgorithm::ConvolutionFilter>(image, Area(), filter);    delete filter;    if (boundImage)    {      ImageAlgorithm::algebraOperation(result, *boundImage, ImageAlgorithm::Add);      delete boundImage;    }  }  if (type.testFlag(DownUp))  {    ImageAlgorithm::ConvolutionFilter *filter =        new ImageAlgorithm::ConvolutionFilter(DownUpConvolutionCore,                                              3,                                              3,                                              1,                                              0);    boundImage = ImageAlgorithm::filtImage<ImageAlgorithm::ConvolutionFilter>(image, Area(), filter);    delete filter;    if (boundImage)    {      ImageAlgorithm::algebraOperation(result, *boundImage, ImageAlgorithm::Add);      delete boundImage;    }  }  if (type.testFlag(LeftRight))  {    ImageAlgorithm::ConvolutionFilter *filter =        new ImageAlgorithm::ConvolutionFilter(LeftRightConvolutionCore,                                              3,                                              3,                                              1,                                              0);    boundImage = ImageAlgorithm::filtImage<ImageAlgorithm::ConvolutionFilter>(image, Area(), filter);    delete filter;    if (boundImage)    {      ImageAlgorithm::algebraOperation(result, *boundImage, ImageAlgorithm::Add);      delete boundImage;    }  }  if (type.testFlag(RightLeft))  {    ImageAlgorithm::ConvolutionFilter *filter =        new ImageAlgorithm::ConvolutionFilter(RightLeftConvolutionCore,                                              3,                                              3,                                              1,                                              0);    boundImage = ImageAlgorithm::filtImage<ImageAlgorithm::ConvolutionFilter>(image, Area(), filter);    delete filter;    if (boundImage)    {      ImageAlgorithm::algebraOperation(result, *boundImage, ImageAlgorithm::Add);      delete boundImage;    }  }  return result;}
开发者ID:SidneyTTW,项目名称:ImageProcessor,代码行数:71,


示例24: Matrix

//.........这里部分代码省略.........		}		offset /= scalex;		bool bClosed = Closed();		int nspans = nSpans();		if(bClosed) {			Get(nspans, curSpan, true);						// assign previus span for closed			prevSpanOff = curSpan.Offset(offset);			nspans++; // read first again		}		for(int spannumber = 1; spannumber <= nspans; spannumber++) {			if(spannumber > nSpans())				Get(1, curSpan, true);						// closed kurve - read first span again			else				Get(spannumber, curSpan, true);			if(!curSpan.NullSpan) {				int numint = 0;				curSpanOff = curSpan.Offset(offset);				curSpanOff.ID = 0;				if(!kOffset.m_started) {					kOffset.Start(curSpanOff.p0);					kOffset.AddSpanID(0);				}				if(spannumber > 1) {					// see if tangent					double d = curSpanOff.p0.Dist(prevSpanOff.p1);					if((d > geoff_geometry::TOLERANCE) && (curSpanOff.NullSpan == false && prevSpanOff.NullSpan == false)) {						// see if offset spans intersect						double cp = prevSpanOff.ve ^ curSpanOff.vs;						bool inters = (cp > 0 && direction == GEOFF_LEFT) || (cp < 0 && direction == GEOFF_RIGHT);						if(inters) {							double t[4];							numint = prevSpanOff.Intof(curSpanOff, p0, p1, t);						}						if(numint == 1) {							// intersection - modify previous endpoint							kOffset.Replace(kOffset.m_nVertices-1, prevSpanOff.dir, p0, prevSpanOff.pc, prevSpanOff.ID);						}						else {							// 0 or 2 intersections, add roll around (remove -ve loops in elimination function)							if(kOffset.Add(RollDir, curSpanOff.p0, curSpan.p0, false))	kOffset.AddSpanID(ROLL_AROUND);						}					}				}				// add span				if(spannumber < m_nVertices) {					curSpanOff.ID = spannumber;					kOffset.Add(curSpanOff, false);				}				else if(numint == 1)		// or replace the closed first span					kOffset.Replace(0, 0, p0, Point(0, 0), 0);			}			if(!curSpanOff.NullSpan)prevSpanOff = curSpanOff;		}		// end of main pre-offsetting loop#ifdef _DEBUG//testDraw->AddKurve("", &kOffset, 0, GREEN);//		outXML oxml(L"c://temp//eliminateLoops.xml");//		oxml.startElement(L"eliminateLoops");//		oxml.Write(kOffset, L"kOffset");//		oxml.endElement();#endif		// eliminate loops		if(method == NO_ELIMINATION) {			ret = 0;			return 1;		}		kOffset = eliminateLoops(kOffset, *this, offset, ret);		if(ret == 0 && bClosed) {			// check for inverted offsets of closed kurves			if(kOffset.Closed()) {				double a = Area();				int dir = (a < 0);				double ao = kOffset.Area();				int dirOffset = ao < 0;				if(dir != dirOffset)					ret = 3;				else {					// check area change compatible with offset direction - catastrophic failure					bool bigger = (a > 0 && offset > 0) || (a < 0 && offset < 0);					if(bigger && fabs(ao) < fabs(a)) ret = 2;				}			}			else				ret = 2;			// started closed but now open??		}		return (ret == 0)?1 : 0;	}
开发者ID:Heeks,项目名称:libarea-old,代码行数:101,


示例25: return

//---------------------------------------------------------bool CCRS_Transform_Grid::Set_Target_Area(const CSG_Grid_System &Source, const CSG_Grid_System &Target){	if( Parameters("TARGET_AREA")->asBool() == false )	{		m_Target_Area.Destroy();		return( true );	}	//-----------------------------------------------------	CSG_Rect	r(Source.Get_Extent());	if( m_Projector.Get_Source().Get_Type() == SG_PROJ_TYPE_CS_Geographic )	{		if( r.Get_XMax() > 180.0 )	r.Move(-180.0, 0.0);		if( r.Get_YMin() < -90.0 )	r.m_rect.yMin	= -90.0;		if( r.Get_YMax() <  90.0 )	r.m_rect.yMax	=  90.0;	}	//-----------------------------------------------------	CSG_Shapes			Area(SHAPE_TYPE_Polygon);	CSG_Shape_Polygon	*pArea	= (CSG_Shape_Polygon *)Area.Add_Shape();	TSG_Point			p, q;	double				dx	= Source.Get_XRange() / 100.0;	double				dy	= Source.Get_YRange() / 100.0;	m_Projector.Set_Inverse(false);	for(p.x=r.Get_XMin(), p.y=r.Get_YMin(); p.y<r.Get_YMax(); p.y+=dy)	{		m_Projector.Get_Projection(q = p);	pArea->Add_Point(q);	}	for(p.x=r.Get_XMin(), p.y=r.Get_YMax(); p.x<r.Get_XMax(); p.x+=dx)	{		m_Projector.Get_Projection(q = p);	pArea->Add_Point(q);	}	for(p.x=r.Get_XMax(), p.y=r.Get_YMax(); p.y>r.Get_YMin(); p.y-=dy)	{		m_Projector.Get_Projection(q = p);	pArea->Add_Point(q);	}	for(p.x=r.Get_XMax(), p.y=r.Get_YMin(); p.x>r.Get_XMin(); p.x-=dx)	{		m_Projector.Get_Projection(q = p);	pArea->Add_Point(q);	}	m_Projector.Set_Inverse(true);	//-----------------------------------------------------	m_Target_Area.Create(Target, SG_DATATYPE_Char);	m_Target_Area.Set_NoData_Value(0);	for(int y=0; y<m_Target_Area.Get_NY() && Set_Progress(y, m_Target_Area.Get_NY()); y++)	{		double	yWorld	= Target.Get_yGrid_to_World(y);		#pragma omp parallel for		for(int x=0; x<m_Target_Area.Get_NX(); x++)		{			m_Target_Area.Set_Value(x, y, pArea->Contains(Target.Get_xGrid_to_World(x), yWorld) ? 1 : 0);		}	}	//-----------------------------------------------------	return( true );}
开发者ID:johanvdw,项目名称:saga-debian,代码行数:69,


示例26: Area

void Triangle::ComputeArea(){    //Extra credit to implement this    this->area = Area(points[0], points[1], points[2]);}
开发者ID:aksris,项目名称:PathTracer,代码行数:5,


示例27: Area

Area DilationErosionProcessor::resultArea() const{  return Area();}
开发者ID:SidneyTTW,项目名称:ImageProcessor,代码行数:4,


示例28: haar_scale

/*----------------------------------------------------------------------------------------------------------------------------------------- */void haar_scale(unsigned char *I , int Ny , int Nx , int P , struct model detector , double *z){	int  p , indF , NxNy = Nx*Ny , indNxNy = 0 ;	double *rect_param = detector.rect_param;	unsigned int *F = detector.F;	int nx = detector.nx , ny = detector.ny , nF = detector.nF;	unsigned int f , indnF = 0;	int x , xr , y , yr  , w , wr  , h , hr , i , r , R , indR ;	int coeffw , coeffh;	int last = NxNy - 1;	double val , s , var , mean , std , cteNxNy = 1.0/NxNy , scalex = (Nx - 1 )/(double)nx , scaley = (Ny - 1 )/(double)ny ;	double ctescale = 1.0/(scalex*scaley);	unsigned int *II  , *Itemp , tempI;	II          = (unsigned int *)malloc(NxNy*sizeof(unsigned int));	Itemp       = (unsigned int *)malloc(NxNy*sizeof(unsigned int));					for(p = 0 ; p < P ; p++)	{			MakeIntegralImage((I + indNxNy) , II , Nx , Ny , Itemp);		var       = 0.0;		for(i = 0 ; i < NxNy ; i++)		{			tempI      = I[i + indNxNy];				var       += (tempI*tempI);		}						var      *= cteNxNy;		mean      = II[last]*cteNxNy;		std       = ctescale/sqrt(var - mean*mean);				indF      = 0;				for (f = 0 ; f < nF ; f++)		{					x     = F[1 + indF];				y     = F[2 + indF];			w     = F[3 + indF];			h     = F[4 + indF];			indR  = F[5 + indF];			R     = (int) rect_param[3 + indR];						val   = 0.0;						for (r = 0 ; r < R ; r++)			{				coeffw  = w/(int)rect_param[1 + indR];					coeffh  = h/(int)rect_param[2 + indR];				xr      = Round(scalex*(x + (coeffw*(int)rect_param[5 + indR])));				yr      = Round(scaley*(y + (coeffh*(int)rect_param[6 + indR])));				wr      = Round(scalex*coeffw*(int)(rect_param[7 + indR]));				hr      = Round(scaley*coeffh*(int)(rect_param[8 + indR]));				s       = rect_param[9 + indR];				val    += s*Area(II , xr  , yr  , wr , hr , Ny);				indR   += 10;			}			z[f + indnF]    = val*std;					indF           += 6;		}		indNxNy   += NxNy;		indnF     += nF;	}				free(II);	free(Itemp);		}
开发者ID:abnerdi,项目名称:FaceDetection-1,代码行数:67,



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


C++ ArenaTeamInfoType函数代码示例
C++ Arc函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。