예제 #1
0
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
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;
}