75 double crop_width_px = (double)
image->getCropRect().width(),
76 crop_hieght_px = (double)
image->getCropRect().height(),
77 crop_radius = (crop_width_px < crop_hieght_px ?
78 crop_width_px : crop_hieght_px) / 2.0;
98 Vertex(
double vx,
double vy,
double tx,
double ty);
133 inline bool Inside(
const unsigned int vertex,
134 const double clip_line[3])
const;
138 const double clip_line[3])
const;
144 for (
unsigned short int v = 0; v < 4; v++)
147 unsigned short int x = (v == 2 || v==3) ? 1 : 0,
148 y = (v == 1 || v==2) ? 1 : 0;
149 for (
unsigned short int a = 0; a < 2; a++)
164 return verts[v].tex_c[0] * l[0] +
verts[v].tex_c[1] * l[1] + l[2] > 0;
168 const unsigned int v2_index,
169 const double cl[3])
const
176 *v2 = &
verts[v2_index];
178 double dx = v2->tex_c[0] - v1->
tex_c[0],
179 dy = v2->tex_c[1] - v1->
tex_c[1];
194 double t = (-cl[0] * v1->
tex_c[0] - cl[1] * v1->
tex_c[1] - cl[2]) /
195 (cl[0] * dx + cl[1] * dy),
197 x = dx * t + v1->
tex_c[0],
198 y = dy * t + v1->
tex_c[1],
202 xc = v1->
vertex_c[0] * td1 + v2->vertex_c[0] * t,
203 yc = v1->
vertex_c[1] * td1 + v2->vertex_c[1] * t;
205 return Vertex(xc, yc, x, y);
213 unsigned int vertices_count =
verts.size(),
214 v_previous = vertices_count - 1;
216 for (
unsigned int v_index = 0; v_index < vertices_count; v_index++)
218 bool v_index_inside =
Inside(v_index, clip_line),
219 v_previous_inside =
Inside(v_previous, clip_line);
220 if (v_index_inside != v_previous_inside)
230 v_previous = v_index;
252 std::vector<MeshRemapper::ArrayCoords> result;
253 unsigned int vertices_count =
verts.size();
266 while (i < vertices_count)
268 if (i < vertices_count - 1)
272 for (
unsigned short int c = 0; c < 2; c++)
277 quad.
tex_c [0][1][c] =
verts[i - 1].tex_c [c];
281 quad.
tex_c [1][0][c] =
verts[i + 1].tex_c [c];
283 result.push_back(quad);
290 for (
unsigned short int c = 0; c < 2; c++)
295 quad.
tex_c [0][1][c] =
verts[i - 1].tex_c [c];
301 result.push_back(quad);
318 double clip_lines[4][3] = {{ 1.0, 0.0, -
crop_x1},
323 poly = poly.
Clip(clip_lines[0]);
324 poly = poly.
Clip(clip_lines[1]);
325 poly = poly.
Clip(clip_lines[2]);
326 poly = poly.
Clip(clip_lines[3]);
339 for (
unsigned int edge = 0; edge < 4; edge++)
341 double angle =
M_PI + atan2(face->
tex_c[edge % 2][edge / 2][1]
343 face->
tex_c[edge % 2][edge / 2][0]
349 poly = poly.
Clip(clip_line);
364 for (
unsigned short int x = 0; x < 2; x++)
366 for (
unsigned short int y = 0; y < 2; y++)
368 for (
unsigned short int c = 0; c < 2; c++)
bool GiveClipFaceResult(Coords *result)
Get a face that was produced by ClipFace.
double circle_crop_centre_y
std::vector< MeshRemapper::ArrayCoords > face_list
List for results when clipping faces.
std::vector< MeshRemapper::ArrayCoords > ConvertToQuads()
A class for exchanging pointers to coordinates.
HuginBase::SrcPanoImage * image
HuginBase::SrcPanoImage::CropMode crop_mode
Crop mode of the source image.
virtual void UpdateAndResetIndex()
A_Polygon Clip(const double clip_line[3])
include file for the hugin project
double(* tex_c)[2][2]
The coordinate in the source image ranging from 0 to 1.
VisualizationState * visualization_state
Vertex Intersect(const unsigned int v1, const unsigned int v2, const double clip_line[3]) const
void ClipFace(Coords *face)
Crop a face to the source image, return true if there is anything left.
void SetCrop()
Fill the crop values of the MeshRemapper from the source image.
double height
The sizes of the input images in pixels.
float scale
The number number of units between vertex coorinates that gives a pixel in the display.
double circle_crop_radius_x
double circle_crop_radius_y
MeshRemapper(HuginBase::Panorama *m_pano, HuginBase::SrcPanoImage *image, VisualizationState *visualization_state)
include file for the hugin project
double circle_crop_centre_x
bool Inside(const unsigned int vertex, const double clip_line[3]) const
std::vector< Vertex > verts
double(* vertex_c)[2][2]
The coordinate in the panorama, in its pixel space.
All variables of a source image.
HuginBase::Panorama * m_pano
A class for exchanging coordinates by value.