About the 3D multipatch examples Sample
[C#]
Transform3DExamples.cs
using System;
using ESRI.ArcGIS.Geometry;
namespace MultiPatchExamples
{
public static class Transform3DExamples
{
private static object _missing = Type.Missing;
public static IGeometry GetExample1()
{
const double XOffset = 7.5;
const double YOffset = 7.5;
const double ZOffset = -10;
//Transform3D: Cylinder Repositioned Via Move3D()
IGeometry geometry = Vector3DExamples.GetExample3();
ITransform3D transform3D = geometry as ITransform3D;
transform3D.Move3D(XOffset, YOffset, ZOffset);
return geometry;
}
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;
}
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;
}
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;
}
}
}
[Visual Basic .NET]
Transform3DExamples.vb
Imports Microsoft.VisualBasic
Imports System
Imports ESRI.ArcGIS.Geometry
Public Class Transform3DExamples
Private Shared _missing As Object = Type.Missing
Private Sub New()
End Sub
Public Shared Function GetExample1() As IGeometry
Const XOffset As Double = 7.5
Const YOffset As Double = 7.5
Const ZOffset As Double = -10
'Transform3D: Cylinder Repositioned Via Move3D()
Dim geometry As IGeometry = Vector3DExamples.GetExample3()
Dim transform3D As ITransform3D = TryCast(geometry, ITransform3D)
transform3D.Move3D(XOffset, YOffset, ZOffset)
Return geometry
End Function
Public Shared Function GetExample2() As IGeometry
Const XScale As Double = 2
Const YScale As Double = 2
Const ZScale As Double = 3
'Transform3D: Cylinder Scaled Via Scale3D()
Dim geometry As IGeometry = Vector3DExamples.GetExample3()
'Define Origin At Which Scale Operation Should Be Performed
Dim originPoint As IPoint = GeometryUtilities.ConstructPoint3D(0, 0, 0)
Dim transform3D As ITransform3D = TryCast(geometry, ITransform3D)
transform3D.Scale3D(originPoint, XScale, YScale, ZScale)
Return geometry
End Function
Public Shared Function GetExample3() As IGeometry
Const DegreesOfRotation As Double = 45
'Transform3D: Cylinder Rotated Around An Axis Via RotateVector3D()
Dim geometry As IGeometry = Vector3DExamples.GetExample3()
'Construct A Vector3D Corresponding To The Desired Axis Of Rotation
Dim axisOfRotationVector3D As IVector3D = GeometryUtilities.ConstructVector3D(0, 10, 0)
'Obtain Angle Of Rotation In Radians
Dim angleOfRotationInRadians As Double = GeometryUtilities.GetRadians(DegreesOfRotation)
Dim transform3D As ITransform3D = TryCast(geometry, ITransform3D)
transform3D.RotateVector3D(axisOfRotationVector3D, angleOfRotationInRadians)
Return geometry
End Function
Public Shared Function GetExample4() As IGeometry
Const XScale As Double = 0.5
Const YScale As Double = 0.5
Const ZScale As Double = 2
Const XOffset As Double = -5
Const YOffset As Double = -5
Const ZOffset As Double = -8
Const DegreesOfRotation As Double = 90
'Transform3D: Cylinder Scaled, Rotated, Repositioned Via Move3D(), Scale3D(), RotateVector3D()
Dim geometry As IGeometry = Vector3DExamples.GetExample3()
Dim transform3D As ITransform3D = TryCast(geometry, ITransform3D)
'Stretch The Cylinder So It Looks Like A Tube
Dim originPoint As IPoint = GeometryUtilities.ConstructPoint3D(0, 0, 0)
transform3D.Scale3D(originPoint, XScale, YScale, ZScale)
'Rotate The Cylinder So It Lies On Its Side
Dim axisOfRotationVector3D As IVector3D = GeometryUtilities.ConstructVector3D(0, 10, 0)
Dim angleOfRotationInRadians As Double = GeometryUtilities.GetRadians(DegreesOfRotation)
transform3D.RotateVector3D(axisOfRotationVector3D, angleOfRotationInRadians)
'Reposition The Cylinder So It Is Located Underground
transform3D.Move3D(XOffset, YOffset, ZOffset)
Return geometry
End Function
End Class