Debian Codegraph @

src/SphereObj.cc

raw
1 /////////////////////////////////////////////////////////////
2 // //
3 // Copyright (c) 2007-2017 by The University of Queensland //
4 // Centre for Geoscience Computing //
5 // http://earth.uq.edu.au/centre-geoscience-computing //
6 // //
7 // Primary Business: Brisbane, Queensland, Australia //
8 // Licensed under the Open Software License version 3.0 //
9 // http://www.apache.org/licenses/LICENSE-2.0 //
10 // //
11 /////////////////////////////////////////////////////////////
12
13 #include "SphereObj.h"
14
15 void SphereObj::insert(Vector3 pos, double radius, MNTable3D* table,int tag,int id) {
16
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);
20
21 // Rotate each one through all axis using the rotate function as below
22 //
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);
28 }
29
30 // Translate all spheres to the given position
31 sphere_origin = sphere_origin + pos;
32
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;
37
38 // Finally insert all spheres and bonds where relevant.
39 Sphere Sc(sphere_origin, r);
40 if ( table->checkInsertable(Sc,id) ) {
41 Sc.setTag(tag);
42 table->insert(Sc,id);
43 }
44 }
45 void SphereObj::setBias(int factor) {
46 this->bias_factor = factor;
47 }
48 int SphereObj::bias() {
49 return this->bias_factor;
50 }