Example #1
0
// output a cubic
int Ttt::my_cubic_to(const FT_Vector* control1, const FT_Vector* control2, const FT_Vector *to, void* user) {
    P ctrl1(control1);
    P ctrl2(control2);
    P to_pt(to);
    my_writer->cubic_to( ctrl1, ctrl2, to_pt );
    last_point = *to;
    return 0;
}
Example #2
0
// output a conic
int Ttt::my_conic_to( const FT_Vector* control, const FT_Vector* to, void* user ) {
    P to_pt(to);
    P ctrl_pt(control);
    P last_pt(&last_point);
    P diff =  ctrl_pt-last_pt ;
    my_writer->conic_to( to_pt, diff );
    last_point = *to;
    return 0;
}
Example #3
0
bool COptimizePath::_LineTo(CLine& line, APointF& to)
{

#define  LOCAL_STRICT_LINE
	A3DPOINT2 to_pt((int)to.x, (int)to.y);
	A3DPOINT2 cur_pt((int)line.GetFrom().x, (int)line.GetFrom().y);

	CMoveMap * pMoveMap = g_MoveAgentManager.GetMoveMap();
	assert(pMoveMap);

#ifdef LOCAL_STRICT_LINE
	A3DPOINT2  last_pt(cur_pt);

#endif
	while (cur_pt != to_pt )
	{
		
		APointF cur(line.Next());
		cur_pt.x = (int)cur.x;
		cur_pt.y = (int)cur.y;

		if (!pMoveMap->IsPosReachable(cur_pt))
		{
			return false;
		}

#ifdef LOCAL_STRICT_LINE
		if ((cur_pt.x != last_pt.x && cur_pt.y != last_pt.y) 
			&&(!pMoveMap->IsPosReachable(last_pt.x, cur_pt.y)
			  || !pMoveMap->IsPosReachable(cur_pt.x, last_pt.y)) )
		{
			return false;
		}
		last_pt = cur_pt;
#endif

	}
	
#undef  LOCAL_STRICT_LINE
	return true;
}