Blender V2.61 - r43446
|
00001 00004 00005 // This file is part of Wavelet Turbulence. 00006 // 00007 // Wavelet Turbulence is free software: you can redistribute it and/or modify 00008 // it under the terms of the GNU General Public License as published by 00009 // the Free Software Foundation, either version 3 of the License, or 00010 // (at your option) any later version. 00011 // 00012 // Wavelet Turbulence is distributed in the hope that it will be useful, 00013 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 // GNU General Public License for more details. 00016 // 00017 // You should have received a copy of the GNU General Public License 00018 // along with Wavelet Turbulence. If not, see <http://www.gnu.org/licenses/>. 00019 // 00020 // Copyright 2008 Theodore Kim and Nils Thuerey 00021 // 00022 // SPHERE.cpp: implementation of the SPHERE class. 00023 // 00025 00026 #include "SPHERE.h" 00027 00029 // Construction/Destruction 00031 00032 SPHERE::SPHERE(float x, float y, float z, float radius) : 00033 _radius(radius) 00034 { 00035 _center[0] = x; 00036 _center[1] = y; 00037 _center[2] = z; 00038 } 00039 00040 SPHERE::~SPHERE() 00041 { 00042 00043 } 00044 00045 bool SPHERE::inside(float x, float y, float z) 00046 { 00047 float translate[] = {x - _center[0], y - _center[1], z - _center[2]}; 00048 float magnitude = translate[0] * translate[0] + 00049 translate[1] * translate[1] + 00050 translate[2] * translate[2]; 00051 00052 return (magnitude < _radius * _radius) ? true : false; 00053 }