[V8i] How can I Compare the direction of two lines.

Hi!

I have two lines to compare direction.( to check two line go same direction or not.)

I made two Ray3D objects from the lines like below.

Dim oRay_Cell       As Ray3d
Dim oRay_Line As Ray3d
oRay_Cell = Ray3dFromPoint3dStartEnd(oLineFromCell.startPoint, oLineFromCell.EndPoint)
oRay_Line = Ray3dFromPoint3dStartEnd(oLineFromLine.startPoint, oLineFromLine.EndPoint)
 
But I don't know how to compare the direction.
oRay_Cell.Direction ,,,,, oRay_Line.Direction
Parents
  • Hi,

    One issue I had (using a different command) was tolerance.  I had to say, if the difference in angle is less than my tolerance, then it is parallel.  With out that, I had "rounding errors" which produced an insignificant difference that would tell me that the lines were not parallel.

    --Robert

  • Computational Geometry: Cross Product and Dot Product

    Unknown said:
    One issue I had (using a different command) was tolerance.  I had to say, if the difference in angle is less than my tolerance, then it is parallel

    That's an argument in favour of using the cross-product of two vectors.  First, it's simpler than extracting and comparing three sets of angles; second, it's numerically concise: if the cross-product is zero then the vectors are parallel. 

    The cross-product can also inform you if two unit vectors are perpendicular.  You can see why the cross-product, and its companion the dot-product, are useful and why they are included in the VBA library.  See...

    • Point3dCrossProduct3PointsXY
    • Point3dDotProductXY
    • Point3dTripleProduct
    • Vector3dCrossProduct
    • Vector3dDotProduct
    • Matrix3dFromRotationBetweenVectors

     
    Regards, Jon Summers
    LA Solutions

Reply
  • Computational Geometry: Cross Product and Dot Product

    Unknown said:
    One issue I had (using a different command) was tolerance.  I had to say, if the difference in angle is less than my tolerance, then it is parallel

    That's an argument in favour of using the cross-product of two vectors.  First, it's simpler than extracting and comparing three sets of angles; second, it's numerically concise: if the cross-product is zero then the vectors are parallel. 

    The cross-product can also inform you if two unit vectors are perpendicular.  You can see why the cross-product, and its companion the dot-product, are useful and why they are included in the VBA library.  See...

    • Point3dCrossProduct3PointsXY
    • Point3dDotProductXY
    • Point3dTripleProduct
    • Vector3dCrossProduct
    • Vector3dDotProduct
    • Matrix3dFromRotationBetweenVectors

     
    Regards, Jon Summers
    LA Solutions

Children
No Data