Example #1
0
  void ChipViewport::stretchFromCubeViewport(Stretch *newStretch,
      CubeViewport *cvp) {

    ASSERT(cvp != NULL);

    if (!cvp || !p_chipCube)
      return;

    // only stretch if the CubeViewport is opened to the same cube as we are,
    // otherwise the signal was meant for a different ChipViewport!
    if (cvp->cube()->fileName() == p_chipCube->fileName()) {

      // if user right clicked in the CubeViewport then we get a SIGNAL with a
      // NULL Stretch.  This is used to signify that we need to restretch on our
      // own (go back to global).
      if (!newStretch) {
        computeStretch(p_gray.stretch, true);
        paintImage();
        update();
      }
      else {
        *p_stretch = *newStretch;
        p_gray.stretch = *newStretch;
        paintImage();
        update();
      }
    }
  }
void computeStrain(){
	printf("Computing Green strain tensor...\n");

	computeDeformGradient();

	int j, atom;

	double matrI[9];

	for (atom = 0; atom < pdbData.atomCount; atom++){

		for (j = 0; j < 9; j++){
			atomGreenStrain[atom][j] = 0.0;
		}

		transposeMatrix(atomDeformGradient[atom], matrI);
		multMatrix(matrI, atomDeformGradient[atom], atomGreenStrain[atom]);

		for(j = 0; j < 9; j++)
			matrI[j] = 0.0;
		matrI[0] = -1.0;
		matrI[4] = -1.0;
		matrI[8] = -1.0;

		addMatrix(atomGreenStrain[atom], matrI);
		multScalarMatrix(atomGreenStrain[atom], 0.5);

	}
	if(stretchOn)
		computeStretch();
}
Example #3
0
 //! Apply automatic stretch using data from entire chip
 void ChipViewport::autoStretch() {
   computeStretch(p_gray.stretch);
   paintImage();
   update();
 }