Exemplo n.º 1
0
        private static GeomTristrip Clip_strip_ToTristrip(Clip_tristrip Clip_strip)
        {
            GeomTristrip tristrip = new GeomTristrip();

            tristrip.NofStrips = Clip_strip.num_strips;
            tristrip.Strip     = new GeomVertexList[tristrip.NofStrips];
            IntPtr ptr = Clip_strip.strip;

            for (int i = 0; i < tristrip.NofStrips; i++)
            {
                tristrip.Strip[i] = new GeomVertexList();
                Clip_vertex_list Clip_vtx_list = (Clip_vertex_list)Marshal.PtrToStructure(ptr, typeof(Clip_vertex_list));
                tristrip.Strip[i].NofVertices = Clip_vtx_list.num_vertices;
                tristrip.Strip[i].Vertex      = new GeomVertex[tristrip.Strip[i].NofVertices];

                IntPtr ptr2 = Clip_vtx_list.vertex;
                for (int j = 0; j < tristrip.Strip[i].NofVertices; j++)
                {
                    Clip_vertex Clip_vtx = (Clip_vertex)Marshal.PtrToStructure(ptr2, typeof(Clip_vertex));
                    tristrip.Strip[i].Vertex[j].X = Clip_vtx.x;
                    tristrip.Strip[i].Vertex[j].Y = Clip_vtx.y;

                    ptr2 = IntPtrPlus(ptr2, Marshal.SizeOf(Clip_vtx)); // (IntPtr)(((int)ptr2) + Marshal.SizeOf(Clip_vtx));
                }
                ptr = IntPtrPlus(ptr, Marshal.SizeOf(Clip_vtx_list));  // (IntPtr)(((int)ptr) + Marshal.SizeOf(Clip_vtx_list));
            }

            return(tristrip);
        }
Exemplo n.º 2
0
        public static GeomTristrip PolygonToTristip(IPolygon polygon)
        {
            Clip_tristrip clip_strip = new Clip_tristrip();
            Clip_polygon  clip_pol   = ClipWrapper.PolygonTo_Clip_polygon(polygon);

            try
            {
                Polygon2Tristrip(ref clip_pol, ref clip_strip);
                GeomTristrip tristrip = ClipWrapper.Clip_strip_ToTristrip(clip_strip);

                return(tristrip);
            }
            finally
            {
                ClipWrapper.Free_Clip_polygon(clip_pol);
                ClipWrapper.FreeTristrip(ref clip_strip);
            }
        }
Exemplo n.º 3
0
        public static GeomTristrip GeomPolygonToTristrip(GeomPolygon polygon)
        {
            Clip_tristrip Clip_strip = new Clip_tristrip();
            Clip_polygon  Clip_pol   = ClipWrapper.GeomPolygonTo_Clip_polygon(polygon);

            try
            {
                Polygon2Tristrip(ref Clip_pol, ref Clip_strip);
                GeomTristrip tristrip = ClipWrapper.Clip_strip_ToTristrip(Clip_strip);

                return(tristrip);
            }
            finally
            {
                ClipWrapper.Free_Clip_polygon(Clip_pol);
                ClipWrapper.FreeTristrip(ref Clip_strip);
            }
        }
Exemplo n.º 4
0
        public static GeomTristrip ClipToTristrip(ClipOperation operation, GeomPolygon subject_polygon, GeomPolygon clip_polygon)
        {
            Clip_tristrip Clip_strip           = new Clip_tristrip();
            Clip_polygon  Clip_subject_polygon = ClipWrapper.GeomPolygonTo_Clip_polygon(subject_polygon);
            Clip_polygon  Clip_clip_polygon    = ClipWrapper.GeomPolygonTo_Clip_polygon(clip_polygon);

            try
            {
                ClipTristrip(ref Clip_subject_polygon, ref Clip_clip_polygon, operation, ref Clip_strip);
                GeomTristrip tristrip = ClipWrapper.Clip_strip_ToTristrip(Clip_strip);

                return(tristrip);
            }
            finally
            {
                ClipWrapper.Free_Clip_polygon(Clip_subject_polygon);
                ClipWrapper.Free_Clip_polygon(Clip_clip_polygon);
                ClipWrapper.FreeTristrip(ref Clip_strip);
            }
        }