我如何在C#中转换代码(请帮助我) [英] How I Convert The Code In C#(please help me)

查看:105
本文介绍了我如何在C#中转换代码(请帮助我)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

double lnR, lnG, lnB;
	double wR_temp, wG_temp, wB_temp;
	double wR, wG, wB;

	h->s = new irradiance[size];
	
	for(i = 0; i < size; i++)
	{
		lnR = lnG = lnB = 0.0;
		wR  = wG  = wB  = 0.0;
		for(j = 0; j < conf->frame_number; j++)
		{
			wR_temp = weight(b[j]->data[in_idx+R_INDEX]);
			wG_temp = weight(b[j]->data[in_idx+G_INDEX]);
			wB_temp = weight(b[j]->data[in_idx+B_INDEX]);						

			lnR += wR_temp * ( g[R_INDEX][ b[j]->data[in_idx+R_INDEX]] - conf->lnt[j]);
			lnG += wG_temp * ( g[G_INDEX][ b[j]->data[in_idx+G_INDEX]] - conf->lnt[j]);
			lnB += wB_temp * ( g[B_INDEX][ b[j]->data[in_idx+B_INDEX]] - conf->lnt[j]);

			
		}
		h->s[i].r = exp(lnR/wR);
		h->s[i].g = exp(lnG/wG);
		h->s[i].b = exp(lnB/wB);
		in_idx = in_idx + 3;
	}

推荐答案

请参阅对该问题的评论.除了我在评论中所说的以外:您甚至没有提供C ++源代码,因此-如果您需要,我们没有代码可以翻译.
一个人需要定义hbconf类型的代码,可能还有其他的东西,您的所有代码都依赖于该类型.

因此,这是为您提供的基本思想:将这些类型定义为C#classstruct类型,然后将所有的``->''替换为``.''.

—SA
Please see the comments to the question. In addition to what I said in my comment: you did not even provide the C++ source code, so — we don''t have the code to translate if for you.
One would need the code defining types of h, b, conf, and probably something else, all your code depends on.

So, here is the basic idea for you: define these types as C# class or struct types and replace all ''->'' with ''.''.

—SA


这篇关于我如何在C#中转换代码(请帮助我)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆