Welcome to Code Forum!

Join a community that supports you and your coding journey from day one. We strive to be a friendly, supportive community that empowers everyone to be better developers. By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!
  • Guest, before posting your code please take these rules into consideration:
    • It is required to use our BBCode feature to display your code. While within the editor click < / > or >_ and place your code within the BB Code prompt. This helps others with finding a solution by making it easier to read and easier to copy.
    • You can also use markdown to share your code. When using markdown your code will be automatically converted to BBCode. For help with markdown check out the markdown guide.
    • Don't share a wall of code. All we want is the problem area, the code related to your issue.

    GIF shows where to locate </> in the thread and or post editor toolbar.
    To learn more about how to use our BBCode feature, review our "How to post your code into threads" here.

    Thank you, Code Forum.

Higher dimensional slicing

JosiahMaybe

Platinum Coder
A common way to do higher dimensional cut to view is to use tetrahedra. Before we dive into that, how is view defined? There may be many ways to define it but for this I will define it as what from a viewpoint, like an eye, goes exactly through a 2d view plane, the screen, on the way to an object, the thing we view. Tetrahedra allow only checking the line edges for being in or out of view including in spherical or hyperbolic space, not just Euclidean. There is a problem though, the number for one box is dimension factorial, n!, one of the fastest increasing functions known to man.

So, what else is there? I know that since the tetrahedra cover the entire higher dimensional space that they cover all 2d faces or if they do not, it is wrong. From research, for any convex shape, we need to only check all the 2d bounding shapes for the complete shape. A 5d box has 4d bounding volumes which have 3d bounding volumes which have 2d bounding rectangles. Unless the shape has a curve, all higher dimensional convex shapes should have planar shapes like this bounding them. Sure, the function of number of faces is 2 to the power of dimension about for this, but it does increase slower than factorial.

Now we know that 2d shapes bound the shape, what do we do with them? Consider the entire 3 vector space for view for this. Odd but true, we can break them into triangles and check each line for one point in view, because of how the tetrahedra work this also should work. Then we have a point cloud with no connections. To solve that we can connect every point to every other point and check the midpoints; if the midpoint is viewable then the entire line is viewable. This leaves inner lines, but far fewer than a few trillion tetrahedra. The inner lines can be solved for removal, but I have not done so yet.

Why the 3-vector space? First know that based on tests, view can always be represented by 3 vectors. Next, if a spear were to go through the camera, how would we view it? My approach is to remove the part between viewpoint and plane and view that. There are some really nasty things that happen when the object has parts entirely parallel to the plane and "in view" at infinity. It is good to avoid those by making it 3 vectors, then from the shape, slicing the result to be in correct view is simpler and does not involve infinity ever. This is of course only one way to do this, and possibly not the best. Now imagine this; how would a similar process apply to spherical or hyperbolic spaces? X E.
 

Latest posts

Buy us a coffee!

Buy me a coffee.
Back
Top Bottom