/** * Adds a mutation to a {@link MutationLibrary}. Six versions of of each mutation are added to * mutationLibrary entry. the method fill's for the given mutation all the possible vector in the * given rotations * * <p>0 degrees on axis x * * <p>90 degrees on axis x * * <p>-90 degrees on axis x * * <p>180 degrees on axis x * * <p>90 degrees on axis y * * <p>-90 degrees on axis y * * @param mutation the mutation * @param library the mutationLibrary */ private void addLibraryEntry(Mutation mutation, MutationLibrary library) { Vector3f positionVector = new Vector3f(); // TODO: check for duplicity in the Dictionary while putting mutation positionVector.sub(mutation.getLastMonomerVector(), mutation.getFirstMonomerVector()); // put in library as it is MutationLibraryEntry newEntry = new MutationLibraryEntry(mutation, 'x', 0, MonomerDirection.FORWARD, dimensions, matrixMan); library.put(positionVector, newEntry); if (dimensions == Dimensions.THREE) { // rotation of 90 deg around x axis addToLib(mutation, library, positionVector, (Math.PI / 2), 'x', MonomerDirection.UP); // rotation of -90 deg around x axis addToLib(mutation, library, positionVector, (-Math.PI / 2), 'x', MonomerDirection.DOWN); } // rotation of 180 deg around x axis // TODO: check definition in here !!! addToLib(mutation, library, positionVector, Math.PI, 'x', MonomerDirection.FORWARD); // rotation of 90 deg around y axis addToLib(mutation, library, positionVector, (Math.PI / 2), 'z', MonomerDirection.LEFT); // rotation of -90 deg around y axis addToLib(mutation, library, positionVector, (-Math.PI / 2), 'z', MonomerDirection.RIGHT); }
private void addToLib( Mutation mutation, MutationLibrary library, Vector3f positionVector, double degree, char axis, MonomerDirection relative) { if ((dimensions == Dimensions.THREE) || (relative.ordinal() < 3)) { MutationLibraryEntry newEntry = new MutationLibraryEntry(mutation, axis, degree, relative, dimensions, matrixMan); library.put(matrixMan.LorentzTransformation(positionVector, axis, degree), newEntry); } }