| 1 |
+ |
#define _FILE_OFFSET_BITS 64 |
| 2 |
+ |
|
| 3 |
|
#include <stdio.h> |
| 4 |
|
#include <stdlib.h> |
| 5 |
|
#include <string.h> |
| 451 |
|
current_frame->r[i].hasVector = 1; |
| 452 |
|
} else { |
| 453 |
|
current_frame->r[i].hasVector = 0; |
| 454 |
+ |
} |
| 455 |
+ |
|
| 456 |
+ |
if (nTokens >= 10) { |
| 457 |
+ |
foo = strtok(NULL, " ,;\t"); |
| 458 |
+ |
(void)sscanf(foo, "%lf", ¤t_frame->r[i].vx); |
| 459 |
+ |
foo = strtok(NULL, " ,;\t"); |
| 460 |
+ |
(void)sscanf(foo, "%lf", ¤t_frame->r[i].vy); |
| 461 |
+ |
foo = strtok(NULL, " ,;\t"); |
| 462 |
+ |
(void)sscanf(foo, "%lf", ¤t_frame->r[i].vz); |
| 463 |
+ |
current_frame->r[i].hasSecondVector = 1; |
| 464 |
+ |
} else { |
| 465 |
+ |
current_frame->r[i].hasSecondVector = 0; |
| 466 |
|
} |
| 467 |
+ |
|
| 468 |
+ |
|
| 469 |
+ |
|
| 470 |
|
} |
| 471 |
|
currentCount++; |
| 472 |
|
|
| 549 |
|
out_coords[j].uz = temp_frame->r[j].uz + dz * (i+1); |
| 550 |
|
} |
| 551 |
|
|
| 552 |
+ |
if (current_frame->r[j].hasSecondVector) { |
| 553 |
+ |
dx = current_frame->r[j].vx - temp_frame->r[j].vx; |
| 554 |
+ |
dy = current_frame->r[j].vy - temp_frame->r[j].vy; |
| 555 |
+ |
dz = current_frame->r[j].vz - temp_frame->r[j].vz; |
| 556 |
+ |
|
| 557 |
+ |
dx /= (double)(n_interpolate + 1); |
| 558 |
+ |
dy /= (double)(n_interpolate + 1); |
| 559 |
+ |
dz /= (double)(n_interpolate + 1); |
| 560 |
+ |
|
| 561 |
+ |
out_coords[j].hasVector = current_frame->r[j].hasSecondVector; |
| 562 |
+ |
out_coords[j].vx = temp_frame->r[j].vx + dx * (i+1); |
| 563 |
+ |
out_coords[j].vy = temp_frame->r[j].vy + dy * (i+1); |
| 564 |
+ |
out_coords[j].vz = temp_frame->r[j].vz + dz * (i+1); |
| 565 |
+ |
} |
| 566 |
+ |
|
| 567 |
|
if (current_frame->r[j].hasCharge) { |
| 568 |
|
dx = current_frame->r[j].charge - temp_frame->r[j].charge; |
| 569 |
|
|
| 631 |
|
out_coords[i].uz = current_frame->r[i].uz; |
| 632 |
|
} |
| 633 |
|
|
| 634 |
+ |
if (current_frame->r[i].hasSecondVector) { |
| 635 |
+ |
out_coords[i].hasSecondVector = current_frame->r[i].hasSecondVector; |
| 636 |
+ |
out_coords[i].vx = current_frame->r[i].vx; |
| 637 |
+ |
out_coords[i].vy = current_frame->r[i].vy; |
| 638 |
+ |
out_coords[i].vz = current_frame->r[i].vz; |
| 639 |
+ |
} |
| 640 |
+ |
|
| 641 |
|
if (current_frame->r[i].hasCharge) { |
| 642 |
|
out_coords[i].hasCharge = current_frame->r[i].hasCharge; |
| 643 |
|
out_coords[i].charge = current_frame->r[i].charge; |
| 707 |
|
fprintf(out_file, |
| 708 |
|
"// The following script was automatically generated by:\n" |
| 709 |
|
"// xyz2pov Copyright 2001 by MATTHEW A. MEINEKE\n" |
| 710 |
+ |
"#include \"colors.inc\"\n" |
| 711 |
+ |
"#include \"math.inc\"\n" |
| 712 |
|
"\n" |
| 713 |
|
"\n" |
| 714 |
|
"background { rgb <1.0, 1.0, 1.0> }\n" |
| 752 |
|
"#declare cameraLookY = sysCenterY;\n" |
| 753 |
|
"#declare cameraLookZ = sysCenterZ;\n" |
| 754 |
|
"\n" |
| 755 |
+ |
"#declare rotatePointX = cameraLookX;\n" |
| 756 |
+ |
"#declare rotatePointY = cameraLookY;\n" |
| 757 |
+ |
"#declare rotatePointZ = cameraLookZ;\n" |
| 758 |
+ |
"\n" |
| 759 |
|
"#declare cameraX = cameraLookX;\n" |
| 760 |
|
"#declare cameraY = cameraLookY;\n" |
| 761 |
|
"#declare cameraZ = cameraLookZ - zoom;\n" |
| 771 |
|
"#declare boxCenterX = cameraLookX;\n" |
| 772 |
|
"#declare boxCenterY = cameraLookY;\n" |
| 773 |
|
"#declare boxCenterZ = cameraLookZ;\n" |
| 774 |
+ |
"#declare fn = function(x,y,z) {(y+1)/2}\n" |
| 775 |
+ |
"#declare grad1 = pigment { function { fn(x, y, z) } color_map {[0.0 rgb <0,0,0>] [1.0 rgb <3,0,0>]} };\n" |
| 776 |
+ |
"#declare grad2 = pigment { function { fn(x, y, z) } rotate 120*z color_map {[0.0 rgb <0,0,0>] [1.0 rgb <0,3,0>]} };\n" |
| 777 |
+ |
"#declare grad3 = pigment { function { fn(x, y, z) } rotate 240*z color_map {[0.0 rgb <0,0,0>] [1.0 rgb <0,0,3>]} };\n" |
| 778 |
+ |
"#declare fnz = function(x,y,z) {(z+1)/2}\n" |
| 779 |
+ |
"#declare gradz = pigment { function { fnz(x, y, z) } color_map {[0.0 rgb <0,0,0>] [1.0 rgb <1,1,1>]} };\n" |
| 780 |
|
"\n" |
| 781 |
|
"// declare the cameras and the light sources\n" |
| 782 |
|
"\n" |
| 861 |
|
" #local pHx = boxCenterX + bx1 + bx2 + bx3 - bcx;\n" |
| 862 |
|
" #local pHy = boxCenterY + by1 + by2 + by3 - bcy;\n" |
| 863 |
|
" #local pHz = boxCenterZ + bz1 + bz2 + bz3 - bcz;\n" |
| 864 |
+ |
"\n" |
| 865 |
+ |
" #if(ROTATE)\n" |
| 866 |
+ |
" #local pAx_new = rotatePointX + A11 * (pAx-rotatePointX) + A12 * (pAy-rotatePointY) + A13 * (pAz-rotatePointZ);\n" |
| 867 |
+ |
" #local pAy_new = rotatePointY + A21 * (pAx-rotatePointX) + A22 * (pAy-rotatePointY) + A23 * (pAz-rotatePointZ);\n" |
| 868 |
+ |
" #local pAz_new = rotatePointZ + A31 * (pAx-rotatePointX) + A32 * (pAy-rotatePointY) + A33 * (pAz-rotatePointZ);\n" |
| 869 |
+ |
"\n" |
| 870 |
+ |
" #local pBx_new = rotatePointX + A11 * (pBx-rotatePointX) + A12 * (pBy-rotatePointY) + A13 * (pBz-rotatePointZ);\n" |
| 871 |
+ |
" #local pBy_new = rotatePointY + A21 * (pBx-rotatePointX) + A22 * (pBy-rotatePointY) + A23 * (pBz-rotatePointZ);\n" |
| 872 |
+ |
" #local pBz_new = rotatePointZ + A31 * (pBx-rotatePointX) + A32 * (pBy-rotatePointY) + A33 * (pBz-rotatePointZ);\n" |
| 873 |
+ |
"\n" |
| 874 |
+ |
" #local pCx_new = rotatePointX + A11 * (pCx-rotatePointX) + A12 * (pCy-rotatePointY) + A13 * (pCz-rotatePointZ);\n" |
| 875 |
+ |
" #local pCy_new = rotatePointY + A21 * (pCx-rotatePointX) + A22 * (pCy-rotatePointY) + A23 * (pCz-rotatePointZ);\n" |
| 876 |
+ |
" #local pCz_new = rotatePointZ + A31 * (pCx-rotatePointX) + A32 * (pCy-rotatePointY) + A33 * (pCz-rotatePointZ);\n" |
| 877 |
+ |
"\n" |
| 878 |
+ |
" #local pDx_new = rotatePointX + A11 * (pDx-rotatePointX) + A12 * (pDy-rotatePointY) + A13 * (pDz-rotatePointZ);\n" |
| 879 |
+ |
" #local pDy_new = rotatePointY + A21 * (pDx-rotatePointX) + A22 * (pDy-rotatePointY) + A23 * (pDz-rotatePointZ);\n" |
| 880 |
+ |
" #local pDz_new = rotatePointZ + A31 * (pDx-rotatePointX) + A32 * (pDy-rotatePointY) + A33 * (pDz-rotatePointZ);\n" |
| 881 |
+ |
"\n" |
| 882 |
+ |
" #local pEx_new = rotatePointX + A11 * (pEx-rotatePointX) + A12 * (pEy-rotatePointY) + A13 * (pEz-rotatePointZ);\n" |
| 883 |
+ |
" #local pEy_new = rotatePointY + A21 * (pEx-rotatePointX) + A22 * (pEy-rotatePointY) + A23 * (pEz-rotatePointZ);\n" |
| 884 |
+ |
" #local pEz_new = rotatePointZ + A31 * (pEx-rotatePointX) + A32 * (pEy-rotatePointY) + A33 * (pEz-rotatePointZ);\n" |
| 885 |
+ |
"\n" |
| 886 |
+ |
" #local pFx_new = rotatePointX + A11 * (pFx-rotatePointX) + A12 * (pFy-rotatePointY) + A13 * (pFz-rotatePointZ);\n" |
| 887 |
+ |
" #local pFy_new = rotatePointY + A21 * (pFx-rotatePointX) + A22 * (pFy-rotatePointY) + A23 * (pFz-rotatePointZ);\n" |
| 888 |
+ |
" #local pFz_new = rotatePointZ + A31 * (pFx-rotatePointX) + A32 * (pFy-rotatePointY) + A33 * (pFz-rotatePointZ);\n" |
| 889 |
+ |
"\n" |
| 890 |
+ |
" #local pGx_new = rotatePointX + A11 * (pGx-rotatePointX) + A12 * (pGy-rotatePointY) + A13 * (pGz-rotatePointZ);\n" |
| 891 |
+ |
" #local pGy_new = rotatePointY + A21 * (pGx-rotatePointX) + A22 * (pGy-rotatePointY) + A23 * (pGz-rotatePointZ);\n" |
| 892 |
+ |
" #local pGz_new = rotatePointZ + A31 * (pGx-rotatePointX) + A32 * (pGy-rotatePointY) + A33 * (pGz-rotatePointZ);\n" |
| 893 |
+ |
"\n" |
| 894 |
+ |
" #local pHx_new = rotatePointX + A11 * (pHx-rotatePointX) + A12 * (pHy-rotatePointY) + A13 * (pHz-rotatePointZ);\n" |
| 895 |
+ |
" #local pHy_new = rotatePointY + A21 * (pHx-rotatePointX) + A22 * (pHy-rotatePointY) + A23 * (pHz-rotatePointZ);\n" |
| 896 |
+ |
" #local pHz_new = rotatePointZ + A31 * (pHx-rotatePointX) + A32 * (pHy-rotatePointY) + A33 * (pHz-rotatePointZ);\n" |
| 897 |
+ |
"\n" |
| 898 |
+ |
" #else\n" |
| 899 |
+ |
" #local pAx_new = pAx;" |
| 900 |
+ |
" #local pAy_new = pAy;" |
| 901 |
+ |
" #local pAz_new = pAz;" |
| 902 |
+ |
"\n" |
| 903 |
+ |
" #local pBx_new = pBx;" |
| 904 |
+ |
" #local pBy_new = pBy;" |
| 905 |
+ |
" #local pBz_new = pBz;" |
| 906 |
+ |
"\n" |
| 907 |
+ |
" #local pCx_new = pCx;" |
| 908 |
+ |
" #local pCy_new = pCy;" |
| 909 |
+ |
" #local pCz_new = pCz;" |
| 910 |
+ |
"\n" |
| 911 |
+ |
" #local pDx_new = pDx;" |
| 912 |
+ |
" #local pDy_new = pDy;" |
| 913 |
+ |
" #local pDz_new = pDz;" |
| 914 |
+ |
"\n" |
| 915 |
+ |
" #local pEx_new = pEx;" |
| 916 |
+ |
" #local pEy_new = pEy;" |
| 917 |
+ |
" #local pEz_new = pEz;" |
| 918 |
+ |
"\n" |
| 919 |
+ |
" #local pFx_new = pFx;" |
| 920 |
+ |
" #local pFy_new = pFy;" |
| 921 |
+ |
" #local pFz_new = pFz;" |
| 922 |
+ |
"\n" |
| 923 |
+ |
" #local pGx_new = pGx;" |
| 924 |
+ |
" #local pGy_new = pGy;" |
| 925 |
+ |
" #local pGz_new = pGz;" |
| 926 |
+ |
"\n" |
| 927 |
+ |
" #local pHx_new = pHx;" |
| 928 |
+ |
" #local pHy_new = pHy;" |
| 929 |
+ |
" #local pHz_new = pHz;" |
| 930 |
+ |
"\n" |
| 931 |
+ |
" #end\n" |
| 932 |
+ |
" #local pAx = pAx_new;" |
| 933 |
+ |
" #local pAy = pAy_new;" |
| 934 |
+ |
" #local pAz = pAz_new;" |
| 935 |
+ |
"\n" |
| 936 |
+ |
" #local pBx = pBx_new;" |
| 937 |
+ |
" #local pBy = pBy_new;" |
| 938 |
+ |
" #local pBz = pBz_new;" |
| 939 |
+ |
"\n" |
| 940 |
+ |
" #local pCx = pCx_new;" |
| 941 |
+ |
" #local pCy = pCy_new;" |
| 942 |
+ |
" #local pCz = pCz_new;" |
| 943 |
+ |
"\n" |
| 944 |
+ |
" #local pDx = pDx_new;" |
| 945 |
+ |
" #local pDy = pDy_new;" |
| 946 |
+ |
" #local pDz = pDz_new;" |
| 947 |
+ |
"\n" |
| 948 |
+ |
" #local pEx = pEx_new;" |
| 949 |
+ |
" #local pEy = pEy_new;" |
| 950 |
+ |
" #local pEz = pEz_new;" |
| 951 |
+ |
"\n" |
| 952 |
+ |
" #local pFx = pFx_new;" |
| 953 |
+ |
" #local pFy = pFy_new;" |
| 954 |
+ |
" #local pFz = pFz_new;" |
| 955 |
+ |
"\n" |
| 956 |
+ |
" #local pGx = pGx_new;" |
| 957 |
+ |
" #local pGy = pGy_new;" |
| 958 |
+ |
" #local pGz = pGz_new;" |
| 959 |
+ |
"\n" |
| 960 |
+ |
" #local pHx = pHx_new;" |
| 961 |
+ |
" #local pHy = pHy_new;" |
| 962 |
+ |
" #local pHz = pHz_new;" |
| 963 |
|
"\n" |
| 964 |
|
" #local colorR = 0.90;\n" |
| 965 |
|
" #local colorG = 0.91;\n" |