x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Getting smallest Bounding Box (MinimumAreaRectangle) problem

Hey. i wanna get the smallest enclosuring rectangle. Basically what i'm doing right now: getting each boundary, calculate the 2d-vertices A,B,C,D (also minding the rotation!) and add them to a array. Then feed that array of cvertices into a node called "MinimumAreaRectangle". Here is the problem: it outputs the right x and y dimensions, but not the right centerpoint. (actually it outputs the average of all points) if included some pics to better visualize the problem: alt text alt text two boundaries with same size and no rotation: no problem but if i add a 3rd one or change the size or rotation of one of the boundaries then fallowing happens: alt text alt text somehow gets offset by a random value?

so is the algorithm broken?

Product Version: UE 4.21
Tags:
more ▼

asked Feb 06 '19 at 05:00 PM in Blueprint Scripting

avatar image

schauk
31 2 3 11

avatar image schauk Feb 06 '19 at 05:06 PM

you can see the blueprint graph here: link text in case youre wondering, how i calculate the rectangle vertices here link text (but shoudn't be the problem, vertices are allright)

also another pic of the issue:

alt text

avatar image schauk Feb 06 '19 at 05:16 PM

ah, and it shoudn't be a relative / worldspace problem (since i placed my generating object at 0/0/0

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

You are correct that it is taking the average of all points when it should only be considering points that make up the convex hull. I would definitely submit a bug report, as I don't see one currently on Unreal Issues. It should be a very simple fix.

In the meantime you can fix this in the C++ source for yourself if you are using it. It's in KismetMathLibrary.cpp. If you are in blueprint only, you could write the algorithm yourself using the link below, although it will be pretty complex for BP. This is the same source that the Unreal implementation comes from, so be sure to correct its center as well.

http://www.geometrictools.com/Documentation/MinimumAreaRectangle.pdf

more ▼

answered Feb 06 '19 at 06:11 PM

avatar image

dachora1
274 4 9 12

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question