This question did not get any attention when I posted it with other questions so I'll try it again by itself.

Primitive Design
I have built a rudimentary 3D engine using good OOD where the primitives (points, polygons, lines, etc.) provide methods for their management and transformations. If I have a model with 100,000 points, each point carries the overhead of the virtual function table and whatever else the compiler does to the class. Is it more prudent to restrict the primitive class design to data only and provide a different set of methods outside of the class to manage their transformations, say, in a math lib for example

When using .NET, my ref class Point3D

Re: Game Technologies: General Primitive design and OOD

Jim Perry

Or you could make the methods static class members. Also, in your example you mention a model with 100,000 points - do you mean vertices If so, if you need to do something to all of them why wouldn't you just pass the model in one call to work on them You'll have to be a bit more specific I think as to what you're trying to accomplish instead of posing hypotheticals.

Re: Game Technologies: General Primitive design and OOD


This is a memory issue, not a processing issue. Sorry for not clarifying that.

The issue is the amount of memory used by an object which contains a virtual table (and other compiler added assundries) versus just data.

I'm looking for feedback on how other people approach this (I already know the HOW TO of each approach).


Do others stick to strict OOD and encapsulate their data with the methods required to manage the data



Do they trade away OOD and limit their object(s) to data only and move the processing to an external class with static methods that operate on their data only class

Consider the same in .NET managed code where a class inherits from System::Object.

I used a point (vertex, tomatoe, tomato) as an example because any 3D world will have 100's of thousands of these and that is where it becomes a memory issue.

Again, I am not looking for a solution (I have already proposed 2 of them here). I am just looking for some feedback on which solution others use AND WHY.