Exemplo n.º 1
0
Arquivo: main.cpp Projeto: CCJY/coliru
int main()
{
    Alpha a,b;

    Alpha c;

    c = a+b;

    c.print_me();


    return 0;
}
Exemplo n.º 2
0
void Tracer::evaluate_alpha(
    const Material&     material,
    const ShadingPoint& shading_point,
    Alpha&              alpha) const
{
    // Init to fully opaque.
    alpha.set(1.0f);

    // Evaluate the alpha map at the shading point.
    if (const Source* alpha_map = material.get_alpha_map())
    {
        alpha_map->evaluate(
            m_texture_cache,
            shading_point.get_uv(0),
            alpha);
    }

#ifdef WITH_OSL
    if (const ShaderGroup* sg = material.get_osl_surface())
    {
        if (sg->has_transparency())
        {
            Alpha a;
            m_shadergroup_exec.execute_transparency(
                *sg,
                shading_point,
                a);

            alpha *= a;
        }
    }
#endif
}
Exemplo n.º 3
0
    ::HRESULT __stdcall ThumbnailProvider::GetThumbnail (
        ::UINT width, ::HBITMAP * bitmap, ::WTS_ALPHATYPE * alphatype
        )
    try
    {
        Alpha alpha = Alpha::unknown();
        compute(w32::gdi::Size(width,width),32);
        const w32::gdi::Bitmap& thumbnail = fetch();
        *bitmap = thumbnail.handle();
        *alphatype = alpha.value();

        return (S_OK);
    }
    catch ( const w32::Error& error ) {
        DEBUG("GetThumbnail: w3232 unchecked error!");
        return (HRESULT_FROM_WIN32(error.code()));
    }
    catch ( ... ) {
        DEBUG("GetThumbnail: unknown failure!");
        return (E_FAIL);
    }
double Optimizer::ComputeCost(InputPtr input_image, ModelPtr model, Alpha& alpha) const
{
	double function_value = 0;
	
	int random_num = 1000;
	vector<int> triangle_ids;
	model->GenerateRandomNumbers(random_num, triangle_ids);	
	//int random_num = random_points_.size();

	for (int i = 0; i < random_num; ++i)
	{
		int id = triangle_ids[i];
    	//int id = random_points_[i];

		ivec2 pos = alpha.ComputePosition(id);
		vec3 model_color = alpha.ComputeColor(id);  // in RGB order 
		vec3 input_color = input_image->GetColor(Point(pos[0], pos[1])); // in RGB order
		vec3 diff = (model_color - input_color);
		function_value += dot(diff, diff);
	}
	return 40.0/1000*function_value;
}
double Optimizer::ComputeCost(InputPtr input_image,  Alpha& alpha) const
{
	double function_value = 0;

	for (int i = 0; i < LandmarkNum; ++i)
	{
		vec2 model_pos = alpha.ComputeLandmarkPosition(i);
		vec2 input_pos = input_image->LandmarkPosition(i);
		vec2 diff = (model_pos - input_pos);
		function_value += dot(diff, diff);
	}

	return function_value;

}
Exemplo n.º 6
0
int main(void){
  Alpha a;
  Beta b;
  a.f1();
  b.f1();
}
Exemplo n.º 7
0
void process_transparency_tree(const OSL::ClosureColor* ci, Alpha& alpha)
{
    // Convert from transparency to opacity.
    float transp = luminance(do_process_closure_id_tree(ci, TransparentID));
    alpha.set(1.0f - clamp(transp, 0.0f, 1.0f));
}
Exemplo n.º 8
0
void process_transparency_tree(const OSL::ClosureColor* ci, Alpha& alpha)
{
    // Convert from transparency to opacity.
    const float transparency = saturate(luminance(do_process_closure_id_tree(ci, TransparentID)));
    alpha.set(1.0f - transparency);
}
Exemplo n.º 9
0
Alpha::Alpha(const Alpha& New_Alpha):BasisAlpha(New_Alpha)
{
  Coefficients_ = New_Alpha.Coefficients();
}//Close copy constructor.