public static IGeometry GetExample3()
        {
            //Triangles: Three Upright Triangles

            IGeometryCollection multiPatchGeometryCollection = new MultiPatchClass();

            IPointCollection trianglesPointCollection = new TrianglesClass();

            //Triangle 1

            trianglesPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(2.5, 2.5, 0), ref _missing, ref _missing);
            trianglesPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(2.5, 2.5, 7.5), ref _missing, ref _missing);
            trianglesPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(7.5, 2.5, 7.5), ref _missing, ref _missing);

            //Triangle 2

            trianglesPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(-7.5, 2.5, 0), ref _missing, ref _missing);
            trianglesPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(-7.5, 2.5, 7.5), ref _missing, ref _missing);
            trianglesPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(-2.5, 2.5, 7.5), ref _missing, ref _missing);

            //Triangle 3

            trianglesPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(-2.5, -2.5, 0), ref _missing, ref _missing);
            trianglesPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(-2.5, -2.5, 7.5), ref _missing, ref _missing);
            trianglesPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(2.5, -2.5, 7.5), ref _missing, ref _missing);

            multiPatchGeometryCollection.AddGeometry(trianglesPointCollection as IGeometry, ref _missing, ref _missing);

            return(multiPatchGeometryCollection as IGeometry);
        }
Beispiel #2
0
        public static IGeometry GetExample2()
        {
            const double FromZ = -0.1;
            const double ToZ   = -8;

            //Extrusion: Multiple Point 2D Polyline Extruded To Generate 3D Wall Via ConstructExtrudeFromTo()

            IPointCollection polylinePointCollection = new PolylineClass();

            polylinePointCollection.AddPoint(GeometryUtilities.ConstructPoint2D(-10, -10), ref _missing, ref _missing);
            polylinePointCollection.AddPoint(GeometryUtilities.ConstructPoint2D(-8, -7), ref _missing, ref _missing);
            polylinePointCollection.AddPoint(GeometryUtilities.ConstructPoint2D(-5, -5), ref _missing, ref _missing);
            polylinePointCollection.AddPoint(GeometryUtilities.ConstructPoint2D(-3, -2), ref _missing, ref _missing);
            polylinePointCollection.AddPoint(GeometryUtilities.ConstructPoint2D(0, 0), ref _missing, ref _missing);
            polylinePointCollection.AddPoint(GeometryUtilities.ConstructPoint2D(3, 2), ref _missing, ref _missing);
            polylinePointCollection.AddPoint(GeometryUtilities.ConstructPoint2D(5, 5), ref _missing, ref _missing);
            polylinePointCollection.AddPoint(GeometryUtilities.ConstructPoint2D(8, 7), ref _missing, ref _missing);
            polylinePointCollection.AddPoint(GeometryUtilities.ConstructPoint2D(10, 10), ref _missing, ref _missing);

            IGeometry polylineGeometry = polylinePointCollection as IGeometry;

            ITopologicalOperator topologicalOperator = polylineGeometry as ITopologicalOperator;

            topologicalOperator.Simplify();

            IConstructMultiPatch constructMultiPatch = new MultiPatchClass();

            constructMultiPatch.ConstructExtrudeFromTo(FromZ, ToZ, polylineGeometry);

            return(constructMultiPatch as IGeometry);
        }
Beispiel #3
0
        public static IGeometry GetExample3()
        {
            const double FromZ = 0;
            const double ToZ   = 9.5;

            //Extrusion: Square Shaped 2D Polygon Extruded To Generate 3D Building Via ConstructExtrudeFromTo()

            IPointCollection polygonPointCollection = new PolygonClass();

            polygonPointCollection.AddPoint(GeometryUtilities.ConstructPoint2D(-2, 2), ref _missing, ref _missing);
            polygonPointCollection.AddPoint(GeometryUtilities.ConstructPoint2D(2, 2), ref _missing, ref _missing);
            polygonPointCollection.AddPoint(GeometryUtilities.ConstructPoint2D(2, -2), ref _missing, ref _missing);
            polygonPointCollection.AddPoint(GeometryUtilities.ConstructPoint2D(-2, -2), ref _missing, ref _missing);

            IPolygon polygon = polygonPointCollection as IPolygon;

            polygon.Close();

            IGeometry polygonGeometry = polygonPointCollection as IGeometry;

            ITopologicalOperator topologicalOperator = polygonGeometry as ITopologicalOperator;

            topologicalOperator.Simplify();

            IConstructMultiPatch constructMultiPatch = new MultiPatchClass();

            constructMultiPatch.ConstructExtrudeFromTo(FromZ, ToZ, polygonGeometry);

            return(constructMultiPatch as IGeometry);
        }
        public static IGeometry GetExample4()
        {
            //Ring: Maze Lying On XY Plane

            IGeometryCollection multiPatchGeometryCollection = new MultiPatchClass();

            IPointCollection ringPointCollection = new RingClass();

            ringPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(-10, 10, 0), ref _missing, ref _missing);
            ringPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(10, 10, 0), ref _missing, ref _missing);
            ringPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(10, -10, 0), ref _missing, ref _missing);
            ringPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(-10, -10, 0), ref _missing, ref _missing);
            ringPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(-10, 6, 0), ref _missing, ref _missing);
            ringPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(6, 6, 0), ref _missing, ref _missing);
            ringPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(6, -6, 0), ref _missing, ref _missing);
            ringPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(-6, -6, 0), ref _missing, ref _missing);
            ringPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(-6, 2, 0), ref _missing, ref _missing);
            ringPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(-6, 2, 0), ref _missing, ref _missing);
            ringPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(0, 2, 0), ref _missing, ref _missing);
            ringPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(0, 0, 0), ref _missing, ref _missing);
            ringPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(-4, 0, 0), ref _missing, ref _missing);
            ringPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(-4, -4, 0), ref _missing, ref _missing);
            ringPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(4, -4, 0), ref _missing, ref _missing);
            ringPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(4, 4, 0), ref _missing, ref _missing);
            ringPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(-8, 4, 0), ref _missing, ref _missing);
            ringPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(-8, -8, 0), ref _missing, ref _missing);
            ringPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(8, -8, 0), ref _missing, ref _missing);
            ringPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(8, 8, 0), ref _missing, ref _missing);
            ringPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(-10, 8, 0), ref _missing, ref _missing);
            ringPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(-10, 10, 0), ref _missing, ref _missing);

            multiPatchGeometryCollection.AddGeometry(ringPointCollection as IGeometry, ref _missing, ref _missing);

            return(multiPatchGeometryCollection as IGeometry);
        }
Beispiel #5
0
        public static IGeometry GetExample2()
        {
            //TriangleStrip: Multi-Paneled Vertical Plane

            IGeometryCollection multiPatchGeometryCollection = new MultiPatchClass();

            IPointCollection triangleStripPointCollection = new TriangleStripClass();

            //Panel 1

            triangleStripPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(-7.5, 7.5, 0), ref _missing, ref _missing);
            triangleStripPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(-7.5, 7.5, 7.5), ref _missing, ref _missing);

            //Panel 2

            triangleStripPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(-2.5, 2.5, 0), ref _missing, ref _missing);
            triangleStripPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(-2.5, 2.5, 7.5), ref _missing, ref _missing);

            //Panel 3

            triangleStripPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(2.5, -2.5, 0), ref _missing, ref _missing);
            triangleStripPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(2.5, -2.5, 7.5), ref _missing, ref _missing);

            //Panel 4

            triangleStripPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(7.5, -7.5, 0), ref _missing, ref _missing);
            triangleStripPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(7.5, -7.5, 7.5), ref _missing, ref _missing);

            multiPatchGeometryCollection.AddGeometry(triangleStripPointCollection as IGeometry, ref _missing, ref _missing);

            return(multiPatchGeometryCollection as IGeometry);
        }
Beispiel #6
0
        public static IGeometry GetExample5()
        {
            //TriangleStrip: Star Shaped Box Without Top or Bottom

            IGeometryCollection multiPatchGeometryCollection = new MultiPatchClass();

            IPointCollection triangleStripPointCollection = new TriangleStripClass();

            //Start

            triangleStripPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(0, 2, 0), ref _missing, ref _missing);
            triangleStripPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(0, 2, 5), ref _missing, ref _missing);

            //First Panel

            triangleStripPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(-1 * Math.Sqrt(10), Math.Sqrt(10), 0), ref _missing, ref _missing);
            triangleStripPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(-1 * Math.Sqrt(10), Math.Sqrt(10), 5), ref _missing, ref _missing);

            //Second Panel

            triangleStripPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(-2, 0, 0), ref _missing, ref _missing);
            triangleStripPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(-2, 0, 5), ref _missing, ref _missing);

            //Third Panel

            triangleStripPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(-1 * Math.Sqrt(10), -1 * Math.Sqrt(10), 0), ref _missing, ref _missing);
            triangleStripPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(-1 * Math.Sqrt(10), -1 * Math.Sqrt(10), 5), ref _missing, ref _missing);

            //Fourth Panel

            triangleStripPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(0, -2, 0), ref _missing, ref _missing);
            triangleStripPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(0, -2, 5), ref _missing, ref _missing);

            //Fifth Panel

            triangleStripPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(Math.Sqrt(10), -1 * Math.Sqrt(10), 0), ref _missing, ref _missing);
            triangleStripPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(Math.Sqrt(10), -1 * Math.Sqrt(10), 5), ref _missing, ref _missing);

            //Sixth Panel

            triangleStripPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(2, 0, 0), ref _missing, ref _missing);
            triangleStripPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(2, 0, 5), ref _missing, ref _missing);

            //Seventh Panel

            triangleStripPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(Math.Sqrt(10), Math.Sqrt(10), 0), ref _missing, ref _missing);
            triangleStripPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(Math.Sqrt(10), Math.Sqrt(10), 5), ref _missing, ref _missing);

            //End, To Close Box

            triangleStripPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(0, 2, 0), ref _missing, ref _missing);
            triangleStripPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(0, 2, 5), ref _missing, ref _missing);

            multiPatchGeometryCollection.AddGeometry(triangleStripPointCollection as IGeometry, ref _missing, ref _missing);

            return(multiPatchGeometryCollection as IGeometry);
        }
        public static IGeometry GetExample5()
        {
            const int    XRange            = 16;
            const int    YRange            = 16;
            const int    InteriorRingCount = 25;
            const double HoleRange         = 0.5;

            //RingGroup: Square Lying In XY Plane With Single Exterior Ring And Multiple Interior Rings

            IGeometryCollection multiPatchGeometryCollection = new MultiPatchClass();

            IMultiPatch multiPatch = multiPatchGeometryCollection as IMultiPatch;

            //Exterior Ring

            IPointCollection exteriorRingPointCollection = new RingClass();

            exteriorRingPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(0.5 * (XRange + 2), -0.5 * (YRange + 2), 0), ref _missing, ref _missing);
            exteriorRingPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(-0.5 * (XRange + 2), -0.5 * (YRange + 2), 0), ref _missing, ref _missing);
            exteriorRingPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(-0.5 * (XRange + 2), 0.5 * (YRange + 2), 0), ref _missing, ref _missing);
            exteriorRingPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(0.5 * (XRange + 2), 0.5 * (YRange + 2), 0), ref _missing, ref _missing);

            IRing exteriorRing = exteriorRingPointCollection as IRing;

            exteriorRing.Close();

            multiPatchGeometryCollection.AddGeometry(exteriorRing as IGeometry, ref _missing, ref _missing);

            multiPatch.PutRingType(exteriorRing, esriMultiPatchRingType.esriMultiPatchOuterRing);

            //Interior Rings

            Random random = new Random();

            for (int i = 0; i < InteriorRingCount; i++)
            {
                double interiorRingOriginX = XRange * (random.NextDouble() - 0.5);
                double interiorRingOriginY = YRange * (random.NextDouble() - 0.5);

                IPointCollection interiorRingPointCollection = new RingClass();
                interiorRingPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(interiorRingOriginX - 0.5 * HoleRange, interiorRingOriginY - 0.5 * HoleRange, 0), ref _missing, ref _missing);
                interiorRingPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(interiorRingOriginX + 0.5 * HoleRange, interiorRingOriginY - 0.5 * HoleRange, 0), ref _missing, ref _missing);
                interiorRingPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(interiorRingOriginX + 0.5 * HoleRange, interiorRingOriginY + 0.5 * HoleRange, 0), ref _missing, ref _missing);
                interiorRingPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(interiorRingOriginX - 0.5 * HoleRange, interiorRingOriginY + 0.5 * HoleRange, 0), ref _missing, ref _missing);

                IRing interiorRing = interiorRingPointCollection as IRing;
                interiorRing.Close();

                multiPatchGeometryCollection.AddGeometry(interiorRing as IGeometry, ref _missing, ref _missing);

                multiPatch.PutRingType(interiorRing, esriMultiPatchRingType.esriMultiPatchInnerRing);
            }

            return(multiPatchGeometryCollection as IGeometry);
        }
Beispiel #8
0
        private static void DrawAxis(IGraphicsContainer3D axesGraphicsContainer3D, IPoint axisFromPoint, IPoint axisToPoint, IColor axisColor, esriSimple3DLineStyle axisStyle, double axisWidth)
        {
            IPointCollection axisPointCollection = new PolylineClass();

            axisPointCollection.AddPoint(axisFromPoint, ref _missing, ref _missing);
            axisPointCollection.AddPoint(axisToPoint, ref _missing, ref _missing);

            GeometryUtilities.MakeZAware(axisPointCollection as IGeometry);

            GraphicsLayer3DUtilities.AddAxisToGraphicsLayer3D(axesGraphicsContainer3D, axisPointCollection as IGeometry, axisColor, axisStyle, axisWidth);
        }
Beispiel #9
0
        public static void DrawAxes(IGraphicsContainer3D axesGraphicsContainer3D)
        {
            const esriSimple3DLineStyle AxisStyle = esriSimple3DLineStyle.esriS3DLSTube;
            const double AxisWidth = 0.25;

            DrawAxis(axesGraphicsContainer3D, GeometryUtilities.ConstructPoint3D(-10, 0, 0), GeometryUtilities.ConstructPoint3D(10, 0, 0), ColorUtilities.GetColor(255, 0, 0), AxisStyle, AxisWidth);
            DrawAxis(axesGraphicsContainer3D, GeometryUtilities.ConstructPoint3D(0, -10, 0), GeometryUtilities.ConstructPoint3D(0, 10, 0), ColorUtilities.GetColor(0, 0, 255), AxisStyle, AxisWidth);
            DrawAxis(axesGraphicsContainer3D, GeometryUtilities.ConstructPoint3D(0, 0, -10), GeometryUtilities.ConstructPoint3D(0, 0, 10), ColorUtilities.GetColor(0, 255, 0), AxisStyle, AxisWidth);

            DrawEnd(axesGraphicsContainer3D, GeometryUtilities.ConstructPoint3D(10, 0, 0), GeometryUtilities.ConstructVector3D(0, 10, 0), 90, ColorUtilities.GetColor(255, 0, 0), 0.2 * AxisWidth);
            DrawEnd(axesGraphicsContainer3D, GeometryUtilities.ConstructPoint3D(0, 10, 0), GeometryUtilities.ConstructVector3D(10, 0, 0), -90, ColorUtilities.GetColor(0, 0, 255), 0.2 * AxisWidth);
            DrawEnd(axesGraphicsContainer3D, GeometryUtilities.ConstructPoint3D(0, 0, 10), null, 0, ColorUtilities.GetColor(0, 255, 0), 0.2 * AxisWidth);
        }
Beispiel #10
0
        public static IGeometry GetExample3()
        {
            //TriangleStrip: Stairs

            IGeometryCollection multiPatchGeometryCollection = new MultiPatchClass();

            IPointCollection triangleStripPointCollection = new TriangleStripClass();

            //First Step

            triangleStripPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(0, 10, 10), ref _missing, ref _missing);
            triangleStripPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(10, 10, 10), ref _missing, ref _missing);

            triangleStripPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(0, 7.5, 10), ref _missing, ref _missing);
            triangleStripPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(10, 7.5, 10), ref _missing, ref _missing);

            //Second Step

            triangleStripPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(0, 7.5, 7.5), ref _missing, ref _missing);
            triangleStripPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(10, 7.5, 7.5), ref _missing, ref _missing);


            triangleStripPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(0, 5, 7.5), ref _missing, ref _missing);
            triangleStripPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(10, 5, 7.5), ref _missing, ref _missing);

            //Third Step

            triangleStripPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(0, 5, 5), ref _missing, ref _missing);
            triangleStripPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(10, 5, 5), ref _missing, ref _missing);


            triangleStripPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(0, 2.5, 5), ref _missing, ref _missing);
            triangleStripPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(10, 2.5, 5), ref _missing, ref _missing);

            //Fourth Step

            triangleStripPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(0, 2.5, 2.5), ref _missing, ref _missing);
            triangleStripPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(10, 2.5, 2.5), ref _missing, ref _missing);

            triangleStripPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(0, 0, 2.5), ref _missing, ref _missing);
            triangleStripPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(10, 0, 2.5), ref _missing, ref _missing);

            //End

            triangleStripPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(0, 0, 0), ref _missing, ref _missing);
            triangleStripPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(10, 0, 0), ref _missing, ref _missing);

            multiPatchGeometryCollection.AddGeometry(triangleStripPointCollection as IGeometry, ref _missing, ref _missing);

            return(multiPatchGeometryCollection as IGeometry);
        }
Beispiel #11
0
        public static IGeometry GetExample14()
        {
            const int    PointCount = 100;
            const double ZMin       = 0;
            const double ZMax       = 4;

            //Extrusion: Square Shaped Base Geometry Extruded Between Single TIN-Based Functional Surface

            IGeometryCollection multiPatchGeometryCollection = new MultiPatchClass();

            //Base Geometry

            IEnvelope envelope = new EnvelopeClass();

            envelope.XMin = -10;
            envelope.XMax = 10;
            envelope.YMin = -10;
            envelope.YMax = 10;

            IGeometry baseGeometry = envelope as IGeometry;

            //Upper Functional Surface

            ITinEdit tinEdit = new TinClass();

            tinEdit.InitNew(envelope);

            Random random = new Random();

            for (int i = 0; i < PointCount; i++)
            {
                double x = envelope.XMin + (envelope.XMax - envelope.XMin) * random.NextDouble();
                double y = envelope.YMin + (envelope.YMax - envelope.YMin) * random.NextDouble();
                double z = ZMin + (ZMax - ZMin) * random.NextDouble();

                IPoint point = GeometryUtilities.ConstructPoint3D(x, y, z);

                tinEdit.AddPointZ(point, 0);
            }

            IFunctionalSurface functionalSurface = tinEdit as IFunctionalSurface;

            IConstructMultiPatch constructMultiPatch = new MultiPatchClass();

            constructMultiPatch.ConstructExtrudeBetween(functionalSurface, functionalSurface, baseGeometry);

            return(constructMultiPatch as IGeometry);
        }
        public static IGeometry GetExample4()
        {
            //Triangles: Six Triangles Lying In Different Planes

            IGeometryCollection multiPatchGeometryCollection = new MultiPatchClass();

            IPointCollection trianglesPointCollection = new TrianglesClass();

            //Triangle 1

            trianglesPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(7.5, 7.5, 0), ref _missing, ref _missing);
            trianglesPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(10, 7.5, 0), ref _missing, ref _missing);
            trianglesPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(7.5, 5, 0), ref _missing, ref _missing);

            //Triangle 2

            trianglesPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(-7.5, 7.5, 0), ref _missing, ref _missing);
            trianglesPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(-5, 7.5, 0), ref _missing, ref _missing);
            trianglesPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(-7.5, 5, 0), ref _missing, ref _missing);

            //Triangle 3

            trianglesPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(0, -5, 0), ref _missing, ref _missing);
            trianglesPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(2.5, -5, 0), ref _missing, ref _missing);
            trianglesPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(0, -7.5, 0), ref _missing, ref _missing);

            //Triangle 4

            trianglesPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(0, 7.5, 2.5), ref _missing, ref _missing);
            trianglesPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(2.5, 7.5, 0), ref _missing, ref _missing);
            trianglesPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(0, 7.5, 0), ref _missing, ref _missing);

            //Triangle 5

            trianglesPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(-7.5, -7.5, 2.5), ref _missing, ref _missing);
            trianglesPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(-5, -7.5, 0), ref _missing, ref _missing);
            trianglesPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(-7.5, -7.5, 0), ref _missing, ref _missing);

            //Triangle 6

            trianglesPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(7.5, -7.5, 2.5), ref _missing, ref _missing);
            trianglesPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(10, -7.5, 0), ref _missing, ref _missing);
            trianglesPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(7.5, -7.5, 0), ref _missing, ref _missing);

            multiPatchGeometryCollection.AddGeometry(trianglesPointCollection as IGeometry, ref _missing, ref _missing);

            return(multiPatchGeometryCollection as IGeometry);
        }
        public static IGeometry GetExample1()
        {
            //Triangles: One Triangle Lying On XY Plane

            IGeometryCollection multiPatchGeometryCollection = new MultiPatchClass();

            IPointCollection trianglesPointCollection = new TrianglesClass();

            trianglesPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(2.5, 2.5, 0), ref _missing, ref _missing);
            trianglesPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(7.5, 7.5, 0), ref _missing, ref _missing);
            trianglesPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(7.5, 2.5, 0), ref _missing, ref _missing);

            multiPatchGeometryCollection.AddGeometry(trianglesPointCollection as IGeometry, ref _missing, ref _missing);

            return(multiPatchGeometryCollection as IGeometry);
        }
Beispiel #14
0
        public static IGeometry GetExample1()
        {
            //TriangleStrip: Square Lying On XY Plane

            IGeometryCollection multiPatchGeometryCollection = new MultiPatchClass();

            IPointCollection triangleStripPointCollection = new TriangleStripClass();

            triangleStripPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(-6, -6, 0), ref _missing, ref _missing);
            triangleStripPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(-6, 6, 0), ref _missing, ref _missing);
            triangleStripPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(6, -6, 0), ref _missing, ref _missing);
            triangleStripPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(6, 6, 0), ref _missing, ref _missing);

            multiPatchGeometryCollection.AddGeometry(triangleStripPointCollection as IGeometry, ref _missing, ref _missing);

            return(multiPatchGeometryCollection as IGeometry);
        }
        public static IGeometry GetExample4()
        {
            //TriangleFan: Triangle Based Pyramid

            IGeometryCollection multiPatchGeometryCollection = new MultiPatchClass();

            IPointCollection triangleFanPointCollection = new TriangleFanClass();

            triangleFanPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(0, 0, 6), ref _missing, ref _missing);
            triangleFanPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(-3 * Math.Sqrt(3), -3, 0), ref _missing, ref _missing);
            triangleFanPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(0, 6, 0), ref _missing, ref _missing);
            triangleFanPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(3 * Math.Sqrt(3), -3, 0), ref _missing, ref _missing);
            triangleFanPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(-3 * Math.Sqrt(3), -3, 0), ref _missing, ref _missing);

            multiPatchGeometryCollection.AddGeometry(triangleFanPointCollection as IGeometry, ref _missing, ref _missing);

            return(multiPatchGeometryCollection as IGeometry);
        }
        public static IGeometry GetExample1()
        {
            //Ring: Upright Rectangle

            IGeometryCollection multiPatchGeometryCollection = new MultiPatchClass();

            IPointCollection ringPointCollection = new RingClass();

            ringPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(-7.5, 0, 0), ref _missing, ref _missing);
            ringPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(-7.5, 0, 7.5), ref _missing, ref _missing);
            ringPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(7.5, 0, 7.5), ref _missing, ref _missing);
            ringPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(7.5, 0, 0), ref _missing, ref _missing);
            ringPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(-7.5, 0, 0), ref _missing, ref _missing);

            multiPatchGeometryCollection.AddGeometry(ringPointCollection as IGeometry, ref _missing, ref _missing);

            return(multiPatchGeometryCollection as IGeometry);
        }
Beispiel #17
0
        public static IGeometry GetExample9()
        {
            const int    DensificationDivisions = 20;
            const double MaxDeviation           = 0.1;
            const double BaseZ   = 0;
            const double OffsetZ = -7;

            //Extrusion: 3D Polyline Having Vertices With Varying Z Values, Extruded Relative To Existing
            //           Vertex Z Values Via ConstructExtrude()

            IPointCollection polylinePointCollection = new PolylineClass();

            polylinePointCollection.AddPoint(GeometryUtilities.ConstructPoint2D(-10, -10), ref _missing, ref _missing);
            polylinePointCollection.AddPoint(GeometryUtilities.ConstructPoint2D(0, -5), ref _missing, ref _missing);
            polylinePointCollection.AddPoint(GeometryUtilities.ConstructPoint2D(0, 5), ref _missing, ref _missing);
            polylinePointCollection.AddPoint(GeometryUtilities.ConstructPoint2D(10, 10), ref _missing, ref _missing);

            IPolyline polyline = polylinePointCollection as IPolyline;

            polyline.Densify(polyline.Length / DensificationDivisions, MaxDeviation);

            IGeometry polylineGeometry = polyline as IGeometry;

            GeometryUtilities.MakeZAware(polylineGeometry);

            Random random = new Random();

            for (int i = 0; i < polylinePointCollection.PointCount; i++)
            {
                IPoint polylinePoint = polylinePointCollection.get_Point(i);

                polylinePointCollection.UpdatePoint(i, GeometryUtilities.ConstructPoint3D(polylinePoint.X, polylinePoint.Y, BaseZ - 2 * Math.Sin(random.NextDouble())));
            }

            ITopologicalOperator topologicalOperator = polylineGeometry as ITopologicalOperator;

            topologicalOperator.Simplify();

            IConstructMultiPatch constructMultiPatch = new MultiPatchClass();

            constructMultiPatch.ConstructExtrude(OffsetZ, polylineGeometry);

            return(constructMultiPatch as IGeometry);
        }
        public static IGeometry GetExample3()
        {
            //RingGroup: Upright Square With Hole

            IGeometryCollection multiPatchGeometryCollection = new MultiPatchClass();

            IMultiPatch multiPatch = multiPatchGeometryCollection as IMultiPatch;

            //Exterior Ring 1

            IPointCollection exteriorRing1PointCollection = new RingClass();

            exteriorRing1PointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(5, 0, -5), ref _missing, ref _missing);
            exteriorRing1PointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(-5, 0, -5), ref _missing, ref _missing);
            exteriorRing1PointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(-5, 0, 5), ref _missing, ref _missing);
            exteriorRing1PointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(5, 0, 5), ref _missing, ref _missing);

            IRing exteriorRing1 = exteriorRing1PointCollection as IRing;

            exteriorRing1.Close();

            multiPatchGeometryCollection.AddGeometry(exteriorRing1 as IGeometry, ref _missing, ref _missing);

            multiPatch.PutRingType(exteriorRing1, esriMultiPatchRingType.esriMultiPatchOuterRing);

            //Interior Ring 1

            IPointCollection interiorRing1PointCollection = new RingClass();

            interiorRing1PointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(-4, 0, -4), ref _missing, ref _missing);
            interiorRing1PointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(4, 0, -4), ref _missing, ref _missing);
            interiorRing1PointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(4, 0, 4), ref _missing, ref _missing);
            interiorRing1PointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(-4, 0, 4), ref _missing, ref _missing);

            IRing interiorRing1 = interiorRing1PointCollection as IRing;

            interiorRing1.Close();

            multiPatchGeometryCollection.AddGeometry(interiorRing1 as IGeometry, ref _missing, ref _missing);

            multiPatch.PutRingType(interiorRing1, esriMultiPatchRingType.esriMultiPatchInnerRing);

            return(multiPatchGeometryCollection as IGeometry);
        }
        public static IGeometry GetExample2()
        {
            //TriangleFan: Upright Square

            IGeometryCollection multiPatchGeometryCollection = new MultiPatchClass();

            IPointCollection triangleFanPointCollection = new TriangleFanClass();

            triangleFanPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(0, 0, 0), ref _missing, ref _missing);
            triangleFanPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(-5, 0, -5), ref _missing, ref _missing);
            triangleFanPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(-5, 0, 5), ref _missing, ref _missing);
            triangleFanPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(5, 0, 5), ref _missing, ref _missing);
            triangleFanPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(5, 0, -5), ref _missing, ref _missing);
            triangleFanPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(-5, 0, -5), ref _missing, ref _missing);

            multiPatchGeometryCollection.AddGeometry(triangleFanPointCollection as IGeometry, ref _missing, ref _missing);

            return(multiPatchGeometryCollection as IGeometry);
        }
        public static IGeometry GetExample3()
        {
            //TriangleFan: Square Based Pyramid

            IGeometryCollection multiPatchGeometryCollection = new MultiPatchClass();

            IPointCollection triangleFanPointCollection = new TriangleFanClass();

            triangleFanPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(0, 0, 7), ref _missing, ref _missing);
            triangleFanPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(-6, -6, 0), ref _missing, ref _missing);
            triangleFanPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(-6, 6, 0), ref _missing, ref _missing);
            triangleFanPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(6, 6, 0), ref _missing, ref _missing);
            triangleFanPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(6, -6, 0), ref _missing, ref _missing);
            triangleFanPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(-6, -6, 0), ref _missing, ref _missing);

            multiPatchGeometryCollection.AddGeometry(triangleFanPointCollection as IGeometry, ref _missing, ref _missing);

            return(multiPatchGeometryCollection as IGeometry);
        }
Beispiel #21
0
        public static IGeometry GetExample2()
        {
            const double XScale = 2;
            const double YScale = 2;
            const double ZScale = 3;

            //Transform3D: Cylinder Scaled Via Scale3D()

            IGeometry geometry = Vector3DExamples.GetExample3();

            //Define Origin At Which Scale Operation Should Be Performed

            IPoint originPoint = GeometryUtilities.ConstructPoint3D(0, 0, 0);

            ITransform3D transform3D = geometry as ITransform3D;

            transform3D.Scale3D(originPoint, XScale, YScale, ZScale);

            return(geometry);
        }
Beispiel #22
0
        private static void DrawEnd(IGraphicsContainer3D endGraphicsContainer3D, IPoint endPoint, IVector3D axisOfRotationVector3D, double degreesOfRotation, IColor endColor, double endRadius)
        {
            IGeometry endGeometry = Vector3DExamples.GetExample2();

            ITransform3D transform3D = endGeometry as ITransform3D;

            IPoint originPoint = GeometryUtilities.ConstructPoint3D(0, 0, 0);

            transform3D.Scale3D(originPoint, endRadius, endRadius, 2 * endRadius);

            if (degreesOfRotation != 0)
            {
                double angleOfRotationInRadians = GeometryUtilities.GetRadians(degreesOfRotation);

                transform3D.RotateVector3D(axisOfRotationVector3D, angleOfRotationInRadians);
            }

            transform3D.Move3D(endPoint.X - originPoint.X, endPoint.Y - originPoint.Y, endPoint.Z - originPoint.Z);

            GraphicsLayer3DUtilities.AddMultiPatchToGraphicsLayer3D(endGraphicsContainer3D, endGeometry, endColor);
        }
        public static IGeometry GetExample6()
        {
            //TriangleFan: Partial Fan, Two Levels Of Zs

            IGeometryCollection multiPatchGeometryCollection = new MultiPatchClass();

            IPointCollection triangleFanPointCollection = new TriangleFanClass();

            triangleFanPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(0, 0, 3), ref _missing, ref _missing);
            triangleFanPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(0, -6, 3), ref _missing, ref _missing);
            triangleFanPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(-3 * Math.Sqrt(2), -3 * Math.Sqrt(2), 3), ref _missing, ref _missing);
            triangleFanPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(-6, 0, 3), ref _missing, ref _missing);
            triangleFanPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(-3 * Math.Sqrt(2), 3 * Math.Sqrt(2), 0), ref _missing, ref _missing);
            triangleFanPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(0, 6, 0), ref _missing, ref _missing);
            triangleFanPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(3 * Math.Sqrt(2), 3 * Math.Sqrt(2), 0), ref _missing, ref _missing);
            triangleFanPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(6, 0, 0), ref _missing, ref _missing);

            multiPatchGeometryCollection.AddGeometry(triangleFanPointCollection as IGeometry, ref _missing, ref _missing);

            return(multiPatchGeometryCollection as IGeometry);
        }
        public static IGeometry GetExample3()
        {
            //Ring: Octagon With Non-Coplanar Points

            IGeometryCollection multiPatchGeometryCollection = new MultiPatchClass();

            IPointCollection ringPointCollection = new RingClass();

            ringPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(-7.5, 7.5, 5), ref _missing, ref _missing);
            ringPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(0, 8.5, 0), ref _missing, ref _missing);
            ringPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(7.5, 7.5, 5), ref _missing, ref _missing);
            ringPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(8.5, 0, 0), ref _missing, ref _missing);
            ringPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(7.5, -7.5, 5), ref _missing, ref _missing);
            ringPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(0, -8.5, 0), ref _missing, ref _missing);
            ringPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(-7.5, -7.5, 5), ref _missing, ref _missing);
            ringPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(-8.5, 0, 0), ref _missing, ref _missing);
            ringPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(-7.5, 7.5, 5), ref _missing, ref _missing);

            multiPatchGeometryCollection.AddGeometry(ringPointCollection as IGeometry, ref _missing, ref _missing);

            return(multiPatchGeometryCollection as IGeometry);
        }
Beispiel #25
0
        public static IGeometry GetExample3()
        {
            const double DegreesOfRotation = 45;

            //Transform3D: Cylinder Rotated Around An Axis Via RotateVector3D()

            IGeometry geometry = Vector3DExamples.GetExample3();

            //Construct A Vector3D Corresponding To The Desired Axis Of Rotation

            IVector3D axisOfRotationVector3D = GeometryUtilities.ConstructVector3D(0, 10, 0);

            //Obtain Angle Of Rotation In Radians

            double angleOfRotationInRadians = GeometryUtilities.GetRadians(DegreesOfRotation);

            ITransform3D transform3D = geometry as ITransform3D;

            transform3D.RotateVector3D(axisOfRotationVector3D, angleOfRotationInRadians);

            return(geometry);
        }
Beispiel #26
0
        public static IGeometry GetExample4()
        {
            //TriangleStrip: Box Without Top or Bottom

            IGeometryCollection multiPatchGeometryCollection = new MultiPatchClass();

            IPointCollection triangleStripPointCollection = new TriangleStripClass();

            //Start

            triangleStripPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(0, 0, 0), ref _missing, ref _missing);
            triangleStripPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(0, 0, 10), ref _missing, ref _missing);

            //First Panel

            triangleStripPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(5, 0, 0), ref _missing, ref _missing);
            triangleStripPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(5, 0, 10), ref _missing, ref _missing);

            //Second Panel

            triangleStripPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(5, 5, 0), ref _missing, ref _missing);
            triangleStripPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(5, 5, 10), ref _missing, ref _missing);

            //Third Panel

            triangleStripPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(0, 5, 0), ref _missing, ref _missing);
            triangleStripPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(0, 5, 10), ref _missing, ref _missing);

            //End, To Close Box

            triangleStripPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(0, 0, 0), ref _missing, ref _missing);
            triangleStripPointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(0, 0, 10), ref _missing, ref _missing);

            multiPatchGeometryCollection.AddGeometry(triangleStripPointCollection as IGeometry, ref _missing, ref _missing);

            return(multiPatchGeometryCollection as IGeometry);
        }
Beispiel #27
0
        public static IGeometry GetExample4()
        {
            const double XScale            = 0.5;
            const double YScale            = 0.5;
            const double ZScale            = 2;
            const double XOffset           = -5;
            const double YOffset           = -5;
            const double ZOffset           = -8;
            const double DegreesOfRotation = 90;

            //Transform3D: Cylinder Scaled, Rotated, Repositioned Via Move3D(), Scale3D(), RotateVector3D()

            IGeometry geometry = Vector3DExamples.GetExample3();

            ITransform3D transform3D = geometry as ITransform3D;

            //Stretch The Cylinder So It Looks Like A Tube

            IPoint originPoint = GeometryUtilities.ConstructPoint3D(0, 0, 0);

            transform3D.Scale3D(originPoint, XScale, YScale, ZScale);

            //Rotate The Cylinder So It Lies On Its Side

            IVector3D axisOfRotationVector3D = GeometryUtilities.ConstructVector3D(0, 10, 0);

            double angleOfRotationInRadians = GeometryUtilities.GetRadians(DegreesOfRotation);

            transform3D.RotateVector3D(axisOfRotationVector3D, angleOfRotationInRadians);

            //Reposition The Cylinder So It Is Located Underground

            transform3D.Move3D(XOffset, YOffset, ZOffset);

            return(geometry);
        }
        public static IGeometry GetExample5()
        {
            const double CylinderBaseDegrees   = 360.0;
            const int    CylinderBaseDivisions = 8;
            const double VectorComponentOffset = 0.0000001;
            const double CylinderBaseRadius    = 3;
            const double CylinderUpperZ        = 8;
            const double CylinderLowerZ        = 0;

            //Vector3D: Cylinder, TriangleStrip With 8 Vertices

            IGeometryCollection multiPatchGeometryCollection = new MultiPatchClass();

            IPointCollection triangleStripPointCollection = new TriangleStripClass();

            //Set Cylinder Base Origin To (0, 0, 0)

            IPoint originPoint = GeometryUtilities.ConstructPoint3D(0, 0, 0);

            //Define Upper Portion Of Axis Around Which Vector Should Be Rotated To Generate Cylinder Base Vertices

            IVector3D upperAxisVector3D = GeometryUtilities.ConstructVector3D(0, 0, 10);

            //Define Lower Portion of Axis Around Which Vector Should Be Rotated To Generate Cylinder Base Vertices

            IVector3D lowerAxisVector3D = GeometryUtilities.ConstructVector3D(0, 0, -10);

            //Add A Slight Offset To X or Y Component Of One Of Axis Vectors So Cross Product Does Not Return A Zero-Length Vector

            lowerAxisVector3D.XComponent += VectorComponentOffset;

            //Obtain Cross Product Of Upper And Lower Axis Vectors To Obtain Normal Vector To Axis Of Rotation To Generate Cylinder Base Vertices

            IVector3D normalVector3D = upperAxisVector3D.CrossProduct(lowerAxisVector3D) as IVector3D;

            //Set Normal Vector Magnitude Equal To Radius Of Cylinder Base

            normalVector3D.Magnitude = CylinderBaseRadius;

            //Obtain Angle Of Rotation In Radians As Function Of Number Of Divisions Within 360 Degree Sweep Of Cylinder Base

            double rotationAngleInRadians = GeometryUtilities.GetRadians(CylinderBaseDegrees / CylinderBaseDivisions);

            for (int i = 0; i < CylinderBaseDivisions; i++)
            {
                //Rotate Normal Vector Specified Rotation Angle In Radians Around Either Upper Or Lower Axis

                normalVector3D.Rotate(rotationAngleInRadians, upperAxisVector3D);

                //Construct Cylinder Base Vertex Whose XY Coordinates Are The Sum Of Origin XY Coordinates And Normal Vector XY Components

                IPoint vertexPoint = GeometryUtilities.ConstructPoint3D(originPoint.X + normalVector3D.XComponent,
                                                                        originPoint.Y + normalVector3D.YComponent,
                                                                        0);

                //Construct Lower Base Vertex From This Point And Add To TriangleStrip

                IPoint lowerVertexPoint = GeometryUtilities.ConstructPoint3D(vertexPoint.X, vertexPoint.Y, CylinderLowerZ);

                triangleStripPointCollection.AddPoint(lowerVertexPoint, ref _missing, ref _missing);

                //Construct Upper Base Vertex From This Point And Add To TriangleStrip

                IPoint upperVertexPoint = GeometryUtilities.ConstructPoint3D(vertexPoint.X, vertexPoint.Y, CylinderUpperZ);

                triangleStripPointCollection.AddPoint(upperVertexPoint, ref _missing, ref _missing);
            }

            //Re-Add The First And Second Points Of The Triangle Strip (First Two Vertices Added) To Close The Strip

            triangleStripPointCollection.AddPoint(triangleStripPointCollection.get_Point(0), ref _missing, ref _missing);

            triangleStripPointCollection.AddPoint(triangleStripPointCollection.get_Point(1), ref _missing, ref _missing);

            //Add TriangleStrip To MultiPatch

            multiPatchGeometryCollection.AddGeometry(triangleStripPointCollection as IGeometry, ref _missing, ref _missing);

            return(multiPatchGeometryCollection as IGeometry);
        }
        public static IGeometry GetExample1()
        {
            const double CircleDegrees         = 360.0;
            const int    CircleDivisions       = 36;
            const double VectorComponentOffset = 0.0000001;
            const double CircleRadius          = 5.0;
            const double CircleZ = 0.0;

            //Vector3D: Circle, TriangleFan With 36 Vertices

            IGeometryCollection multiPatchGeometryCollection = new MultiPatchClass();

            IPointCollection triangleFanPointCollection = new TriangleFanClass();

            //Set Circle Origin To (0, 0, CircleZ)

            IPoint originPoint = GeometryUtilities.ConstructPoint3D(0, 0, CircleZ);

            //Add Origin Point To Triangle Fan

            triangleFanPointCollection.AddPoint(originPoint, ref _missing, ref _missing);

            //Define Upper Portion Of Axis Around Which Vector Should Be Rotated To Generate Circle Vertices

            IVector3D upperAxisVector3D = GeometryUtilities.ConstructVector3D(0, 0, 10);

            //Define Lower Portion of Axis Around Which Vector Should Be Rotated To Generate Circle Vertices

            IVector3D lowerAxisVector3D = GeometryUtilities.ConstructVector3D(0, 0, -10);

            //Add Slight Offset To X or Y Component Of One Of Axis Vectors So Cross Product Does Not Return A Zero-Length Vector

            lowerAxisVector3D.XComponent += VectorComponentOffset;

            //Obtain Cross Product Of Upper And Lower Axis Vectors To Obtain Normal Vector To Axis Of Rotation To Generate Circle Vertices

            IVector3D normalVector3D = upperAxisVector3D.CrossProduct(lowerAxisVector3D) as IVector3D;

            //Set Normal Vector Magnitude Equal To Radius Of Circle

            normalVector3D.Magnitude = CircleRadius;

            //Obtain Angle Of Rotation In Radians As Function Of Number Of Divisions Within 360 Degree Sweep Of Circle

            double rotationAngleInRadians = GeometryUtilities.GetRadians(CircleDegrees / CircleDivisions);

            for (int i = 0; i < CircleDivisions; i++)
            {
                //Rotate Normal Vector Specified Rotation Angle In Radians Around Either Upper Or Lower Axis

                normalVector3D.Rotate(-1 * rotationAngleInRadians, upperAxisVector3D);

                //Construct Circle Vertex Whose XY Coordinates Are The Sum Of Origin XY Coordinates And Normal Vector XY Components

                IPoint vertexPoint = GeometryUtilities.ConstructPoint3D(originPoint.X + normalVector3D.XComponent,
                                                                        originPoint.Y + normalVector3D.YComponent,
                                                                        CircleZ);

                //Add Vertex To TriangleFan

                triangleFanPointCollection.AddPoint(vertexPoint, ref _missing, ref _missing);
            }

            //Re-Add The Second Point Of The Triangle Fan (First Vertex Added) To Close The Fan

            triangleFanPointCollection.AddPoint(triangleFanPointCollection.get_Point(1), ref _missing, ref _missing);

            //Add TriangleFan To MultiPatch

            multiPatchGeometryCollection.AddGeometry(triangleFanPointCollection as IGeometry, ref _missing, ref _missing);

            return(multiPatchGeometryCollection as IGeometry);
        }
        public static IGeometry GetExample2()
        {
            //RingGroup: Multiple Exterior Rings With Corresponding Interior Rings

            IGeometryCollection multiPatchGeometryCollection = new MultiPatchClass();

            IMultiPatch multiPatch = multiPatchGeometryCollection as IMultiPatch;

            //Exterior Ring 1

            IPointCollection exteriorRing1PointCollection = new RingClass();

            exteriorRing1PointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(1, 1, 0), ref _missing, ref _missing);
            exteriorRing1PointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(1, 4, 0), ref _missing, ref _missing);
            exteriorRing1PointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(4, 4, 0), ref _missing, ref _missing);
            exteriorRing1PointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(4, 1, 0), ref _missing, ref _missing);

            IRing exteriorRing1 = exteriorRing1PointCollection as IRing;

            exteriorRing1.Close();

            multiPatchGeometryCollection.AddGeometry(exteriorRing1 as IGeometry, ref _missing, ref _missing);

            multiPatch.PutRingType(exteriorRing1, esriMultiPatchRingType.esriMultiPatchOuterRing);

            //Interior Ring 1

            IPointCollection interiorRing1PointCollection = new RingClass();

            interiorRing1PointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(3.5, 1.5, 0), ref _missing, ref _missing);
            interiorRing1PointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(3.5, 3.5, 0), ref _missing, ref _missing);
            interiorRing1PointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(1.5, 3.5, 0), ref _missing, ref _missing);
            interiorRing1PointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(1.5, 1.5, 0), ref _missing, ref _missing);

            IRing interiorRing1 = interiorRing1PointCollection as IRing;

            interiorRing1.Close();

            multiPatchGeometryCollection.AddGeometry(interiorRing1 as IGeometry, ref _missing, ref _missing);

            multiPatch.PutRingType(interiorRing1, esriMultiPatchRingType.esriMultiPatchInnerRing);

            //Exterior Ring 2

            IPointCollection exteriorRing2PointCollection = new RingClass();

            exteriorRing2PointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(1, -1, 0), ref _missing, ref _missing);
            exteriorRing2PointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(4, -1, 0), ref _missing, ref _missing);
            exteriorRing2PointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(4, -4, 0), ref _missing, ref _missing);
            exteriorRing2PointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(1, -4, 0), ref _missing, ref _missing);

            IRing exteriorRing2 = exteriorRing2PointCollection as IRing;

            exteriorRing2.Close();

            multiPatchGeometryCollection.AddGeometry(exteriorRing2 as IGeometry, ref _missing, ref _missing);

            multiPatch.PutRingType(exteriorRing2, esriMultiPatchRingType.esriMultiPatchOuterRing);

            //Interior Ring 2

            IPointCollection interiorRing2PointCollection = new RingClass();

            interiorRing2PointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(1.5, -1.5, 0), ref _missing, ref _missing);
            interiorRing2PointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(3.5, -1.5, 0), ref _missing, ref _missing);
            interiorRing2PointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(3.5, -3.5, 0), ref _missing, ref _missing);
            interiorRing2PointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(1.5, -3.5, 0), ref _missing, ref _missing);

            IRing interiorRing2 = interiorRing2PointCollection as IRing;

            interiorRing2.Close();

            multiPatchGeometryCollection.AddGeometry(interiorRing2 as IGeometry, ref _missing, ref _missing);

            multiPatch.PutRingType(interiorRing2, esriMultiPatchRingType.esriMultiPatchInnerRing);

            //Exterior Ring 3

            IPointCollection exteriorRing3PointCollection = new RingClass();

            exteriorRing3PointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(-1, 1, 0), ref _missing, ref _missing);
            exteriorRing3PointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(-4, 1, 0), ref _missing, ref _missing);
            exteriorRing3PointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(-4, 4, 0), ref _missing, ref _missing);
            exteriorRing3PointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(-1, 4, 0), ref _missing, ref _missing);

            IRing exteriorRing3 = exteriorRing3PointCollection as IRing;

            exteriorRing3.Close();

            multiPatchGeometryCollection.AddGeometry(exteriorRing3 as IGeometry, ref _missing, ref _missing);

            multiPatch.PutRingType(exteriorRing3, esriMultiPatchRingType.esriMultiPatchOuterRing);

            //Interior Ring 3

            IPointCollection interiorRing3PointCollection = new RingClass();

            interiorRing3PointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(-1.5, 1.5, 0), ref _missing, ref _missing);
            interiorRing3PointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(-3.5, 1.5, 0), ref _missing, ref _missing);
            interiorRing3PointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(-3.5, 3.5, 0), ref _missing, ref _missing);
            interiorRing3PointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(-1.5, 3.5, 0), ref _missing, ref _missing);

            IRing interiorRing3 = interiorRing3PointCollection as IRing;

            interiorRing3.Close();

            multiPatchGeometryCollection.AddGeometry(interiorRing3 as IGeometry, ref _missing, ref _missing);

            multiPatch.PutRingType(interiorRing3, esriMultiPatchRingType.esriMultiPatchInnerRing);

            //Exterior Ring 4

            IPointCollection exteriorRing4PointCollection = new RingClass();

            exteriorRing4PointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(-1, -1, 0), ref _missing, ref _missing);
            exteriorRing4PointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(-1, -4, 0), ref _missing, ref _missing);
            exteriorRing4PointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(-4, -4, 0), ref _missing, ref _missing);
            exteriorRing4PointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(-4, -1, 0), ref _missing, ref _missing);

            IRing exteriorRing4 = exteriorRing4PointCollection as IRing;

            exteriorRing4.Close();

            multiPatchGeometryCollection.AddGeometry(exteriorRing4 as IGeometry, ref _missing, ref _missing);

            multiPatch.PutRingType(exteriorRing4, esriMultiPatchRingType.esriMultiPatchOuterRing);

            //Interior Ring 4

            IPointCollection interiorRing4PointCollection = new RingClass();

            interiorRing4PointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(-1.5, -1.5, 0), ref _missing, ref _missing);
            interiorRing4PointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(-1.5, -3.5, 0), ref _missing, ref _missing);
            interiorRing4PointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(-3.5, -3.5, 0), ref _missing, ref _missing);
            interiorRing4PointCollection.AddPoint(GeometryUtilities.ConstructPoint3D(-3.5, -1.5, 0), ref _missing, ref _missing);

            IRing interiorRing4 = interiorRing4PointCollection as IRing;

            interiorRing4.Close();

            multiPatchGeometryCollection.AddGeometry(interiorRing4 as IGeometry, ref _missing, ref _missing);

            multiPatch.PutRingType(interiorRing4, esriMultiPatchRingType.esriMultiPatchInnerRing);

            return(multiPatchGeometryCollection as IGeometry);
        }