Ejemplo n.º 1
0
Point divide_interval(Interval tmp, Fraction K)
{
	Point tmp_point;

	Fraction S_lg_X = tmp.getS().getX();
	Fraction S_lg_Y = tmp.getS().getY();
	Fraction E_lg_X = tmp.getE().getX();
	Fraction E_lg_Y = tmp.getE().getY();

	Fraction rvec_X = E_lg_X - S_lg_X;
	Fraction rvec_Y = E_lg_Y - S_lg_Y;

	if(K.lg_u_() + rvec_X.lg_u_() + S_lg_X.lg_l_() > 17 ||
		K.lg_l_() + rvec_X.lg_l_() + S_lg_X.lg_u_() > 17 ||
		K.lg_u_() + rvec_Y.lg_u_() + S_lg_Y.lg_l_() > 17 ||
		K.lg_l_() + rvec_Y.lg_l_() + S_lg_Y.lg_u_() > 17 ||
		K.lg_l_() + rvec_X.lg_l_() + S_lg_X.lg_l_() > 18 ||
		K.lg_l_() + rvec_Y.lg_l_() + S_lg_Y.lg_l_() > 18)
	{
		double tmp_x = S_lg_X.numerical() + K.numerical() * (E_lg_X.numerical() - S_lg_X.numerical());
		double tmp_y = S_lg_Y.numerical() + K.numerical() * (E_lg_Y.numerical() - S_lg_Y.numerical());
		Fraction x_(tmp_x, 17);	
		Fraction y_(tmp_y, 17);
		return tmp_point.upload(x_, y_);
	}
	else
	{
		Fraction x = S_lg_X + K * rvec_X;
		Fraction y = S_lg_Y + K * rvec_Y;
		return tmp_point.upload(x, y);
	}
}
Ejemplo n.º 2
0
Interval::Interval(Interval const &tmp) : s(tmp.getS()), e(tmp.getE())
{

}