gwnavgeneration/raster/edgerasterizer.h Source File

edgerasterizer.h
Go to the documentation of this file.
1 /*
2 * Copyright 2016 Autodesk, Inc. All rights reserved.
3 * Use of this software is subject to the terms of the Autodesk license agreement and any attachments or Appendices thereto provided at the time of installation or download,
4 * or which otherwise accompanies this software in either electronic or hard copy form, or which is signed by you and accepted by Autodesk.
5 */
6 
7 
8 
9 
10 
11 #pragma once
12 
13 
15 
16 
17 namespace Kaim
18 {
19 
20 class GeneratorSystem;
21 class Box2i;
22 class RasterPoint;
23 class SingleStageRaster;
24 
25 
26 class EdgeRasterizer
27 {
28 public:
29  EdgeRasterizer(GeneratorSystem* sys, KyFloat32 rasterPrecision, KyInt32 pixelSizeInInt, SingleStageRaster* singleStageRaster);
30 
31  bool InitToRasterizeAlong_X(const RasterPoint& A, const RasterPoint& B);
32 
33  bool InitToRasterizeAlong_Y(const RasterPoint& A, const RasterPoint& B);
34 
35  void Rasterize();
36 
37 private:
38  void FinalizeInit();
39  friend class EdgeRasterizerImpl;
40 
41 private:
42  GeneratorSystem* m_sys;
43  KyInt32 m_pixelSize;
44  KyInt64 m_pixelSize64; // same in 64 bits
45 
46  SingleStageRaster* m_singleStageRaster;
47  KyFloat32 m_meter_pixelSize;
48 
49 
50  Coord m_Au; // Coordinate of A along "u" axis
51  Coord m_Av; // Coordinate of A along "v" axis
52  KyFloat32 m_meter_Az; // the altitude in meter of point A
53 
54  Coord m_Bu; // Coordinate of B along "u" axis
55  Coord m_Bv; // Coordinate of B along "u" axis
56  KyFloat32 m_meter_Bz; // the altitude in meter of point B
57 
58  // Raster pixelBox in uv coordinates
59  // retrieved during InitToRasterizeAlong_X/Y
60  PixelCoord m_MINpu;
61  PixelCoord m_MAXpu;
62  PixelCoord m_MINpv;
63  PixelCoord m_MAXpv;
64 
65  KyFloat32 m_dz_on_du; // gradient of altitude along "u"
66  KyFloat32 m_meter_step_z; // increment of altitude by pixel along "u"
67 
68  // internal values we cache to speedUp GetPv() computation
69  KyInt64 m_ABu; // = (KyInt64)(m_Bu - m_Au);
70  KyInt64 m_ABv; // = (KyInt64)(m_Bv - m_Av); used in GetPv()
71  KyInt64 m_ABu_by_Av; // = m_ABu * m_Av; used in GetPv()
72  KyInt64 m_ABu_by_pixelSize; // = m_ABu * m_coord_pixelSize; used in GetPv()
73 
74  // so: Does "u" means X axis or Y axis ? and v ?
75  // m_x_in_uv = 0;
76  // m_y_in_uv = 1;
77  // means Rasterize along X
78  // m_x_in_uv = 1;
79  // m_y_in_uv = 0;
80  // means Rasterize along Y
81  KyInt32 m_x_in_uv;
82  KyInt32 m_y_in_uv;
83 };
84 
85 
86 }
87 
88 
std::int64_t KyInt64
int64_t
Definition: types.h:25
The Autodesk Navigation namespace.
Definition: gamekitcrowddispersion.cpp:17
std::int32_t KyInt32
int32_t
Definition: types.h:24
float KyFloat32
float
Definition: types.h:32