コード例 #1
0
ファイル: SkeletonSlot.cpp プロジェクト: johndpope/Medusa
Rect2F SkeletonSlot::CalculateBoundingBox()
{
	if (mAttachment != nullptr&&mAttachment->Type() == SkeletonAttachmentType::BoundingBox)
	{
		SkeletonBoundingBoxAttachmentModel* boundingBox = (SkeletonBoundingBoxAttachmentModel*)mAttachment;


		const List<Point2F>& vertices = boundingBox->Polygon().Vertices();

		RangeF rangeX;
		RangeF rangeY;
		FOR_EACH_COLLECTION(i, vertices)
		{
			Point2F pos = *i;
			pos = TransformToWorld(pos);
			rangeX.Expand(pos.X);
			rangeY.Expand(pos.Y);
		}
コード例 #2
0
ファイル: SkeletonSlot.cpp プロジェクト: fjz13/Medusa
Rect2F SkeletonSlot::CalculateBoundingBox()
{
	if (mAttachment != nullptr&&mAttachment->Type() == SkeletonAttachmentType::BoundingBox)
	{
		SkeletonBoundingBoxAttachmentModel* boundingBox = (SkeletonBoundingBoxAttachmentModel*)mAttachment;


		const List<Point2F>& vertices = boundingBox->Polygon().Vertices();

		RangeF rangeX;
		RangeF rangeY;
		for(auto pos: vertices)
		{
			pos = TransformToWorld(pos);
			rangeX.Expand(pos.X);
			rangeY.Expand(pos.Y);
		}

		return Rect2F(rangeX.Min, rangeY.Min, rangeX.Length(), rangeY.Length());
	}
	return Rect2F::Zero;
}