Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042 #ifndef __STRUCTS_H__
00043 #define __STRUCTS_H__
00044
00045
00046
00047
00048
00049
00050
00051 #include "Math/Math2d.h"
00052 #include "Math/Math3d.h"
00053 #include "DataStructures/DynamicArrayTemplate.h"
00054
00055
00056 #include <string.h>
00057 #include <math.h>
00058 #include <vector>
00059
00060
00061
00062
00063
00064
00065
00066 struct ROI
00067 {
00068 int min_x, min_y, max_x, max_y;
00069 };
00070
00071 struct PointPair2d
00072 {
00073 Vec2d p1;
00074 Vec2d p2;
00075 };
00076
00077 struct PointPair3d
00078 {
00079 Vec3d p1;
00080 Vec3d p2;
00081 };
00082
00089 struct Rectangle2d
00090 {
00094 Vec2d center;
00095
00099 float width;
00100
00104 float height;
00105
00109 float angle;
00110 };
00111
00118 struct Circle2d
00119 {
00123 Vec2d center;
00124
00128 float radius;
00129 };
00130
00137 struct Ellipse2d
00138 {
00142 Vec2d center;
00143
00147 float radius_x;
00148
00152 float radius_y;
00153
00161 float angle;
00162 };
00163
00179 struct StraightLine2d
00180 {
00181 StraightLine2d()
00182 {
00183 Math2d::SetVec(point, Math2d::zero_vec);
00184 Math2d::SetVec(directionVector, Math2d::zero_vec);
00185 Math2d::SetVec(normalVector, Math2d::zero_vec);
00186 c = 0.0f;
00187 }
00188
00189 StraightLine2d(const Vec2d &point1, const Vec2d &point2)
00190 {
00191
00192 Math2d::SetVec(point, point1);
00193
00194
00195 Math2d::SubtractVecVec(point2, point1, directionVector);
00196
00197
00198 Math2d::NormalizeVec(directionVector);
00199
00200
00201 Math2d::SetVec(normalVector, -directionVector.y, directionVector.x);
00202
00203
00204 c = -Math2d::ScalarProduct(normalVector, point);
00205 }
00206
00207 StraightLine2d(float angle, float c)
00208 {
00209
00210 this->c = c;
00211
00212
00213 Math2d::SetVec(normalVector, cosf(angle), sinf(angle));
00214
00215
00216 Math2d::SetVec(directionVector, -normalVector.y, normalVector.x);
00217
00218
00219 if (fabsf(normalVector.x) > fabsf(normalVector.y))
00220 {
00221 Math2d::SetVec(point, -c / normalVector.x, 0.0f);
00222 }
00223 else
00224 {
00225 Math2d::SetVec(point, 0.0f, -c / normalVector.y);
00226 }
00227 }
00228
00229 StraightLine2d(const PointPair2d &pointPair)
00230 {
00231 StraightLine2d(pointPair.p1, pointPair.p2);
00232 }
00233
00237 Vec2d point;
00238
00242 Vec2d directionVector;
00243
00247 Vec2d normalVector;
00248
00252 float c;
00253 };
00254
00255 struct MyRegion
00256 {
00257
00258 MyRegion()
00259 {
00260 pPixels = 0;
00261 }
00262
00263
00264 MyRegion(const MyRegion ®ion)
00265 {
00266 nPixels = region.nPixels;
00267
00268 if (region.pPixels)
00269 {
00270 pPixels = new int[nPixels];
00271 memcpy(pPixels, region.pPixels, nPixels * sizeof(int));
00272 }
00273 else
00274 pPixels = 0;
00275
00276 nSeedOffset = region.nSeedOffset;
00277
00278 Math2d::SetVec(centroid, region.centroid);
00279
00280 min_x = region.min_x;
00281 min_y = region.min_y;
00282 max_x = region.max_x;
00283 max_y = region.max_y;
00284
00285 ratio = region.ratio;
00286 }
00287
00288
00289 ~MyRegion()
00290 {
00291 if (pPixels)
00292 delete [] pPixels;
00293 }
00294
00295
00296 MyRegion& operator= (const MyRegion ®ion)
00297 {
00298 nPixels = region.nPixels;
00299
00300 if (pPixels)
00301 delete [] pPixels;
00302
00303 if (region.pPixels)
00304 {
00305 pPixels = new int[nPixels];
00306 memcpy(pPixels, region.pPixels, nPixels * sizeof(int));
00307 }
00308 else
00309 pPixels = 0;
00310
00311 nSeedOffset = region.nSeedOffset;
00312
00313 Math2d::SetVec(centroid, region.centroid);
00314
00315 min_x = region.min_x;
00316 min_y = region.min_y;
00317 max_x = region.max_x;
00318 max_y = region.max_y;
00319
00320 ratio = region.ratio;
00321
00322 return *this;
00323 }
00324
00325
00326 int *pPixels;
00327 int nPixels;
00328
00329 int nSeedOffset;
00330
00331 Vec2d centroid;
00332
00333 int min_x;
00334 int min_y;
00335 int max_x;
00336 int max_y;
00337
00338 float ratio;
00339 };
00340
00341
00342
00343
00344
00345
00346 typedef std::vector<MyRegion> RegionList;
00347 typedef CDynamicArrayTemplate<MyRegion> CRegionArray;
00348 typedef CDynamicArrayTemplate<Circle2d> CCircle2dArray;
00349 typedef CDynamicArrayTemplate<Ellipse2d> CEllipse2dArray;
00350 typedef CDynamicArrayTemplate<StraightLine2d> CStraightLine2dArray;
00351 typedef CDynamicArrayTemplate<int> CIntArray;
00352
00353
00354
00355 #endif
asr_ivt
Author(s): Allgeyer Tobias, Hutmacher Robin, Kleinert Daniel, Meißner Pascal, Scholz Jonas, Stöckle Patrick
autogenerated on Thu Jun 6 2019 21:46:58