IVector3D Interface

Provides access to 3D vector properties and operations.

Description

A 3 Dimensional vector with an X Component, Y Component, and Z Component that correspond to the X-Axis, Y-Axis, and Z-Axis respectively. The 3 Dimensional vector can also be defined in terms of spherical coordinates as an angle of rotation (Azimuth) from the YZ-Plane, angle of displacement (Inclination) from the XY-Plane, and a length (Magnitude). This vector can be manipulated by any of the general Vector operations as well as operations specific to the third dimension.

Members

Name Description
Method AddVector Construct a new vector by adding a different vector to this vector.
Read/write property Azimuth The vector's azimuth angle in radians.
Read/write property ComponentByIndex The component corresponding to a given index.
Method ConstructAddVector Set this vector by adding two input vectors.
Method ConstructCrossProduct Set this vector equal to the cross product of the two input vectors.
Method ConstructDifference Set the vector by taking the difference of point1 and point2 (so the vector would go from point2 to point1).
Method ConstructSubtractVector Set this vector by subtracting the second input vector from the first one.
Method CrossProduct Returns the cross product of this vector and another vector.
Read-only property Dimension The dimension of this vector.
Method DotProduct Returns the dot product of this vector and another vector.
Read/write property Inclination The vector's inclination in radians.
Read-only property IsEmpty Indicates if the vector is empty (unset).
Read/write property Magnitude The length of the vector.
Method Move Move the vector by adding a shift value to each component.
Method Normalize Normalize the vector (scale it to magnitude = 1).
Method PolarMove Modify the vector by adding to its polar components. Angles are in radians.
Method PolarQuery Get the vector's polar components. Angles are in radians.
Method PolarSet Set the vector using polar components. Angles are in radians.
Method QueryComponents Get the values of the vector's components.
Method Rotate Rotate the vector around an axis defined by another vector. The angle is in radians.
Method Scale Scale the vector by the given factor.
Method SetComponents Set the values of the vector's components.
Method SetEmpty Makes the vector empty (unset).
Method SubtractVector Construct a new vector by subtracting a different vector from this vector.
Read/write property XComponent The vector's X component.
Read/write property YComponent The vector's Y component.
Read/write property ZComponent The vector's Z component.

IVector3D.Azimuth Property

The vector's azimuth angle in radians.

Public Property Azimuth As Double
public double Azimuth {get; set;}

Description

Returns and sets the Azimuth of the 3 Dimensional vector. The Azimuth is the angle between the YZ-Plane and the vector measured in the X-direction. The Azimuth is measured in radians in a clockwise direction and has a value between 0 and 2*Pi.

Remarks

Vector3D Azimuth Example

IVector3D.ConstructCrossProduct Method

Set this vector equal to the cross product of the two input vectors.

Public Sub ConstructCrossProduct ( _
    ByVal vector1 As IVector, _
    ByVal vector2 As IVector _
)
public void ConstructCrossProduct (
    IVector vector1,
    IVector vector2
);

IVector3D.ConstructDifference Method

Set the vector by taking the difference of point1 and point2 (so the vector would go from point2 to point1).

Public Sub ConstructDifference ( _
    ByVal point1 As IPoint, _
    ByVal point2 As IPoint _
)
public void ConstructDifference (
    IPoint point1,
    IPoint point2
);

Description

Constructs a Vector3D defined by the difference between the first point and the second point. The first point and the Origin define a Vector3D, and the Origin and the second point define a second Vector3D. Thus, the constructed difference Vector3D is the Constructed Subtract Vector between the first vector and the second vector.

Remarks

IVector3D ConstructDifference Example

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;

    }

IVector3D.CrossProduct Method

Returns the cross product of this vector and another vector.

Public Function CrossProduct ( _
    ByVal otherVector As IVector _
) As IVector
public IVector CrossProduct (
    IVector otherVector
);

IVector3D.Inclination Property

The vector's inclination in radians.

Public Property Inclination As Double
public double Inclination {get; set;}

Description

Returns and sets the Inclination of the 3 Dimensional vector. The Inclination is the angle between the XY-Plane and the vector measured in the Z-direction. The Inclination is measured in radians and has a value between -Pi/2 and Pi/2.

Remarks

Vector3D Inclination Example

IVector3D.Move Method

Move the vector by adding a shift value to each component.

Public Sub Move ( _
    ByVal dx As Double, _
    ByVal dy As Double, _
    ByVal dz As Double _
)
public void Move (
    double dx,
    double dy,
    double dz
);

Description

Moves the Vector3D by adding a given input factor to each of the X, Y, and Z Components. The result is the same as adding another Vector3D defined by the inputs to the base Vector3D.

IVector3D.PolarMove Method

Modify the vector by adding to its polar components. Angles are in radians.

Public Sub PolarMove ( _
    ByVal dAzimuth As Double, _
    ByVal dInclination As Double, _
    ByVal dRadius As Double _
)
public void PolarMove (
    double dAzimuth,
    double dInclination,
    double dRadius
);

Description

Moves the Vector3D in Polar coordinates by adding a given input factor to each of the Azimuth, Inclination, and Radius Components. This can be thought of as applying a Polar rotation and modification to the base Vector.

IVector3D.PolarQuery Method

Get the vector's polar components. Angles are in radians.

Public Sub PolarQuery ( _
    ByRef Azimuth As Double, _
    ByRef Inclination As Double, _
    ByRef radiusLength As Double _
)
public void PolarQuery (
    ref double Azimuth,
    ref double Inclination,
    ref double radiusLength
);

Description

Returns the Azimuth, Inclination, and Radius Length (Magnitude) of the 3 Dimensional vector.

Remarks

Vector3D PolarQuery Example

IVector3D.PolarSet Method

Set the vector using polar components. Angles are in radians.

Public Sub PolarSet ( _
    ByVal Azimuth As Double, _
    ByVal Inclination As Double, _
    ByVal radiusLength As Double _
)
public void PolarSet (
    double Azimuth,
    double Inclination,
    double radiusLength
);

Description

Sets the X Component, Y Component, and Z Component values of the 3 Dimensional vector that correspond to the input Azimuth, Inclination, and Radius Length (Magnitude) values. The Azimuth and Inclination are measured in radians.

Remarks

Vector3D PolarSet Example

public IVector3D CreateVector3DPolar(double azimuth, double inclination, double magnitude)

    {

        IVector3D vector3D = new Vector3DClass();

        vector3D.PolarSet(azimuth, inclination, magnitude);

        return vector3D;

    }

IVector3D.QueryComponents Method

Get the values of the vector's components.

Public Sub QueryComponents ( _
    ByRef dx As Double, _
    ByRef dy As Double, _
    ByRef dz As Double _
)
public void QueryComponents (
    ref double dx,
    ref double dy,
    ref double dz
);

Description

Returns the X Component, Y Component, and X Component of the 3 Dimensional vector.

Remarks

Vector3D QueryComponents Example

IVector3D.Rotate Method

Rotate the vector around an axis defined by another vector. The angle is in radians.

Public Sub Rotate ( _
    ByVal Angle As Double, _
    ByVal axis As IVector3D _
)
public void Rotate (
    double Angle,
    IVector3D axis
);

Description

Rotates the base Vector3D a given input angle measured in radians around the specified axis defined by the input Vector3D. To rotate a vector in a given plane defined by two vectors, use the CrossProduct of those vectors as the axis of rotation.

IVector3D.SetComponents Method

Set the values of the vector's components.

Public Sub SetComponents ( _
    ByVal dx As Double, _
    ByVal dy As Double, _
    ByVal dz As Double _
)
public void SetComponents (
    double dx,
    double dy,
    double dz
);

Description

Sets the X Component, Y Component, and Z Component of the 3 Dimensional vector.

Remarks

Vector3D SetComponents Example

public IVector3D CreateVector3D(double x, double y, double z)

    {

        IVector3D vector3D = new Vector3DClass();

        vector3D.SetComponents(x, y, z);

        return vector3D;

    }

IVector3D.XComponent Property

The vector's X component.

Public Property XComponent As Double
public double XComponent {get; set;}

Description

Returns and sets the X Component of the 3 Dimensional vector. The X Component corresponds to the displacement from the origin along the X-Axis.

Remarks

Vector3D XComponent Example

IVector3D.YComponent Property

The vector's Y component.

Public Property YComponent As Double
public double YComponent {get; set;}

Description

Returns and sets the Y Component of the 3 Dimensional vector. The Y Component corresponds to the displacement from the origin along the Y-Axis.

Remarks

Vector3D YComponent Example

IVector3D.ZComponent Property

The vector's Z component.

Public Property ZComponent As Double
public double ZComponent {get; set;}

Description

Returns and sets the Z Component of the 3 Dimensional vector. The Z Component corresponds to the displacement from the origin along the Z-Axis.

Remarks

Vector3D ZComponent Example

Inherited Interfaces

Interfaces Description
IVector Provides access to vector properties and operations.

Classes that implement IVector3D

Classes Description
Vector3D A 3D vector containing dx, dy, and dz components.

Remarks

Vector3D Example

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);

          }

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.