Not logged in, Join Here! or Log In Below:  
 
News Articles Search    
 

 Home / 3D Theory & Graphics / IS-A Polygon a Plane or does it HAVE-A Plane?? Account Manager
 
Archive Notice: This thread is old and no longer active. It is here for reference purposes. This thread was created on an older version of the flipcode forums, before the site closed in 2005. Please keep that in mind as you view this thread, as many of the topics and opinions may be outdated.
 
ROME

March 13, 1999, 02:57 PM

Hi, I am researching the hierarchy of my upcoming 3D engine and so want to get the inhieritance correct etc. Here is my question: Concerning the following classes: Polygon3D and Plane. Should I have my Polygon3D inherit the properties of the Plane class (as it is a type of plane ) or should I include the Plane Class inside Polygon3D's member data?? (ie. use it as an object instead). ?? Thanks..

 
Jaap Suter

March 13, 1999, 04:50 PM


I have an object of class cPlane in my poly class. I find this more attractive than
inheritance. Actually i hate inheritance. You should read code on the cob on www.loonygames.com
there one issue chris hargroves did a nice column on inheritance versus composition. I
do use inheritance in my engine but often people tend to think that OOP = Inheritance. I
disAgree.

Jaap Suter

 
Jeroen

March 14, 1999, 02:41 PM



ROME wrote:
>>Hi, I am researching the hierarchy of my upcoming 3D engine and so want to get the
>>inhieritance correct etc. Here is my question: Concerning the following classes: Polygon3D
>>and Plane. Should I have my Polygon3D inherit the properties of the Plane class (as it is
>>a type of plane ) or should I include the Plane Class inside Polygon3D's member data?? (ie.
>>use it as an object instead). ?? Thanks..

Well, a plane goes on into infinity and a polygon doesn't. Therefore, a polygon (a finite set
of points in space) is a subset of the plane (an infinite number of points) in which it lies.
But in practice, a plane is only used for certain operations on a polygon. Personally, I would
define a completely different class for both, and let the polygon have a member of class Plane.

Jeroen

 
ROME

March 14, 1999, 06:25 PM



Jeroen wrote:

>>Well, a plane goes on into infinity and a polygon doesn't. Therefore, a polygon (a finite set
>>of points in space) is a subset of the plane (an infinite number of points) in which it lies.
>>But in practice, a plane is only used for certain operations on a polygon. Personally, I would
>>define a completely different class for both, and let the polygon have a member of class Plane.
>>
>>Jeroen
>>
You make a strong point. I guess that I will simple have my Polygons have a member of class plane as you stated in your reply. Thanks for the great example. ROME.

 
This thread contains 4 messages.
 
 
Hosting by Solid Eight Studios, maker of PhotoTangler Collage Maker.