Quantcast
Channel: MicroStation Programming Forum - Recent Threads
Viewing all articles
Browse latest Browse all 7260

RE: [V8i VBA] Detecting if coordinate is above or below target element

$
0
0

[quote user="Jon Summers"]

One way to find if a point is 'left' or 'right' of a line is to use vector algebra.  Construct one vector V1 from the chainage element's direction at the point of intersection.  Construct a second vector V2 which is the perpendicular from the point onto the chainage line.  Calculate the cross product of the two vectors V3 = V1 x V2. [/quote]

Hi Jon,

based on your earlier post I calculated cross product as a multiplying the magnitudes of the tangent vector by the normal vector. Further research suggests I need to do, instead I need to calculate the cross product of the two coplanar vectors defined by the 2 pairs of points by using the formula: 

=(x2 - x1)*(y3 - y1) - (x3-x1)*(y2-y1)


I've revised the notation for the coordinates to match convention and added the above formula to another cell.

The first coordinate test case shows the both the vector multiplication method and the above formula yielding the same cross product result.

for the second coordinate test case, after changing the spreadsheet to a clockwise rotation matrix (because the spreadsheet knows nothing about the direction of the element and which way the tangent vector should point), the cross product calculations are different as can be seen below.


 


Viewing all articles
Browse latest Browse all 7260

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>