GeoGen Development snapshot a3
|
00001 /* 00002 00003 This file is part of GeoGen. 00004 00005 GeoGen is free software: you can redistribute it and/or modify 00006 it under the terms of the GNU General Public License as published by 00007 the Free Software Foundation, either version 2 of the License, or 00008 (at your option) any later version. 00009 00010 GeoGen is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 GNU General Public License for more details. 00014 00015 You should have received a copy of the GNU General Public License 00016 along with GeoGen. If not, see <http://www.gnu.org/licenses/>. 00017 00018 */ 00019 00024 #pragma once 00025 00026 #include <cmath> 00027 #include <cstring> 00028 00029 #include "ggen_amplitudes.h" 00030 #include "ggen_point.h" 00031 #include "ggen_path.h" 00032 00036 class GGen_Data_1D{ 00037 public: 00038 GGen_Height* data; 00039 GGen_Size length; 00040 00046 GGen_Data_1D(GGen_Size length, GGen_Height value); 00047 00048 ~GGen_Data_1D(); 00049 00054 GGen_Data_1D* Clone(); 00055 00060 GGen_Size GetLength(); 00061 00067 void SetValue(GGen_Coord x, GGen_Height value); 00068 00075 void SetValueInRange(GGen_Coord from, GGen_Coord to, GGen_Height value); 00076 00082 GGen_Height GetValue(GGen_Coord x); 00083 00091 GGen_Height GetValueInterpolated(GGen_Coord x, GGen_Size scale_to_length); 00092 00097 void Add(GGen_Height value); 00098 00103 void AddArray(GGen_Data_1D* addend); 00104 00110 void AddTo(GGen_Data_1D* addend, GGen_CoordOffset offset); 00111 00119 void AddMasked(GGen_Height value, GGen_Data_1D* mask, bool relative); 00120 00128 void AddArrayMasked(GGen_Data_1D* addend, GGen_Data_1D* mask, bool relative); 00129 00134 void Multiply(double factor); 00135 00140 void MultiplyArray(GGen_Data_1D* factor); 00141 00145 void Invert(); 00146 00153 void Scale(double ratio, bool scale_values); 00154 00161 void ScaleTo(GGen_Size new_length, bool scale_values); 00162 00168 void ScaleValuesTo(GGen_Height new_min, GGen_Height new_max); 00169 00174 void Fill(GGen_Height value); 00175 00182 void ResizeCanvas(GGen_Size new_length, GGen_CoordOffset new_zero); 00183 00190 void Clamp(GGen_Height min, GGen_Height max); 00191 00195 void Flip(); 00196 00201 GGen_Height Min(); 00202 00207 GGen_Height Max(); 00208 00215 void Shift(GGen_CoordOffset offset, GGen_Overflow_Mode overflow_mode); 00216 00221 void Union(GGen_Data_1D* victim); 00222 00227 void Intersection(GGen_Data_1D* victim); 00228 00232 void Abs(); 00233 00238 void Monochrome(GGen_Height threshold); 00239 00244 void Normalize(GGen_Normalization_Mode mode); 00245 00249 void SlopeMap(); 00250 00260 void Gradient(GGen_Coord from, GGen_Coord to, GGen_Height from_value, GGen_Height to_value, bool fill_outside); 00261 00269 void Noise(GGen_Size min_feature_size, GGen_Size max_feature_size, GGen_Amplitudes* amplitudes); 00270 00275 void Smooth(GGen_Distance radius); 00276 00281 void Flood(double land_amount); 00282 00288 GGen_Path* ToPath(uint16 point_count); 00289 };