MCPcopy Create free account
hub / github.com/MapServer/MapServer / line_parameters

Class line_parameters

renderers/agg/include/agg_line_aa_basics.h:81–147  ·  view source on GitHub ↗

==========================================================line_parameters

Source from the content-addressed store, hash-verified

79
80 //==========================================================line_parameters
81 struct line_parameters
82 {
83 //---------------------------------------------------------------------
84 line_parameters() {}
85 line_parameters(int x1_, int y1_, int x2_, int y2_, int len_) :
86 x1(x1_), y1(y1_), x2(x2_), y2(y2_),
87 dx(abs(x2_ - x1_)),
88 dy(abs(y2_ - y1_)),
89 sx((x2_ > x1_) ? 1 : -1),
90 sy((y2_ > y1_) ? 1 : -1),
91 vertical(dy >= dx),
92 inc(vertical ? sy : sx),
93 len(len_),
94 octant((sy & 4) | (sx & 2) | int(vertical))
95 {
96 }
97
98 //---------------------------------------------------------------------
99 unsigned orthogonal_quadrant() const { return s_orthogonal_quadrant[octant]; }
100 unsigned diagonal_quadrant() const { return s_diagonal_quadrant[octant]; }
101
102 //---------------------------------------------------------------------
103 bool same_orthogonal_quadrant(const line_parameters& lp) const
104 {
105 return s_orthogonal_quadrant[octant] == s_orthogonal_quadrant[lp.octant];
106 }
107
108 //---------------------------------------------------------------------
109 bool same_diagonal_quadrant(const line_parameters& lp) const
110 {
111 return s_diagonal_quadrant[octant] == s_diagonal_quadrant[lp.octant];
112 }
113
114 //---------------------------------------------------------------------
115 void divide(line_parameters& lp1, line_parameters& lp2) const
116 {
117 int xmid = (x1 + x2) >> 1;
118 int ymid = (y1 + y2) >> 1;
119 int len2 = len >> 1;
120
121 lp1 = *this;
122 lp2 = *this;
123
124 lp1.x2 = xmid;
125 lp1.y2 = ymid;
126 lp1.len = len2;
127 lp1.dx = abs(lp1.x2 - lp1.x1);
128 lp1.dy = abs(lp1.y2 - lp1.y1);
129
130 lp2.x1 = xmid;
131 lp2.y1 = ymid;
132 lp2.len = len2;
133 lp2.dx = abs(lp2.x2 - lp2.x1);
134 lp2.dy = abs(lp2.y2 - lp2.y1);
135 }
136
137 //---------------------------------------------------------------------
138 int x1, y1, x2, y2, dx, dy, sx, sy;

Callers 2

drawMethod · 0.85
renderMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected