This document is archived and information here might be outdated. Recommended version. |
Construct a MultiPatch by extruding a (non-point) geometry along a specified vector, using Zs already set on the input geometry.
[Visual Basic .NET] Public Sub ConstructExtrudeRelative ( _ ByVal extrusionVector As IVector3D, _ ByVal baseGeom As IGeometry _ )
[C#] public void ConstructExtrudeRelative ( IVector3D extrusionVector, IGeometry baseGeom );
[C++]
HRESULT ConstructExtrudeRelative(
IVector3D* extrusionVector,
IGeometry* baseGeom
);
[C++]
Parameters extrusionVector
extrusionVector is a parameter of type IVector3D* baseGeom
baseGeom is a parameter of type IGeometry*
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.
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;
}
IConstructMultiPatch Interface | IExtrude.ExtrudeBetween Method | IConstructMultiPatch.ConstructExtrudeAbsolute Method | IConstructMultiPatch.ConstructExtrudeBetween Method | IExtrude.ExtrudeAbsolute Method | IConstructMultiPatch.ConstructExtrudeRelative Method | IConstructMultiPatch.ConstructExtrudeFromTo Method | IConstructMultiPatch Interface | IConstructMultiPatch.ConstructExtrudeAlongLine Method | IConstructMultiPatch.ConstructExtrude Method | IExtrude.Extrude Method | IExtrude.ExtrudeFromTo Method | IExtrude.ExtrudeRelative Method | IExtrude.ExtrudeAlongLine Method | IExtrude Interface | IGlobeHeightProperties.ExtrusionExpressionString Property