Provides access to methods for transforming 3D geometries using either specific parameters or arbitrary transformation objects.
Members
Name | Description | |
---|---|---|
Move3D | Moves the object by dx, dy and dz along the x, y, and z axes respectively. | |
MoveVector3D | Moves the object by an offset defined by a 3D vector. | |
ProjectToPlane | Generates a polygon footprint for the object in an arbitrary plane. The footprint may have multiple parts. | |
RotateVector3D | Rotates the object about axis defined by the specified vector through an angle measured in radians. | |
Scale3D | Scales the object about the specified origin point. sx, sy, and sz are the scaling factors for the x, y, and z dimensions repectively. | |
Transform3D | Applies an arbitrary 3D transformation. |
ITransform3D.Move3D Method
Moves the object by dx, dy and dz along the x, y, and z axes respectively.
Public Sub Move3D ( _
ByVal dx As Double, _
ByVal dy As Double, _
ByVal dz As Double _
)
public void Move3D (
double dx,
double dy,
double dz
);
public static void TransformMultiPatchGeometry()
{
const double XOffset = 7.5;
const double YOffset = 7.5;
const double ZOffset = -10;
//Transform3D: Cylinder Repositioned Via Move3D()
IGeometry geometry = GetMultiPatchGeometry();
ITransform3D transform3D = geometry as ITransform3D;
transform3D.Move3D(XOffset, YOffset, ZOffset);
}
ITransform3D.MoveVector3D Method
Moves the object by an offset defined by a 3D vector.
Public Sub MoveVector3D ( _
ByVal v As IVector3D _
)
public void MoveVector3D (
IVector3D v
);
public static void TransformMultiPatchGeometry()
{
const double XComponent = 7.5;
const double YComponent = 7.5;
const double ZComponent = -10;
//Transform3D: Cylinder Repositioned Via MoveVector3D()
IVector3D vector3D = ConstructVector3D(
XComponent, YComponent, ZComponent
);
IGeometry geometry = GetMultiPatchGeometry();
ITransform3D transform3D = geometry as ITransform3D;
transform3D.MoveVector3D(vector3D);
}
private static IVector3D ConstructVector3D(double xComponent, double yComponent, double zComponent)
{
IVector3D vector3D = new Vector3DClass();
vector3D.SetComponents(xComponent, yComponent, zComponent);
return vector3D;
}
ITransform3D.ProjectToPlane Method
Generates a polygon footprint for the object in an arbitrary plane. The footprint may have multiple parts.
Public Function ProjectToPlane ( _
ByVal planarOrigin As IPoint, _
ByVal planarPositiveX As IVector3D, _
ByVal planarNorm As IVector3D _
) As IGeometry
public IGeometry ProjectToPlane (
IPoint planarOrigin,
IVector3D planarPositiveX,
IVector3D planarNorm
);
Remarks
This method can be used to get the xy-footprint of a multipatch if set all the parameters to Null.
public static void TransformMultiPatchGeometry()
{
//Transform3D: Cylinder Projected To XY Plane Via ProjectToPlane()
//Define Origin At Which ProjectToPlane Operation Should Be Performed
IPoint planarOriginPoint = ConstructPoint3D(0, 0, 0);
//Construct A Vector3D Corresponding To The Positive X Vector
IVector3D planarPositiveXVector3D = ConstructVector3D(10, 0, 0);
//Construct A Vector3D Corresponding To The Normal Vector
IVector3D planarNormalVector3D = ConstructVector3D(0, 0, 10);
IGeometry geometry = GetMultiPatchGeometry();
ITransform3D transform3D = geometry as ITransform3D;
IGeometry projectedGeometry =
transform3D.ProjectToPlane(
planarOriginPoint,
planarPositiveXVector3D,
planarNormalVector3D
);
}
private static IVector3D ConstructVector3D(double xComponent, double yComponent, double zComponent)
{
IVector3D vector3D = new Vector3DClass();
vector3D.SetComponents(xComponent, yComponent, zComponent);
return vector3D;
}
ITransform3D.RotateVector3D Method
Rotates the object about axis defined by the specified vector through an angle measured in radians.
Public Sub RotateVector3D ( _
ByVal axis As IVector3D, _
ByVal rotationAngle As Double _
)
public void RotateVector3D (
IVector3D axis,
double rotationAngle
);
Remarks
The angle of rotation must be in radians. To convert to radians from decimal degrees, multiply by PI/180.
public static void TransformMultiPatchGeometry()
{
const double DegreesOfRotation = 45;
//Transform3D: Cylinder Rotated Around An Axis Via RotateVector3D()
//Construct A Vector3D Corresponding To The Desired Axis Of Rotation
IVector3D axisOfRotationVector3D = ConstructVector3D(0, 10, 0);
//Obtain Angle Of Rotation In Radians
double angleOfRotationInRadians = GetRadians(DegreesOfRotation);
IGeometry geometry = GetMultiPatchGeometry();
ITransform3D transform3D = geometry as ITransform3D;
transform3D.RotateVector3D(axisOfRotationVector3D, angleOfRotationInRadians);
}
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);
}
ITransform3D.Scale3D Method
Scales the object about the specified origin point. sx, sy, and sz are the scaling factors for the x, y, and z dimensions repectively.
Public Sub Scale3D ( _
ByVal Origin As IPoint, _
ByVal sx As Double, _
ByVal sy As Double, _
ByVal sz As Double _
)
public void Scale3D (
IPoint Origin,
double sx,
double sy,
double sz
);
public static void TransformMultiPatchGeometry()
{
const double XScale = 2;
const double YScale = 2;
const double ZScale = 3;
//Transform3D: Cylinder Scaled Via Scale3D()
//Define Origin At Which Scale Operation Should Be Performed
IPoint originPoint = ConstructPoint3D(0, 0, 0);
MakeZAware(originPoint as IGeometry);
IGeometry geometry = GetMultiPatchGeometry();
ITransform3D transform3D = geometry as ITransform3D;
transform3D.Scale3D(originPoint, XScale, YScale, ZScale);
}
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;
}
ITransform3D.Transform3D Method
Applies an arbitrary 3D transformation.
Public Sub Transform3D ( _
ByVal Direction As esriTransformDirection, _
ByVal Transformation As ITransformation3D _
)
public void Transform3D (
esriTransformDirection Direction,
ITransformation3D Transformation
);
Classes that implement ITransform3D
Classes | Description |
---|---|
MultiPatch | A collection of surface patches. |
Multipoint | An ordered collection of points; optionally has measure, height and ID attributes. |
Path | A sequence of connected segments. |
Point | A two dimensional point, optionally with measure, height, and ID attributes. |
Polygon | A collection of rings ordered by their containment relationship; optionally has measure, height and ID attributes. |
Polyline | An ordered collection of paths; optionally has measure, height and ID attributes. |
Ring | An area bounded by one, closed sequence of connected segments; optionally has measure, height and ID attributes at each vertex. |
TriangleFan | A continuous 3D fan of triangles, where each triangle after the first shares an edge with the preceding triangle, and all triangles share a common pivot point. |
Triangles | A collection of 3D triangles, where each consecutive triplet of vertices defines a new triangle |
TriangleStrip | A continuous 3D strip of triangles, where each triangle after the first shares an edge with the preceding triangle. |
Remarks
These methods are intended to be called against top-level geometries only (Point, Polyline, Polygon, MultiPatch). To call a method against a Segment/Path or Ring, first add the part to a Polyline or Polygon container, respectively, and then call the appropriate method against the container.
public static void TransformMultiPatchGeometry()
{
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 = GetMultiPatchGeometry();
ITransform3D transform3D = geometry as ITransform3D;
//Stretch The Cylinder So It Looks Like A Tube
IPoint originPoint = ConstructPoint3D(0, 0, 0);
transform3D.Scale3D(originPoint, XScale, YScale, ZScale);
//Rotate The Cylinder So It Lies On Its Side
IVector3D axisOfRotationVector3D = ConstructVector3D(0, 10, 0);
double angleOfRotationInRadians = GetRadians(DegreesOfRotation);
transform3D.RotateVector3D(axisOfRotationVector3D, angleOfRotationInRadians);
//Reposition The Cylinder So It Is Located Underground
transform3D.Move3D(XOffset, YOffset, ZOffset);
}
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 double GetRadians(double decimalDegrees)
{
return decimalDegrees * (Math.PI / 180);
}
private static IVector3D ConstructVector3D(double xComponent, double yComponent, double zComponent)
{
IVector3D vector3D = new Vector3DClass();
vector3D.SetComponents(xComponent, yComponent, zComponent);
return vector3D;
}