本文整理汇总了C++中BOX2I::Normalize方法的典型用法代码示例。如果您正苦于以下问题:C++ BOX2I::Normalize方法的具体用法?C++ BOX2I::Normalize怎么用?C++ BOX2I::Normalize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BOX2I
的用法示例。
在下文中一共展示了BOX2I::Normalize方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
const BOX2I RULER_ITEM::ViewBBox() const
{
BOX2I tmp;
tmp.SetOrigin( m_origin );
tmp.SetEnd( m_end );
tmp.Normalize();
return tmp;
}
示例2: ConvexHull
const SHAPE_LINE_CHAIN ConvexHull( const SHAPE_CONVEX& aConvex, int aClearance )
{
// this defines the horizontal and vertical lines in the hull octagon
BOX2I box = aConvex.BBox( aClearance + HULL_MARGIN );
box.Normalize();
SEG topline = SEG( VECTOR2I( box.GetX(), box.GetY() + box.GetHeight() ),
VECTOR2I( box.GetX() + box.GetWidth(), box.GetY() + box.GetHeight() ) );
SEG rightline = SEG( VECTOR2I( box.GetX() + box.GetWidth(), box.GetY() + box.GetHeight() ),
VECTOR2I( box.GetX() + box.GetWidth(), box.GetY() ) );
SEG bottomline = SEG( VECTOR2I( box.GetX() + box.GetWidth(), box.GetY() ),
box.GetOrigin() );
SEG leftline = SEG( box.GetOrigin(), VECTOR2I( box.GetX(), box.GetY() + box.GetHeight() ) );
const SHAPE_LINE_CHAIN& vertices = aConvex.Vertices();
// top right diagonal
VECTOR2I corner = box.GetOrigin() + box.GetSize();
SEG toprightline = SEG( corner,
corner + VECTOR2I( box.GetHeight(), -box.GetHeight() ) );
MoveDiagonal( toprightline, vertices, aClearance );
// bottom right diagonal
corner = box.GetOrigin() + VECTOR2I( box.GetWidth(), 0 );
SEG bottomrightline = SEG( corner + VECTOR2I( box.GetHeight(), box.GetHeight() ),
corner );
MoveDiagonal( bottomrightline, vertices, aClearance );
// bottom left diagonal
corner = box.GetOrigin();
SEG bottomleftline = SEG( corner,
corner + VECTOR2I( -box.GetHeight(), box.GetHeight() ) );
MoveDiagonal( bottomleftline, vertices, aClearance );
// top left diagonal
corner = box.GetOrigin() + VECTOR2I( 0, box.GetHeight() );
SEG topleftline = SEG( corner + VECTOR2I( -box.GetHeight(), -box.GetHeight() ),
corner );
MoveDiagonal( topleftline, vertices, aClearance );
SHAPE_LINE_CHAIN octagon;
octagon.SetClosed( true );
octagon.Append( *leftline.IntersectLines( bottomleftline ) );
octagon.Append( *bottomline.IntersectLines( bottomleftline ) );
octagon.Append( *bottomline.IntersectLines( bottomrightline ) );
octagon.Append( *rightline.IntersectLines( bottomrightline ) );
octagon.Append( *rightline.IntersectLines( toprightline ) );
octagon.Append( *topline.IntersectLines( toprightline ) );
octagon.Append( *topline.IntersectLines( topleftline ) );
octagon.Append( *leftline.IntersectLines( topleftline ) );
return octagon;
}