コード例 #1
0
ファイル: adaptive.cpp プロジェクト: Yonka/cg
int vp(const my_point &a, const my_point &b, const my_point &c)
{
    double t[12];

    std::pair<double, double> tmp;
    tmp = prod(b.x, c.y);
    t[0] = tmp.first;
    t[1] = tmp.second;
    tmp = prod(-b.x, a.y);
    t[2] = tmp.first;
    t[3] = tmp.second;
    tmp = prod(-a.x, c.y);
    t[4] = tmp.first;
    t[5] = tmp.second;
    tmp = prod(-b.y, c.x);
    t[6] = tmp.first;
    t[7] = tmp.second;
    tmp = prod(b.y, a.x);
    t[8] = tmp.first;
    t[9] = tmp.second;
    tmp = prod(a.y, c.x);
    t[10] = tmp.first;
    t[11] = tmp.second;

    exp_sum(t, t + 2, 2, 2);
    exp_sum(t + 4, t + 6, 2, 2);
    exp_sum(t + 8, t + 10, 2, 2);
    exp_sum(t, t + 4, 4, 4);
    exp_sum(t, t + 8, 8, 4);

    for (int i = 11; i >= 0; i--)
    {
        if (t[i] > 0)
            return 1;
        if (t[i] < 0)
            return -1;
    }
    return 0;
}
コード例 #2
0
inline vector_dist_expression_op<vector_dist_expression<prp,vector_type>,boost::mpl::vector<NN,Kernel,vector_type>,VECT_APPLYKER_IN_GEN>
applyKernel_in_gen(const vector_dist_expression<prp,vector_type> & va, vector_type & vd, NN & cl, Kernel & ker)
{
	vector_dist_expression_op<vector_dist_expression<prp,vector_type>,boost::mpl::vector<NN,Kernel,vector_type>,VECT_APPLYKER_IN_GEN> exp_sum(va,cl,ker,vd);

	return exp_sum;
}
コード例 #3
0
inline vector_dist_expression_op<void,boost::mpl::vector<NN,Kernel,vector_type>,VECT_APPLYKER_IN_SIM>
applyKernel_in_sim(vector_type & vd, NN & cl, Kernel & ker)
{
	vector_dist_expression_op<void,boost::mpl::vector<NN,Kernel,vector_type>,VECT_APPLYKER_IN_SIM> exp_sum(cl,ker,vd);

	return exp_sum;
}
コード例 #4
0
inline vector_dist_expression_op<vector_dist_expression<prp1,v1>,vector_type,VECT_SUM_REDUCE>
rsum(const vector_dist_expression<prp1,v1> & va, const vector_type & vd)
{
	vector_dist_expression_op<vector_dist_expression<prp1,v1>,vector_type,VECT_SUM_REDUCE> exp_sum(va,vd);

	return exp_sum;
}