linestring direction

Dear All,

How to find the direction of the linestring . I have tried the code available in this link http://debian.fmi.uni-sofia.bg/~sergei/cgsr/docs/clockwise.htm , but it failed.

My issue I need to compare 2 elements whether it belongs to same direction ie., Start point of the element in the 2 elements is in the first vertex or not in the vertex list.

Can any body help me to resolve this issue. I would appreciate is some body send me the code snippet.

Regards

K.JAYAKUMAR

Parents
  • Vector Algebra

    Unknown said:
    I need to compare 2 elements whether it belongs to same direction

    Consider the following VBA data types …

    1. Ray3d
    2. Segment3d

    Ray3d may be useful to you, because it has a direction. Construct two Ray3d objects from the start and end points of each of your two lines. Now you have two direction vectors that you can compare.

    Use Matrix3dFromRotationBetweenVectors to calculate the angle between the vectors. Read the notes about that method in VBA help …

    Returns a matrix representing rotation from one vector to another. In the usual case where the the vectors are neither parallel nor antiparallel, the rotation is around their cross product, which is perpendicular to their plane. If the vectors are parallel, the matrix is an identity. If the vectors are antiparallel (opposite directions), the rotation is 180 degrees around some vector chosen to be perpendicular to them.

    Regards, Jon Summers
    LA Solutions

     
    Regards, Jon Summers
    LA Solutions

Reply
  • Vector Algebra

    Unknown said:
    I need to compare 2 elements whether it belongs to same direction

    Consider the following VBA data types …

    1. Ray3d
    2. Segment3d

    Ray3d may be useful to you, because it has a direction. Construct two Ray3d objects from the start and end points of each of your two lines. Now you have two direction vectors that you can compare.

    Use Matrix3dFromRotationBetweenVectors to calculate the angle between the vectors. Read the notes about that method in VBA help …

    Returns a matrix representing rotation from one vector to another. In the usual case where the the vectors are neither parallel nor antiparallel, the rotation is around their cross product, which is perpendicular to their plane. If the vectors are parallel, the matrix is an identity. If the vectors are antiparallel (opposite directions), the rotation is 180 degrees around some vector chosen to be perpendicular to them.

    Regards, Jon Summers
    LA Solutions

     
    Regards, Jon Summers
    LA Solutions

Children
No Data