node thing.

This is a discussion on node thing. within the C++ Programming forums, part of the General Programming Boards category; I've tried to make a structure of nodes where each node have a different type and different data which it ...

  1. #1
    Unregistered
    Guest

    node thing.

    I've tried to make a structure of nodes where each node have a different type and different data which it store about itself, but I can't find any information on it. Maybee since I don't know what this kind of structure is called.

    node(bsptree)
    / node(triangle)
    / /
    / /
    node(octree)-------------node(binary space partitioning tree)
    \ \
    \ \
    \ \
    node(cube) node(furry rabbit)

    If anyone knows how to create a structure of this type please submit a reply.

  2. #2
    geek SilentStrike's Avatar
    Join Date
    Aug 2001
    Location
    NJ
    Posts
    1,141
    I don't know specifically what structure nodes in a bsp have, but I'll assume it's just like a regular binary tree.

    Code:
    class BspNode {
    public:
    // whatever
    protected:
    BstNode* right;
    BstNode* left;
    };
    
    class TriangleNode : public BspNode {
    public:
    Triangle tri;
    };
    
    class CubeNode: public BspNode {
    public:
    Cube cube;
    };
    etc.
    Prove you can code in C++ or C# at TopCoder, referrer rrenaud
    Read my livejournal

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Concatenating in linked list
    By drater in forum C Programming
    Replies: 12
    Last Post: 05-03-2008, 12:10 AM
  2. Replies: 7
    Last Post: 06-16-2006, 10:23 PM
  3. Program Crashing
    By Pressure in forum C Programming
    Replies: 3
    Last Post: 04-18-2005, 11:28 PM
  4. Binary Tree, couple questions
    By scoobasean in forum C Programming
    Replies: 3
    Last Post: 03-12-2005, 09:09 PM
  5. Big help in Astar search code...
    By alvifarooq in forum C++ Programming
    Replies: 6
    Last Post: 09-24-2004, 12:38 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21