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

C++ GetBoundingBox函数代码示例

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

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



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


示例16: GetBoundingBox

void wxSFControlShape::UpdateControl()
{
    if( m_pControl )
    {
        int x = 0, y = 0;
		
        wxRect minBB = m_pControl->GetMinSize();
        wxRect rctBB = GetBoundingBox().Deflate(m_nControlOffset, m_nControlOffset);

        if( rctBB.GetWidth() < minBB.GetWidth() )
        {
            rctBB.SetWidth(minBB.GetWidth());
            m_nRectSize.x = minBB.GetWidth() + 2*m_nControlOffset;
        }

        if( rctBB.GetHeight() < minBB.GetHeight() )
        {
            rctBB.SetHeight(minBB.GetHeight());
            m_nRectSize.y = minBB.GetHeight() + 2*m_nControlOffset;
        }

        GetParentCanvas()->CalcUnscrolledPosition(0, 0, &x, &y);

        // set the control's dimensions and position according to the parent control shape
        m_pControl->SetSize(rctBB.GetWidth(), rctBB.GetHeight());
        m_pControl->Move(rctBB.GetLeft() - x, rctBB.GetTop() - y);
    }
}
开发者ID:292388900,项目名称:codelite,代码行数:28,代码来源:ControlShape.cpp


示例17: RayIntersect

	bool AnimatedObject::RayIntersect(XMVECTOR origin, XMVECTOR direction, float& pDist)
	{
		if(XNA::IntersectRayAxisAlignedBox(origin, direction, &GetBoundingBox(), &pDist))
			return true;
		else
			return false;
	}
开发者ID:simplerr,项目名称:Graphics-Library,代码行数:7,代码来源:AnimatedObject.cpp


示例18: GetDefaultLineThickness

void SCH_TEXT::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, const wxPoint& aOffset,
                     GR_DRAWMODE DrawMode, EDA_COLOR_T Color )
{
    EDA_COLOR_T color;
    int         linewidth = ( m_Thickness == 0 ) ? GetDefaultLineThickness() : m_Thickness;

    linewidth = Clamp_Text_PenSize( linewidth, m_Size, m_Bold );

    if( Color >= 0 )
        color = Color;
    else
        color = ReturnLayerColor( m_Layer );

    GRSetDrawMode( DC, DrawMode );

    wxPoint text_offset = aOffset + GetSchematicTextOffset();
    EXCHG( linewidth, m_Thickness );            // Set the minimum width
    EDA_TEXT::Draw( panel, DC, text_offset, color, DrawMode, FILLED, UNSPECIFIED_COLOR );
    EXCHG( linewidth, m_Thickness );            // set initial value

    if( m_isDangling )
        DrawDanglingSymbol( panel, DC, m_Pos + aOffset, color );

    // Enable these line to draw the bounding box (debug tests purposes only)
#if 0
    {
        EDA_RECT BoundaryBox = GetBoundingBox();
        GRRect( panel->GetClipBox(), DC, BoundaryBox, 0, BROWN );
    }
#endif
}
开发者ID:james-sakalaukus,项目名称:kicad,代码行数:31,代码来源:sch_text.cpp


示例19: commit

int ALIGN_DISTRIBUTE_TOOL::doAlignRight()
{
    const SELECTION& selection = m_selectionTool->GetSelection();

    if( selection.Size() <= 1 )
        return 0;

    BOARD_COMMIT commit( getEditFrame<PCB_BASE_FRAME>() );
    commit.StageItems( selection, CHT_MODIFY );

    // Compute the rightmost point of selection - it will be the edge of alignment
    int right = selection.Front()->GetBoundingBox().GetRight();

    for( int i = 1; i < selection.Size(); ++i )
    {
        int currentRight = selection[i]->GetBoundingBox().GetRight();

        if( right < currentRight )      // X increases when going right
            right = currentRight;
    }

    // Move the selected items
    for( auto i : selection )
    {
        auto item = static_cast<BOARD_ITEM*>( i );

        int difference = right - item->GetBoundingBox().GetRight();

        item->Move( wxPoint( difference, 0 ) );
    }

    commit.Push( _( "Align to right" ) );

    return 0;
}
开发者ID:cpavlina,项目名称:kicad,代码行数:35,代码来源:placement_tool.cpp


示例20: GetBoundingBox

void LIB_FIELD::Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
                      const TRANSFORM& aTransform )
{
    if( IsVoid() )
        return;

    /* Calculate the text orientation, according to the component
     * orientation/mirror */
    int orient = m_Orient;

    if( aTransform.y1 )  // Rotate component 90 deg.
    {
        if( orient == TEXT_ORIENT_HORIZ )
            orient = TEXT_ORIENT_VERT;
        else
            orient = TEXT_ORIENT_HORIZ;
    }

    EDA_RECT BoundaryBox = GetBoundingBox();
    EDA_TEXT_HJUSTIFY_T hjustify = GR_TEXT_HJUSTIFY_CENTER;
    EDA_TEXT_VJUSTIFY_T vjustify = GR_TEXT_VJUSTIFY_CENTER;
    wxPoint textpos = aTransform.TransformCoordinate( BoundaryBox.Centre() )
                      + aOffset;

    aPlotter->Text( textpos, GetDefaultColor(), m_Text, orient, m_Size,
                    hjustify, vjustify,
                    GetPenSize(), m_Italic, m_Bold );
}
开发者ID:johnbeard,项目名称:kicad-source-mirror,代码行数:28,代码来源:lib_field.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ GetBox函数代码示例发布时间:2022-05-30
下一篇:
C++ GetBottom函数代码示例发布时间: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