• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ Area函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



在下文中一共展示了Area函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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,代码来源:CWorldMap.cpp


示例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,代码来源:HSTriangular.cpp


示例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,代码来源:Area.cpp


示例4: Area

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


示例5: InRadius

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


示例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,代码来源:do_tris.c


示例7: Area

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


示例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,代码来源:8.9_Area_de_tetraedro.cpp


示例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,代码来源:SceneCapturer.cpp


示例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,代码来源:PlayerShip.cpp


示例11: ShowCircle

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


示例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,代码来源:Circle.cpp


示例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,代码来源:Area.cpp


示例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,代码来源:Triangulate.cpp


示例15: controller

void
BorderResizer::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,代码来源:Border.cpp


示例16: C4ValueArray

// return is to be freed by the caller
C4ValueArray *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,代码来源:C4FindObject.cpp


示例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,代码来源:HalfEdgeMesh.cpp


示例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,代码来源:clipping.cpp


示例19: addArea

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


示例20: Area

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



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ ArenaTeamInfoType函数代码示例发布时间:2022-05-30
下一篇:
C++ Arc函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap