Skip to content
/ pt2d Public

Projective transformation matrix between two quadrangles on a 2D plane

Notifications You must be signed in to change notification settings

nopria/pt2d

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 

Repository files navigation

pt2d

Projective transformation matrix between two quadrangles on a 2D plane

A little aid to compute what's described in https://math.stackexchange.com/a/339033/412495

Matrix A (or B)

Matrix A or B.

The following is a Maxima symbolic definition of matrix A (the format is meaningful enough to be easily translatable to any other language format):

matrix(
	[(x_1*(x_2*(y_4-y_3)+x_3*(y_2-y_4)+x_4*(y_3-y_2)))/(x_1*(y_3-y_2)+x_2*(y_1-y_3)+x_3*(y_2-y_1)),	-(x_2*(x_1*(y_4-y_3)+x_3*(y_1-y_4)+x_4*(y_3-y_1)))/(x_1*(y_3-y_2)+x_2*(y_1-y_3)+x_3*(y_2-y_1)),	(x_3*(x_1*(y_4-y_2)+x_2*(y_1-y_4)+x_4*(y_2-y_1)))/(x_1*(y_3-y_2)+x_2*(y_1-y_3)+x_3*(y_2-y_1))],
	[(y_1*(x_2*(y_4-y_3)+x_3*(y_2-y_4)+x_4*(y_3-y_2)))/(x_1*(y_3-y_2)+x_2*(y_1-y_3)+x_3*(y_2-y_1)),	-(y_2*(x_1*(y_4-y_3)+x_3*(y_1-y_4)+x_4*(y_3-y_1)))/(x_1*(y_3-y_2)+x_2*(y_1-y_3)+x_3*(y_2-y_1)),	(y_3*(x_1*(y_4-y_2)+x_2*(y_1-y_4)+x_4*(y_2-y_1)))/(x_1*(y_3-y_2)+x_2*(y_1-y_3)+x_3*(y_2-y_1))],
	[(x_2*(y_4-y_3)+x_3*(y_2-y_4)+x_4*(y_3-y_2))/(x_1*(y_3-y_2)+x_2*(y_1-y_3)+x_3*(y_2-y_1)),	-(x_1*(y_4-y_3)+x_3*(y_1-y_4)+x_4*(y_3-y_1))/(x_1*(y_3-y_2)+x_2*(y_1-y_3)+x_3*(y_2-y_1)),	(x_1*(y_4-y_2)+x_2*(y_1-y_4)+x_4*(y_2-y_1))/(x_1*(y_3-y_2)+x_2*(y_1-y_3)+x_3*(y_2-y_1))]
)

Inverse of A

Inverse of matrix A.

The following is a Maxima symbolic definition of the inverse of matrix A:

matrix(
	[-(y_3-y_2)/(x_3*y_4-x_2*y_4-x_4*y_3+x_2*y_3+x_4*y_2-x_3*y_2),	(x_3-x_2)/(x_3*y_4-x_2*y_4-x_4*y_3+x_2*y_3+x_4*y_2-x_3*y_2),	(x_2*y_3-x_3*y_2)/(x_3*y_4-x_2*y_4-x_4*y_3+x_2*y_3+x_4*y_2-x_3*y_2)],
	[-(y_3-y_1)/(x_3*y_4-x_1*y_4-x_4*y_3+x_1*y_3+x_4*y_1-x_3*y_1),	(x_3-x_1)/(x_3*y_4-x_1*y_4-x_4*y_3+x_1*y_3+x_4*y_1-x_3*y_1),	(x_1*y_3-x_3*y_1)/(x_3*y_4-x_1*y_4-x_4*y_3+x_1*y_3+x_4*y_1-x_3*y_1)],
	[-(y_2-y_1)/(x_2*y_4-x_1*y_4-x_4*y_2+x_1*y_2+x_4*y_1-x_2*y_1),	(x_2-x_1)/(x_2*y_4-x_1*y_4-x_4*y_2+x_1*y_2+x_4*y_1-x_2*y_1),	(x_1*y_2-x_2*y_1)/(x_2*y_4-x_1*y_4-x_4*y_2+x_1*y_2+x_4*y_1-x_2*y_1)]
)

About

Projective transformation matrix between two quadrangles on a 2D plane

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published