|
|
/*************************************************************************** vim:tabstop=4 trianglep.h - description ------------------- begin : Sun Jul 1 2001 copyright : (C) 2001 by Francois Biot email : fbiot@free.fr *************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ #ifndef TRIANGLEP_H #define TRIANGLEP_H #include "planesurf.h" #include "point.h" #include "couleur.h" #include "vect.h" /**Triangle that is made with three ptr on point instead three instances of points * * A trianglep is very usefull to share same point between more than one triangle. *@author Francois Biot */ class trianglep : public planesurf { public: /** The default constructor is needed by maps, lists etc... * It should never been used elsewhere ! */ trianglep() { mpa=new point(0,0,0); mpb=mpa; mpc=mpa; mpcol=0; } /** * This ctor does not duplicates points ! */ trianglep(point *pa,point *pb,point *pc,const CString &sName="") : planesurf(sName), mpa(pa), mpb(pb), mpc(pc), mpcol(0) {}; /** * This ctor does not duplicates points ! */ trianglep( point *pa, point *pb, point *pc, couleur* pcol, const CString &sName="") : planesurf(sName), mpa(pa), mpb(pb), mpc(pc) { if (mpcol) mpcol=new couleur(col_black); else mpcol=0; }; trianglep(const trianglep &t); /** Note, points are not deleted. This is voluntary * Memory must be cleared by the trianglep user. */ virtual ~trianglep(){ if (mpcol) delete mpcol; }; // from planesurf virtual const vect& Normal () const; virtual vect AVect(const point &p) const; // from glsurface virtual void Translate (const vect &v); virtual void Render () const; virtual glsurface* Duplicate () const; virtual point GPoint () const; // from glsurface virtual float PlanSide (const planesurf *) const; /** This method returns true if a line segment passes through the * triangle. If yes, this function can also return the intersection * of the triangle and the line segment in ppIntersect */ virtual planesurf* Collision ( const point &poStart, const vect &vPath, point* pptInter, glsolid* &pSolid); virtual void SetColor (const couleur &col); void SetPoints(point* pa,point *pb,point *pc) { mpa=pa; mpb=pb; mpc=pc; }; const point& Getpa() const { return *mpa; }; const point& Getpb() const { return *mpb; }; const point& Getpc() const { return *mpc; }; const point* Getppa()const { return mpa; }; const point* Getppb()const { return mpb; }; const point* Getppc()const { return mpc; }; point* Getppa() { return mpa; }; point* Getppb() { return mpb; }; point* Getppc() { return mpc; }; private: trianglep& operator=(const trianglep&); point* mpa; point* mpb; point* mpc; couleur* mpcol; }; #endif
Generated by: saturn on FrancoisLinux on Sun Feb 3 20:01:44 2002, using kdoc 2.0a53. |