All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.biojava.nbio.structure.symmetry.geometry.IcosahedralSampler Maven / Gradle / Ivy

There is a newer version: 7.2.2
Show newest version
/*
 *                    BioJava development code
 *
 * This code may be freely distributed and modified under the
 * terms of the GNU Lesser General Public Licence.  This should
 * be distributed with the code.  If you do not have a copy,
 * see:
 *
 *      http://www.gnu.org/copyleft/lesser.html
 *
 * Copyright for this code is held jointly by the individual
 * authors.  These should be listed in @author doc comments.
 *
 * For more information on the BioJava project and its aims,
 * or to join the biojava-l mailing list, visit the home page
 * at:
 *
 *      http://www.biojava.org/
 *
 */
package org.biojava.nbio.structure.symmetry.geometry;

import javax.vecmath.AxisAngle4d;
import javax.vecmath.Quat4d;

/**
 *
 * @author Peter
 */
public final class IcosahedralSampler {
	private static Quat4d quat = new Quat4d();

	// this class cannot be instantiated
	private IcosahedralSampler() {
	};

	public static int getSphereCount() {
		return orientations.length;
	}

	public static Quat4d getQuat4d(int index) {
		Quat4d q = new Quat4d(orientations[index]);
		return q;
	}

	public static void getAxisAngle(int index, AxisAngle4d axisAngle) {
		quat.set(orientations[index]);
		axisAngle.set(quat);
	}

//	# Orientation set c600v, number = 60, radius = 44.48 degrees
//	# $Id: c600v.quat 6102 2006-02-21 19:45:40Z ckarney $
//	# For more information, eee http://charles.karney.info/orientation/
//	format quaternion
	private static double[][] orientations = {
	{1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000f},
	{0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 1.000000f},
	{0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 1.000000f},
	{0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 1.000000f},
	{0.000000000f, 0.500000000f, 0.309016994f, 0.809016994f, 1.000000f},
	{0.000000000f, -0.500000000f, 0.309016994f, 0.809016994f, 1.000000f},
	{0.000000000f, 0.500000000f, -0.309016994f, 0.809016994f, 1.000000f},
	{-0.000000000f, -0.500000000f, -0.309016994f, 0.809016994f, 1.000000f},
	{0.000000000f, 0.309016994f, 0.809016994f, 0.500000000f, 1.000000f},
	{0.000000000f, -0.309016994f, 0.809016994f, 0.500000000f, 1.000000f},
	{-0.000000000f, -0.309016994f, 0.809016994f, -0.500000000f, 1.000000f},
	{0.000000000f, 0.309016994f, 0.809016994f, -0.500000000f, 1.000000f},
	{0.000000000f, 0.809016994f, 0.500000000f, 0.309016994f, 1.000000f},
	{-0.000000000f, 0.809016994f, -0.500000000f, -0.309016994f, 1.000000f},
	{0.000000000f, 0.809016994f, -0.500000000f, 0.309016994f, 1.000000f},
	{0.000000000f, 0.809016994f, 0.500000000f, -0.309016994f, 1.000000f},
	{0.500000000f, 0.000000000f, 0.809016994f, 0.309016994f, 1.000000f},
	{-0.500000000f, 0.000000000f, 0.809016994f, 0.309016994f, 1.000000f},
	{-0.500000000f, -0.000000000f, 0.809016994f, -0.309016994f, 1.000000f},
	{0.500000000f, 0.000000000f, 0.809016994f, -0.309016994f, 1.000000f},
	{0.309016994f, 0.000000000f, 0.500000000f, 0.809016994f, 1.000000f},
	{-0.309016994f, 0.000000000f, 0.500000000f, 0.809016994f, 1.000000f},
	{0.309016994f, 0.000000000f, -0.500000000f, 0.809016994f, 1.000000f},
	{-0.309016994f, -0.000000000f, -0.500000000f, 0.809016994f, 1.000000f},
	{0.809016994f, 0.000000000f, 0.309016994f, 0.500000000f, 1.000000f},
	{0.809016994f, -0.000000000f, -0.309016994f, -0.500000000f, 1.000000f},
	{0.809016994f, 0.000000000f, -0.309016994f, 0.500000000f, 1.000000f},
	{0.809016994f, 0.000000000f, 0.309016994f, -0.500000000f, 1.000000f},
	{0.309016994f, 0.809016994f, 0.000000000f, 0.500000000f, 1.000000f},
	{-0.309016994f, 0.809016994f, 0.000000000f, 0.500000000f, 1.000000f},
	{-0.309016994f, 0.809016994f, -0.000000000f, -0.500000000f, 1.000000f},
	{0.309016994f, 0.809016994f, 0.000000000f, -0.500000000f, 1.000000f},
	{0.809016994f, 0.500000000f, 0.000000000f, 0.309016994f, 1.000000f},
	{0.809016994f, -0.500000000f, -0.000000000f, -0.309016994f, 1.000000f},
	{0.809016994f, -0.500000000f, 0.000000000f, 0.309016994f, 1.000000f},
	{0.809016994f, 0.500000000f, 0.000000000f, -0.309016994f, 1.000000f},
	{0.500000000f, 0.309016994f, 0.000000000f, 0.809016994f, 1.000000f},
	{-0.500000000f, 0.309016994f, 0.000000000f, 0.809016994f, 1.000000f},
	{0.500000000f, -0.309016994f, 0.000000000f, 0.809016994f, 1.000000f},
	{-0.500000000f, -0.309016994f, -0.000000000f, 0.809016994f, 1.000000f},
	{0.809016994f, 0.309016994f, 0.500000000f, 0.000000000f, 1.000000f},
	{0.809016994f, -0.309016994f, -0.500000000f, -0.000000000f, 1.000000f},
	{0.809016994f, -0.309016994f, 0.500000000f, 0.000000000f, 1.000000f},
	{0.809016994f, 0.309016994f, -0.500000000f, 0.000000000f, 1.000000f},
	{0.500000000f, 0.809016994f, 0.309016994f, 0.000000000f, 1.000000f},
	{-0.500000000f, 0.809016994f, 0.309016994f, 0.000000000f, 1.000000f},
	{-0.500000000f, 0.809016994f, -0.309016994f, -0.000000000f, 1.000000f},
	{0.500000000f, 0.809016994f, -0.309016994f, 0.000000000f, 1.000000f},
	{0.309016994f, 0.500000000f, 0.809016994f, 0.000000000f, 1.000000f},
	{-0.309016994f, 0.500000000f, 0.809016994f, 0.000000000f, 1.000000f},
	{0.309016994f, -0.500000000f, 0.809016994f, 0.000000000f, 1.000000f},
	{-0.309016994f, -0.500000000f, 0.809016994f, -0.000000000f, 1.000000f},
	{0.500000000f, 0.500000000f, 0.500000000f, 0.500000000f, 1.000000f},
	{0.500000000f, -0.500000000f, -0.500000000f, -0.500000000f, 1.000000f},
	{0.500000000f, -0.500000000f, 0.500000000f, 0.500000000f, 1.000000f},
	{0.500000000f, 0.500000000f, -0.500000000f, 0.500000000f, 1.000000f},
	{0.500000000f, 0.500000000f, 0.500000000f, -0.500000000f, 1.000000f},
	{0.500000000f, 0.500000000f, -0.500000000f, -0.500000000f, 1.000000f},
	{0.500000000f, -0.500000000f, 0.500000000f, -0.500000000f, 1.000000f},
	{0.500000000f, -0.500000000f, -0.500000000f, 0.500000000f, 1.000000f},
	};
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy