diff options
author | Karl Berry <karl@freefriends.org> | 2013-05-18 21:58:51 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2013-05-18 21:58:51 +0000 |
commit | 1b4cb2401e932a47c4e736a0197d22c7797b58ad (patch) | |
tree | 8e478eee9868a06467931e053ec06658ae3a8e06 /Build/source/utils/asymptote/prc | |
parent | 93dcab8a877f998aafe2bef5e59b7c6ea2f7f434 (diff) |
asy 2.22 sources
git-svn-id: svn://tug.org/texlive/trunk@30552 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/utils/asymptote/prc')
-rw-r--r-- | Build/source/utils/asymptote/prc/oPRCFile.cc | 12 | ||||
-rw-r--r-- | Build/source/utils/asymptote/prc/writePRC.cc | 6 | ||||
-rw-r--r-- | Build/source/utils/asymptote/prc/writePRC.h | 48 |
3 files changed, 34 insertions, 32 deletions
diff --git a/Build/source/utils/asymptote/prc/oPRCFile.cc b/Build/source/utils/asymptote/prc/oPRCFile.cc index 10f9431652c..9724d0735f1 100644 --- a/Build/source/utils/asymptote/prc/oPRCFile.cc +++ b/Build/source/utils/asymptote/prc/oPRCFile.cc @@ -1251,8 +1251,8 @@ uint32_t oPRCFile::addTransform(PRCGeneralTransformation3d*& transform) return pTransform->second; PRCCoordinateSystem *coordinateSystem = new PRCCoordinateSystem(); bool transform_replaced = false; - if( transform->M(0,1)==0 && transform->M(0,2)==0 && - transform->M(1,0)==0 && transform->M(1,2)==0 && + if( transform->M(0,1)==0 && transform->M(0,2)==0 && + transform->M(1,0)==0 && transform->M(1,2)==0 && transform->M(2,0)==0 && transform->M(2,1)==0 && transform->M(3,0)==0 && transform->M(3,1)==0 && transform->M(3,2)==0 && transform->M(3,3)==1 ) { @@ -1417,10 +1417,10 @@ uint32_t oPRCFile::addMaterial(const PRCmaterial& m) bool isid(const double* t) { return( - t[0]==1 && t[4]==0 && t[ 8]==0 && t[12]==0 && - t[1]==0 && t[5]==1 && t[ 9]==0 && t[13]==0 && - t[2]==0 && t[6]==0 && t[10]==1 && t[14]==0 && - t[3]==0 && t[7]==0 && t[11]==0 && t[15]==1 ); + t[0]==1 && t[1]==0 && t[2]==0 && t[3]==0 && + t[4]==0 && t[5]==1 && t[6]==0 && t[7]==0 && + t[8]==0 && t[9]==0 && t[10]==1 && t[11]==0 && + t[12]==0 && t[13]==0 && t[14]==0 && t[15]==1 ); } void oPRCFile::begingroup(const char *name, PRCoptions *options, diff --git a/Build/source/utils/asymptote/prc/writePRC.cc b/Build/source/utils/asymptote/prc/writePRC.cc index 5f62ea6731e..5c5b6875b3d 100644 --- a/Build/source/utils/asymptote/prc/writePRC.cc +++ b/Build/source/utils/asymptote/prc/writePRC.cc @@ -764,8 +764,10 @@ void PRCPolyWire::serializePolyWire(PRCbitStream &pbs) void PRCGeneralTransformation3d::serializeGeneralTransformation3d(PRCbitStream &pbs) const { WriteUnsignedInteger (PRC_TYPE_MISC_GeneralTransformation) - for (uint32_t i=0; i<16; i++) - WriteDouble(m_coef[i]); + // Like Fortran, PRC uses transposed (column-major) format! + for (int j=0;j<4;j++) + for (int i=0;i<4;i++) + WriteDouble(mat[i][j]); } void PRCCartesianTransformation3d::serializeCartesianTransformation3d(PRCbitStream &pbs) const diff --git a/Build/source/utils/asymptote/prc/writePRC.h b/Build/source/utils/asymptote/prc/writePRC.h index a1c794c919c..3be7569e3af 100644 --- a/Build/source/utils/asymptote/prc/writePRC.h +++ b/Build/source/utils/asymptote/prc/writePRC.h @@ -749,54 +749,54 @@ public: void serializeGeneralTransformation3d(PRCbitStream&) const; void serializeTransformation3d(PRCbitStream& pbs) const { serializeGeneralTransformation3d(pbs); } - double m_coef[16]; + double mat[4][4]; bool operator==(const PRCGeneralTransformation3d &t) const { - for (size_t i=0;i<16;i++) - if(m_coef[i]!=t.m_coef[i]) + for (size_t i=0;i<4;i++) + for (size_t j=0;j<4;j++) + if(mat[i][j]!=t.mat[i][j]) return false; return true; } bool operator<(const PRCGeneralTransformation3d &t) const { - for (size_t i=0;i<16;i++) - if(m_coef[i]!=t.m_coef[i]) + for (size_t i=0;i<4;i++) + for (size_t j=0;j<4;j++) + if(mat[i][j]!=t.mat[i][j]) { - return (m_coef[i]<t.m_coef[i]); + return (mat[i][j]<t.mat[i][j]); } return false; } void set(const double t[]) { if(t!=NULL) - for (size_t i=0;i<16;i++) - m_coef[i]=t[i]; + for (size_t i=0;i<4;i++) + for (size_t j=0;j<4;j++) + mat[i][j]=t[4*i+j]; else setidentity(); } void setidentity() { - m_coef[0]=1; m_coef[4]=0; m_coef[ 8]=0; m_coef[12]=0; - m_coef[1]=0; m_coef[5]=1; m_coef[ 9]=0; m_coef[13]=0; - m_coef[2]=0; m_coef[6]=0; m_coef[10]=1; m_coef[14]=0; - m_coef[3]=0; m_coef[7]=0; m_coef[11]=0; m_coef[15]=1; - } - bool isnotidtransform() const { - return( - m_coef[0]!=1 || m_coef[4]!=0 || m_coef[ 8]!=0 || m_coef[12]!=0 || - m_coef[1]!=0 || m_coef[5]!=1 || m_coef[ 9]!=0 || m_coef[13]!=0 || - m_coef[2]!=0 || m_coef[6]!=0 || m_coef[10]!=1 || m_coef[14]!=0 || - m_coef[3]!=0 || m_coef[7]!=0 || m_coef[11]!=0 || m_coef[15]!=1 ); + mat[0][0]=1; mat[0][1]=0; mat[0][2]=0; mat[0][3]=0; + mat[1][0]=0; mat[1][1]=1; mat[1][2]=0; mat[1][3]=0; + mat[2][0]=0; mat[2][1]=0; mat[2][2]=1; mat[2][3]=0; + mat[3][0]=0; mat[3][1]=0; mat[3][2]=0; mat[3][3]=1; } bool isidtransform() const { return( - m_coef[0]==1 && m_coef[4]==0 && m_coef[ 8]==0 && m_coef[12]==0 && - m_coef[1]==0 && m_coef[5]==1 && m_coef[ 9]==0 && m_coef[13]==0 && - m_coef[2]==0 && m_coef[6]==0 && m_coef[10]==1 && m_coef[14]==0 && - m_coef[3]==0 && m_coef[7]==0 && m_coef[11]==0 && m_coef[15]==1 ); + mat[0][0]==1 && mat[0][1]==0 && mat[0][2]==0 && mat[0][3]==0 && + mat[1][0]==0 && mat[1][1]==1 && mat[1][2]==0 && mat[1][3]==0 && + mat[2][0]==0 && mat[2][1]==0 && mat[2][2]==1 && mat[2][3]==0 && + mat[3][0]==0 && mat[3][1]==0 && mat[3][2]==0 && mat[3][3]==1); + } + bool isnotidtransform() const { + return !isidtransform(); } double M(size_t i, size_t j) const { - return m_coef[i+j*4]; + // Like Fortran, PRC uses transposed (column-major) format! + return mat[j][i]; } }; typedef std::deque <PRCGeneralTransformation3d> PRCGeneralTransformation3dList; |