本文整理汇总了C++中FCOORD::rotate方法的典型用法代码示例。如果您正苦于以下问题:C++ FCOORD::rotate方法的具体用法?C++ FCOORD::rotate怎么用?C++ FCOORD::rotate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FCOORD
的用法示例。
在下文中一共展示了FCOORD::rotate方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: find_blob_limits
void find_blob_limits( //get y limits
PBLOB *blob, //blob to search
float leftx, //x limits
float rightx,
FCOORD rotation, //for landscape
float &ymin, //output y limits
float &ymax) {
float testy; //y intercept
FCOORD pos; //rotated
FCOORD vec;
POLYPT *polypt; //current point
//outlines
OUTLINE_IT out_it = blob->out_list ();
POLYPT_IT poly_it; //outline pts
ymin = (float) MAX_INT32;
ymax = (float) -MAX_INT32;
for (out_it.mark_cycle_pt (); !out_it.cycled_list (); out_it.forward ()) {
//get points
poly_it.set_to_list (out_it.data ()->polypts ());
for (poly_it.mark_cycle_pt (); !poly_it.cycled_list ();
poly_it.forward ()) {
polypt = poly_it.data ();
pos = polypt->pos;
pos.rotate (rotation);
vec = polypt->vec;
vec.rotate (rotation);
if (pos.x () < leftx && pos.x () + vec.x () > leftx
|| pos.x () > leftx && pos.x () + vec.x () < leftx) {
testy = pos.y () + vec.y () * (leftx - pos.x ()) / vec.x ();
//intercept of boundary
if (testy < ymin)
ymin = testy;
if (testy > ymax)
ymax = testy;
}
if (pos.x () >= leftx && pos.x () <= rightx) {
if (pos.y () > ymax)
ymax = pos.y ();
if (pos.y () < ymin)
ymin = pos.y ();
}
if (pos.x () > rightx && pos.x () + vec.x () < rightx
|| pos.x () < rightx && pos.x () + vec.x () > rightx) {
testy = pos.y () + vec.y () * (rightx - pos.x ()) / vec.x ();
//intercept of boundary
if (testy < ymin)
ymin = testy;
if (testy > ymax)
ymax = testy;
}
}
}
}
示例2: rotate
void POLY_BLOCK::rotate(FCOORD rotation) {
FCOORD pos; //current pos;
ICOORDELT *pt; //current point
ICOORDELT_IT pts = &vertices; //iterator
do {
pt = pts.data ();
pos.set_x (pt->x ());
pos.set_y (pt->y ());
pos.rotate (rotation);
pt->set_x ((inT16) (floor (pos.x () + 0.5)));
pt->set_y ((inT16) (floor (pos.y () + 0.5)));
pts.forward ();
}
while (!pts.at_first ());
compute_bb();
}