CrystalSpace

Public API Reference

Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

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 
00029 #include "csutil/scf_interface.h"
00030 
00031 class csBox2;
00032 class csVector2;
00033 
00035 #define MAX_OUTPUT_VERTICES     64
00036 
00045 enum
00046 {
00048   CS_CLIP_OUTSIDE = 0,
00050   CS_CLIP_INSIDE = 1,
00052   CS_CLIP_CLIPPED = 2
00053 };
00064 struct csVertexStatus
00065 {
00070   unsigned char Type;
00072   size_t Vertex;
00074   float Pos;
00075 };
00076 
00077 enum
00078 {
00080   CS_VERTEX_ORIGINAL = 0,
00082   CS_VERTEX_ONEDGE = 1,
00084   CS_VERTEX_INSIDE = 2
00085 };
00092 struct iClipper2D : public virtual iBase
00093 {
00094   SCF_INTERFACE(iClipper2D, 2, 0, 0);
00100   virtual uint8 Clip (csVector2 *InPolygon, size_t InCount,
00101     csVector2 *OutPolygon, size_t &OutCount) = 0;
00102 
00111   virtual uint8 Clip (csVector2 *InPolygon, size_t InCount,
00112     csVector2 *OutPolygon, size_t &OutCount, csBox2 &BoundingBox) = 0;
00113 
00123   virtual uint8 Clip (csVector2 *InPolygon, size_t InCount,
00124     csVector2 *OutPolygon, size_t &OutCount, csVertexStatus *OutStatus) = 0;
00125 
00130   virtual uint8 ClipInPlace (csVector2 *InPolygon, size_t &InOutCount,
00131                              csBox2 &BoundingBox) = 0;
00132 
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.4