本文整理汇总了C#中Scientrace.negative方法的典型用法代码示例。如果您正苦于以下问题:C# Scientrace.negative方法的具体用法?C# Scientrace.negative怎么用?C# Scientrace.negative使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Scientrace
的用法示例。
在下文中一共展示了Scientrace.negative方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: enterReflection
public virtual double enterReflection(Scientrace.Trace trace, Scientrace.UnitVector norm, MaterialProperties previousMaterial)
{
double ti = trace.traceline.direction.angleWith(norm.negative());
double sti = Math.Sin(ti);
double cti = Math.Cos(ti);
/*debug Console.WriteLine("reflecting prev.: "+ previousObject.GetType()); Console.WriteLine("reflecting prev. material: "+ previousObject.materialproperties.GetType());*/
double n1 = previousMaterial.refractiveindex(trace);
double n2 = this.refractiveindex(trace);
//Fresnel Equations on a 50/50 distribution of parallel and perpendicular to the plane polarization
double Rs = Math.Pow(
( (n1*cti) - (n2*Math.Sqrt(1.0 - Math.Pow((n1/n2)*sti,2.0))) ) /
( (n1*cti) + (n2*Math.Sqrt(1.0 - Math.Pow((n1/n2)*sti,2.0))) )
,2.0);
double Rp = Math.Pow(
( (n1*Math.Sqrt(1.0-Math.Pow((n1/n2)*sti,2.0))) - (n2*cti) ) /
( (n1*Math.Sqrt(1.0-Math.Pow((n1/n2)*sti,2.0))) + (n2*cti) )
,2.0);
double R = (Rs+Rp)/2.0;
// Console.WriteLine("Reflection (n1/n2) = ("+n1+"/"+n2+") for angle "+ti+" is ("+Rs+"+"+Rp+")/2 ="+R);
// Console.WriteLine("Reflection "+trace.traceline.direction.trico()+"->"+norm.trico()+" for angle "+ti+" is ("+Rs+"+"+Rp+")/2 ="+R);
if (!((R>=0) && (R<1))) {
Console.WriteLine("R==null("+R+", Rs:"+Rs+" Rp:"+Rp+" n1:"+n1+" n2:"+n2+" ti:"+ti+" rpnoem:"+
((n1/n2)*sti)+") where "+this.ToString()+ " and "+previousMaterial.ToString());
}
/*StackTrace stackTrace = new StackTrace();
MethodBase methodBase = stackTrace.GetFrame(1).GetMethod();
Console.WriteLine(methodBase.Name); // e.g. */
return R;
}