public Graph(System.Windows.Forms.PictureBox pictureBox, Xi xi, Eta eta, Function function) { _pictureBox = pictureBox; _xi = xi; _eta = eta; _function = function; }
public void Visualize(System.Windows.Forms.PictureBox pictureBox, Xi xi, Eta eta, System.Windows.Forms.PaintEventArgs e, List <Tuple <float, float> > values) { System.Drawing.Pen pen = new System.Drawing.Pen(System.Drawing.Color.Red); Func f = _function.Func; foreach (Tuple <float, float> record in values) { float x = record.Item1, xnew = record.Item2; e.Graphics.DrawLine ( pen, new System.Drawing.PointF(xi(x), eta(0)), new System.Drawing.PointF(xi(x), eta(f(x))) ); e.Graphics.DrawLine ( pen, new System.Drawing.PointF(xi(x), eta(f(x))), new System.Drawing.PointF(xi(xnew), eta(0)) ); } }
void Start() { _texPw = new Texture2D(n, n, TextureFormat.RGBA32, false, true); _texEtaX = new Texture2D(n, n, TextureFormat.RGBA32, false, true); _texEtaY = new Texture2D(n, n, TextureFormat.RGBA32, false, true); _cPw = _texPw.GetPixels(); _cEtaX = _texEtaX.GetPixels(); _cEtaY = _texEtaY.GetPixels(); displacementMat.SetFloat("_L", L); floatDecoderMat.SetFloat("_L", L); floatDecoderMat.SetTexture("_XTex", _texEtaX); floatDecoderMat.SetTexture("_YTex", _texEtaY); floatDecoderMat.SetTexture("_ZTex", _texPw); _texUvw = new RenderTexture(n, n, 0, RenderTextureFormat.ARGBFloat, RenderTextureReadWrite.Linear); displacementMat.mainTexture = _texUvw; _k = new K(n, L); _phillips = new Phillips(_k, wind.magnitude, wind.normalized); _h0 = new H0(_phillips); _w = new W(_k); _h = new H(_h0, _w); _eta = new Eta(n, _k, _h); _fft = new FFT(n); _pw = new float[2 * n * n]; _etaX = new float[_pw.Length]; _etaY = new float[_pw.Length]; }
public void bind_nondefault_constructors_complex() { // Demonstrates that an object with a nondefault constructor // can be populated with a complex object like Eta PropertyTreeReader pt = LoadContent("iota.xml"); Assert.True(pt.Read()); Iota i = pt.Bind <Iota>(); Assert.Equal(8256, i.A); Assert.Equal(TimeSpan.Parse("82.5:05:05.200"), i.B); Assert.Equal(82256.231250002, i.C); Assert.Equal(8293680235, i.D); Assert.Equal("Typedescriptor", i.F); Assert.Equal(new Uri("http://carbonfrost.com"), i.G); Eta e = i.E; Assert.Equal(256, e.A); Assert.Equal(TimeSpan.Parse("2.5:05:05.200"), e.B); Assert.Equal(2256.231250002, e.C); Assert.Equal(293680235, e.D); }
void Start() { _texPw = new Texture2D(n, n, TextureFormat.RGBA32, false, true); _texEtaX = new Texture2D(n, n, TextureFormat.RGBA32, false, true); _texEtaY = new Texture2D(n, n , TextureFormat.RGBA32, false, true); _cPw = _texPw.GetPixels(); _cEtaX = _texEtaX.GetPixels(); _cEtaY = _texEtaY.GetPixels(); displacementMat.SetFloat("_L", L); floatDecoderMat.SetFloat("_L", L); floatDecoderMat.SetTexture("_XTex", _texEtaX); floatDecoderMat.SetTexture("_YTex", _texEtaY); floatDecoderMat.SetTexture("_ZTex", _texPw); _texUvw = new RenderTexture(n, n, 0, RenderTextureFormat.ARGBFloat, RenderTextureReadWrite.Linear); displacementMat.mainTexture = _texUvw; _k = new K(n, L); _phillips = new Phillips(_k, wind.magnitude, wind.normalized); _h0 = new H0(_phillips); _w = new W(_k); _h = new H(_h0, _w); _eta = new Eta(n, _k, _h); _fft = new FFT(n); _pw = new float[2 * n * n]; _etaX = new float[_pw.Length]; _etaY = new float[_pw.Length]; }
public void bind_nondefault_constructors() { // Demonstrates that an object with a nondefault constructor // can be populated with arbitrary simple values PropertyTreeReader pt = LoadContent("eta.xml"); Assert.True(pt.Read()); Eta e = pt.Bind <Eta>(); Assert.Equal(256, e.A); Assert.Equal(TimeSpan.Parse("2.5:05:05.200"), e.B); Assert.Equal(2256.231250002, e.C); Assert.Equal(293680235, e.D); }
/// <summary> /// Serves as a hash function for a particular type. /// </summary> /// <returns> /// A hash code for the current <see cref="T:System.Object"/>. /// </returns> /// <filterpriority>2</filterpriority> public override int GetHashCode() { unchecked { int result = Id; result = (result * 397) ^ (State != null ? State.GetHashCode() : 0); result = (result * 397) ^ StateEnum.GetHashCode(); result = (result * 397) ^ Project; result = (result * 397) ^ Run; result = (result * 397) ^ Clone; result = (result * 397) ^ Gen; result = (result * 397) ^ (Core != null ? Core.GetHashCode() : 0); result = (result * 397) ^ (UnitId != null ? UnitId.GetHashCode() : 0); result = (result * 397) ^ (PercentDone != null ? PercentDone.GetHashCode() : 0); result = (result * 397) ^ TotalFrames; result = (result * 397) ^ FramesDone; result = (result * 397) ^ (Assigned != null ? Assigned.GetHashCode() : 0); result = (result * 397) ^ (AssignedDateTime.HasValue ? AssignedDateTime.Value.GetHashCode() : 0); result = (result * 397) ^ (Timeout != null ? Timeout.GetHashCode() : 0); result = (result * 397) ^ (TimeoutDateTime.HasValue ? TimeoutDateTime.Value.GetHashCode() : 0); result = (result * 397) ^ (Deadline != null ? Deadline.GetHashCode() : 0); result = (result * 397) ^ (DeadlineDateTime.HasValue ? DeadlineDateTime.Value.GetHashCode() : 0); result = (result * 397) ^ (WorkServer != null ? WorkServer.GetHashCode() : 0); result = (result * 397) ^ (WorkServerIPAddress != null ? WorkServerIPAddress.GetHashCode() : 0); result = (result * 397) ^ (CollectionServer != null ? CollectionServer.GetHashCode() : 0); result = (result * 397) ^ (CollectionServerIPAddress != null ? CollectionServerIPAddress.GetHashCode() : 0); result = (result * 397) ^ (WaitingOn != null ? WaitingOn.GetHashCode() : 0); result = (result * 397) ^ Attempts; result = (result * 397) ^ (NextAttempt != null ? NextAttempt.GetHashCode() : 0); result = (result * 397) ^ (NextAttemptTimeSpan.HasValue ? NextAttemptTimeSpan.Value.GetHashCode() : 0); result = (result * 397) ^ Slot; result = (result * 397) ^ (Eta != null ? Eta.GetHashCode() : 0); result = (result * 397) ^ (EtaTimeSpan.HasValue ? EtaTimeSpan.Value.GetHashCode() : 0); result = (result * 397) ^ Ppd.GetHashCode(); result = (result * 397) ^ (Tpf != null ? Tpf.GetHashCode() : 0); result = (result * 397) ^ (TpfTimeSpan.HasValue ? TpfTimeSpan.Value.GetHashCode() : 0); result = (result * 397) ^ BaseCredit.GetHashCode(); result = (result * 397) ^ CreditEstimate.GetHashCode(); result = (result * 397) ^ (Description != null ? Description.GetHashCode() : 0); return(result); } }
public virtual PolizzaDatiResponse GetDatiPolizza(PolizzaDatiResponse datiResponse) { DatiDiPolizza datiDiPolizza = new DatiDiPolizza() { Durata = Durata.ToString(), Eta = Eta.ToString(), TipoRata = TipoRata }; DatiCalcolati datiCalcolati = new DatiCalcolati() { PremioFondo1 = _datiResponse.PremioFondo1.ToString(), PremioFondo2 = _datiResponse.PremioFondo2.ToString(), PremioFondoGS = _datiResponse.PremioFondoGS.ToString(), PremioLordo = _datiResponse.PremioLordo.ToString(), PremioNetto = _datiResponse.PremioNetto.ToString() }; _datiResponse.DatiDiPolizza = datiDiPolizza; _datiResponse.DatiCalcolati = datiCalcolati; return(_datiResponse); }
public void ComputeScatteringFunctions(SurfaceInteraction si, IObjectArena arena, TransportMode mode, bool allowMultipleLobes) { BumpMap?.Bump(si); si.BSDF.Initialize(si); // Diffuse var c = Color.Evaluate(si).Clamp(); var metallicWeight = Metallic.Evaluate(si); var e = Eta.Evaluate(si); var strans = SpecTrans.Evaluate(si); var diffuseWeight = (1f - metallicWeight) * (1f - strans); var dt = DiffTrans.Evaluate(si) / 2f; var rough = Roughness.Evaluate(si); var lum = c.YComponent(); var Ctint = lum > 0f ? c / lum : Spectrum.One; if (diffuseWeight > 0f) { if (IsThin) { var flat = Flatness.Evaluate(si); si.BSDF.Add(arena.Create <DisneyDiffuse>().Initialize(diffuseWeight * (1f - flat) * (1 - dt) * c)); si.BSDF.Add(arena.Create <DisneyFakeSS>().Initialize(diffuseWeight * flat * (1f - dt) * c, rough)); } else { var sd = ScatterDistance.Evaluate(si); if (sd.IsBlack()) { si.BSDF.Add(arena.Create <DisneyDiffuse>().Initialize(diffuseWeight * c)); } else { // The line below was the original code but produces some odd results. si.BSDF.Add(arena.Create <SpecularTransmission>().Initialize(Spectrum.One, 1f, e, mode)); si.BSSRDF = arena.Create <DisneyBSSRDF>().Initialize(diffuseWeight * c, sd, si, e, this, mode); } } // Retro-reflection. si.BSDF.Add(arena.Create <DisneyRetro>().Initialize(diffuseWeight * c, rough)); // Sheen var sheenWeight = Sheen.Evaluate(si); if (sheenWeight > 0f) { var stint = SheenTint.Evaluate(si); var Csheen = Spectrum.Lerp(Spectrum.One, Ctint, stint); si.BSDF.Add(arena.Create <DisneySheen>().Initialize(diffuseWeight * sheenWeight * Csheen)); } } // Microfacet distribution var aspect = Sqrt(1f - Anisotropic.Evaluate(si) * 0.9f); var ax = Max(0.001f, Sqr(rough) / aspect); var ay = Max(0.001f, Sqr(rough) * aspect); var dist = arena.Create <DisneyMicrofacetDistribution>().Initialize(ax, ay); // Specular = Trowbridge-Reitz with modified Fresnel function. var specTint = SpecularTint.Evaluate(si); var Cspec0 = Spectrum.Lerp(SchlickR0FromEta(e) * Spectrum.Lerp(Spectrum.One, Ctint, specTint), c, metallicWeight); var fresnel = arena.Create <DisneyFresnel>().Initialize(Cspec0, metallicWeight, e); si.BSDF.Add(arena.Create <MicrofacetReflection>().Initialize(c, dist, fresnel)); // Clearcoat var cc = Clearcoat.Evaluate(si); if (cc > 0f) { si.BSDF.Add(arena.Create <DisneyClearcoat>() .Initialize(cc, Lerp(0.1f, 0.001f, ClearcoatGloss.Evaluate(si)))); } // BTDF if (strans > 0f) { // Walter et al's model, with the provided transmissive term scaled // by sqrt(color), so that after two refractions, we're back to the // provided color. var T = strans * c.Sqrt(); if (IsThin) { var rScaled = (0.65f * e - 0.35f) * rough; var atx = Max(0.001f, Sqr(rScaled) / aspect); var aty = Max(0.001f, Sqr(rScaled) * aspect); var scaledDist = arena.Create <TrowbridgeReitzDistribution>().Initialize(atx, aty); si.BSDF.Add(arena.Create <MicrofacetTransmission>().Initialize(T, scaledDist, 1f, e, mode)); } else { si.BSDF.Add(arena.Create <MicrofacetTransmission>().Initialize(T, dist, 1f, e, mode)); } } if (IsThin) { si.BSDF.Add(arena.Create <LambertianTransmission>().Initialize(dt * c)); } }