Rect2F SkeletonSlot::GetModelBoundingBox() const { //no rotation or scale on this slot if (mAttachment != nullptr&&mAttachment->Type() == SkeletonAttachmentType::BoundingBox) { SkeletonBoundingBoxAttachmentModel* boundingBox = (SkeletonBoundingBoxAttachmentModel*)mAttachment; return boundingBox->Polygon().BoundingBox(); } return Rect2F::Zero; }
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); }
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; }