当前位置: 首页>>代码示例>>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;未经允许,请勿转载。