Skip to main content
Known Participant
August 8, 2016
Answered

Check if bounding box is within another bounding box

  • August 8, 2016
  • 3 replies
  • 1260 views

Using the PDETextIsAtRect function I discovered that if returns element that are not part of bounding box. So I wanted to know if I have two bounding boxes is it possible to check if the bounding box of one element can be found within the bounding bx of another element.

This topic has been closed for replies.
Correct answer Test Screen Name

That's not valid C. Well, clearly it compiles but it very much doesn't do what you think. You cannot use the form a <= b <= c, only compare TWO things, not three.

3 replies

LWShayAuthor
Known Participant
August 9, 2016

So I tried to use the following if statement with newRect being the ASFixedRect  element I'm checking to see is within boundingRect, however I am getting addition text run

if((boundingRect.left <= newRect.left <= boundingRect.right) && (boundingRect.left <= newRect.right <= boundingRect.right) && (boundingRect.bottom <= newRect.bottom <= boundingRect.top) && (boundingRect.bottom <= newRect.top <= boundingRect.top))

Test Screen NameCorrect answer
Braniac
August 9, 2016

That's not valid C. Well, clearly it compiles but it very much doesn't do what you think. You cannot use the form a <= b <= c, only compare TWO things, not three.

LWShayAuthor
Known Participant
August 8, 2016

Can you explain more? I'm still a little confused. Do you mean that I can use the x y coordinated?

lrosenth
Adobe Employee
Adobe Employee
August 8, 2016

Just use standard polygon containment to determine that.