Reputation: 181
I am trying to find the rough equivalent point from one quadrilateral to another.
quadrilateral equivalent point
What is a good method to find this point?
Any info in the right direction would be great.
Thanks
Upvotes: 2
Views: 196
Reputation: 3633
You can find the general barycentric coordinates of the point against the first quadrilateral, then applies the barycentric coordinates against the 2nd quadrilateral to find the "equivalent" point.
There are many different ways to compute the general barycentric coordinates for a point against a quadrilateral (or against a n-sided polygon). One of them is the Wachpress coordinates, which only works when the polygon is convex. For a convex polygon with vertices V0, V1,...Vn:
we can compute the Wachpress coordinates for point P within the polygon as
where A(a,b,c) is the signed area of triangle abc.
Then, we can compute the barycentric coordinates of P as
The equivalent point P* against the new polygon with vertices V*i (or quadrilateral in your case) can be computed as
P* = \summation(Wi * V*i) for i=0~n.
Upvotes: 0
Reputation: 14868
Let the points be [P1, P2, P3, P4]
and assume they are transformed into [Q1, Q2, Q3, Q4]
by means of an affine transformation of the form x -> Mx + b
where M
is a 2x2
matrix and b
is a constant vector. The idea is to find M
and apply the transformation to P
to get Q
.
Let v1 = P2 - P1
, v2 = P3 - P1
, w1 = Q2 - Q1
, w2 = Q3 - Q1
. Then M
is the linear transformation that applies [v1, v2]
onto [w1, w2]
. One way to find M
is by calculating the matrix product
M = S * T
where S
is the 2x2
matrix whose columns are the vectors w1
and w2
and T
is the inverse of the matrix whose columns are v1
and v2
.
Regarding the displacement vector b
, it can be calculated as
b = Q1 - M * P1
The clarification here is that all of this is correct only if the fourth points are consistent with the transformation, i.e., if
M * P4 + b = Q4
otherwise the Q
-quadrilateral is not an affine transformation of the P
-quadrilateral.
Upvotes: 1