Provides access to members that can be used to construct MultiPatches.
Description
Constructs a MultiPatch by extruding a non-point based geometry. Extrusion adds another dimension to the base geometry. Generally, this dimension is along the Z-Axis, but some extrusions allow the axis of extrusion to be defined by an input Line or Vector3D. Depending on the extrusion method, the base geometry may be preserved or may by projected to the XY-Plane and then extruded. Polylines, Polygons, and Envelopes can be extruded to produce MultiPatches. Polygon geometry is assumed to be planar.
Members
Name | Description | |
---|---|---|
ConstructExtrude | Construct a MultiPatch by using an input (non-point) geometry as one base and offsetting the Zs already set on the input geometry to get the second base. | |
ConstructExtrudeAbsolute | Construct a MultiPatch by extruding a (non-point) geometry using its initial Zs for one base, and a uniform input Z for the other. | |
ConstructExtrudeAlongLine | Construct a MultiPatch by extruding a (non-point) geometry along a specified line, using the Zs on the two ends of the line to set Zs on the top and bottom. | |
ConstructExtrudeBetween | Construct a MultiPatch by extruding a (non-point) geometry between two functional surfaces. | |
ConstructExtrudeFromTo | Construct a MultiPatch by extruding a (non-point) geometry between two specified Z values. | |
ConstructExtrudeRelative | Construct a MultiPatch by extruding a (non-point) geometry along a specified vector, using Zs already set on the input geometry. |
IConstructMultiPatch.ConstructExtrude Method
Construct a MultiPatch by using an input (non-point) geometry as one base and offsetting the Zs already set on the input geometry to get the second base.
Public Sub ConstructExtrude ( _
ByVal OffsetZ As Double, _
ByVal baseGeom As IGeometry _
)
public void ConstructExtrude (
double OffsetZ,
IGeometry baseGeom
);
Description
Creates a MultiPatch from a base non-point geometry by extruding the base geometry along the Z-axis by a given offset factor. The base Z value of the geometry is preserved and top Z value is calculated as an offset of each point in the input geometry. The resulting extrusion is parallel to the XY-plane only if the base geometry is parallel to the XY-plane.
Remarks
All non-linear segments are treated as linear segments when extrusion is performed. Only Polylines, Polygons, and Envelopes are allowed as input geometries.
private static object _missing = Type.Missing;
public static IGeometry GetMultiPatchGeometry()
{
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(ConstructPoint2D(-10, -10), ref _missing, ref _missing);
polylinePointCollection.AddPoint(ConstructPoint2D(0, -5), ref _missing, ref _missing);
polylinePointCollection.AddPoint(ConstructPoint2D(0, 5), ref _missing, ref _missing);
polylinePointCollection.AddPoint(ConstructPoint2D(10, 10), ref _missing, ref _missing);
IPolyline polyline = polylinePointCollection as IPolyline;
polyline.Densify(polyline.Length / DensificationDivisions, MaxDeviation);
IGeometry polylineGeometry = polyline as IGeometry;
MakeZAware(polylineGeometry);
Random random = new Random();
for (int i = 0; i < polylinePointCollection.PointCount; i++)
{
IPoint polylinePoint = polylinePointCollection.get_Point(i);
polylinePointCollection.UpdatePoint(i, 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;
}
private static IVector3D ConstructVector3D(double xComponent, double yComponent, double zComponent)
{
IVector3D vector3D = new Vector3DClass();
vector3D.SetComponents(xComponent, yComponent, zComponent);
return vector3D;
}
private static double GetRadians(double decimalDegrees)
{
return decimalDegrees * (Math.PI / 180);
}
private static IPoint ConstructPoint3D(double x, double y, double z)
{
IPoint point = ConstructPoint2D(x, y);
point.Z = z;
return point;
}
private static IPoint ConstructPoint2D(double x, double y)
{
IPoint point = new PointClass();
point.PutCoords(x, y);
return point;
}
private static void MakeZAware(IGeometry geometry)
{
IZAware zAware = geometry as IZAware;
zAware.ZAware = true;
}
IConstructMultiPatch.ConstructExtrudeAbsolute Method
Construct a MultiPatch by extruding a (non-point) geometry using its initial Zs for one base, and a uniform input Z for the other.
Public Sub ConstructExtrudeAbsolute ( _
ByVal toZ As Double, _
ByVal baseGeom As IGeometry _
)
public void ConstructExtrudeAbsolute (
double toZ,
IGeometry baseGeom
);
Description
Creates a MultiPatch from a base non-point geometry by extruding the base geometry along the Z-axis from the base geometry to a given absolute Z plane. The base Z value of the geometry is preserved and top Z value is uniformly equal to the input absolute Z. The resulting extrusion is always parallel to the XY-plane on the top and only parallel at the base if the base geometry is parallel to the XY-plane.
Remarks
All non-linear segments are treated as linear segments when extrusion is performed. Only Polylines, Polygons, and Envelopes are allowed as input geometries.
private static object _missing = Type.Missing;
public static IGeometry GetMultiPatchGeometry()
{
const int DensificationDivisions = 20;
const double MaxDeviation = 0.1;
const double BaseZ = 0;
const double ToZ = -10;
//Extrusion: 3D Polyline Having Vertices With Varying Z Values, Extruded To Specified Z Value
// Via ConstructExtrudeAbsolute()
IPointCollection polylinePointCollection = new PolylineClass();
polylinePointCollection.AddPoint(ConstructPoint2D(-10, -10), ref _missing, ref _missing);
polylinePointCollection.AddPoint(ConstructPoint2D(0, -5), ref _missing, ref _missing);
polylinePointCollection.AddPoint(ConstructPoint2D(0, 5), ref _missing, ref _missing);
polylinePointCollection.AddPoint(ConstructPoint2D(10, 10), ref _missing, ref _missing);
IPolyline polyline = polylinePointCollection as IPolyline;
polyline.Densify(polyline.Length / DensificationDivisions, MaxDeviation);
IGeometry polylineGeometry = polyline as IGeometry;
MakeZAware(polylineGeometry);
Random random = new Random();
for (int i = 0; i < polylinePointCollection.PointCount; i++)
{
IPoint polylinePoint = polylinePointCollection.get_Point(i);
polylinePointCollection.UpdatePoint(i, ConstructPoint3D(polylinePoint.X, polylinePoint.Y, BaseZ - 2 * Math.Sin(random.NextDouble())));
}
ITopologicalOperator topologicalOperator = polylineGeometry as ITopologicalOperator;
topologicalOperator.Simplify();
IConstructMultiPatch constructMultiPatch = new MultiPatchClass();
constructMultiPatch.ConstructExtrudeAbsolute(ToZ, polylineGeometry);
return constructMultiPatch as IGeometry;
}
public static IPoint ConstructPoint2D(double x, double y)
{
IPoint point = new PointClass();
point.PutCoords(x, y);
return point;
}
private static void MakeZAware(IGeometry geometry)
{
IZAware zAware = geometry as IZAware;
zAware.ZAware = true;
}
IConstructMultiPatch.ConstructExtrudeAlongLine Method
Construct a MultiPatch by extruding a (non-point) geometry along a specified line, using the Zs on the two ends of the line to set Zs on the top and bottom.
Public Sub ConstructExtrudeAlongLine ( _
ByVal extrusionLine As ILine, _
ByVal baseGeom As IGeometry _
)
public void ConstructExtrudeAlongLine (
ILine extrusionLine,
IGeometry baseGeom
);
Description
Creates a MultiPatch from a base non-point geometry by extruding the base geometry along an axis defined by the input Line. The base Z value of the geometry is uniformly set to the Z value of the Along Line's FromPoint and top Z value is uniformly set to the Z value of the Along Line's ToPoint. The top geometry is also shifted in the X and Y directions by an offset defined by the X and Y change of the Along Line between From and To Points. The resulting extrusion is always parallel to the XY-plane on both the base and top.
Remarks
All non-linear segments are treated as linear segments when extrusion is performed. Only Polylines, Polygons, and Envelopes are allowed as input geometries.
private static object _missing = Type.Missing;
public static IGeometry GetExample10()
{
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 Polygon Extruded Along 3D Line Via ConstructExtrudeAlongLine()
IPointCollection polygonPointCollection = new PolygonClass();
IGeometry polygonGeometry = polygonPointCollection as IGeometry;
MakeZAware(polygonGeometry);
IPoint originPoint = ConstructPoint3D(0, 0, 0);
IVector3D upperAxisVector3D = ConstructVector3D(0, 0, 10);
IVector3D lowerAxisVector3D = ConstructVector3D(0, 0, -10);
lowerAxisVector3D.XComponent += VectorComponentOffset;
IVector3D normalVector3D = upperAxisVector3D.CrossProduct(lowerAxisVector3D) as IVector3D;
normalVector3D.Magnitude = CircleRadius;
double rotationAngleInRadians = GetRadians(CircleDegrees / CircleDivisions);
for (int i = 0; i < CircleDivisions; i++)
{
normalVector3D.Rotate(-1 * rotationAngleInRadians, upperAxisVector3D);
IPoint vertexPoint = ConstructPoint3D(originPoint.X + normalVector3D.XComponent,
originPoint.Y + normalVector3D.YComponent,
BaseZ);
polygonPointCollection.AddPoint(vertexPoint, ref _missing, ref _missing);
}
polygonPointCollection.AddPoint(polygonPointCollection.get_Point(0), ref _missing, ref _missing);
ITopologicalOperator topologicalOperator = polygonGeometry as ITopologicalOperator;
topologicalOperator.Simplify();
//Define Line To Extrude Along
ILine extrusionLine = new LineClass();
extrusionLine.FromPoint = ConstructPoint3D(-4, -4, -5);
extrusionLine.ToPoint = ConstructPoint3D(4, 4, 5);
//Perform Extrusion
IConstructMultiPatch constructMultiPatch = new MultiPatchClass();
constructMultiPatch.ConstructExtrudeAlongLine(extrusionLine, polygonGeometry);
//Transform Extrusion Result
IArea area = polygonGeometry as IArea;
ITransform2D transform2D = constructMultiPatch as ITransform2D;
transform2D.Move(extrusionLine.FromPoint.X - area.Centroid.X, extrusionLine.FromPoint.Y - area.Centroid.Y);
return constructMultiPatch as IGeometry;
}
private static IVector3D ConstructVector3D(double xComponent, double yComponent, double zComponent)
{
IVector3D vector3D = new Vector3DClass();
vector3D.SetComponents(xComponent, yComponent, zComponent);
return vector3D;
}
private static double GetRadians(double decimalDegrees)
{
return decimalDegrees * (Math.PI / 180);
}
private static IPoint ConstructPoint3D(double x, double y, double z)
{
IPoint point = ConstructPoint2D(x, y);
point.Z = z;
return point;
}
private static IPoint ConstructPoint2D(double x, double y)
{
IPoint point = new PointClass();
point.PutCoords(x, y);
return point;
}
private static void MakeZAware(IGeometry geometry)
{
IZAware zAware = geometry as IZAware;
zAware.ZAware = true;
}
IConstructMultiPatch.ConstructExtrudeBetween Method
Construct a MultiPatch by extruding a (non-point) geometry between two functional surfaces.
Public Sub ConstructExtrudeBetween ( _
ByVal fromSurface As IFunctionalSurface, _
ByVal toSurface As IFunctionalSurface, _
ByVal baseGeom As IGeometry _
)
public void ConstructExtrudeBetween (
IFunctionalSurface fromSurface,
IFunctionalSurface toSurface,
IGeometry baseGeom
);
Description
Constructs a MultiPatch from a base non-point geometry and two input FunctionalSurfaces. The constructed MultiPatch is equivalent to the region of extrusion of the base geometry along the Z-axis that is bounded on top and bottom by the two FunctionalSurfaces. Only the portion of the input geometry in the region of intersection of the domains of the FunctionalSurfaces is extruded.
Remarks
All non-linear segments are treated as linear segments when extrusion is performed. Only Polylines, Polygons, and Envelopes are allowed as input geometries. Z values from the FunctionalSurfaces are only calculated at Points in the input Geometry. If the input Geometry extents exceed the extents of the Functional Surfaces then an output Oeometry with NaNs will be produced. Currently not implemented for RasterSurfaces.
private static object _missing = Type.Missing;
public static IGeometry GetMultiPatchGeometry()
{
const double CircleDegrees = 360.0;
const int CircleDivisions = 36;
const double VectorComponentOffset = 0.0000001;
const double CircleRadius = 9.5;
const int PointCount = 100;
const double UpperZMin = 7;
const double UpperZMax = 10;
const double LowerZMin = 0;
const double LowerZMax = 3;
//Extrusion: Circle Shaped Base Geometry Extruded Between Two Different TIN-Based Functional Surfaces
IGeometryCollection multiPatchGeometryCollection = new MultiPatchClass();
//Base Geometry
IPointCollection polygonPointCollection = new PolygonClass();
IPoint originPoint = ConstructPoint3D(0, 0, 0);
IVector3D upperAxisVector3D = ConstructVector3D(0, 0, 10);
IVector3D lowerAxisVector3D = ConstructVector3D(0, 0, -10);
lowerAxisVector3D.XComponent += VectorComponentOffset;
IVector3D normalVector3D = upperAxisVector3D.CrossProduct(lowerAxisVector3D) as IVector3D;
normalVector3D.Magnitude = CircleRadius;
double rotationAngleInRadians = GetRadians(CircleDegrees / CircleDivisions);
for (int i = 0; i < CircleDivisions; i++)
{
normalVector3D.Rotate(-1 * rotationAngleInRadians, upperAxisVector3D);
IPoint vertexPoint = ConstructPoint2D(originPoint.X + normalVector3D.XComponent,
originPoint.Y + normalVector3D.YComponent);
polygonPointCollection.AddPoint(vertexPoint, ref _missing, ref _missing);
}
IPolygon polygon = polygonPointCollection as IPolygon;
polygon.Close();
IGeometry baseGeometry = polygon as IGeometry;
ITopologicalOperator topologicalOperator = polygon as ITopologicalOperator;
topologicalOperator.Simplify();
//Functional Surfaces
IEnvelope envelope = new EnvelopeClass();
envelope.XMin = -10;
envelope.XMax = 10;
envelope.YMin = -10;
envelope.YMax = 10;
Random random = new Random();
//Upper Functional Surface
ITinEdit upperTinEdit = new TinClass();
upperTinEdit.InitNew(envelope);
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 = UpperZMin + (UpperZMax - UpperZMin) * random.NextDouble();
IPoint point = ConstructPoint3D(x, y, z);
upperTinEdit.AddPointZ(point, 0);
}
IFunctionalSurface upperFunctionalSurface = upperTinEdit as IFunctionalSurface;
//Lower Functional Surface
ITinEdit lowerTinEdit = new TinClass();
lowerTinEdit.InitNew(envelope);
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 = LowerZMin + (LowerZMax - LowerZMin) * random.NextDouble();
IPoint point = ConstructPoint3D(x, y, z);
lowerTinEdit.AddPointZ(point, 0);
}
IFunctionalSurface lowerFunctionalSurface = lowerTinEdit as IFunctionalSurface;
IConstructMultiPatch constructMultiPatch = new MultiPatchClass();
constructMultiPatch.ConstructExtrudeBetween(upperFunctionalSurface, lowerFunctionalSurface, baseGeometry);
return constructMultiPatch as IGeometry;
}
private static IVector3D ConstructVector3D(double xComponent, double yComponent, double zComponent)
{
IVector3D vector3D = new Vector3DClass();
vector3D.SetComponents(xComponent, yComponent, zComponent);
return vector3D;
}
private static double GetRadians(double decimalDegrees)
{
return decimalDegrees * (Math.PI / 180);
}
private static IPoint ConstructPoint3D(double x, double y, double z)
{
IPoint point = ConstructPoint2D(x, y);
point.Z = z;
return point;
}
private static IPoint ConstructPoint2D(double x, double y)
{
IPoint point = new PointClass();
point.PutCoords(x, y);
return point;
}
IConstructMultiPatch.ConstructExtrudeFromTo Method
Construct a MultiPatch by extruding a (non-point) geometry between two specified Z values.
Public Sub ConstructExtrudeFromTo ( _
ByVal fromZ As Double, _
ByVal toZ As Double, _
ByVal baseGeom As IGeometry _
)
public void ConstructExtrudeFromTo (
double fromZ,
double toZ,
IGeometry baseGeom
);
Description
Creates a MultiPatch from a base non-point geometry by extruding the base geometry along the Z-axis from a given FromZ input to a given ToZ input. The base Z value of the geometry is uniformly set to the FromZ and top Z value is set to a uniform ToZ. The resulting extrusion is always parallel to the XY-plane on both the base and top.
Remarks
All non-linear segments are treated as linear segments when extrusion is performed. Only Polylines, Polygons, and Envelopes are allowed as input geometries.
private static object _missing = Type.Missing;
public static IGeometry GetMultiPatchGeometry()
{
const double FromZ = 0;
const double ToZ = 8.5;
//Extrusion: 2D Polygon Composed Of Multiple Square Shaped Exterior Rings And Corresponding Interior Rings,
// Extruded To Generate Multiple 3D Buildings With Hollow Interiors Via ConstructExtrudeFromTo()
IPolygon polygon = new PolygonClass();
IGeometryCollection geometryCollection = polygon as IGeometryCollection;
//Exterior Ring 1
IPointCollection exteriorRing1PointCollection = new RingClass();
exteriorRing1PointCollection.AddPoint(ConstructPoint2D(1, 1), ref _missing, ref _missing);
exteriorRing1PointCollection.AddPoint(ConstructPoint2D(1, 4), ref _missing, ref _missing);
exteriorRing1PointCollection.AddPoint(ConstructPoint2D(4, 4), ref _missing, ref _missing);
exteriorRing1PointCollection.AddPoint(ConstructPoint2D(4, 1), ref _missing, ref _missing);
IRing exteriorRing1 = exteriorRing1PointCollection as IRing;
exteriorRing1.Close();
geometryCollection.AddGeometry(exteriorRing1 as IGeometry, ref _missing, ref _missing);
//Interior Ring 1
IPointCollection interiorRing1PointCollection = new RingClass();
interiorRing1PointCollection.AddPoint(ConstructPoint2D(1.5, 1.5), ref _missing, ref _missing);
interiorRing1PointCollection.AddPoint(ConstructPoint2D(1.5, 3.5), ref _missing, ref _missing);
interiorRing1PointCollection.AddPoint(ConstructPoint2D(3.5, 3.5), ref _missing, ref _missing);
interiorRing1PointCollection.AddPoint(ConstructPoint2D(3.5, 1.5), ref _missing, ref _missing);
IRing interiorRing1 = interiorRing1PointCollection as IRing;
interiorRing1.Close();
geometryCollection.AddGeometry(interiorRing1 as IGeometry, ref _missing, ref _missing);
//Exterior Ring 2
IPointCollection exteriorRing2PointCollection = new RingClass();
exteriorRing2PointCollection.AddPoint(ConstructPoint2D(1, -1), ref _missing, ref _missing);
exteriorRing2PointCollection.AddPoint(ConstructPoint2D(4, -1), ref _missing, ref _missing);
exteriorRing2PointCollection.AddPoint(ConstructPoint2D(4, -4), ref _missing, ref _missing);
exteriorRing2PointCollection.AddPoint(ConstructPoint2D(1, -4), ref _missing, ref _missing);
IRing exteriorRing2 = exteriorRing2PointCollection as IRing;
exteriorRing2.Close();
geometryCollection.AddGeometry(exteriorRing2 as IGeometry, ref _missing, ref _missing);
//Interior Ring 2
IPointCollection interiorRing2PointCollection = new RingClass();
interiorRing2PointCollection.AddPoint(ConstructPoint2D(1.5, -1.5), ref _missing, ref _missing);
interiorRing2PointCollection.AddPoint(ConstructPoint2D(3.5, -1.5), ref _missing, ref _missing);
interiorRing2PointCollection.AddPoint(ConstructPoint2D(3.5, -3.5), ref _missing, ref _missing);
interiorRing2PointCollection.AddPoint(ConstructPoint2D(1.5, -3.5), ref _missing, ref _missing);
IRing interiorRing2 = interiorRing2PointCollection as IRing;
interiorRing2.Close();
geometryCollection.AddGeometry(interiorRing2 as IGeometry, ref _missing, ref _missing);
//Exterior Ring 3
IPointCollection exteriorRing3PointCollection = new RingClass();
exteriorRing3PointCollection.AddPoint(ConstructPoint2D(-1, 1), ref _missing, ref _missing);
exteriorRing3PointCollection.AddPoint(ConstructPoint2D(-4, 1), ref _missing, ref _missing);
exteriorRing3PointCollection.AddPoint(ConstructPoint2D(-4, 4), ref _missing, ref _missing);
exteriorRing3PointCollection.AddPoint(ConstructPoint2D(-1, 4), ref _missing, ref _missing);
IRing exteriorRing3 = exteriorRing3PointCollection as IRing;
exteriorRing3.Close();
geometryCollection.AddGeometry(exteriorRing3 as IGeometry, ref _missing, ref _missing);
//Interior Ring 3
IPointCollection interiorRing3PointCollection = new RingClass();
interiorRing3PointCollection.AddPoint(ConstructPoint2D(-1.5, 1.5), ref _missing, ref _missing);
interiorRing3PointCollection.AddPoint(ConstructPoint2D(-3.5, 1.5), ref _missing, ref _missing);
interiorRing3PointCollection.AddPoint(ConstructPoint2D(-3.5, 3.5), ref _missing, ref _missing);
interiorRing3PointCollection.AddPoint(ConstructPoint2D(-1.5, 3.5), ref _missing, ref _missing);
IRing interiorRing3 = interiorRing3PointCollection as IRing;
interiorRing3.Close();
geometryCollection.AddGeometry(interiorRing3 as IGeometry, ref _missing, ref _missing);
//Exterior Ring 4
IPointCollection exteriorRing4PointCollection = new RingClass();
exteriorRing4PointCollection.AddPoint(ConstructPoint2D(-1, -1), ref _missing, ref _missing);
exteriorRing4PointCollection.AddPoint(ConstructPoint2D(-1, -4), ref _missing, ref _missing);
exteriorRing4PointCollection.AddPoint(ConstructPoint2D(-4, -4), ref _missing, ref _missing);
exteriorRing4PointCollection.AddPoint(ConstructPoint2D(-4, -1), ref _missing, ref _missing);
IRing exteriorRing4 = exteriorRing4PointCollection as IRing;
exteriorRing4.Close();
geometryCollection.AddGeometry(exteriorRing4 as IGeometry, ref _missing, ref _missing);
//Interior Ring 5
IPointCollection interiorRing4PointCollection = new RingClass();
interiorRing4PointCollection.AddPoint(ConstructPoint2D(-1.5, -1.5), ref _missing, ref _missing);
interiorRing4PointCollection.AddPoint(ConstructPoint2D(-1.5, -3.5), ref _missing, ref _missing);
interiorRing4PointCollection.AddPoint(ConstructPoint2D(-3.5, -3.5), ref _missing, ref _missing);
interiorRing4PointCollection.AddPoint(ConstructPoint2D(-3.5, -1.5), ref _missing, ref _missing);
IRing interiorRing4 = interiorRing4PointCollection as IRing;
interiorRing4.Close();
geometryCollection.AddGeometry(interiorRing4 as IGeometry, ref _missing, ref _missing);
IGeometry polygonGeometry = polygon as IGeometry;
ITopologicalOperator topologicalOperator = polygonGeometry as ITopologicalOperator;
topologicalOperator.Simplify();
IConstructMultiPatch constructMultiPatch = new MultiPatchClass();
constructMultiPatch.ConstructExtrudeFromTo(FromZ, ToZ, polygonGeometry);
return constructMultiPatch as IGeometry;
}
public static IPoint ConstructPoint2D(double x, double y)
{
IPoint point = new PointClass();
point.PutCoords(x, y);
return point;
}
IConstructMultiPatch.ConstructExtrudeRelative Method
Construct a MultiPatch by extruding a (non-point) geometry along a specified vector, using Zs already set on the input geometry.
Public Sub ConstructExtrudeRelative ( _
ByVal extrusionVector As IVector3D, _
ByVal baseGeom As IGeometry _
)
public void ConstructExtrudeRelative (
IVector3D extrusionVector,
IGeometry baseGeom
);
Description
Creates a MultiPatch from a base non-point geometry by extruding the base geometry along an axis defined by the input Vector3D. The base Z values of the geometry are the same as the base geometry and top Z values are offset from the base by the Z component of the input Vector3D. The top geometry is also shifted in the X and Y directions by an offset defined by the X component and Y component of the Vector3D. The resulting extrusion is parallel to the XY-plane only if the base geometry is parallel to the XY-plane.
Remarks
All non-linear segments are treated as linear segments when extrusion is performed. Only Polylines, Polygons, and Envelopes are allowed as input geometries.
private static object _missing = Type.Missing;
public static IGeometry GetMultiPatchGeometry()
{
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 Polygon Extruded Along 3D Vector Via ConstructExtrudeRelative()
IPointCollection pathPointCollection = new PathClass();
IGeometry pathGeometry = pathPointCollection as IGeometry;
MakeZAware(pathGeometry);
IPoint originPoint = ConstructPoint3D(0, 0, 0);
IVector3D upperAxisVector3D = ConstructVector3D(0, 0, 10);
IVector3D lowerAxisVector3D = ConstructVector3D(0, 0, -10);
lowerAxisVector3D.XComponent += VectorComponentOffset;
IVector3D normalVector3D = upperAxisVector3D.CrossProduct(lowerAxisVector3D) as IVector3D;
normalVector3D.Magnitude = CircleRadius;
double rotationAngleInRadians = GetRadians(CircleDegrees / CircleDivisions);
for (int i = 0; i < CircleDivisions; i++)
{
normalVector3D.Rotate(-1 * rotationAngleInRadians, upperAxisVector3D);
IPoint vertexPoint = 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 = ConstructVector3D(0, 10, 0);
ITransform3D transform3D = pathGeometry as ITransform3D;
transform3D.RotateVector3D(rotationAxisVector3D, GetRadians(RotationAngleInDegrees));
//Construct Polygon From Path Vertices
IGeometry polygonGeometry = new PolygonClass();
MakeZAware(polygonGeometry);
IPointCollection polygonPointCollection = polygonGeometry as IPointCollection;
for (int i = 0; i < pathPointCollection.PointCount; i++)
{
polygonPointCollection.AddPoint(pathPointCollection.get_Point(i), ref _missing, ref _missing);
}
ITopologicalOperator topologicalOperator = polygonGeometry as ITopologicalOperator;
topologicalOperator.Simplify();
//Define Vector To Extrude Along
IVector3D extrusionVector3D = ConstructVector3D(10, 0, 5);
//Perform Extrusion
IConstructMultiPatch constructMultiPatch = new MultiPatchClass();
constructMultiPatch.ConstructExtrudeRelative(extrusionVector3D, polygonGeometry);
return constructMultiPatch as IGeometry;
}
private static IVector3D ConstructVector3D(double xComponent, double yComponent, double zComponent)
{
IVector3D vector3D = new Vector3DClass();
vector3D.SetComponents(xComponent, yComponent, zComponent);
return vector3D;
}
private static double GetRadians(double decimalDegrees)
{
return decimalDegrees * (Math.PI / 180);
}
private static IPoint ConstructPoint3D(double x, double y, double z)
{
IPoint point = ConstructPoint2D(x, y);
point.Z = z;
MakeZAware(point as IGeometry);
return point;
}
private static IPoint ConstructPoint2D(double x, double y)
{
IPoint point = new PointClass();
point.PutCoords(x, y);
return point;
}
private static void MakeZAware(IGeometry geometry)
{
IZAware zAware = geometry as IZAware;
zAware.ZAware = true;
}
Classes that implement IConstructMultiPatch
Classes | Description |
---|---|
MultiPatch | A collection of surface patches. |
Remarks
To Extrude Points and Multipoints to create Polylines, use IExtrude.