MakeZAware() public static method

public static MakeZAware ( IGeometry geometry ) : void
geometry IGeometry
return void
Beispiel #1
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 #2
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);
        }
Beispiel #3
0
        public static IGeometry GetExample13()
        {
            const double CircleDegrees         = 360.0;
            const int    CircleDivisions       = 36;
            const double VectorComponentOffset = 0.0000001;
            const double CircleRadius          = 3.0;
            const double BaseZ = 0.0;
            const double RotationAngleInDegrees = 89.9;

            //Extrusion: 3D Circle Polyline Extruded Along 3D Vector Via ConstructExtrudeRelative()

            IPointCollection pathPointCollection = new PathClass();

            IGeometry pathGeometry = pathPointCollection as IGeometry;

            GeometryUtilities.MakeZAware(pathGeometry);

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

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

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

            lowerAxisVector3D.XComponent += VectorComponentOffset;

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

            normalVector3D.Magnitude = CircleRadius;

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

            for (int i = 0; i < CircleDivisions; i++)
            {
                normalVector3D.Rotate(-1 * rotationAngleInRadians, upperAxisVector3D);

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

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

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

            //Rotate Geometry

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

            ITransform3D transform3D = pathGeometry as ITransform3D;

            transform3D.RotateVector3D(rotationAxisVector3D, GeometryUtilities.GetRadians(RotationAngleInDegrees));

            //Construct Polyline From Path Vertices

            IGeometry polylineGeometry = new PolylineClass();

            GeometryUtilities.MakeZAware(polylineGeometry);

            IPointCollection polylinePointCollection = polylineGeometry as IPointCollection;

            for (int i = 0; i < pathPointCollection.PointCount; i++)
            {
                polylinePointCollection.AddPoint(pathPointCollection.get_Point(i), ref _missing, ref _missing);
            }

            ITopologicalOperator topologicalOperator = polylineGeometry as ITopologicalOperator;

            topologicalOperator.Simplify();

            //Define Vector To Extrude Along

            IVector3D extrusionVector3D = GeometryUtilities.ConstructVector3D(10, 0, 5);

            //Perform Extrusion

            IConstructMultiPatch constructMultiPatch = new MultiPatchClass();

            constructMultiPatch.ConstructExtrudeRelative(extrusionVector3D, polylineGeometry);

            return(constructMultiPatch as IGeometry);
        }
Beispiel #4
0
        public static IGeometry GetExample11()
        {
            const double CircleDegrees         = 360.0;
            const int    CircleDivisions       = 36;
            const double VectorComponentOffset = 0.0000001;
            const double CircleRadius          = 3.0;
            const double BaseZ = 0.0;

            //Extrusion: 3D Circle Polyline Extruded Along 3D Line Via ConstructExtrudeAlongLine()

            IPointCollection polylinePointCollection = new PolylineClass();

            IGeometry polylineGeometry = polylinePointCollection as IGeometry;

            GeometryUtilities.MakeZAware(polylineGeometry);

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

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

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

            lowerAxisVector3D.XComponent += VectorComponentOffset;

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

            normalVector3D.Magnitude = CircleRadius;

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

            for (int i = 0; i < CircleDivisions; i++)
            {
                normalVector3D.Rotate(-1 * rotationAngleInRadians, upperAxisVector3D);

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

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

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

            ITopologicalOperator topologicalOperator = polylineGeometry as ITopologicalOperator;

            topologicalOperator.Simplify();

            //Define Line To Extrude Along

            ILine extrusionLine = new LineClass();

            extrusionLine.FromPoint = GeometryUtilities.ConstructPoint3D(-4, -4, -5);
            extrusionLine.ToPoint   = GeometryUtilities.ConstructPoint3D(4, 4, 5);

            //Perform Extrusion

            IConstructMultiPatch constructMultiPatch = new MultiPatchClass();

            constructMultiPatch.ConstructExtrudeAlongLine(extrusionLine, polylineGeometry);

            //Transform Extrusion Result

            IPoint centroid = GeometryUtilities.ConstructPoint2D(0.5 * (polylineGeometry.Envelope.XMax + polylineGeometry.Envelope.XMin),
                                                                 0.5 * (polylineGeometry.Envelope.YMax + polylineGeometry.Envelope.YMin));

            ITransform2D transform2D = constructMultiPatch as ITransform2D;

            transform2D.Move(extrusionLine.FromPoint.X - centroid.X, extrusionLine.FromPoint.Y - centroid.Y);

            return(constructMultiPatch as IGeometry);
        }
Beispiel #5
0
        public static IGeometry GetExample8()
        {
            const double CircleDegrees         = 360.0;
            const int    CircleDivisions       = 36;
            const double VectorComponentOffset = 0.0000001;
            const double CircleRadius          = 3.0;
            const double BaseZ   = -10;
            const double OffsetZ = 5;

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

            IGeometryCollection multiPatchGeometryCollection = new MultiPatchClass();

            IPointCollection polygonPointCollection = new PolygonClass();

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

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

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

            lowerAxisVector3D.XComponent += VectorComponentOffset;

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

            normalVector3D.Magnitude = CircleRadius;

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

            Random random = new Random();

            for (int i = 0; i < CircleDivisions; i++)
            {
                normalVector3D.Rotate(-1 * rotationAngleInRadians, upperAxisVector3D);

                IPoint vertexPoint = GeometryUtilities.ConstructPoint3D(originPoint.X + normalVector3D.XComponent,
                                                                        originPoint.Y + normalVector3D.YComponent,
                                                                        BaseZ + 2 * Math.Sin(random.NextDouble()));

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

            IPolygon polygon = polygonPointCollection as IPolygon;

            polygon.Close();

            IGeometry polygonGeometry = polygon as IGeometry;

            GeometryUtilities.MakeZAware(polygonGeometry);

            ITopologicalOperator topologicalOperator = polygon as ITopologicalOperator;

            topologicalOperator.Simplify();

            IConstructMultiPatch constructMultiPatch = new MultiPatchClass();

            constructMultiPatch.ConstructExtrude(OffsetZ, polygonGeometry);

            return(constructMultiPatch as IGeometry);
        }