Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7763645
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T14:42:41+00:00 2026-06-01T14:42:41+00:00

This may have been answered before, and if so, point me to the answer.

  • 0

This may have been answered before, and if so, point me to the answer. Otherwise, here goes.

You have x number of objects in space, which have bounding coordinates p0 and p1. p0 and p1 are each 3 dimensional coordinates and p0 always has the lower values – whether negative or positive, and p1 always has the higher values.

Now, you have a plane, which is perfectly orthogonal to the direction of camera C, which has a position (pC) and a heading (hC). This plane can then be defined as being 90 degrees (pi/2 radians) from the camera’s yaw (sometimes called ‘heading’) and pitch and extending unto the furthest defined bounds in the space.

Because I do not permit more than 180 degrees FOV, anything which lies completely behind the camera (behind the plane of exclusion) must be excluded.

Is there a simple way to do this? For this question, I do not treat the issue of having to check against every object in the space; assume for the purpose of our question that there are always a limited number of objects – managed by partitioning the space in some fashion – so that the objects we check against are always ‘questionable’.

Also keep in mind that because these are not points but pairs of points representing 3d bounding cubes, it is not enough for a point to lie on this or that side of the plane.

I get the feeling there is a simple way to do this, but not having taken Computer Graphics I was never introduced to the math.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T14:42:42+00:00Added an answer on June 1, 2026 at 2:42 pm

    So here’s how to do it.

    First you need to store the eight points in each bounding box in a predictable manner, for instance, each bit in an integer representing its position about the center of the box. What you can do is use 0x4 to represent EAST (+x) (zero in that bit means WEST) 0x2 to represent NORTH (zero in that bit means SOUTH) and 0x1 to represent TOP (zero in that bit means BOTTOM). Now you can universally access all points in the same position of the bounding box by specifying a position number. (all zero bit numbers are just zero. Java warns that these assignments are meaningless, but they help with readability.)

    Setting up the bounding box: (do this for every bounding box)

        pointList = new Point3d[8];
    
        pointList[WEST|SOUTH|BOTTOM] = new Point3d(x0,y0,z0);
        pointList[WEST|SOUTH|TOP]    = new Point3d(x0,y0,z1);
        pointList[WEST|NORTH|BOTTOM] = new Point3d(x0,y1,z0);
        pointList[WEST|NORTH|TOP]    = new Point3d(x0,y1,z1);
        pointList[EAST|SOUTH|BOTTOM] = new Point3d(x1,y0,z0);
        pointList[EAST|SOUTH|TOP]    = new Point3d(x1,y0,z1);
        pointList[EAST|NORTH|BOTTOM] = new Point3d(x1,y1,z0);
        pointList[EAST|NORTH|TOP]    = new Point3d(x1,y1,z1);
    

    Next, calculate the normal from your view angle. (Yaw is left/right rotation, pitch is up/down rotation)

        float nx = -(float)Math.cos(yaw);
        float ny = (float)Math.sin(yaw);
        float nz = (float)Math.sin(pitch);
    

    I think the negative is right, but if everything is invisible on one side, just reverse it 🙂

    Calculate the Characteristic Point, which is just the index that you’re going to check in every bounding box because it represents the point in every box that will be nearest to the plane on the invisible side:

        int characteristicPoint = (nx<0?WEST:EAST)|
                                  (ny<0?SOUTH:NORTH)|
                                  (nz<0?BOTTOM:TOP);
    

    Make sure that every bounding box is set up such that x,y,z aught are lesser than x,y,z prime (x0 = x aught, x1 = x prime)

    Then collect your characteristic (‘check’) point, your set of normals (‘frustrum’), and your camera position (x,y,z) and do this with every bounding box:

        float checkA = ((bounds.pointList[check].x-position.x)*frustrum.x) +
                ((bounds.pointList[check].y-position.y)*frustrum.y);
    
        float checkB = ((bounds.pointList[check].x-position.x)*frustrum.x) +
                ((bounds.pointList[check].z-position.z)*frustrum.z);
        if(checkB>=0&&checkA>=0) {
            visible = true;
            return;
        } else if(checkB<0&&checkA<0) {
            visible = false;
            return;
        } else {
           float checkC = ((bounds.pointList[check].y-position.y)*frustrum.y) +
                ((bounds.pointList[check].z-position.z)*frustrum.z);
           if(checkC>=0) {
              visible = true;
              return;
           } else {
              visible = false;
              return;
           }
    
        }
    

    This is simple linear algebra (IMO) and the logic is as follows: If the point is on the positive side of two or more of the lines representing the plane, it is visible. If it is on the negative side of tow or more of the lines representing the plane, it is invisible. You calculate the first two, and if they are different (one negative, one positive) you check the third and take that value.

    It is important to note the following property when treating lines as equations:

    -x-y = p != x+y = p
    

    The line is the same, but its implicit ‘facing’ is inverse.

    I hope this helps someone else with this question. It was hard, but enjoyable, to figure out.

    This could be made more efficient by storing the first half of CheckA, I suppose 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This question may have been asked before, but I had trouble finding an answer,
This may have been asked before, but I could not find the answer. I
This may have been answered before, but I cannot find a solution that works.
This may have been answered before. I see many dynamic method overload resolution questions,
Ok, this may have been answered, but I'm new and trying to learn, so
This has / may have been asked before, but, as far as I remember,
I have a question that may have been answered over 9000 times before but
This may have been answered elsewhere but I could not find a suitable response.
This may have been answered but my search hasn't found what I was looking
I know this may have been answered but SubSonic 2.2 causes an error in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.