1
/////////////////////////////////////////////////////////////
3
// Copyright (c) 2007-2011 by The University of Queensland //
4
// Earth Systems Science Computational Centre (ESSCC) //
5
// http://www.uq.edu.au/esscc //
7
// Primary Business: Brisbane, Queensland, Australia //
8
// Licensed under the Open Software License version 3.0 //
9
// http://www.opensource.org/licenses/osl-3.0.php //
11
/////////////////////////////////////////////////////////////
13
#include "SphereObj.h"
15
void SphereObj::insert(Vector3 pos, double radius, MNTable3D* table,int tag,int id) {
17
// First list all (only 1 in this case) sphere locations relative to the
18
// middle of the "empty space"
19
Vector3 sphere_origin(0,0,0);
21
// Rotate each one through all axis using the rotate function as below
23
// The below will do nothing, but is an example of what to do with more
24
// complex shapes with multiple spheres.
25
if ( this->useRandomOrientation() ) {
26
this->setRandomOrientation();
27
sphere_origin = this->rotatePoint(sphere_origin);
30
// Translate all spheres to the given position
31
sphere_origin = sphere_origin + pos;
33
// Expand radius from unit circle to actual given radius for each circle
34
// For example a circle that has radius 1/4 of unit circle should get
35
// radius 0.25f*radius.
36
double r = radius*1.0f;
38
// Finally insert all spheres and bonds where relevant.
39
Sphere Sc(sphere_origin, r);
40
if ( table->checkInsertable(Sc,id) ) {
45
void SphereObj::setBias(int factor) {
46
this->bias_factor = factor;
48
int SphereObj::bias() {
49
return this->bias_factor;