本文整理汇总了C++中FCOORD::set_x方法的典型用法代码示例。如果您正苦于以下问题:C++ FCOORD::set_x方法的具体用法?C++ FCOORD::set_x怎么用?C++ FCOORD::set_x使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FCOORD
的用法示例。
在下文中一共展示了FCOORD::set_x方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: vector_fit
// Returns the direction of the fitted line as a unit vector, using the
// least mean squared perpendicular distance. The line runs through the
// mean_point, i.e. a point p on the line is given by:
// p = mean_point() + lambda * vector_fit() for some real number lambda.
// Note that the result (0<=x<=1, -1<=y<=-1) is directionally ambiguous
// and may be negated without changing its meaning.
FCOORD LLSQ::vector_fit() const {
double x_var = x_variance();
double y_var = y_variance();
double covar = covariance();
FCOORD result;
if (x_var >= y_var) {
if (x_var == 0.0)
return FCOORD(0.0f, 0.0f);
result.set_x(x_var / sqrt(x_var * x_var + covar * covar));
result.set_y(sqrt(1.0 - result.x() * result.x()));
} else {
result.set_y(y_var / sqrt(y_var * y_var + covar * covar));
result.set_x(sqrt(1.0 - result.y() * result.y()));
}
if (covar < 0.0)
result.set_y(-result.y());
return result;
}
示例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();
}