The present invention relates to computer graphics programs for visualizing and processing 3D polygonal data structures as well as to the data structures themselves and to images generated from the data structures images, e.g. those whose surfaces are represented by polygonal meshes as well as to data structures for se therewith.
Three Dimensional Software graphics programs that work with polygonal data such as triangle data as shown in
Applications working with large amounts of data sometimes suffer from loss of performance because the available physical memory (Random Access Memory or RAM) is not sufficient for holding all the necessary data. The Operating System (OS) will then typically swap certain parts of the computer memory to disk, e.g. into a swap file. The OS will read the data back from disk if the program makes use of this memory. This process can be time consuming.
Typical examples are the applications working with 3D models represented by polygonal meshes such as triangle meshes. The triangle meshes have to be loaded into memory in order to be manipulated inside the application. If there are modifications these are saved again on disk in a modified way.
If a flexible data structure is used, the amount of RAM memory needed to hold such a dataset from file in memory is not the same as the disk-space required for the dataset. It can even be multiple times bigger than the disk space required to store the same data. For example, triangle mesh data is typically stored on hard-disk as STL files. These are files describing a collection of triangles. For STL files, a triangle on disk is written by or stored as 3 times 3 coordinates, i.e. 3 coordinates for each of the 3 vertices of a triangle. This means that at least 9*4 (4 bytes=1 floating point number)=36 bytes are required to describe one triangle on disk. In the STL file format this is 50 bytes, because there is also information about the normal on the triangle stored. In practical applications, the amount of triangles in such a triangle files is constantly increasing, going to several millions of triangles, which generates files of 500 Mbytes and more.
A minimal way to store these triangles into memory is to have an array of points and an array of triangles. The array of points will contain all the points, listed in a certain order. Since there are 3 coordinates (x, y, z) for each point and 1 coordinate needs 4 bytes, there are 12 bytes needed per point. Because the number of points in a typical (closed) triangle mesh is half the number of triangles, 6 bytes per triangle are needed.
The triangles are then also stored in an array, where for each triangle, the reference to the 3 points (3×4 bytes) is stored plus a description of the normal on the triangle (another 4 bytes), which consumes in total 16 bytes per triangle. So in total this type of memory structure would need only 22 bytes per triangle.
However, if the application is performing certain CAD operations on the triangle meshes (e.g. Boolean operations) certain triangles will have to be cut into multiple triangles and/or certain triangles must be deleted and/or triangles and points have to be added to the structure. For those types of changes, such a double array structure is not very suitable, because it will be slow to add and delete triangles and points, and the memory will get fragmented.
To work more efficiently a rich data structure can be created. In this case it is needed to have some information about the neighbor triangle(s) in each of the vertices and triangles and references in each of the triangles to the next and previous triangles in order to be able to remove the triangle(s) in an efficient way. Such information is called “connectivity data”.
Then the list of points will contain
Since the number of points it typically half the number of triangles, in total 24 bytes per triangle are needed for storing the list of points.
The list of triangles contains:
In total 72 bytes per triangle are needed to store a triangle mesh in such a rich structure. If there is a lot of extra information also stored, this can go up to 100 bytes.
Thus, although the calculations will go much faster with such a rich data structure, it will need 4 times more memory, which restricts the number of files that can be loaded at a time.
In case a user wants to load 100 files of on average 1 million triangles, the rich data structure will consume 8200 million bytes, which is physically impossible with today's PC hardware. With a minimal data structure, it would consume only 2200 million bytes, which is much more feasible with today's PC hardware and operating systems.
It is an object of the present invention to improve speed at which large data files such as 3D polygonal, e.g. triangle graphics files can be loaded and/or processed and/or viewed in a computer system.
An aspect of the present invention is to provide and use a hybrid data structure, that can be both compact and flexible.
The present invention also provides a computer system comprising: a memory system (e.g. a random access memory, a non-volatile memory), a processor, one computer program running on the processor, a display device, a first data structure being a first representation of a 3D polygonal Model and residing in the memory system such as the volatile memory or non-volatile memory and occupying a first amount of memory space and a means for converting the first data structure into a second data structure residing in the memory system such as the volatile memory and occupying a second amount of memory space being a second representation of the 3D polygonal Model.
The first and second 3D surface representation of the model may represent the model with the same image resolution. Either of the first or second data structure may be polygonal mesh representations of the surface of the 3D model with or without connectivity data. The first or second data structure may be displayed on the display device, e.g. as a wire frame or as a rendered image. In the latter case the computer program may include a rendering program. Optionally, further data structures may be provided, each structure, for example, being a 3D surface representation of the model and each of these may optionally represent the model with the same image resolution. In particular, the data structures may be:
The first data structure may be stored in random access memory as a simple array. The second data structure may be stored in random access memory as a linked list. The first data structure may be quicker to store in random access memory than the second data structure. The first data structure may be slower to manipulate for additions and deletions than the second data structure.
The computer program may be adapted to load data in the first to third data structures based on:
a and b show representations of data structures in memory for use with the present invention.
The present invention will be described with respect to particular embodiments and with reference to certain drawings but the invention is not limited thereto but only by the claims. The drawings described are only schematic and are non-limiting. In the drawings, the size of some of the elements may be exaggerated and not drawn on scale for illustrative purposes. Where the term “comprising” is used in the present description and claims, it does not exclude other elements or steps. Furthermore, the terms first, second, third and the like in the description and in the claims, are used for distinguishing between similar elements and not necessarily for describing a sequential or chronological order. It is to be understood that the terms so used are interchangeable under appropriate circumstances and that the embodiments of the invention described herein are capable of operation in other sequences than described or illustrated herein.
An example of a computing environment for use with the present invention is shown in
Various interface adapters 27-29 can be provided. Adapter 27 is an interface adapter, e.g. a display adapter, for connecting system bus 21 to an optional video display terminal 34. Further adapters 29 provide an input/output (I/O) adapter for connecting peripheral devices (e.g. an optical drive such as a DVD or CD-ROM drive 23) to system bus 21. Video display terminal 34 can be the visual output of computer device 10, which can be any suitable display device such as a CRT-based video display well-known in the art of computer hardware. However, with a portable or notebook-based computer, video display terminal 34 can be replaced with a LCD-based or a gas plasma-based flat-panel display. Computer device 10 further includes connecting a keyboard 36, mouse 38, and optional speaker, etc. using adapter 29. Access to an external non-volatile memory 25 such a hard disk may be provided an external bus interface 28 with address, data and control busses.
Optionally, software programs may be stored in an internal ROM (read only memory) 22 and/or may be stored in the external memory 25. An operating system may be implemented as software to run on processor 20. A graphics program suitable for use by the present invention may be obtained by programming of the processor 20. The methods and procedures of the present invention may be written as computer programs in a suitable computer language such as C++ and then compiled for the specific processor 20 in the device 10.
The present invention relates to data structures to be stored on the external memory 25, e.g. hard disk, and/or internal memory such as RAM 12 and/or on or in any other form of memory such as a memory device attached to a USB port or inserted in PCMCIA slot of the computing system, a magnetic tape memory device or an optical memory disk such as a CD-ROM or DVD-ROM readable and writable disk and to data that is to be transferred between these two memories under control of processor 20.
To overcome the dilemma of the prior art, the present invention proposes in a first embodiment an intelligent hybrid data structure. The present invention proposes allowing different data structures (representing objects to be viewed and manipulated) to be available to a graphics application program. At least two different data structures (representing objects to be viewed) are provided by embodiments of the present invention. In other embodiments three different data structures are provided.
Depending on which operations a user wants to perform on the objects, the application will convert the object(s), stored in or on a non-volatile memory such as a hard disk or a USB solid state memory device, a magnetic tape memory, an optical memory disk, etc., into a memory state which is most suited for a particular kind of operation. The latter memory state may be stored in any suitable volatile memory such as random access memory (RAM) or in any suitable non-volatile memory. The data structures proposed can all represent 3D polygonal models having the same resolution. Accordingly, embodiments of the present invention provide constant-resolution swapping from a first data structure representing a 3D polygonal surface structure of a model with a first resolution to a second data structure representing a polygonal representation of the 3D model with the same first resolution, e.g. to swap from one data structure having connectivity data between polygonals of a surface representation to another data structure without connectivity and having the same resolution or vice versa.
There are generally two types of data structures used in computing systems, e.g. used in digital computers having a memory and a processor such as a microprocessor. These data structures are arrays and linked lists. A list is a sequence of vertices where associated with each vertex is a data item and a next vertex. The association with the next vertex can be as simple as making the next data item contiguous in memory with the first data item. For example, lists may be used in an array implementation in which data items are stored in sequential memory locations in an array. Generally, it is only possible to insert or delete data easily at the ends of such an array. If the array is stored in a stack, only one end of the stack may be used to push or pop a data item (last in-first out). In a queue, data items are added at one end and removed from another (first in-first out).
Arrays are simple data structures that are quick to store and retrieve. It is more difficult to insert or delete data from the middle of the array. To do this it is necessary to slide all the data in one direction or another so as to close up a hole after a deletion or to create a hole for an addition. This sliding process takes up processor time. To make insertion or addition in the middle easier, pointers can be used. A pointer is a variable whose value denotes an address in memory. Each element in the list can be represented by a vertex that contains the data and a pointer to the next data element and/or the previous data element. Addition and deletion then only requires modifying the relevant pointers to insert or delete a data item. Such a list is sometimes called a linked list. Linked lists can be doubly or singly linked. If singly linked there is only a pointer associated with each item that points to the next data item. In doubly linked lists there are pointers to the previous data item and the next data item.
Linked lists increase the amount of memory required to store the data and hence increase the time to transfer a large array of data items to memory but any subsequent manipulation of the data, e.g. involving insertion or addition, is much quicker.
A linked list can contain a list header that can store global information about the list such as list size and pointers to the first and/or last vertices and/or information relevant to the application, e.g. the name of an object used by a computer program. If headers are not used the same information can be stored in additional variables.
Linked lists can make use of pointer variables. A variable can be declared that contains the address in memory of a data item and an operator can be provided to go between the pointer and the data that is pointed to. Another method of implementing pointers is using an array field. In this case the linked list is stored as a simple array. Each entry in the memory includes:
The present invention includes within its scope any way of storing a simple array or similar or of storing a linked list or similar. A useful source of information about data structures and memory can be found in “An introduction to data structures and algorithms”, J. A. Storer, Birkhäuser Springer 2002.
In the following it will be explained how arrays and linked lists can be used to provide the advantage of the present invention.
If, e.g., a user simply wants to visualize a polygonal mesh, e.g. triangle mesh, a lot of the extra references, which the application normally constructs, are not needed in RAM. Hence a first data structure may be compact and not have connectivity data, for instance. Accordingly, the data structure that can be selected is a simple array. Only when the user performs an operation which requires extra references, e.g. connectivity data, these references will be created in memory, e.g. non-volatile memory such as RAM by converting the first data structure to a completely different second data structure. It is not enough to create some extra information at some point in time, the basic data structure itself is completely differently organized. For example, the data is now stored as a linked list.
Examples of the use of arrays and linked list will be described with reference to
In
The data structure is stored in contiguous memory, each address or sub-address A1 to 15, etc. storing coordinate data of a vertex of a triangle (X1, Y1, Z1, etc). Hence there are three entries for each triangle T1 to T5, etc. (A1, A2, A3; etc.). The link to the next triangle in the sequence is provided by the position in memory, i.e. the next one in contiguous memory. For simple manipulations such as translation or rotation, an operation can be performed on each address or sub-address to change each value and write it back at the same position in memory. No connectivity or extra data is shown as being stored in this data structure.
b shows another minimal data structure that can be used with the present invention. In a first section of contiguous memory S1, there are four entries defined by memory addresses or sub-addresses P1 to P8, etc. for each triangle T1, T2, etc. Three of the entries are pointers (P1, P2, P3; P5, P6, P7) to the data for individual points of the triangle (X1, Y1, Z1, etc.). The fourth entry (P4, P8, etc.) is the co-ordinates of a vector defining the normal to the triangle. The vector defining the normal to the triangle is a useful data element in manipulating graphics files.
Each pointer P1 to P3; P5 to P7 etc. points to part of another section of contiguous memory S2 where the data for each point is stored X1, Y1, Z1, etc.). The points are stored in groups of three addresses or sub-addresses as required for triangles. As can be seen from the section S2 some pointers such as P2 and P5 point to the same point data (X4, Y4, Z4). This refers to a common point between the two triangles T2 and T1. This saves one data entry for each such point in the memory.
In both of the data structures of
With the data structures of
Although triangles have been referred to with respect to
The present invention includes within its scope that different kinds of data structures in memory can be created. In an embodiment of the present invention 3 different structures are provided. An application such as a graphics application can select between these two or three different data structures dynamically and convert, for example the 3D polygonal surface representation of a 3D model stored in RAM (e.g. as a simple array as shown for example in
Data structures which are included within the present invention are:
The present invention is not limited to two or three data structures. More different types of structures are included within the scope of the present invention. Some special type of operations can require special type of data to be generated. Data structures may be required which are used by specific graphics software programs, i.e. containing specific information used exclusively by such a program.
An aspect of the present invention is to reduce the memory usage again from the moment it is not absolutely required anymore. This means that as soon as manipulations of data are no longer necessary the data is converted to a representation requiring less data in non-volatile memory, e.g. RAM, e.g. conversion to a “read-only” type of data.
In accordance with a second embodiment of the present invention, the time taken for swapping from one data structure to another is addressed. If the application would switch between different memory structures for all operations, this would consume a lot of time, and eliminate all advantages. The present invention proposes in this embodiment a control algorithm for the swapping from one data structure to another.
For example, if there are certain operations (a,b,c,d) which would be best done with a minimal data structure, and other operations (E,F,G,H) where the Rich data structure is more suited, a sequence of operations like [a E b F c G d H] would require 7 conversions between the data structures. To overcome this problem, a number of solutions are proposed, each one of which is an embodiment of the present invention:
1. Double implementation of some operations.
Alternative implementations of operations using one data structure are provided so that the same operation is also possible in another structure. For example alternative implementations of the operations E and F are provided that can run in the minimal data structure (let us call these new operations e and f), and an alternative operation D for operation d that can run in the Rich data structure. The graphics program can use the following operations [a e b f c G D H] and get the same result as executing [a E b F c G d H]. However, the first sequence will only require 1 conversion between the data structures, and will therefore be much more efficient and faster.
In a preferred embodiment all the operations can be implemented in the Rich data structure, and only some limited operations in the minimal data structure.
2. Intelligent prediction about which operations the user will perform.
Because users are typically performing the same operations, but with other data, a prediction algorithm can be used to optimize the operations performed by a user. The software program can predict which operations the user will perform based on an algorithm, e.g. based on historical information about the user's actions on any data or, for example, about how the particular data has been used by any user in the past. Such an algorithm can be built into the software, or the software can include a learn function so that the program learns from the individual user or users.
If the software knows that the user will perform a series of operations that are all optimal in a certain data structure, the software can first (before the first of the series) convert the data into the appropriate data structure, and next start performing the operations. In accordance with an aspect of the present invention the software detects the start of such a series of operations and changes the data structure, e.g. after first informing the user and asking whether such a conversion is desired or appropriate and optionally requesting an action is carried out, e.g. press a key, or first informing the user that the conversion will take place, e.g. within so many seconds unless an action is carried out, e.g. press a key, or the conversion is done automatically.
A typical example of this is described in the following with reference to
When the software detects that the memory consumption is high, and that certain objects are not used for a long time, the software can automatically convert those objects back into another data structure such as minimal data structure—reverse of step 6, or the program can ask the user if this conversion may be done, e.g. a) first inform the user and ask whether the new representation is desired or appropriate and optionally request an action is carried out, e.g. press a key, or b) first inform the user that the new representation will be loaded, e.g. within so many seconds unless an action is carried out, e.g. press a key.
All these conversions can be done either at the moment when the user is requesting a certain operation, or during idle time (e.g. when the user is only looking to the object), e.g. in background, which again reduces the overhead for the user.
3. Guidance of users.
In accordance with a third embodiment of the present invention, if it does not matter in what sequence the operations are performed, the software guides the users during display and manipulation of the images. This can be done by grouping the operations into the user-interface, or by giving indications to the users, e.g. via pop-ups (e.g. ‘Do you really want to perform this operation now? Perhaps it is better that you perform this operation at the end?’).
In the example from above, in an embodiment providing grouping a Toolbar is constructed with the operations (a,b,c,d) and another toolbar with the operations (E,F,G,H). Or a wizard-like interface can be provided where first only the operations (a,b,c,d) are available, and next only the operations (E,F,G,H). Further a wizard may be provided in which the user inputs the intended operation sequence and the wizard proposes optimized variations of the sequence, whereby memory operations are reduced.
The present invention provides at least one of the following advantages:
As indicated above, although the present invention can be extended to more different structures, as a preferred embodiment a scheme of 3 different memory structures is proposed.
These three memory structures are:
A “compact” data structure that holds all the necessary data, e.g. in RAM, to show an object to the user, e.g. in 3D representation of a first resolution. Only simple viewing operations are possible, e.g. no modifications which involve changes in the polygonal structure. This data structure can be of the type shown in
A “rich” data structure that reserves RAM for much more extra information such as connectivity data. This extra information can allow the programmer to write algorithms in a much more efficient way, e.g. when extra calculations are required because the polygonal structure is changed or when advanced operations are required such as advanced editing. The resolution remains as for the compact data structure. The data structure can be a linked list as shown in
An “on disk” data structure that allows swapping of the data of the object to be viewed from RAM to disk in a efficient and controlled way. The object will still be in the database of the application and will be easily retrievable again. In this state the data objects will require virtually no RAM memory.
In a typical use, the software will load the data initially into the “Compact” data structure, which consumes less memory, and is much faster to load, because no calculations for the extra references need to be made. Once a more complicated operation is performed, the software will automatically switch to a “rich” data structure, and it will keep the data in this rich data structure. When certain data are not used frequently during working with the software the program and/or the user can decide to put these data in the ‘On Disk’ structure, which consumes much less memory and is much more optimized than the normal Disk Swapping of the Operating System. The Operating System will swap data and or programs to disk which are not used for a while. This ‘on disk’ method is preferred because the OS does not know which data will be used or not, e.g. within the immediate future.
In a further embodiment the user is given the possibility to control and change the memory mode for each object separately.
Number | Date | Country | |
---|---|---|---|
60843410 | Sep 2006 | US |