Project a point perpendicular from line

Dear All,
I need to project a point(Blue colored) from a line(Majenta Color) to another line(Yellow Color) and the projected point should be perpendicular from a line(Majenta Color).
The required output was represented(in attachment) as green colored line. Is there any options available in Microstation_VBA to achieve this?
Parents
  • Hi Dharmarajan,

    I assume you are in a 2D model. Then the following steps can help you:

    1. Get a Vector3d xVec from your magenta line as below shown:

    2. Create a zVec with (0, 0, 1);

    3. Compute out a yVec by cross producting zVec to xVec using Vector3dCrossProduct method.

    4. Construct Ray3d from your blue point and yVec;

    5. Get the yellow line and call yellowLine.IntersectRay3d method to get the intersect point on yellow line.

    HTH, YongAn



Reply
  • Hi Dharmarajan,

    I assume you are in a 2D model. Then the following steps can help you:

    1. Get a Vector3d xVec from your magenta line as below shown:

    2. Create a zVec with (0, 0, 1);

    3. Compute out a yVec by cross producting zVec to xVec using Vector3dCrossProduct method.

    4. Construct Ray3d from your blue point and yVec;

    5. Get the yellow line and call yellowLine.IntersectRay3d method to get the intersect point on yellow line.

    HTH, YongAn



Children
  • (1) How to create a  vector3D from a LineString? (2) How to convert a lineElement to valid object which has IntersectRay3d method ? can you please send me a sample code?

  • Unknown said:
    How to create a  vector3D from a LineString?

    A line-string has multiple segments.  Since each segment has its own direction and start-point, you can't convert an entire line-string to a vector.  You must focus on each segment of that line-string, and convert each segment to a vector.

    A Vector3d is a vector in the mathematical sense: it has direction but no particular location.  Use Vector3dSubtractPoint3dPoint3d to compute a vector from the end and start points of a line-string segment.

    Unknown said:
    How to convert a lineElement to valid object which has IntersectRay3d method?

    The BSplineSurface.IntersectRay3d method belongs to the BSplineSurface object.  I don't know how you would consider a LineElement segment to be a BSplineSurface.

    It would be better to tell us what you want to achieve.

     
    Regards, Jon Summers
    LA Solutions

  • Hi Jon,

    Majenta(Source line) and Yellow(Destination line) Color are input. Green color line was the output want to achieve.

    The one end of Output lines are snapped with Majenta lines at a regular interval(0.5 m along the element) and are perpendicular to Majenta lines. The other end of output lines are snapped with Yellow line. Input,output are 3D elements
  • I don't see a question, but it's a nice screenshot. By the way, we all use MicroStation, so a DGN model is always a better way of showing us what you are doing or what you want.

    There are some things a screenshot cannot tell us. For example, we still don't know if you have a 2D or 3D model.

    If you're working in 3D, answers will be more complex because you need to check that your input lines are planar before attempting any calculation.

     
    Regards, Jon Summers
    LA Solutions

  • Unknown said:

    (2) How to convert a lineElement to valid object which has IntersectRay3d method ?

    Sorry, my step 4 and 5 should be modified as below:

    4. Construct a line  from your blue point and yVec; 

    5. Get the yellow line and call yellowLine.GetIntersectPoints method to get the intersect point on yellow line.