Changeset 2576 for trunk/packages/vizservers/vtkvis
- Timestamp:
- Sep 25, 2011, 3:12:59 PM (13 years ago)
- Location:
- trunk/packages/vizservers/vtkvis
- Files:
-
- 1 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/packages/vizservers/vtkvis/Makefile.in
r2573 r2576 155 155 RpVolume.o: RpVolume.h RpVtkGraphicsObject.h RpVtkDataSet.h ColorMap.h Trace.h 156 156 RpVtkDataSet.o: RpVtkDataSet.h Trace.h 157 RpVtkRenderer.o: RpVtkRenderer.h vtkRpCubeAxesActor2D.h RpVtkDataSet.h RpContour2D.h RpContour3D.h RpCutplane.h RpGlyphs.h RpHeightMap.h RpLIC.h RpMolecule.h RpPolyData.h RpPseudoColor.h RpStreamlines.h RpVolume.h ColorMap.h Trace.h157 RpVtkRenderer.o: RpVtkRenderer.h RpMath.h vtkRpCubeAxesActor2D.h RpVtkDataSet.h RpContour2D.h RpContour3D.h RpCutplane.h RpGlyphs.h RpHeightMap.h RpLIC.h RpMolecule.h RpPolyData.h RpPseudoColor.h RpStreamlines.h RpVolume.h ColorMap.h Trace.h 158 158 RpVtkRendererCmd.o: RpVtkRenderer.h vtkRpCubeAxesActor2D.h RpVtkDataSet.h RpContour2D.h RpContour3D.h RpCutplane.h RpGlyphs.h RpHeightMap.h RpLIC.h RpMolecule.h RpPolyData.h RpPseudoColor.h RpStreamlines.h RpVolume.h ColorMap.h ReadBuffer.h ResponseQueue.h Trace.h CmdProc.h PPMWriter.h TGAWriter.h 159 159 RpVtkRenderServer.o: RpVtkRenderServer.h RpVtkRendererCmd.h RpVtkRenderer.h vtkRpCubeAxesActor2D.h ReadBuffer.h ResponseQueue.h Trace.h PPMWriter.h TGAWriter.h -
trunk/packages/vizservers/vtkvis/RpVtkRenderer.cpp
r2575 r2576 43 43 44 44 #include "RpVtkRenderer.h" 45 #include "RpMath.h" 45 46 #include "ColorMap.h" 46 47 #include "Trace.h" … … 7885 7886 } 7886 7887 7887 inline void quaternionToMatrix4x4(const double quat[4], vtkMatrix4x4& mat)7888 {7889 double ww = quat[0]*quat[0];7890 double wx = quat[0]*quat[1];7891 double wy = quat[0]*quat[2];7892 double wz = quat[0]*quat[3];7893 7894 double xx = quat[1]*quat[1];7895 double yy = quat[2]*quat[2];7896 double zz = quat[3]*quat[3];7897 7898 double xy = quat[1]*quat[2];7899 double xz = quat[1]*quat[3];7900 double yz = quat[2]*quat[3];7901 7902 double rr = xx + yy + zz;7903 // normalization factor, just in case quaternion was not normalized7904 double f = double(1)/double(sqrt(ww + rr));7905 double s = (ww - rr)*f;7906 f *= 2;7907 7908 mat[0][0] = xx*f + s;7909 mat[1][0] = (xy + wz)*f;7910 mat[2][0] = (xz - wy)*f;7911 7912 mat[0][1] = (xy - wz)*f;7913 mat[1][1] = yy*f + s;7914 mat[2][1] = (yz + wx)*f;7915 7916 mat[0][2] = (xz + wy)*f;7917 mat[1][2] = (yz - wx)*f;7918 mat[2][2] = zz*f + s;7919 }7920 7921 inline void quaternionToTransposeMatrix4x4(const double quat[4], vtkMatrix4x4& mat)7922 {7923 double ww = quat[0]*quat[0];7924 double wx = quat[0]*quat[1];7925 double wy = quat[0]*quat[2];7926 double wz = quat[0]*quat[3];7927 7928 double xx = quat[1]*quat[1];7929 double yy = quat[2]*quat[2];7930 double zz = quat[3]*quat[3];7931 7932 double xy = quat[1]*quat[2];7933 double xz = quat[1]*quat[3];7934 double yz = quat[2]*quat[3];7935 7936 double rr = xx + yy + zz;7937 // normalization factor, just in case quaternion was not normalized7938 double f = double(1)/double(sqrt(ww + rr));7939 double s = (ww - rr)*f;7940 f *= 2;7941 7942 mat[0][0] = xx*f + s;7943 mat[0][1] = (xy + wz)*f;7944 mat[0][2] = (xz - wy)*f;7945 7946 mat[1][0] = (xy - wz)*f;7947 mat[1][1] = yy*f + s;7948 mat[1][2] = (yz + wx)*f;7949 7950 mat[2][0] = (xz + wy)*f;7951 mat[2][1] = (yz - wx)*f;7952 mat[2][2] = zz*f + s;7953 }7954 7955 inline double *quatMult(const double q1[4], const double q2[4], double result[4])7956 {7957 double q1w = q1[0];7958 double q1x = q1[1];7959 double q1y = q1[2];7960 double q1z = q1[3];7961 double q2w = q2[0];7962 double q2x = q2[1];7963 double q2y = q2[2];7964 double q2z = q2[3];7965 result[0] = (q1w*q2w) - (q1x*q2x) - (q1y*q2y) - (q1z*q2z);7966 result[1] = (q1w*q2x) + (q1x*q2w) + (q1y*q2z) - (q1z*q2y);7967 result[2] = (q1w*q2y) + (q1y*q2w) + (q1z*q2x) - (q1x*q2z);7968 result[3] = (q1w*q2z) + (q1z*q2w) + (q1x*q2y) - (q1y*q2x);7969 return result;7970 }7971 7972 inline double *quatConjugate(const double quat[4], double result[4])7973 {7974 result[1] = -quat[1];7975 result[2] = -quat[2];7976 result[3] = -quat[3];7977 return result;7978 }7979 7980 inline double *quatReciprocal(const double quat[4], double result[4])7981 {7982 double denom =7983 quat[0]*quat[0] +7984 quat[1]*quat[1] +7985 quat[2]*quat[2] +7986 quat[3]*quat[3];7987 quatConjugate(quat, result);7988 for (int i = 0; i < 4; i++) {7989 result[i] /= denom;7990 }7991 return result;7992 }7993 7994 inline double *quatReciprocal(double quat[4])7995 {7996 return quatReciprocal(quat, quat);7997 }7998 7999 inline void copyQuat(const double quat[4], double result[4])8000 {8001 memcpy(result, quat, sizeof(double)*4);8002 }8003 8004 7888 /** 8005 7889 * \brief Set the orientation of the camera from a quaternion
Note: See TracChangeset
for help on using the changeset viewer.