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

  • SEARCH
  • Home
  • 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 8047943
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T06:16:18+00:00 2026-06-05T06:16:18+00:00

I am looking for a data structure representing axis aligned cuboids Something like System.Drawing.Rectangle,

  • 0

I am looking for a data structure representing axis aligned cuboids

Something like System.Drawing.Rectangle, but in 3d, e.g.

struct AACuboid
{
    int posX, posY, posZ;
    int width, length, height;
}

with the standard operations like c1.Contains(c2), c1.Intersects(c2), c1.Rotate(axis,0/90/180)…
and the basic operations like equality, iComparable, hashCode…

Such a data type is easy enough to write, the problem I am worried about is writing it fast, since I’ll be doing a lot of cube intersections and comparisons per second.

Rather than reinventing the wheel ,and probably forgetting some basic optimisation step, is there a freely available class I could use?
Even better if this also includes some sort of R-Tree or similar structure to speed up intersections, although that is optional at this point.

Otherwise, what would be the basic optimisation steps I should not forget?
(i.e. struct or class? x,y,z internally represented as individual class members or single array or struct?)

  • 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-05T06:16:21+00:00Added an answer on June 5, 2026 at 6:16 am

    So far the best match for what I seek seems to be
    Microsoft.Xna.Framework.BoundingBox, the study of which has proven to be both enlightening and confusing.

    it is a struct:

     public struct BoundingBox : IEquatable<BoundingBox> 
     {
           public Vector3 Min; public Vector3 Max;
           ...
     }
    

    With Vector3 being another struct:

      public struct Vector3 : IEquatable<Vector3> 
      {
           public float X,Y,Z;
           ...
      }
    

    So I suppose structs containing floats are a good design choice for this kind of data, even thought they get rather large (24 bytes, double the officially recommended maximum for structs)

    The main thing that confuses me for now is that these structs are mutable, and the implemented methods make use of that mutability a lot. I would have thought these sorts of types would be immutable or at least have no public non-readonly variables.
    But I guess Microsoft knows what they are doing.

    Right now I am unsure whether I should include the whole xna framework just for these types, or simply model my own types after them.

    I am however open for other suggestions.

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

Sidebar

Related Questions

As ArrayCollection in Flex is limited, I'm looking for a data-structure that something like
I am looking for a data structure that works a bit like Data.HashTable but
I'm looking for a python 2.7 data structure equivalent to a dictionary but where
I'm looking for a data structure that will act like a Queue so that
I was looking for a tree or graph data structure in C#, but I
I'm looking for a data structure pattern for storing recurring events, but everything I
i am looking for a specific data structure, but i forgot its name. if
I'm looking for a data structure that will store any DAG, but can efficiently
I'm looking for a stack-like data structure that allows efficient searching of the contents.
I'm looking for a data structure (array-like) that allows fast (faster than O(N)) arbitrary

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.