00001 // This file is part of ff3d - http://www.freefem.org/ff3d 00002 // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino 00003 00004 // This program is free software; you can redistribute it and/or modify 00005 // it under the terms of the GNU General Public License as published by 00006 // the Free Software Foundation; either version 2, or (at your option) 00007 // any later version. 00008 00009 // This program is distributed in the hope that it will be useful, 00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 // GNU General Public License for more details. 00013 00014 // You should have received a copy of the GNU General Public License 00015 // along with this program; if not, write to the Free Software Foundation, 00016 // Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00017 00018 // $Id: FunctionExpressionObjectCharacteristic.cpp,v 1.2 2006/10/28 23:27:02 delpinux Exp $ 00019 00020 #include <FunctionExpressionObjectCharacteristic.hpp> 00021 #include <Scene.hpp> 00022 #include <Information.hpp> 00023 00024 #include <ScalarFunctionObjectCharacteristic.hpp> 00025 #include <Vector3Expression.hpp> 00026 00027 // std::ostream& FunctionExpressionCharacteristic::put(std::ostream& os) const 00028 // { 00029 // os << "one(<" << (*__reference).value(0) 00030 // << ',' << (*__reference).value(1) 00031 // << ',' << (*__reference).value(2) << ">)"; 00032 // return os; 00033 // } 00034 00035 // real_t FunctionExpressionCharacteristic::value(const real_t& x, 00036 // const real_t& y, 00037 // const real_t& z) const 00038 // { 00039 // TinyVector<3> V(x,y,z); 00040 // for (std::list<Object* >::const_iterator i = __objects.begin(); 00041 // i != __objects.end(); ++i) 00042 // if ((*(*i)).inside(V)) 00043 // return 1; 00044 // return 0; 00045 // } 00046 00047 void FunctionExpressionObjectCharacteristic::execute() 00048 { 00049 ConstReferenceCounting<Scene> scene 00050 = Information::instance().getScene(); 00051 00052 __reference->execute(); 00053 00054 TinyVector<3> r; 00055 for (size_t i=0; i<3; ++i) 00056 r[i] = (*__reference).value(i); 00057 00058 __scalarFunction = new ScalarFunctionObjectCharacteristic(scene, r); 00059 } 00060 00061 FunctionExpressionObjectCharacteristic 00062 ::FunctionExpressionObjectCharacteristic(ReferenceCounting<Vector3Expression> ref) 00063 : FunctionExpression(FunctionExpression::objectCharacteristic), 00064 __reference(ref) 00065 { 00066 ; 00067 } 00068 00069 FunctionExpressionObjectCharacteristic:: 00070 FunctionExpressionObjectCharacteristic(const FunctionExpressionObjectCharacteristic& f) 00071 : FunctionExpression(f), 00072 __reference(f.__reference), 00073 __scene(f.__scene) 00074 { 00075 ; 00076 } 00077 00078 FunctionExpressionObjectCharacteristic:: 00079 ~FunctionExpressionObjectCharacteristic() 00080 { 00081 ; 00082 } 00083
1.5.6