001/* 002 * BioJava development code 003 * 004 * This code may be freely distributed and modified under the 005 * terms of the GNU Lesser General Public Licence. This should 006 * be distributed with the code. If you do not have a copy, 007 * see: 008 * 009 * http://www.gnu.org/copyleft/lesser.html 010 * 011 * Copyright for this code is held jointly by the individual 012 * authors. These should be listed in @author doc comments. 013 * 014 * For more information on the BioJava project and its aims, 015 * or to join the biojava-l mailing list, visit the home page 016 * at: 017 * 018 * http://www.biojava.org/ 019 * 020 */ 021package org.biojava.nbio.structure.symmetry.geometry; 022 023import javax.vecmath.AxisAngle4d; 024import javax.vecmath.Quat4d; 025 026/** 027 * Represents an even coverage of quaternion space by 60 points. This grid is 028 * defined by the vertices of one half of a hexacosichoron (600-cell). It 029 * approximates all possible orientations to within 44.48 degrees. 030 * @author Peter 031 */ 032// This would be better named HexacosichoronSampler, since it's sampling 4D space. -SB 033public final class IcosahedralSampler { 034 private static Quat4d quat = new Quat4d(); 035 036 // this class cannot be instantiated 037 private IcosahedralSampler() { 038 } 039 040 public static int getSphereCount() { 041 return orientations.length; 042 } 043 044 public static Quat4d getQuat4d(int index) { 045 Quat4d q = new Quat4d(orientations[index]); //ignores 5th element 046 return q; 047 } 048 049 public static void getAxisAngle(int index, AxisAngle4d axisAngle) { 050 quat.set(orientations[index]); 051 axisAngle.set(quat); 052 } 053 054 // # Orientation set c600v, number = 60, radius = 44.48 degrees 055 // # $Id: c600v.quat 6102 2006-02-21 19:45:40Z ckarney $ 056 // # For more information, eee http://charles.karney.info/orientation/ 057 // format quaternion 058 // The fifth column gives a weighting factor. Since the 600-cell is regular, all 059 // orientations cover an equal fraction of orientation space and have equal weight. 060 private static double[][] orientations = { 061 {1.000000000f, 0.000000000f, 0.000000000f, 0.000000000f, 1.000000f}, 062 {0.000000000f, 1.000000000f, 0.000000000f, 0.000000000f, 1.000000f}, 063 {0.000000000f, 0.000000000f, 1.000000000f, 0.000000000f, 1.000000f}, 064 {0.000000000f, 0.000000000f, 0.000000000f, 1.000000000f, 1.000000f}, 065 {0.000000000f, 0.500000000f, 0.309016994f, 0.809016994f, 1.000000f}, 066 {0.000000000f, -0.500000000f, 0.309016994f, 0.809016994f, 1.000000f}, 067 {0.000000000f, 0.500000000f, -0.309016994f, 0.809016994f, 1.000000f}, 068 {-0.000000000f, -0.500000000f, -0.309016994f, 0.809016994f, 1.000000f}, 069 {0.000000000f, 0.309016994f, 0.809016994f, 0.500000000f, 1.000000f}, 070 {0.000000000f, -0.309016994f, 0.809016994f, 0.500000000f, 1.000000f}, 071 {-0.000000000f, -0.309016994f, 0.809016994f, -0.500000000f, 1.000000f}, 072 {0.000000000f, 0.309016994f, 0.809016994f, -0.500000000f, 1.000000f}, 073 {0.000000000f, 0.809016994f, 0.500000000f, 0.309016994f, 1.000000f}, 074 {-0.000000000f, 0.809016994f, -0.500000000f, -0.309016994f, 1.000000f}, 075 {0.000000000f, 0.809016994f, -0.500000000f, 0.309016994f, 1.000000f}, 076 {0.000000000f, 0.809016994f, 0.500000000f, -0.309016994f, 1.000000f}, 077 {0.500000000f, 0.000000000f, 0.809016994f, 0.309016994f, 1.000000f}, 078 {-0.500000000f, 0.000000000f, 0.809016994f, 0.309016994f, 1.000000f}, 079 {-0.500000000f, -0.000000000f, 0.809016994f, -0.309016994f, 1.000000f}, 080 {0.500000000f, 0.000000000f, 0.809016994f, -0.309016994f, 1.000000f}, 081 {0.309016994f, 0.000000000f, 0.500000000f, 0.809016994f, 1.000000f}, 082 {-0.309016994f, 0.000000000f, 0.500000000f, 0.809016994f, 1.000000f}, 083 {0.309016994f, 0.000000000f, -0.500000000f, 0.809016994f, 1.000000f}, 084 {-0.309016994f, -0.000000000f, -0.500000000f, 0.809016994f, 1.000000f}, 085 {0.809016994f, 0.000000000f, 0.309016994f, 0.500000000f, 1.000000f}, 086 {0.809016994f, -0.000000000f, -0.309016994f, -0.500000000f, 1.000000f}, 087 {0.809016994f, 0.000000000f, -0.309016994f, 0.500000000f, 1.000000f}, 088 {0.809016994f, 0.000000000f, 0.309016994f, -0.500000000f, 1.000000f}, 089 {0.309016994f, 0.809016994f, 0.000000000f, 0.500000000f, 1.000000f}, 090 {-0.309016994f, 0.809016994f, 0.000000000f, 0.500000000f, 1.000000f}, 091 {-0.309016994f, 0.809016994f, -0.000000000f, -0.500000000f, 1.000000f}, 092 {0.309016994f, 0.809016994f, 0.000000000f, -0.500000000f, 1.000000f}, 093 {0.809016994f, 0.500000000f, 0.000000000f, 0.309016994f, 1.000000f}, 094 {0.809016994f, -0.500000000f, -0.000000000f, -0.309016994f, 1.000000f}, 095 {0.809016994f, -0.500000000f, 0.000000000f, 0.309016994f, 1.000000f}, 096 {0.809016994f, 0.500000000f, 0.000000000f, -0.309016994f, 1.000000f}, 097 {0.500000000f, 0.309016994f, 0.000000000f, 0.809016994f, 1.000000f}, 098 {-0.500000000f, 0.309016994f, 0.000000000f, 0.809016994f, 1.000000f}, 099 {0.500000000f, -0.309016994f, 0.000000000f, 0.809016994f, 1.000000f}, 100 {-0.500000000f, -0.309016994f, -0.000000000f, 0.809016994f, 1.000000f}, 101 {0.809016994f, 0.309016994f, 0.500000000f, 0.000000000f, 1.000000f}, 102 {0.809016994f, -0.309016994f, -0.500000000f, -0.000000000f, 1.000000f}, 103 {0.809016994f, -0.309016994f, 0.500000000f, 0.000000000f, 1.000000f}, 104 {0.809016994f, 0.309016994f, -0.500000000f, 0.000000000f, 1.000000f}, 105 {0.500000000f, 0.809016994f, 0.309016994f, 0.000000000f, 1.000000f}, 106 {-0.500000000f, 0.809016994f, 0.309016994f, 0.000000000f, 1.000000f}, 107 {-0.500000000f, 0.809016994f, -0.309016994f, -0.000000000f, 1.000000f}, 108 {0.500000000f, 0.809016994f, -0.309016994f, 0.000000000f, 1.000000f}, 109 {0.309016994f, 0.500000000f, 0.809016994f, 0.000000000f, 1.000000f}, 110 {-0.309016994f, 0.500000000f, 0.809016994f, 0.000000000f, 1.000000f}, 111 {0.309016994f, -0.500000000f, 0.809016994f, 0.000000000f, 1.000000f}, 112 {-0.309016994f, -0.500000000f, 0.809016994f, -0.000000000f, 1.000000f}, 113 {0.500000000f, 0.500000000f, 0.500000000f, 0.500000000f, 1.000000f}, 114 {0.500000000f, -0.500000000f, -0.500000000f, -0.500000000f, 1.000000f}, 115 {0.500000000f, -0.500000000f, 0.500000000f, 0.500000000f, 1.000000f}, 116 {0.500000000f, 0.500000000f, -0.500000000f, 0.500000000f, 1.000000f}, 117 {0.500000000f, 0.500000000f, 0.500000000f, -0.500000000f, 1.000000f}, 118 {0.500000000f, 0.500000000f, -0.500000000f, -0.500000000f, 1.000000f}, 119 {0.500000000f, -0.500000000f, 0.500000000f, -0.500000000f, 1.000000f}, 120 {0.500000000f, -0.500000000f, -0.500000000f, 0.500000000f, 1.000000f}, 121 }; 122}