⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 physicalproperties.cpp

📁 amygdata的神经网络算法源代码
💻 CPP
字号:
/***************************************************************************                          physicalproperties.cpp  -  description                             -------------------    copyright            : (C) 2004 by Matt Grover    email                : mgrover@amygdala.org ***************************************************************************//*************************************************************************** *                                                                         * *   This program is free software; you can redistribute it and/or modify  * *   it under the terms of the GNU General Public License as published by  * *   the Free Software Foundation; either version 2 of the License, or     * *   (at your option) any later version.                                   * *                                                                         * ***************************************************************************/#include "physicalproperties.h"#include "logging.h"#include <string>#include <map>#include "utilities.h"using namespace std;using namespace Amygdala;using namespace Utilities;PhysicalProperties::PhysicalProperties():    Properties(),    x(0.),    y(0.),    z(0.),    radius(1.){    bodyColor.red   = 255;    bodyColor.green = 0;    bodyColor.blue  = 0;        dendriteColor.red   = 0;    dendriteColor.green = 255;    dendriteColor.blue  = 0;        axonColor.red   = 0;    axonColor.green = 0;    axonColor.blue  = 255;}PhysicalProperties::~PhysicalProperties(){}void PhysicalProperties::SetBodyColor(RGB & color){    memcpy(&bodyColor, &color, sizeof(RGB));}void PhysicalProperties::SetProperty(const string& name, const string& value){    if(name == "position"){        string::size_type nocx = value.find(',');        x = atof(value.substr(0, nocx - 1).c_str());        string::size_type nocy = value.find(',', nocx + 1);        y = atof(value.substr(nocx + 1, nocy - 1 - nocx).c_str());        z = atof(value.substr(nocy + 1).c_str());    }}std::map< std::string, std::string > PhysicalProperties::GetPropertyMap() const{    map<string, string> propMap;    propMap["position"]      = ftostr(x) + "," + ftostr(y) + "," + ftostr(z);    propMap["bodyColor"]     = itostr(bodyColor.red) + "," + itostr(bodyColor.green) + "," + itostr(bodyColor.blue);    propMap["dendriteColor"] = itostr(dendriteColor.red) + "," + itostr(dendriteColor.green) + "," +                               itostr(dendriteColor.blue);    propMap["bodyColor"]     = itostr(axonColor.red) + "," + itostr(axonColor.green) + "," + itostr(axonColor.blue);    propMap["radius"]        = ftostr(radius);    return propMap;}void PhysicalProperties::SetPosition(float _x, float _y, float _z){    x = _x;     y = _y;     z = _z;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -