Esempio n. 1
0
 public static IMessage Create(IPayload payload,
                               DistributionPattern distributionPattern = DistributionPattern.Unicast,
                               byte[] correlationId = null)
 => new Message(payload)
 {
     Distribution  = distributionPattern,
     CorrelationId = correlationId ?? EmptyCorrelationId
 };
 public UniformTraceModifier(DistributionPattern distributionpattern, SpatialDistribution spatialdistribution,
                             NonzeroVector meanvector)
 {
     this.distrPattern        = distributionpattern;
     this.spatialDistribution = spatialdistribution;
     this.meanVec             = meanvector;
     meanvector.fillOrtogonalVectors(ref this.baseVec1, ref this.baseVec2);
 }
 public UniformTraceModifier(DistributionPattern distributionpattern, SpatialDistribution spatialdistribution,
                             NonzeroVector meanvector, NonzeroVector basevector1, NonzeroVector basevector2)
 {
     this.distrPattern        = distributionpattern;
     this.spatialDistribution = spatialdistribution;
     this.meanVec             = meanvector;
     this.baseVec1            = basevector1;
     this.baseVec2            = basevector2;
 }
Esempio n. 4
0
 public static IMessage Create(object payload,
                               IMessageIdentifier messageIdentifier,
                               byte[]?correlationId = default,
                               DistributionPattern distributionPattern = DistributionPattern.Unicast,
                               IMessageSerializer?serializer           = default !)
 => new Message(payload, messageIdentifier, serializer)
 {
     Distribution  = distributionPattern,
     CorrelationId = correlationId ?? EmptyCorrelationId
 };
Esempio n. 5
0
        public void MessageDistribution_IsConsistentlyTransferredViaMultipartMessage(DistributionPattern distributionPattern)
        {
            var message = Message.Create(new SimpleMessage(), distributionPattern).As <Message>();

            var multipart = new MultipartMessage(message);

            message = Message.FromMultipartMessage(multipart);

            Assert.AreEqual(distributionPattern, message.Distribution);
        }
Esempio n. 6
0
        public TestLight(Scientrace.Object3dEnvironment env, DistributionPattern dispat, SpatialDistribution spadis, Scientrace.NonzeroVector mean_direction, double maxangle, int raycount) : base(env)
        {
            /*UniformTraceModifier utm =  new UniformTraceModifier(
             *      //DistributionPattern.ProjectedSpiralGrid,
             *      //DistributionPattern.SphericalSpiralGrid,
             *      DistributionPattern.SingleCircle,
             *      //DistributionPattern.SquareGrid,
             *
             *      //SpatialDistribution.UniformProjections,
             *      SpatialDistribution.UniformAngles,
             *      new Scientrace.NonzeroVector(1,0,0),
             *      new Scientrace.NonzeroVector(0,1,0),
             *      new Scientrace.NonzeroVector(0,0,1));*/

            UniformTraceModifier utm = new UniformTraceModifier(
                dispat, spadis,
                mean_direction);

            utm.setMaxAngle(maxangle);
            //Console.WriteLine("MAXANGLEJ: "+(maxangle*180/Math.PI));
            //Console.WriteLine("MAXANGLEK: "+(utm.maxangle*180/Math.PI));
            int arraysize = raycount;

            double[] wavelengths = new double[arraysize];
            for (int k = 0; k < arraysize; k++)
            {
                wavelengths[k] = 400E-9;
            }

            /*double[] wavelengths = new double[100]{400E-9, 400E-9, 400E-9, 400E-9, 400E-9,
             *                                                                      400E-9, 400E-9, 400E-9, 400E-9, 400E-9,
             *                                                                      400E-9, 400E-9, 400E-9, 400E-9, 400E-9,
             *                                                                      400E-9, 400E-9, 400E-9, 400E-9, 400E-9,
             *                                                                      400E-9, 400E-9, 400E-9, 400E-9, 400E-9,
             *                                                                      400E-9, 400E-9, 400E-9, 400E-9, 400E-9,
             *                                                                      400E-9, 400E-9, 400E-9, 400E-9, 400E-9,
             *                                                                      400E-9, 400E-9, 400E-9, 400E-9, 400E-9,
             *                                                                      400E-9, 400E-9, 400E-9, 400E-9, 400E-9,
             *                                                                      400E-9, 400E-9, 400E-9, 400E-9, 400E-9,
             *                                                                      400E-9, 400E-9, 400E-9, 400E-9, 400E-9,
             *                                                                      400E-9, 400E-9, 400E-9, 400E-9, 400E-9,
             *                                                                      400E-9, 400E-9, 400E-9, 400E-9, 400E-9,
             *                                                                      400E-9, 400E-9, 400E-9, 400E-9, 400E-9,
             *                                                                      400E-9, 400E-9, 400E-9, 400E-9, 400E-9,
             *                                                                      400E-9, 400E-9, 400E-9, 400E-9, 400E-9,
             *                                                                      400E-9, 400E-9, 400E-9, 400E-9, 400E-9,
             *                                                                      400E-9, 400E-9, 400E-9, 400E-9, 400E-9,
             *                                                                      400E-9, 400E-9, 400E-9, 400E-9, 400E-9,
             *                                                                      400E-9, 400E-9, 400E-9, 400E-9, 400E-9}; */

/*		double[] wavelengths = new double[15]{400E-9, 400E-9, 400E-9, 400E-9, 400E-9,
 *                                                                                      400E-9, 400E-9, 400E-9, 400E-9, 400E-9,
 *                                                                                      400E-9, 400E-9, 400E-9, 400E-9, 400E-9};*/

            List <Scientrace.Location> locs = this.getLocs();

            int i = 0;

            foreach (double lambda in wavelengths)
            {
                //Scientrace.Line ray = new Line(new Location(0, 0.0, 0.0), utm.modify(++i,wavelengths.Length).toUnitVector()); //start at node 1 -> ++i !
                //this.traces.Add(new Scientrace.Trace(lambda, this, ray, env, 1 ,1));
                foreach (Location aLoc in locs)
                {
                    this.addTracesLoc(lambda, aLoc, utm, env, i++, wavelengths.Length);
                }
            }
        }
Esempio n. 7
0
        public UniformTraceModifier(DistributionPattern distributionpattern, SpatialDistribution spatialdistribution,
				NonzeroVector meanvector)
        {
            this.distrPattern = distributionpattern;
            this.spatialDistribution = spatialdistribution;
            this.meanVec = meanvector;
            meanvector.fillOrtogonalVectors(ref this.baseVec1, ref this.baseVec2);
        }
Esempio n. 8
0
        public UniformTraceModifier(DistributionPattern distributionpattern, SpatialDistribution spatialdistribution,
				NonzeroVector meanvector, NonzeroVector basevector1, NonzeroVector basevector2)
        {
            this.distrPattern = distributionpattern;
            this.spatialDistribution = spatialdistribution;
            this.meanVec = meanvector;
            this.baseVec1 = basevector1;
            this.baseVec2 = basevector2;
        }
Esempio n. 9
0
 public UniformTraceModifier(DistributionPattern distributionpattern, SpatialDistribution spatialdistribution)
 {
     this.distrPattern = distributionpattern;
     this.spatialDistribution = spatialdistribution;
 }
Esempio n. 10
0
 /* <<< LINEAR MODIFIERS ATTRIBUTES */
 /// <summary>
 /// plain argumentless constructor: preferentially use argumented constructors for this class
 /// </summary>
 public UniformTraceModifier()
 {
     //set some default values
     this.distrPattern = DistributionPattern.ProjectedSpiralGrid;
     this.spatialDistribution = SpatialDistribution.UniformProjections;
 }
 public UniformTraceModifier(DistributionPattern distributionpattern, SpatialDistribution spatialdistribution)
 {
     this.distrPattern        = distributionpattern;
     this.spatialDistribution = spatialdistribution;
 }
        /* <<< LINEAR MODIFIERS ATTRIBUTES */


        /// <summary>
        /// plain argumentless constructor: preferentially use argumented constructors for this class
        /// </summary>
        public UniformTraceModifier()
        {
            //set some default values
            this.distrPattern        = DistributionPattern.ProjectedSpiralGrid;
            this.spatialDistribution = SpatialDistribution.UniformProjections;
        }
Esempio n. 13
0
        public TestLight(Scientrace.Object3dEnvironment env, DistributionPattern dispat, SpatialDistribution spadis, Scientrace.NonzeroVector mean_direction, double maxangle, int raycount)
            : base(env)
        {
            /*UniformTraceModifier utm =  new UniformTraceModifier(
            //DistributionPattern.ProjectedSpiralGrid,
            //DistributionPattern.SphericalSpiralGrid,
            DistributionPattern.SingleCircle,
            //DistributionPattern.SquareGrid,

            //SpatialDistribution.UniformProjections,
            SpatialDistribution.UniformAngles,
            new Scientrace.NonzeroVector(1,0,0),
            new Scientrace.NonzeroVector(0,1,0),
            new Scientrace.NonzeroVector(0,0,1));*/

            UniformTraceModifier utm =  new UniformTraceModifier(
            dispat, spadis,
            mean_direction);
            utm.setMaxAngle(maxangle);
                //Console.WriteLine("MAXANGLEJ: "+(maxangle*180/Math.PI));
                //Console.WriteLine("MAXANGLEK: "+(utm.maxangle*180/Math.PI));
            int arraysize = raycount;
            double[] wavelengths = new double[arraysize];
            for (int k=0; k<arraysize; k++) {
            wavelengths[k] = 400E-9;
            }

            /*double[] wavelengths = new double[100]{400E-9, 400E-9, 400E-9, 400E-9, 400E-9,
                                            400E-9, 400E-9, 400E-9, 400E-9, 400E-9,
                                            400E-9, 400E-9, 400E-9, 400E-9, 400E-9,
                                            400E-9, 400E-9, 400E-9, 400E-9, 400E-9,
                                            400E-9, 400E-9, 400E-9, 400E-9, 400E-9,
                                            400E-9, 400E-9, 400E-9, 400E-9, 400E-9,
                                            400E-9, 400E-9, 400E-9, 400E-9, 400E-9,
                                            400E-9, 400E-9, 400E-9, 400E-9, 400E-9,
                                            400E-9, 400E-9, 400E-9, 400E-9, 400E-9,
                                            400E-9, 400E-9, 400E-9, 400E-9, 400E-9,
                                            400E-9, 400E-9, 400E-9, 400E-9, 400E-9,
                                            400E-9, 400E-9, 400E-9, 400E-9, 400E-9,
                                            400E-9, 400E-9, 400E-9, 400E-9, 400E-9,
                                            400E-9, 400E-9, 400E-9, 400E-9, 400E-9,
                                            400E-9, 400E-9, 400E-9, 400E-9, 400E-9,
                                            400E-9, 400E-9, 400E-9, 400E-9, 400E-9,
                                            400E-9, 400E-9, 400E-9, 400E-9, 400E-9,
                                            400E-9, 400E-9, 400E-9, 400E-9, 400E-9,
                                            400E-9, 400E-9, 400E-9, 400E-9, 400E-9,
                                            400E-9, 400E-9, 400E-9, 400E-9, 400E-9}; */

            /*		double[] wavelengths = new double[15]{400E-9, 400E-9, 400E-9, 400E-9, 400E-9,
                                            400E-9, 400E-9, 400E-9, 400E-9, 400E-9,
                                            400E-9, 400E-9, 400E-9, 400E-9, 400E-9};*/

            List<Scientrace.Location> locs = this.getLocs();

            int i = 0;
            foreach (double lambda in wavelengths) {
            //Scientrace.Line ray = new Line(new Location(0, 0.0, 0.0), utm.modify(++i,wavelengths.Length).toUnitVector()); //start at node 1 -> ++i !
            //this.traces.Add(new Scientrace.Trace(lambda, this, ray, env, 1 ,1));
            foreach (Location aLoc in locs) {
                this.addTracesLoc(lambda, aLoc, utm, env, i++, wavelengths.Length);
                }
            }
        }