CrystalSpace

Public API Reference

igeom/clip2d.h

Go to the documentation of this file.
00001 /*
00002     Copyright (C) 2000 by Jorrit Tyberghein
00003 
00004     This library is free software; you can redistribute it and/or
00005     modify it under the terms of the GNU Library General Public
00006     License as published by the Free Software Foundation; either
00007     version 2 of the License, or (at your option) any later version.
00008 
00009     This library is distributed in the hope that it will be useful,
00010     but WITHOUT ANY WARRANTY; without even the implied warranty of
00011     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012     Library General Public License for more details.
00013 
00014     You should have received a copy of the GNU Library General Public
00015     License along with this library; if not, write to the Free
00016     Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00017 */
00018 
00019 #ifndef __CS_IGEOM_CLIP2D_H__
00020 #define __CS_IGEOM_CLIP2D_H__
00021 
00030 #include "csutil/scf_interface.h"
00031 
00032 class csBox2;
00033 class csVector2;
00034 
00036 #define MAX_OUTPUT_VERTICES     64
00037 
00046 enum
00047 {
00049   CS_CLIP_OUTSIDE = 0,
00051   CS_CLIP_CLIPPED = 1,
00053   CS_CLIP_INSIDE = 2
00054 };
00065 struct csVertexStatus
00066 {
00071   unsigned char Type;
00073   size_t Vertex;
00075   float Pos;
00076 };
00077 
00079 enum
00080 {
00082   CS_VERTEX_ORIGINAL = 0,
00084   CS_VERTEX_ONEDGE = 1,
00086   CS_VERTEX_INSIDE = 2
00087 };
00094 struct iClipper2D : public virtual iBase
00095 {
00096   SCF_INTERFACE(iClipper2D, 2, 0, 0);
00102   virtual uint8 Clip (csVector2 *InPolygon, size_t InCount,
00103     csVector2 *OutPolygon, size_t &OutCount) = 0;
00104 
00113   virtual uint8 Clip (csVector2 *InPolygon, size_t InCount,
00114     csVector2 *OutPolygon, size_t &OutCount, csBox2 &BoundingBox) = 0;
00115 
00125   virtual uint8 Clip (csVector2 *InPolygon, size_t InCount,
00126     csVector2 *OutPolygon, size_t &OutCount, csVertexStatus *OutStatus) = 0;
00127 
00132   virtual uint8 ClipInPlace (csVector2 *InPolygon, size_t &InOutCount,
00133                              csBox2 &BoundingBox) = 0;
00134 
00142   virtual int ClassifyBox (const csBox2 &box) = 0;
00143 
00145   virtual bool IsInside (const csVector2& v) = 0;
00146 
00148   virtual size_t GetVertexCount () = 0;
00149 
00151   virtual csVector2 *GetClipPoly () = 0;
00152 
00154   enum ClipperType
00155   {
00157     clipperPoly,
00159     clipperBox
00160   };
00164   virtual ClipperType GetClipperType() const = 0;
00165 };
00166 
00169 #endif // __CS_IGEOM_CLIP2D_H__

Generated for Crystal Space by doxygen 1.4.7