Screenshot instructions:
Windows
Mac
Red Hat Linux
Ubuntu
Click URL instructions:
Rightclick on ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)
From: Chad Granum <exodist@us...>  20050714 02:32:01

Update of /cvsroot/openrpggde/Source/Source3D/Simple/Headers In directory sc8prcvs1.sourceforge.net:/tmp/cvsserv21078/Source3D/Simple/Headers Added Files: Edge.h Surface.h Vertex.h Log Message: Renamed 3d because java cannot reference apackage that starts with a digit  NEW FILE: Vertex.h  /*************************************************************************** * Vertex.h * * Wed Jun 22 21:52:08 2005 * Copyright 2005 User * Email ****************************************************************************/ #ifndef VERTEX_H #define VERTEX_H #include <list> #include <cmath> #include "Surface.h" namespace OpenRPGGDE { class Surface; /* [API] Public #Exodist  7/03/05# [Class] [Description] The Vertex class is a class for representing a vertex (node) in a system of 3d coordinates. A vertex is a single point in 3d space, when connected to other vertices it forms edges, when these edges close off an area it forms a surface, several surfaces together form a mesh, and meshes can form full 3d objects. [Implimentation] Has coordinates, links to nearby vertices, list of surfaces it is a corner of functions for finding vertices around it. */ class Vertex { public: /* [API] Public #Exodist  7/03/05# [int] ID number of this vertex [Description] Most basic constructor */ Vertex(int); /* [API] Public #Exodist  7/03/05# [int] ID number of this vertex [int*] 3 element array representing coordinates [Description] Creates a Vertex with the given ID and coordinates. */ Vertex(int, int*); /* [API] Public #Exodist  7/03/05# [int] ID number of this vertex [int*] 3 element array representing coordinates [int] Coordinate to link with other vertices [Vertex *] Vertex with which to link given axis [Description] Creates a Vertex with the given ID and coordinates with the given axis linked with the given vertices. */ Vertex(int, int*, int, Vertex *); /* [API] Public #Exodist  7/03/05# [int] ID number of this vertex [int*] 3 element array representing coordinates [int] Coordinate to link with other vertices [Vertex *] Vertex with which to link given axis [int] Coordinate to link with other vertices [Vertex *] Vertex with which to link given axis [Description] Creates a Vertex with the given ID, coordinates, and both linkedAxis */ Vertex(int, int*, int, Vertex *, int, Vertex *); ~Vertex(); /* [API] Public #Exodist  7/03/05# [int] Coordinate to set [int] Value of Coordinate [Description] Set the given coordinate to the given value */ void setCoordinate(int, int); /* [API] Public #Exodist  7/03/05# [int] Change on X axis [int] Change on Y axis [int] Change on Z axis [Description] Move the vertex along each axis by the given ammount. */ void move(int, int, int); /* [API] Public #Exodist  7/03/05# [return] A list of all the surfaces this vertex is connected to. [Description] get a list of all the surfaces connected to this vertex. */ std::list<Surface *> getSurfaces(); /* [API] Public #Exodist  7/03/05# [return] A list of all the vertices this vertex is connected to. [Description] get a list of all the vertices connected to this vertex. */ std::list<Vertex *> getLinks(); /* [API] Private #Exodist  7/03/05# [return] A pointer to the list of links stored in thsi vertex [Description] get a pointer to the intwernal list of links */ std::list<Vertex *>* getLinksR(); /* [API] Public #Exodist  7/03/05# [return] A 3 elements array of pointers to this vertex's coordinates [Description] get a 3 element array of pointers to this vertex's coordinates. */ int* getCoordinates(); /* [API] Public #Exodist  7/03/05# [return] Value of the vertex on the given axis [int] Axis to get the coordinate location from [Description] get the value where this vertex sits on the given axis */ int getCoordinate(int); /* [API] Private #Exodist  7/03/05# [Vertex *] Vertex to link with this vertex. [Description] Link this vertex to the given one, this should be private, linking in a new vertex needs to be controlled so that surfaces are handled. */ void addLink(Vertex*); /* [API] Private #Exodist  7/03/05# [std::list<Vertex *>] Vertices to link with this vertex. [Description] Link this vertex to the given ones, this should be private, linking in a new vertex needs to be controlled so that surfaces are handled. */ void addLinks(std::list<Vertex*>); /* [API] Private #Exodist  7/03/05# [Vertex *] Vertex to unlink from this vertex. [Description] remove a link to a vertex, this should be private, unlinking a vertex needs to be controlled so that surfaces are handled. */ void removeLink(Vertex*); /* [API] Private #Exodist  7/03/05# [std::list<Vertex *>] Vertices to unlink from this vertex. [Description] remove links to the given vertices, this should be private, unlinking a vertex needs to be controlled so that surfaces are handled. */ void removeLinks(std::list<Vertex*>); /* [API] Private #Exodist  7/03/05# [Description] Isolate this vertex, remove all connections and selete all surfaces, this should be private, unlinking a vertex needs to be controlled this will punch a hole in whatever mesh or object the vertex is a part of. */ void isolate(); /* [API] Public #Exodist  7/03/05# [int] Axis to free [Description] Free the given axis so that it is no longer bound to any other vertices */ void freeAxis(int); /* [API] Public #Exodist  7/03/05# [int] Axis to link [Vertex *] Vertex to which this axis should be linked [bool] True if any vertices this axis is currently linked to should carry over to the new link. [Description] Link the axis on this vertex, and possibly it's existing linked axis's to the given vertex. */ void linkAxis(int, Vertex*, bool); /* [API] Private #Exodist  7/03/05# [Surface*] Surface to add [Description] Add the given surface to the vertex */ void addSurface(Surface*); /* [API] Private #Exodist  7/03/05# [std::list<Surface *>] Surfaces to add [Description] Add the given surfaces to the vertex */ void addSurface(std::list<Surface*>); /* [API] Private #Exodist  7/03/05# [Surface *] Surface to remove [Description] remove the given surface from the vertex */ void removeSurface(Surface*); /* [API] Private #Exodist  7/03/05# [std::list<Surface *>] Surfaces to remove [Description] remove the given surfaces from the vertex */ void removeSurface(std::list<Surface*>); /* [API] Public #Exodist  7/03/05# [return] 4 element boolean array, 02 are the 3 axis, true if it is closer on that axis, false if it is the same distance or further. element 3 is true if this vertex is closer all axis considered. [Vertex *] Vertex to compare with. [int*] Coordinates to check against. [Description] Check if this vertex is closer than the given one */ bool isCloser(Vertex*, int*); /* [API] Public #Exodist  7/03/05# [return] true if this vertex is linked with all the given ones [std::list<Vertex *>] list of vertices to check for connections [Description] Check if this vertex is connected to ALL the given ones */ bool isLinkedWith(std::list<Vertex *>); /* [API] Public #Exodist  7/03/05# [return] true if this vertex is linked with the given one. [Vertex *] Vertex to check [Description] Check if this vertex is linked to the given one. */ bool isLinkedWith(Vertex*); /* [API] Public #Exodist  7/03/05# [return] true if this vertex is inside the range on the given planes. [int**] Range: int[3][2] where the first dimension is the axis, the second is the lowest[0] and highest[1] number in the range on that axis. [bool*] boolean array stating which plane's to check [Description] Check if the vertex is within the given range, each axis is checked seperately. */ bool isInside(int**, bool*); /* [API] Public #Exodist  7/05/05# [return] true if this vertex is inside the radius on the given planes. [int*] Center of sphear. [int] Radius of sphear. [bool*] boolean array stating which Axis's to check [Description] Check if the vertex is within the given radius from center */ bool isInside(int*, int, bool*); /* [API] Public #Exodist  7/05/05# [return] true if this vertex is inside the radius on the given planes. [int*] Center of sphear. [int] Radius of sphear. [int] Axis to check [Description] Check if the vertex is within the given radius from center */ bool isInside(int*, int, int); /* [API] Public #Exodist  7/05/05# [return] Linear Distance from given vertex [Vertex*] Vertex to measure distance from [Description] Calculate the linear (direct vertex to virtex) distance. */ int distanceFrom(Vertex*); /* [API] Public #Exodist  7/05/05# [return] Linear Distance from given point [int*] Point to measure distance from [Description] Calculate the linear (direct point to point) distance. */ int distanceFrom(int*); /* [API] Public #Exodist  7/05/05# [return] ID Number of this vertex [Description] Get the ID of this vertex. */ int getID(); protected: std::list<Surface *> mySurfaces; //Surfaces this vertex is part of std::list<Vertex *> links; //other vertices this vertex is linked with std::list<Vertex *>* axisLinks[3]; //list of vertices who share an axis int coordinates[3]; //coordinates of this vertex long myID; //this vertex's id. }; } #endif  NEW FILE: Surface.h  /*************************************************************************** * Surface.h * * Wed Jun 22 21:48:33 2005 * Copyright 2005 User * Email ****************************************************************************/ #ifndef SURFACE_H #define SURFACE_H #include <list> #include "Vertex.h" namespace OpenRPGGDE { class Vertex; /* [API] Public #Exodist  7/03/05# [Class] [Description] Surface is the class to represent a surface stretched between 3 verticies, all surfaces are 2d triangles that are freely rotated in 3d space. */ class Surface { public: /* [API] Public #Exodist  7/03/05# [int] ID number for this surface. [std::list<Vertex *>] a list of 3 vertices, if more are in the list throw an exception [Description] constructor, makes a new Surface from given Vertices. */ Surface(int, std::list<Vertex *>); /* [API] Public #Exodist  7/03/05# [int] ID number for this surface. [Vertex*] First vertex of surface. [Vertex*] Second vertex of surface. [Vertex*] Third vertex of surface. [Description] constructor, makes a new Surface from given Vertices. */ Surface(int, Vertex*, Vertex*, Vertex*); ~Surface(); /* [API] Public #Exodist  7/03/05# [return] 3 element array representing the coordinates (X, Y, and Z location) of the surfaces center point. [Description] This function returns the coordinate of the Very center of the surface, all 3 axis's. */ int* getCenter(); /* [API] Public #Exodist  7/03/05# [return] true if the coordinates fall inside the surface when viewing a specific plane. [int*] 3 element array representing coordinates [int] the Axis we are viewing from, if it is 2 (Z) then we are looking down onto the XY plane. [Description] Check if the coordinates fall within the surface on any of the 2d planes (x,y  x,z  y,z) */ bool inSurfaceRange(int*, int); /* [API] Public #Exodist  7/03/05# [return] true if this surface and the given surface intersect on any 2d plane. [Surface*] Surface to check against [int] the Axis we are viewing from, if it is 2 (Z) then we are looking down onto the XY plane. [Description] Check if the surfaces intersect on a 2d plane. */ bool surfaceIntersects(Surface*, int); /* [API] Public #Exodist  7/03/05# [return] true if any part of this surface is within the given range [int**] Range: int[3][2] where the first dimension is the axis, the second is the lowest[0] and highest[1] number in the range on that axis. [bool*] 3 element array representing what axis do and do not mater. if bool[0] is true then we do care about the x axis. if it is false then we do not. [Description] If any portion of the surface falls within the range on the axis's being checked return true. This is a complicated idea in many ways. a corner might fit on the X and Y ranges, but not the Z so it needs to be within on all the axis we care about (see bool*). but it is also possible one of the sides of the surface might cut accross the range without any of it's corners actually being within the range. This also needs to be checked. */ bool surfaceIsInside(int**, bool*); /* [API] Public #Exodist  7/03/05# [return] true if the given coordinates have a greater value along the given axis than the center of the surface. [int*] coordinates to check [int] the Axis we are viewing from, if it is 2 (Z) then we are looking down onto the XY plane. [bool] A negation. If this is true then we do the negative of normal, as in we return true if the coordinates are lower on the given axis [Description] Check to see if the given point is further along (a greater coordinate value) on the given axis then the corresponding spot on the surface. example: if the axis being tested is Z (2) then see if the z coordinate of the given point is a larger number than the z coordinate of the same point on the surface (the coordinates where the given point intersects the face should it be raised or lowered on the z axis :: this can be figured out using the getIntersection() function). */ bool furtherOnAxis(int*, int, bool); /* [API] Public #Exodist  7/03/05# [return] true if the line represented by the given pair of coordinates pierces/intersects the surface [int*] Coordinates A [int*] Coordinates B [Description] Check if a line between the 2 given coordinates passes through the surface, must account for slope of surface. */ bool piercesSurface(int*, int*); /* [API] Public #Exodist  7/03/05# [return] distance on given axis between given coordinates and corresponding spot on the surface [int*] Coordinates [int] Axis to get a distance on. [Description] To be used w/ gravity mainly, see how far away from the surface the coordinates are on the given axis. (how far it has to fall) */ int distanceFromSurface(int*, int); /* [API] Public #Exodist  7/03/05# [return] List of this surfaces corners [Description] Get a list with references to all the corners of the surface */ std::list<Vertex *> getCorners(); /* [API] Public #Exodist  7/03/05# [return] Point of intersection on given axis [int*] Coordinates [int] Axis to find intersection coordinate on. [Description] return the value on the axis where the point would intersect the surface on the given axis were it to be moved on the axis in question through the surface. This is the kicker, this takes a set of coordinates above or below (+ or  on the given axis) the surface and returns the given axis's coordinate at which the object would be on the surface should it raise/lower into the surface. Basically if the given point were actually a line perfectly following the given axis where would it pass through or intersect the surface. */ int getIntersection(int*, int); /* [API] Public #Exodist  7/03/05# [return] This surfaces ID number [Description] Get this surfaces ID number */ int getID(); protected: Vertex** corners; //an array w/ the corners, we use array instead of list for easy element access since the ammount never changes after object construction int myID; //This surfaces ID number. //more data to come. }; } #endif  NEW FILE: Edge.h  /*************************************************************************** * Edge.h * * Fri Jun 24 17:56:41 2005 * Copyright 2005 User * Email ****************************************************************************/ #ifndef EDGE_H #define EDGE_H #include "Vertex.h" namespace OpenRPGGDE { class Vertex; /* [API] Public #Exodist  7/10/05# [Description] */ class Edge { public: /* [API] Public #Exodist  7/10/05# [Vertex*] First Vertex of linear edge [Vertex*] Second Vertex of Linear Edge [Description] Create an edge between 2 vertices */ Edge(Vertex*, Vertex*); /* [API] Public #Exodist  7/10/05# [int*] Coordinates of possible intersection [bool*] a 3 element bool array, each bool is for a specific axis, aka 0 = X, 1 = Y, 2 = Z [Description] Check to see if the point intersects the line on the axis where the bool[3] array is true. if only the x axis has true in the boolean array see if it is between the 2 points on the x axis if y is also true check to see if it is on the line when both axis's are checked, same if all 3 are supposed to be checked */ bool intersectsEdge(int*, bool*); /* [API] Public #Exodist  7/10/05# [return] center point coordinates of edge [Description] returns the coordinates for the centerpoint of the edge */ int* getCenter(); /* [API] Public #Exodist  7/10/05# [return] 2 element array with both of the common surfaces of the vertices. [Description] get the surfaces that use this edge, if there is only one then the second index is NULL */ Surface** getCommonSurfaces(); private: Vertex* ends[2]; //The 2 vertices that make up the linear edge }; } #endif 