73 double crop_width_px = (double)
image->getCropRect().width(),
74 crop_hieght_px = (double)
image->getCropRect().height(),
75 crop_radius = (crop_width_px < crop_hieght_px ?
76 crop_width_px : crop_hieght_px) / 2.0;
96 Vertex(
double vx,
double vy,
double tx,
double ty);
131 inline bool Inside(
const unsigned int vertex,
132 const double clip_line[3])
const;
136 const double clip_line[3])
const;
142 for (
unsigned short int v = 0; v < 4; v++)
145 unsigned short int x = (v == 2 || v==3) ? 1 : 0,
146 y = (v == 1 || v==2) ? 1 : 0;
147 for (
unsigned short int a = 0; a < 2; a++)
162 return verts[v].tex_c[0] * l[0] +
verts[v].tex_c[1] * l[1] + l[2] > 0;
166 const unsigned int v2_index,
167 const double cl[3])
const
174 *v2 = &
verts[v2_index];
176 double dx = v2->tex_c[0] - v1->
tex_c[0],
177 dy = v2->tex_c[1] - v1->
tex_c[1];
192 double t = (-cl[0] * v1->
tex_c[0] - cl[1] * v1->
tex_c[1] - cl[2]) /
193 (cl[0] * dx + cl[1] * dy),
195 x = dx * t + v1->
tex_c[0],
196 y = dy * t + v1->
tex_c[1],
200 xc = v1->
vertex_c[0] * td1 + v2->vertex_c[0] * t,
201 yc = v1->
vertex_c[1] * td1 + v2->vertex_c[1] * t;
203 return Vertex(xc, yc, x, y);
211 unsigned int vertices_count =
verts.size(),
212 v_previous = vertices_count - 1;
214 for (
unsigned int v_index = 0; v_index < vertices_count; v_index++)
216 bool v_index_inside =
Inside(v_index, clip_line),
217 v_previous_inside =
Inside(v_previous, clip_line);
218 if (v_index_inside != v_previous_inside)
228 v_previous = v_index;
250 std::vector<MeshRemapper::ArrayCoords> result;
251 unsigned int vertices_count =
verts.size();
264 while (i < vertices_count)
266 if (i < vertices_count - 1)
270 for (
unsigned short int c = 0; c < 2; c++)
275 quad.
tex_c [0][1][c] =
verts[i - 1].tex_c [c];
279 quad.
tex_c [1][0][c] =
verts[i + 1].tex_c [c];
281 result.push_back(quad);
288 for (
unsigned short int c = 0; c < 2; c++)
293 quad.
tex_c [0][1][c] =
verts[i - 1].tex_c [c];
299 result.push_back(quad);
316 double clip_lines[4][3] = {{ 1.0, 0.0, -
crop_x1},
321 poly = poly.
Clip(clip_lines[0]);
322 poly = poly.
Clip(clip_lines[1]);
323 poly = poly.
Clip(clip_lines[2]);
324 poly = poly.
Clip(clip_lines[3]);
337 for (
unsigned int edge = 0; edge < 4; edge++)
339 double angle =
M_PI + atan2(face->
tex_c[edge % 2][edge / 2][1]
341 face->
tex_c[edge % 2][edge / 2][0]
347 poly = poly.
Clip(clip_line);
362 for (
unsigned short int x = 0; x < 2; x++)
364 for (
unsigned short int y = 0; y < 2; y++)
366 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.