當前位置: 首頁>>代碼示例>>C++>>正文


C++ GetBoundingBox函數代碼示例

本文整理匯總了C++中GetBoundingBox函數的典型用法代碼示例。如果您正苦於以下問題:C++ GetBoundingBox函數的具體用法?C++ GetBoundingBox怎麽用?C++ GetBoundingBox使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了GetBoundingBox函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。

示例1: GetPosition

void cCreditsString::Initialize()
{
   sf::Vector3<double> l_Position = GetPosition();
   l_Position.x += (GetBoundingBox().width/2) - m_CreditText.getLocalBounds().width / 2;
   l_Position.x = static_cast<int32_t>(l_Position.x);
   m_CreditText.setPosition(l_Position.x, l_Position.y);

   l_Position = GetPosition();
   l_Position.x += (GetBoundingBox().width/2) - m_CreditText2.getLocalBounds().width / 2;
   l_Position.x = static_cast<int32_t>(l_Position.x);
   l_Position.y +=
      m_CreditText.getLocalBounds().height
      + m_CreditText.getLocalBounds().top
      + 100;
   m_CreditText2.setPosition(l_Position.x, l_Position.y);

   l_Position.x = GetPosition().x;
   l_Position.x += (GetBoundingBox().width/2) - m_pSfmlLogo->GetBoundingBox().width / 2;
   l_Position.y +=
      m_CreditText2.getLocalBounds().height
      + m_CreditText2.getLocalBounds().top
      + 10;
   m_pSfmlLogo->SetPosition(l_Position, kNormal, false);
   m_pSfmlLogo->Initialize();

   // Set the position relative to the camera
   float l_X = GetResources()->GetWindow()->getSize().x - m_ContinueString.getLocalBounds().width - 10;
   float l_Y = GetResources()->GetWindow()->getSize().y - m_ContinueString.getCharacterSize() - 10;
   m_ContinueString.setPosition(l_X, l_Y);
}
開發者ID:corbinat,項目名稱:NativeBlocks,代碼行數:30,代碼來源:cCreditsString.cpp

示例2: SitFlush

void cAiBlock::Collision(cObject* a_pOther)
{
   if (a_pOther->GetType() == GetType())
   {
      SitFlush(a_pOther);
      m_AiLabel.setPosition(
         static_cast<int32_t>(GetPosition().x + GetBoundingBox().width / 2 - m_AiLabel.getLocalBounds().width / 2),
         static_cast<int32_t>(GetPosition().y + GetBoundingBox().height / 2 - m_AiLabel.getCharacterSize() / 2.0 - 10)
         );
      SetVelocityY(0, kNormal);

      sMessage l_Message;
      l_Message.m_From = GetUniqueId();
      l_Message.m_Category =GetResources()->GetMessageDispatcher()->Any();
      l_Message.m_Key = GetResources()->GetMessageDispatcher()->Any();
      l_Message.m_Value = "Settled";
      GetResources()->GetMessageDispatcher()->PostMessage(l_Message);

      m_Falling = false;

      PlaySound("Media/Sounds/BigFall.ogg");


   }
}
開發者ID:corbinat,項目名稱:NativeBlocks,代碼行數:25,代碼來源:cAiBlock.cpp

示例3: GetBoundingBox

void cAiBlock::Initialize()
{
   m_AiLabel.setPosition(
      static_cast<int32_t>(GetPosition().x + GetBoundingBox().width / 2 - m_AiLabel.getLocalBounds().width / 2),
      static_cast<int32_t>(GetPosition().y + GetBoundingBox().height / 2 - m_AiLabel.getCharacterSize() / 2.0 - 10)
      );

}
開發者ID:corbinat,項目名稱:NativeBlocks,代碼行數:8,代碼來源:cAiBlock.cpp

示例4: BOX2I

const BOX2I DIMENSION::ViewBBox() const
{
    BOX2I dimBBox = BOX2I( VECTOR2I( GetBoundingBox().GetPosition() ),
                           VECTOR2I( GetBoundingBox().GetSize() ) );
    dimBBox.Merge( m_Text.ViewBBox() );

    return dimBBox;
}
開發者ID:RocFan,項目名稱:kicad-source-mirror,代碼行數:8,代碼來源:class_dimension.cpp

示例5: GetBoundingBox

bool PCB_TARGET::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) const
{
    EDA_RECT arect = aRect;
    arect.Inflate( aAccuracy );

    if( aContained )
        return arect.Contains( GetBoundingBox() );
    else
        return GetBoundingBox().Intersects( arect );
}
開發者ID:cpavlina,項目名稱:kicad,代碼行數:10,代碼來源:class_pcb_target.cpp

示例6: GetBoundingBox

void cButton::Step(uint32_t a_ElapsedMiliSec)
{
   if (m_Label.getString() != "")
   {
      m_Label.setPosition(
         static_cast<int32_t>(GetPosition().x + GetBoundingBox().left + GetBoundingBox().width / 2.0 - m_Label.getLocalBounds().width / 2.0),
          static_cast<int32_t>(GetPosition().y + GetBoundingBox().height / 2.0 - (m_Label.getLocalBounds().height + m_Label.getLocalBounds().top + 10) / 2.0)
         );
   }
}
開發者ID:corbinat,項目名稱:NativeBlocks,代碼行數:10,代碼來源:cButton.cpp

示例7: GetBoundingBox

bool SCH_BUS_ENTRY_BASE::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) const
{
    EDA_RECT rect = aRect;

    rect.Inflate( aAccuracy );

    if( aContained )
        return rect.Contains( GetBoundingBox() );

    return rect.Intersects( GetBoundingBox() );
}
開發者ID:cpavlina,項目名稱:kicad,代碼行數:11,代碼來源:sch_bus_entry.cpp

示例8: SetVelocityY

void cAiBlock::Step(uint32_t a_ElapsedMiliSec)
{
   if (m_Falling)
   {
      SetVelocityY(1500, kNormal);
      m_AiLabel.setPosition(
         static_cast<int32_t>(GetPosition().x + GetBoundingBox().width / 2 - m_AiLabel.getLocalBounds().width / 2),
         static_cast<int32_t>(GetPosition().y + GetBoundingBox().height / 2 - m_AiLabel.getCharacterSize() / 2.0 - 10)
         );
   }
}
開發者ID:corbinat,項目名稱:NativeBlocks,代碼行數:11,代碼來源:cAiBlock.cpp

示例9: cPxAABB

 void CPhysXMultiBodyObjectModel::CalculateBoundingBox() {
    if(m_vecBodies.empty()) return;
    /* Initialize the AABB to be a copy of the AABB of the first actor */
    physx::PxBounds3 cPxAABB(m_vecBodies[0].Body.getWorldBounds());
    /* Go through the bodies and grow the AABB with other bodies */
    for(size_t i = 1; i < m_vecBodies.size(); ++i) {
       cPxAABB.include(m_vecBodies[1].Body.getWorldBounds());
    }
    /* Update the ARGoS bounding box */
    PxVec3ToCVector3(cPxAABB.minimum, GetBoundingBox().MinCorner);
    PxVec3ToCVector3(cPxAABB.maximum, GetBoundingBox().MaxCorner);
 }
開發者ID:NavQ,項目名稱:argos3,代碼行數:12,代碼來源:physx_multi_body_object_model.cpp

示例10: RegisterAnchorMethod

 void CDynamics2DSingleBodyObjectModel::SetBody(cpBody* pt_body,
                                                Real f_height) {
    /* Set the body and its data field for ray queries */
    m_ptBody = pt_body;
    m_ptBody->data = this;
    /* Register the origin anchor update method */
    RegisterAnchorMethod(GetEmbodiedEntity().GetOriginAnchor(),
                         &CDynamics2DSingleBodyObjectModel::UpdateOriginAnchor);
    /* Calculate the bounding box */
    GetBoundingBox().MinCorner.SetZ(GetEmbodiedEntity().GetOriginAnchor().Position.GetZ());
    GetBoundingBox().MaxCorner.SetZ(GetEmbodiedEntity().GetOriginAnchor().Position.GetZ() + f_height);
    CalculateBoundingBox();
 }
開發者ID:NavQ,項目名稱:argos3,代碼行數:13,代碼來源:dynamics2d_single_body_object_model.cpp

示例11: GetBoundingBox

/**
 * Calculate the AABB in the global coordinate frame
 */
void CBulletSphereModel::CalculateBoundingBox()
{
	GetBoundingBox().MinCorner.Set(
					GetEmbodiedEntity().GetOriginAnchor().Position.GetX() - (entity->GetRadius()),
					GetEmbodiedEntity().GetOriginAnchor().Position.GetY() - (entity->GetRadius()),
					GetEmbodiedEntity().GetOriginAnchor().Position.GetZ()
			);
	GetBoundingBox().MaxCorner.Set(
					GetEmbodiedEntity().GetOriginAnchor().Position.GetX() + (entity->GetRadius()),
					GetEmbodiedEntity().GetOriginAnchor().Position.GetY() + (entity->GetRadius()),
					GetEmbodiedEntity().GetOriginAnchor().Position.GetZ() + entity->GetRadius()
			);
}
開發者ID:richard-redpath,項目名稱:bullet-for-argos,代碼行數:16,代碼來源:CBulletSphereModel.cpp

示例12: switch

bool DRAWSEGMENT::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) const
{
    wxPoint p1, p2;
    int radius;
    float theta;
    EDA_RECT arect = aRect;
    arect.Inflate( aAccuracy );

    switch( m_Shape )
    {
    case S_CIRCLE:
        // Test if area intersects or contains the circle:
        if( aContained )
            return arect.Contains( GetBoundingBox() );
        else
            return arect.Intersects( GetBoundingBox() );
        break;

    case S_ARC:
        radius = hypot( (double)( GetEnd().x - GetStart().x ),
                        (double)( GetEnd().y - GetStart().y ) );
        theta  = std::atan2( GetEnd().y - GetStart().y , GetEnd().x - GetStart().x );

        //Approximate the arc with two lines. This should be accurate enough for selection.
        p1.x   = radius * std::cos( theta + M_PI/4 ) + GetStart().x;
        p1.y   = radius * std::sin( theta + M_PI/4 ) + GetStart().y;
        p2.x   = radius * std::cos( theta + M_PI/2 ) + GetStart().x;
        p2.y   = radius * std::sin( theta + M_PI/2 ) + GetStart().y;

        if( aContained )
            return arect.Contains( GetEnd() ) && aRect.Contains( p1 ) && aRect.Contains( p2 );
        else
            return arect.Intersects( GetEnd(), p1 ) || aRect.Intersects( p1, p2 );

        break;

    case S_SEGMENT:
        if( aContained )
            return arect.Contains( GetStart() ) && aRect.Contains( GetEnd() );
        else
            return arect.Intersects( GetStart(), GetEnd() );

        break;

    default:
        ;
    }
    return false;
}
開發者ID:p12tic,項目名稱:kicad-source-mirror,代碼行數:49,代碼來源:class_drawsegment.cpp

示例13: GetBoundingBox

bool SCH_FIELD::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) const
{
    // Do not hit test hidden fields.
    if( !IsVisible() || IsVoid() )
        return false;

    EDA_RECT rect = aRect;

    rect.Inflate( aAccuracy );

    if( aContained )
        return rect.Contains( GetBoundingBox() );

    return rect.Intersects( GetBoundingBox() );
}
開發者ID:james-sakalaukus,項目名稱:kicad,代碼行數:15,代碼來源:sch_field.cpp

示例14: wxASSERT

void LIB_TEXT::Plot( PLOTTER* plotter, const wxPoint& offset, bool fill,
                     const TRANSFORM& aTransform )
{
    wxASSERT( plotter != NULL );

    EDA_RECT bBox = GetBoundingBox();
    // convert coordinates from draw Y axis to libedit Y axis
    bBox.RevertYAxis();
    wxPoint txtpos = bBox.Centre();

    /* The text orientation may need to be flipped if the
     * transformation matrix causes xy axes to be flipped. */
    int t1  = ( aTransform.x1 != 0 ) ^ ( GetTextAngle() != 0 );
    wxPoint pos = aTransform.TransformCoordinate( txtpos ) + offset;

    // Get color
    COLOR4D color;

    if( plotter->GetColorMode() )       // Used normal color or selected color
        color = IsSelected() ? GetItemSelectedColor() : GetDefaultColor();
    else
        color = COLOR4D::BLACK;

    plotter->Text( pos, color, GetShownText(),
                   t1 ? TEXT_ANGLE_HORIZ : TEXT_ANGLE_VERT,
                   GetTextSize(), GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
                   GetPenSize(), IsItalic(), IsBold() );
}
開發者ID:cpavlina,項目名稱:kicad,代碼行數:28,代碼來源:lib_text.cpp

示例15: MemStackMark

void FLightSceneInfo::AddToScene()
{
	const FLightSceneInfoCompact& LightSceneInfoCompact = Scene->Lights[Id];

	// Only need to create light interactions for lights that can cast a shadow, 
	// As deferred shading doesn't need to know anything about the primitives that a light affects
	if (Proxy->CastsDynamicShadow() 
		|| Proxy->CastsStaticShadow() 
		// Lights that should be baked need to check for interactions to track unbuilt state correctly
		|| Proxy->HasStaticLighting()
		// ES2 path supports dynamic point lights in the base pass using forward rendering, so we need to know the primitives
		|| (Scene->GetFeatureLevel() < ERHIFeatureLevel::SM4 && Proxy->GetLightType() == LightType_Point && Proxy->IsMovable()))
	{
		// Add the light to the scene's light octree.
		Scene->LightOctree.AddElement(LightSceneInfoCompact);

		// TODO: Special case directional lights, no need to traverse the octree.

		// Find primitives that the light affects in the primitive octree.
		FMemMark MemStackMark(FMemStack::Get());
		for(FScenePrimitiveOctree::TConstElementBoxIterator<SceneRenderingAllocator> PrimitiveIt(
				Scene->PrimitiveOctree,
				GetBoundingBox()
				);
			PrimitiveIt.HasPendingElements();
			PrimitiveIt.Advance())
		{
			CreateLightPrimitiveInteraction(LightSceneInfoCompact, PrimitiveIt.GetCurrentElement());
		}
	}
}
開發者ID:zhaoyizheng0930,項目名稱:UnrealEngine,代碼行數:31,代碼來源:LightSceneInfo.cpp


注:本文中的GetBoundingBox函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。