Skip to content

Instantly share code, notes, and snippets.

@m13253
Last active December 14, 2023 16:39
Show Gist options
  • Select an option

  • Save m13253/4a9d5b5d3dd4e7050f87 to your computer and use it in GitHub Desktop.

Select an option

Save m13253/4a9d5b5d3dd4e7050f87 to your computer and use it in GitHub Desktop.
/* [wxMaxima batch file version 1] [ DO NOT EDIT BY HAND! ]*/
/* [ Created with wxMaxima version 13.04.2 ] */
/* [wxMaxima: input start ] */
FlashRot:matrix(
[ cos(rotY)*cos(rotZ), cos(rotY)*sin(rotZ), sin(rotY), 0],
[-sin(rotZ), cos(rotZ), 0, 0],
[-sin(rotY)*cos(rotZ), -sin(rotY)*sin(rotZ), cos(rotY), 0 ],
[trX, trY, 0, 1]);
/* [wxMaxima: input end ] */
/* [wxMaxima: input start ] */
ASSRot:(
matrix([1,0,0,0],[0,1,0,0],[0,0,1,0],[trx-W/2,try-H/2,1,1])
.
matrix([cos(z),-sin(z),0,0],[sin(z),cos(z),0,0],[0,0,1,0],[0,0,0,1])
.
matrix([1,0,0,0],[0,cos(x),sin(x),0],[0,-sin(x),cos(x),0],[0,0,0,1])
.
matrix([cos(y),0,-sin(y),0],[0,1,0,0],[sin(y),0,cos(y),0],[0,0,0,1])
.
matrix([1,0,0,0],[0,1,0,0],[0,0,1,0],[W/2,H/2,trz,1])
);
/* [wxMaxima: input end ] */
/* [wxMaxima: input start ] */
(
matrix([1,0,0,0],[0,1,0,0],[0,0,1,0],[trx-W/2,try-H/2,1,1])
.
matrix([cos(rotY)*cos(rotZ),cos(rotY)*sin(rotZ),sin(rotY),0],[−sin(rotZ),cos(rotZ),0,0],[−sin(rotY)*cos(rotZ),−sin(rotY)*sin(rotZ),cos(rotY),0],[0,0,0,1])
.
matrix([1,0,0,0],[0,1,0,0],[0,0,1,0],[W/2,H/2,trz,1])
);
/* [wxMaxima: input end ] */
/* [wxMaxima: input start ] */
solve([W/2+cos(rotY)*cos(rotZ)*(trx−W/2)−(try−H/2)*sin(rotZ)−sin(rotY)*cos(rotZ)=trX, cos(rotY)*sin(rotZ)*(trx−W/2)−sin(rotY)*sin(rotZ)+(try−H/2)*cos(rotZ)+H/2=trY, sin(rotY)*(trx−W/2)+cos(rotY)+trz=0], [trx, try, trz]);
/* [wxMaxima: input end ] */
/* [wxMaxima: input start ] */
trigsimp(%);
/* [wxMaxima: input end ] */
/* [wxMaxima: input start ] */
matrix([trx=−((cos(rotZ)−cos(rotY))*W−2*sin(rotZ)*trY−2*cos(rotZ)*trX+H*sin(rotZ)−2*sin(rotY))/(2*cos(rotY))],[try=
(sin(rotZ)*W+2*cos(rotZ)*trY−2*sin(rotZ)*trX−H*cos(rotZ)+H)/2],[trz=
(sin(rotY)*cos(rotZ)*W−2*sin(rotY)*sin(rotZ)*trY−2*sin(rotY)*cos(rotZ)*trX+H*sin(rotY)*sin(rotZ)−2)/(2*cos(rotY))], [scalez=FOV/('trz+FOV)]);
/* [wxMaxima: input end ] */
/* Maxima can't load/batch files which end with a comment! */
"Created with wxMaxima"$
@m13253
Copy link
Copy Markdown
Author

m13253 commented Jun 8, 2014

14行有误,应改成 matrix([1,0,0,0],[0,1,0,0],[0,0,1,0],[trx-W/2,try-H/2,0,1])

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment