Interface IVector3D
Provides access to 3D vector properties and operations.
[Guid("B3FA5971-ADA3-11D2-9FAE-00C04F8ECE3D")]
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface IVector3D : IVector
Remarks


private static object _missing = Type.Missing;
public static IGeometry GetMultiPatchGeometry()
{
const double ConeBaseDegrees = 360.0;
const int ConeBaseDivisions = 36;
const double VectorComponentOffset = 0.0000001;
const double ConeBaseRadius = 6;
const double ConeBaseZ = 0.0;
const double ConeApexZ = 9.5;
//Vector3D: Cone, TriangleFan With 36 Vertices
IGeometryCollection multiPatchGeometryCollection = new MultiPatchClass();
IPointCollection triangleFanPointCollection = new TriangleFanClass();
//Set Cone Apex To (0, 0, ConeApexZ)
IPoint coneApexPoint = ConstructPoint3D(0, 0, ConeApexZ);
//Add Cone Apex To Triangle Fan
triangleFanPointCollection.AddPoint(coneApexPoint, ref _missing, ref _missing);
//Define Upper Portion Of Axis Around Which Vector Should Be Rotated To Generate Cone Base Vertices
IVector3D upperAxisVector3D = ConstructVector3D(0, 0, 10);
//Define Lower Portion of Axis Around Which Vector Should Be Rotated To Generate Cone Base Vertices
IVector3D lowerAxisVector3D = ConstructVector3D(0, 0, -10);
//Add A Slight Offset To X or Y Component Of One Of Axis Vectors So Cross Product Does Not Return A Zero-Length Vector
lowerAxisVector3D.XComponent += VectorComponentOffset;
//Obtain Cross Product Of Upper And Lower Axis Vectors To Obtain Normal Vector To Axis Of Rotation To Generate Cone Base Vertices
IVector3D normalVector3D = upperAxisVector3D.CrossProduct(lowerAxisVector3D) as IVector3D;
//Set Normal Vector Magnitude Equal To Radius Of Cone Base
normalVector3D.Magnitude = ConeBaseRadius;
//Obtain Angle Of Rotation In Radians As Function Of Number Of Divisions Within 360 Degree Sweep Of Cone Base
double rotationAngleInRadians = GetRadians(ConeBaseDegrees / ConeBaseDivisions);
for (int i = 0; i < ConeBaseDivisions; i++)
{
//Rotate Normal Vector Specified Rotation Angle In Radians Around Either Upper Or Lower Axis
normalVector3D.Rotate(-1 * rotationAngleInRadians, upperAxisVector3D);
//Construct Cone Base Vertex Whose XY Coordinates Are The Sum Of Apex XY Coordinates And Normal Vector XY Components
IPoint vertexPoint = ConstructPoint3D(coneApexPoint.X + normalVector3D.XComponent,
coneApexPoint.Y + normalVector3D.YComponent,
ConeBaseZ);
//Add Vertex To TriangleFan
triangleFanPointCollection.AddPoint(vertexPoint, ref _missing, ref _missing);
}
//Re-Add The Second Point Of The Triangle Fan (First Vertex Added) To Close The Fan
triangleFanPointCollection.AddPoint(triangleFanPointCollection.get_Point(1), ref _missing, ref _missing);
//Add TriangleFan To MultiPatch
multiPatchGeometryCollection.AddGeometry(triangleFanPointCollection as IGeometry, ref _missing, ref _missing);
return multiPatchGeometryCollection as IGeometry;
}
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);
}
Properties
Azimuth
The vector's azimuth angle in radians.
double Azimuth { get; set; }
Property Value
Remarks

ComponentByIndex[int]
double ComponentByIndex[int componentIndex] { get; set; }
Parameters
componentIndexint
Property Value
Dimension
int Dimension { get; }
Property Value
Inclination
The vector's inclination in radians.
double Inclination { get; set; }
Property Value
Remarks

IsEmpty
bool IsEmpty { get; }
Property Value
Magnitude
double Magnitude { get; set; }
Property Value
XComponent
The vector's X component.
double XComponent { get; set; }
Property Value
Remarks

YComponent
The vector's Y component.
double YComponent { get; set; }
Property Value
Remarks

ZComponent
The vector's Z component.
double ZComponent { get; set; }
Property Value
Remarks

Methods
AddVector(IVector)
IVector AddVector(IVector otherVector)
Parameters
otherVectorIVector
Returns
ConstructAddVector(IVector, IVector)
void ConstructAddVector(IVector vector1, IVector vector2)
Parameters
ConstructCrossProduct(IVector, IVector)
Set this vector equal to the cross product of the two input vectors.
void ConstructCrossProduct(IVector vector1, IVector vector2)
Parameters
ConstructDifference(IPoint, IPoint)
Set the vector by taking the difference of point1 and point2 (so the vector would go from point2 to point1).
void ConstructDifference(IPoint point1, IPoint point2)
Parameters
Remarks

public IVector3D CreateVector3DTwoPoints(IPoint fromPoint, IPoint toPoint)
{
if (fromPoint.Z.Equals(Double.NaN))
{
fromPoint.Z = 0;
}
if (toPoint.Z.Equals(Double.NaN))
{
toPoint.Z = 0;
}
IVector3D vector3D = new Vector3DClass();
vector3D.ConstructDifference(fromPoint, toPoint);
return vector3D;
}
ConstructSubtractVector(IVector, IVector)
void ConstructSubtractVector(IVector vector1, IVector vector2)
Parameters
CrossProduct(IVector)
Returns the cross product of this vector and another vector.
IVector CrossProduct(IVector otherVector)
Parameters
otherVectorIVector
Returns
DotProduct(IVector)
double DotProduct(IVector otherVector)
Parameters
otherVectorIVector
Returns
Move(double, double, double)
Move the vector by adding a shift value to each component.
void Move(double dx, double dy, double dz)
Parameters
Normalize()
void Normalize()
PolarMove(double, double, double)
Modify the vector by adding to its polar components. Angles are in radians.
void PolarMove(double dAzimuth, double dInclination, double dRadius)
Parameters
PolarQuery(out double, out double, out double)
Get the vector's polar components. Angles are in radians.
void PolarQuery(out double Azimuth, out double Inclination, out double radiusLength)
Parameters
Remarks

PolarSet(double, double, double)
Set the vector using polar components. Angles are in radians.
void PolarSet(double Azimuth, double Inclination, double radiusLength)
Parameters
Remarks

public IVector3D CreateVector3DPolar(double azimuth, double inclination, double magnitude)
{
IVector3D vector3D = new Vector3DClass();
vector3D.PolarSet(azimuth, inclination, magnitude);
return vector3D;
}
QueryComponents(out double, out double, out double)
Get the values of the vector's components.
void QueryComponents(out double dx, out double dy, out double dz)
Parameters
Remarks

Rotate(double, IVector3D)
Rotate the vector around an axis defined by another vector. The angle is in radians.
void Rotate(double Angle, IVector3D axis)
Parameters
Scale(double)
void Scale(double ScaleFactor)
Parameters
ScaleFactordouble
SetComponents(double, double, double)
Set the values of the vector's components.
void SetComponents(double dx, double dy, double dz)
Parameters
Remarks

public IVector3D CreateVector3D(double x, double y, double z)
{
IVector3D vector3D = new Vector3DClass();
vector3D.SetComponents(x, y, z);
return vector3D;
}
SetEmpty()
void SetEmpty()
SubtractVector(IVector)
IVector SubtractVector(IVector otherVector)
Parameters
otherVectorIVector