Пример #1
0
            protected void Reset(long size)
            {
                this.x = Generate.Random(size);
                this.y = Generate.Random(size);
                this.z = Generate.Random(size) * (TData)0.01;

                var dist = 1f / Sqrt.Apply((this.x.Pow(2f) + this.y.Pow(2f) + this.z.Pow(2f)));

                dist = dist - (TData)(0.8f - (new Random().NextDouble() * 0.1f));

                this.x = XMAX * this.x * dist * Sign.Apply(.5f - Generate.Random(size));
                this.y = YMAX * this.y * dist * Sign.Apply(.5f - Generate.Random(size));
                this.z = ZMAX * this.z * dist * Sign.Apply(.5f - Generate.Random(size));

                var magv     = Cirklev(this.x, this.y, this.z);
                var absangle = Atan.Apply(Abs.Apply(this.y / this.x));
                var thetav   = (TData)(Math.PI / 2) - absangle;

                this.vx = (TData)(-1) * Sign.Apply(this.y) * Cos.Apply(thetav) * magv;
                this.vy = Sign.Apply(this.x) * Sin.Apply(thetav) * magv;
                this.vz = Generate.Zeroes(size);
            }