Jump to content

Check if intersects polygon instead of a point?


Artem
 Share

Recommended Posts

BABYLON.BoundingBox.prototype.intersectsMinMax = function (min, max) {    if (this.maximumWorld.x < min.x || this.minimumWorld.x > max.x)        return false;    if (this.maximumWorld.y < min.y || this.minimumWorld.y > max.y)        return false;    if (this.maximumWorld.z < min.z || this.minimumWorld.z > max.z)        return false;    return true;};// can also be written like this:BABYLON.BoundingBox.prototype.intersectsMinMax = function (min, max) {    if (this.maximumWorld.x >= min.x && this.maximumWorld.y >= min.y && this.maximumWorld.z >= min.z && this.minimumWorld.x <= max.x && this.minimumWorld.y <= max.y && this.minimumWorld.z <= max.z)        return true;    return true;};

intersectsMinMax allows you to check if there is an intersection (a common volume) between two bounding boxes, the one specified while calling intersectsMinMax and the one defined by min and max which are the parameters of the function. This intersection can be a single point... Vector3(max.x, max.y, max.z) = minimumWorld for example.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...