简体   繁体   中英

Data structure for storing, parsing, passing multidimensional information

I am trying to decide how to store a 3 dimensional set of data. Each point in the set contains structure of information about that point.

Facts about the 3d set: The majority of the outside points will be empty. The significant points will be an irregular shape. There is a path between any 2 significant points.

I will want the size of the space to be determined by the max/min points of each dimension (there must be at least one significant point on the outermost layer for it to be kept)

What I need to do with these points (a connection is 2 significant points that are cardinally adjacent):

  • A known start point(relative x,y,z of a starting point)
  • Follow an edge(a point connected to 2-3 others)
  • identify curve switch(a point where 2 3-point edges do not make a quad)
  • identify leafs(points that are only connect to one other point

Structures I have considered:

  • Linked List (6 connections per node)
    • only stores the significant points
    • hard to identify the width of a dimension
  • 3d Array
    • easy to identify the width of a dimension
    • stores a lot of insignificant points

Are there other structures that would work better for me? Are there other reasons to choose one of the aforementioned structures over something else?

If you happen to know anything about minecraft forge development for 1.8.9. I am trying to make a dynamic item model based on an items nbt. Feel free to look at the code I currently have here .

I decided on a hashmap using a string representation of the coordinate as the key ("x,y,z") and I used an interface as the object. This setup made it fairly easy to store the structure out to json gives me easy access to all points because I can generate the key for any point during run time.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM