This document is archived and information here might be outdated. Recommended version. |
ArcObjects namespaces > Geometry > ESRI.ArcGIS.Geometry > Interfaces > IC > IConstructMultiPatch Interface > IConstructMultiPatch.ConstructExtrudeBetween Method (ArcObjects .NET 10.4 SDK) |
Construct a MultiPatch by extruding a (non-point) geometry between two functional surfaces.
[Visual Basic .NET] Public Sub ConstructExtrudeBetween ( _ ByVal fromSurface As IFunctionalSurface, _ ByVal toSurface As IFunctionalSurface, _ ByVal baseGeom As IGeometry _ )
[C#] public void ConstructExtrudeBetween ( IFunctionalSurface fromSurface, IFunctionalSurface toSurface, IGeometry baseGeom );
[C++]
HRESULT ConstructExtrudeBetween(
IFunctionalSurface* fromSurface,
IFunctionalSurface* toSurface,
IGeometry* baseGeom
);
[C++]
Parameters fromSurface
fromSurface is a parameter of type IFunctionalSurface toSurface
toSurface is a parameter of type IFunctionalSurface baseGeom
baseGeom is a parameter of type IGeometry
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.
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 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