|
clip2d.h00001 /* 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 __IGEOM_CLIP2D_H__ 00020 #define __IGEOM_CLIP2D_H__ 00021 00022 #include "csutil/scf.h" 00023 #include "csgeom/vector2.h" 00024 #include "csgeom/box.h" 00025 00027 #define MAX_OUTPUT_VERTICES 64 00028 00029 /* 00030 * Clipper return codes. 00031 * <p>The clipper routines return one of the values below so that we can 00032 * distinguish between the cases when input polygon is completely outside 00033 * the clipping polygon (thus it is not visible), completely inside the 00034 * clipping polygon (thus it has not changed) and partially outside, 00035 * partially inside (thus it was clipped). 00036 */ 00037 00039 #define CS_CLIP_OUTSIDE 0 00040 00041 #define CS_CLIP_INSIDE 1 00042 00043 #define CS_CLIP_CLIPPED 2 00044 00050 struct csVertexStatus 00051 { 00053 unsigned char Type; 00055 unsigned char Vertex; 00057 float Pos; 00058 }; 00059 00060 /* 00061 * The following are possible values for csVertexStatus.Type field. 00062 * The csVertexStatus is used by iClipper2D:Clip() routine which is 00063 * able to output a status structure corresponding to each output vertex. 00064 * This information is usually used to clip other information associated 00065 * with polygon vertices (i.e. z, u, v and such). 00066 */ 00068 #define CS_VERTEX_ORIGINAL 0 00069 00070 #define CS_VERTEX_ONEDGE 1 00071 00072 #define CS_VERTEX_INSIDE 2 00073 00074 SCF_VERSION (iClipper2D, 0, 0, 2); 00075 00079 struct iClipper2D : public iBase 00080 { 00086 virtual uint8 Clip (csVector2 *InPolygon, int InCount, 00087 csVector2 *OutPolygon, int &OutCount) = 0; 00088 00097 virtual uint8 Clip (csVector2 *InPolygon, int InCount, 00098 csVector2 *OutPolygon, int &OutCount, csBox2 &BoundingBox) = 0; 00099 00108 virtual uint8 Clip (csVector2 *InPolygon, int InCount, 00109 csVector2 *OutPolygon, int &OutCount, csVertexStatus *OutStatus) = 0; 00110 00112 virtual uint8 ClipInPlace (csVector2 *InPolygon, int &InOutCount, csBox2 &BoundingBox) = 0; 00113 00123 virtual int ClassifyBox (const csBox2 &box) = 0; 00124 00126 virtual bool IsInside (const csVector2& v) = 0; 00127 00129 virtual int GetVertexCount () = 0; 00130 00132 virtual csVector2 *GetClipPoly () = 0; 00133 }; 00134 00135 #endif 00136 Generated for Crystal Space by doxygen 1.2.5 written by Dimitri van Heesch, ©1997-2000 |