Calculation of coordinates on a curved surface

4 views (last 30 days)
Hello dear community,
I am currently facing a problem that probably requires mathematical understanding. Since I'm looking for an algorithm in MATLAB, or I want to use an existing function, I ask my question here.
It is about finding coordinates on a curved surface. With STL-read I import a CAD file and get all curved surfaces, points and normal vectors of the corresponding model. At the same time I create a two-dimensional rectangle which is to be placed on the curved surface. First I search for the point of intersection between the centre of the two-dimensional rectangle and the curved surface using the xy-coordinates. Now I set the z-coordinate of the centre and the normal of the centre equal to the intersecting surface. Now I want to determine the coordinates of the remaining four points. I can determine the z-coordinate with the same procedure, but not the xy-coordinates. Because the xy-coordinates change due to the curvature, I am now looking for a possibility to determine them.
My first approach was to rotate the coordinates with the rotation matrix around the z-axis with the angle between the normal vectors of the centre and the other point of the rectangle. But unfortunately I got some nonsense.
Do you have an idea for an already implemented function or an algorithm? Here is another illustration that might help to show the problem:
Thanks for your help.
Best regards
  2 Comments
KSSV
KSSV on 18 Oct 2020
You will get the point of intersection of line and curve easily..that will be the mid point.
To get the ends...find the normal vectors to curve and get the intersection of normal vectors and the line...Or
Find the distance to each point of curve from one end of the line, the least distance one is your point of intersection.
Nicolas Kaiser
Nicolas Kaiser on 19 Oct 2020
Edited: Nicolas Kaiser on 19 Oct 2020
Thank you very much for your quick answer, it worked well. I used the point2trimesh, which calculates exactly the closest point (point2trimesh).
Another question you might be able to answer. When I have determined the center point I get the normal vector of the surface. How can I now rotate my 4 coordinate points of the rectangular surface into the normal vector so that the 4 points taken as surface have the same normal vector as the surface of the intersection with the center of the rectangular surface. I have already tried a lot of things from rotation matrices to Euler angles. Probably I just can't get the right angle to calculate. Do you have an idea?

Sign in to comment.

Answers (0)

Products


Release

R2020a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!