0

I want to map some random 2D shape to uv parametric space, e.g A: (u: 0.0 v: 1.0) B: (u: 0.0 v :0.0) C: (u: 1.0 v: 1.0) D : (u:1.0 v: 0.0), and want to map a random point P, at the inside of the item, to the parametric space.

Line AB, AC, BD, CD are consist of path, or can be represented as connected edges.

So the question is, how should I get the correct uv value of P? I got a few knowledge in graphics and geometry, so if needed, could you please recommend any basic article that I can find any hint of solution of the problem? Thank you so much

enter image description here

6
  • How is your random shape represented? Apr 24, 2018 at 6:08
  • I have 4 types of shape : ellipse, rectangle, polygon, and rest one is closed path like the figure. All shapes are closed and represented in 2D space. Since my system is building on QT, they are represented as qgraphicsItemClass, or svg. e. g. ellipse has center point and r, and rectangle has 4 point and length of the edges.
    – andkspark
    Apr 24, 2018 at 6:37
  • Every shape can be converted to path, or set of edges. When converted, member function such as getting dx, dy of a certain point is available. Color is uniform. Point ABCD are picked by user and should be on the boundary or inside of the shape.
    – andkspark
    Apr 24, 2018 at 6:51
  • So, you want to map 2D to 2D? Then maybe just use bilinear interpolation. Apr 24, 2018 at 8:18
  • Have a look at the Coons patches. You can adapt them to your case I guess. (But unfortunately, they solve the inverse problem (u, v) to (x,y)) and you will have to solve nonlinear equations.)
    – user1196549
    Apr 24, 2018 at 8:27

1 Answer 1

0

What you are asking isn't so easy.

You can generate a transformation from (u, v) coordinates to Cartesian (x, y) by means of two Coons interpolants X(u, v) and Y(u, v).

Now if you want to invert the relation, you will need to solve the system

X(u, v) = x
Y(u, v) = y

which is nonlinear.

If you have many points to map (which is likely), a way to address the problem is to apply a grid in the (u, v) space and compute the corresponding mesh in (x, y). The grid should be fine enough to ensure accuracy. Then for given x and y, you need to find the quadrilateral they belong to and obtain u and v for instance by bilinear interpolation, computing the intersection of an horizontal with the sides, then intersecting with the vertical.

To accelerate the search of the containing tiles, you can use bounding boxes and store them in an interval tree. Possibly also, perform a search for the nearest vertex (by means of a kD-tree) and search for the enclosing quadrilateral in the adjoining tiles.

All of this is pretty technical.


If your purpose is just to provide a triangulation with (u, v) information available at the vertices, meshing as described above is sufficient.

3
  • Both comments of yours gave me many tips. The point I've wonder was : If we assume path AB and path CD as different functions, the path which across the shape would be like an convolution of two functions?or something affected by two functions.So my approach was getting that path exactly passes (0.u,0.v) points, and getting the grid first.
    – andkspark
    Apr 24, 2018 at 9:19
  • @andkspark: I said it twice: Coons.
    – user1196549
    Apr 24, 2018 at 9:25
  • Yeah, seems like that's what I looking for. Thx again :)
    – andkspark
    Apr 24, 2018 at 9:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.