/* -*- C++ -*- * Copyright ©2004 Hugo Mills * * This software is distributed under the terms of the GNU GPL v3 * For more information on the GPL, see the file COPYING or * visit http://www.gnu.org/ * * This software is distributed without warranty */ #include "xforbit_random.h" extern "C" PluginInfo* getmodules(int i) { if(i==0) { PluginInfo_Orbit* pi = new PluginInfo_Orbit(); pi->name = "Random Orbit"; pi->author = "Hugo Mills"; pi->copyright = "©2005 Hugo Mills"; pi->version = 0x10000; pi->parser = XfOrbit_Random::parser; return pi; } else return NULL; } XfOrbit* XfOrbit_Random::parser( ConfigLexer* lex, const std::string& type, const std::string& subtype ) { if(type == "random-position") { if(lex->eos()) return new XfOrbit_Random(); else throw UnknownConfigToken(lex); } else return NULL; } XfOrbit_Random::XfOrbit_Random() : XfOrbit() { reset(); } void XfOrbit_Random::reset(void) { double lo = rand()/(RAND_MAX+1.0)*2.0*M_PI - M_PI; double la = rand()/(RAND_MAX+1.0)*M_PI - M_PI_2; setmatrices(lo, la); }