当前位置: 首页>>代码示例>>C#>>正文


C# System.Double类代码示例

本文整理汇总了C#中System.Double的典型用法代码示例。如果您正苦于以下问题:C# Double类的具体用法?C# Double怎么用?C# Double使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Double类属于System命名空间,在下文中一共展示了Double类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Bullet

        //public:
        public Bullet(Double x_, Double y_, Int32 width_, Int32 height_, Int32 damage_, BulletKind kind_)
        {
            PosX = x_;
            PosY = y_;
            Width = width_;
            Height = height_;
            switch (kind_)
            {
                case BulletKind.Laser:
                    {
                        _type = BulletType.Laser;
                        break;
                    }
                case BulletKind.Exploded:
                    {
                        _type = BulletType.Exploded;
                        break;
                    }
                case BulletKind.Rocket:
                    {
                        _type = BulletType.Rocket;
                        break;
                    }
            }
            Damage = damage_+_type._bonusdamage;
            _active = true;

            _vx = 1; _vy = 0;
            _speed = _type.speed;
        }
开发者ID:porcellus,项目名称:UniScrollShooter,代码行数:31,代码来源:Bullet.cs

示例2: RotateImage

        /// <summary>
        /// Rotate an image on a point with a specified angle
        /// </summary>
		/// <param name="pe">The paint area event where the image will be displayed</param>
		/// <param name="img">The image to display</param>
		/// <param name="alpha">The angle of rotation in radian</param>
		/// <param name="ptImg">The location of the left upper corner of the image to display in the paint area in nominal situation</param>
		/// <param name="ptRot">The location of the rotation point in the paint area</param>
		/// <param name="scaleFactor">Multiplication factor on the display image</param>
        protected void RotateImage(PaintEventArgs pe, Image img, Double alpha, Point ptImg, Point ptRot, float scaleFactor)
        {
            double beta = 0; 	// Angle between the Horizontal line and the line (Left upper corner - Rotation point)
            double d = 0;		// Distance between Left upper corner and Rotation point)		
            float deltaX = 0;	// X componant of the corrected translation
            float deltaY = 0;	// Y componant of the corrected translation

			// Compute the correction translation coeff
            if (ptImg != ptRot)
            {
				//
                if (ptRot.X != 0)
                {
                    beta = Math.Atan((double)ptRot.Y / (double)ptRot.X);
                }

                d = Math.Sqrt((ptRot.X * ptRot.X) + (ptRot.Y * ptRot.Y));

                // Computed offset
                deltaX = (float)(d * (Math.Cos(alpha - beta) - Math.Cos(alpha) * Math.Cos(alpha + beta) - Math.Sin(alpha) * Math.Sin(alpha + beta)));
                deltaY = (float)(d * (Math.Sin(beta - alpha) + Math.Sin(alpha) * Math.Cos(alpha + beta) - Math.Cos(alpha) * Math.Sin(alpha + beta)));
            }

            // Rotate image support
            pe.Graphics.RotateTransform((float)(alpha * 180 / Math.PI));

            // Dispay image
            pe.Graphics.DrawImage(img, (ptImg.X + deltaX) * scaleFactor, (ptImg.Y + deltaY) * scaleFactor, img.Width * scaleFactor, img.Height * scaleFactor);

            // Put image support as found
            pe.Graphics.RotateTransform((float)(-alpha * 180 / Math.PI));

        }
开发者ID:suas-anadolu,项目名称:groundstation,代码行数:42,代码来源:InstrumentControl.cs

示例3: operator_click

 private void operator_click(object sender, EventArgs e)
 {
     Button b = (Button)sender;  //"convert" our object to the button
     operation = b.Text; //storing the operator user clicked
     value = Double.Parse(result.Text); // converting the value that is in our texfield into double and storing it
     operation_pressed = true;     
 }
开发者ID:KirillKudaev,项目名称:BasicCalculator,代码行数:7,代码来源:Form1.cs

示例4: PdfAxialShading

        ////////////////////////////////////////////////////////////////////
        /// <summary>
        /// PDF axial shading constructor.
        /// </summary>
        /// <param name="Document">Parent PDF document object</param>
        /// <param name="PosX">Position X</param>
        /// <param name="PosY">Position Y</param>
        /// <param name="Width">Width</param>
        /// <param name="Height">Height</param>
        /// <param name="ShadingFunction">Shading function</param>
        ////////////////////////////////////////////////////////////////////
        public PdfAxialShading(
			PdfDocument		Document,
			Double			PosX,
			Double			PosY,
			Double			Width,
			Double			Height,
			PdfShadingFunction	ShadingFunction
			)
            : base(Document)
        {
            // create resource code
            ResourceCode = Document.GenerateResourceNumber('S');

            // color space red, green and blue
            Dictionary.Add("/ColorSpace", "/DeviceRGB");

            // shading type axial
            Dictionary.Add("/ShadingType", "2");

            // bounding box
            Dictionary.AddRectangle("/BBox", PosX, PosY, PosX + Width, PosY + Height);

            // assume the direction of color change is along x axis
            Dictionary.AddRectangle("/Coords", PosX, PosY, PosX + Width, PosY);

            // add shading function to shading dictionary
            Dictionary.AddIndirectReference("/Function", ShadingFunction);
            return;
        }
开发者ID:UnionMexicanaDelNorte,项目名称:cheques,代码行数:40,代码来源:PdfAxialShading.cs

示例5: PercentageOf

        /// <summary>
        ///     Gets the specified percentage of the number.
        /// </summary>
        /// <param name="number">The number.</param>
        /// <param name="percent">The percent.</param>
        /// <returns>Returns the specified percentage of the number</returns>
        public static Double PercentageOf( this Int64 number, Double percent )
        {
            if ( number <= 0 )
                throw new DivideByZeroException( "The number must be greater than zero." );

            return number * percent / 100;
        }
开发者ID:MannusEtten,项目名称:Extend,代码行数:13,代码来源:Int64.PercentageOf.cs

示例6: MapObject

 public MapObject(MapObjectKind kind, Double x, Double y, Double r)
 {
     this.kind = kind;
     this.x = x;
     this.y = y;
     this.r = r;
 }
开发者ID:VitalyKalinkin,项目名称:ICFP,代码行数:7,代码来源:MapObject.cs

示例7: point

        // accept either a POINT(X Y) or a "X Y"
        public point(String ps)
        {
            if (ps.StartsWith(geomType, StringComparison.InvariantCultureIgnoreCase))
            {
                // remove point, and matching brackets
                ps = ps.Substring(geomType.Length);
                if (ps.StartsWith("("))
                {
                    ps = ps.Substring(1);
                }
                if (ps.EndsWith(")"))
                {
                    ps = ps.Remove(ps.Length - 1);
                }

            }
            ps = ps.Trim(); // trim leading and trailing spaces
            String[] coord = ps.Split(CoordSeparator.ToCharArray());
            if (coord.Length == 2)
            {
                X = Double.Parse(coord[0]);
                Y = Double.Parse(coord[1]);
            }
            else
            {
                throw new WaterOneFlowException("Could not create a point. Coordinates are separated by a space 'X Y'");
            }
        }
开发者ID:CUAHSI,项目名称:CUAHSI-GenericWOF_vs2013,代码行数:29,代码来源:point.cs

示例8: Request

 public Request(Uri url, String director, ref DownloadHandler dlHandler, Double lastVersion)
 {
     this.url = url;
     this.director = director;
     this.dlHandler = dlHandler;
     this.lastVersion = lastVersion;
 }
开发者ID:BenDol,项目名称:RocketLauncher,代码行数:7,代码来源:Request.cs

示例9: LeastSquaresRuntime

 public LeastSquaresRuntime(Double[,] trainingSet, Double[,] trainingOutput, Double[,] testSet, int[] expected)
 {
     this.trainingSet = trainingSet;
     this.trainingOutput = trainingOutput;
     this.testSet = testSet;
     this.expected = expected;
 }
开发者ID:salufa,项目名称:MachineLearning,代码行数:7,代码来源:LeastSquaresRuntime.cs

示例10: Get

 public override Double Get(Double x, Double y, Double z)
 {
     return this.Source.Get(
         x * this.XScale.Get(x, y, z), 
         y * this.YScale.Get(x, y, z), 
         z * this.ZScale.Get(x, y, z));
 }
开发者ID:Cyberbanan,项目名称:WorldGeneratorFinal,代码行数:7,代码来源:ImplicitScaleDomain.cs

示例11: Etiqueta

        public Etiqueta(String partnumber,String descricao,Int64 ean13,String lote,Int32 sequencia,Double quantidade,Tipo tipoEtiqueta)
        {
            switch (tipoEtiqueta )
            {
                case Tipo.QRCODE:

                    PartnumberEtiqueta = partnumber;
                    DescricaoProdutoEtiqueta = descricao;
                    Ean13Etiqueta = ean13;
                    LoteEtiqueta = lote;
                    SequenciaEtiqueta = sequencia;
                    QuantidadeEtiqueta = quantidade;
                    DataHoraValidacao = DateTime.Now;
                    TipoEtiqueta = Tipo.QRCODE;
                    break;

                case Tipo.BARRAS:

                    PartnumberEtiqueta = partnumber;
                    DescricaoProdutoEtiqueta = descricao;
                    Ean13Etiqueta = ean13;
                    LoteEtiqueta = lote;
                    SequenciaEtiqueta = 0;
                    QuantidadeEtiqueta = quantidade;
                    DataHoraValidacao = DateTime.Now;
                    TipoEtiqueta = Tipo.BARRAS;
                    break;

                default:
                    break;
            }
        }
开发者ID:NewprogSoftwares,项目名称:Coletor,代码行数:32,代码来源:Etiqueta.cs

示例12: ModerationBan

 internal ModerationBan(ModerationBanType Type, string Variable, string ReasonMessage, Double Expire)
 {
     this.Type = Type;
     this.Variable = Variable;
     this.ReasonMessage = ReasonMessage;
     this.Expire = Expire;
 }
开发者ID:BjkGkh,项目名称:R106,代码行数:7,代码来源:ModerationBan.cs

示例13: StimTrain

        internal StimTrain(Int32 pulseWidth, Double amplitude, List<Int32> channels, List<Int32> interpulseIntervals)
        {
            //Interpulse intervals come in as us

            this.channel = new List<int>(channels.Count);
            for (int i = 0; i < channels.Count; ++i)
                this.channel.Add(channels[i]);

            width1 = new List<int>(channels.Count);
            width2 = new List<int>(channels.Count);
            interphaseLength = new List<int>(channels.Count);
            prePadding = new List<int>(channels.Count);
            postPadding = new List<int>(channels.Count);
            amp1 = new List<double>(channels.Count);
            amp2 = new List<double>(channels.Count);
            offsetVoltage = new List<double>(channels.Count);
            this.interpulseIntervals = new List<Int32>(interpulseIntervals.Count);

            for (int c = 0; c < channels.Count; ++c)
            {
                width1.Add(pulseWidth);
                width2.Add(pulseWidth);
                amp1.Add(amplitude);
                amp2.Add(-amplitude);

                offsetVoltage.Add(0.0); //Default to no offset voltage

                interphaseLength.Add(0);
                prePadding.Add(Convert.ToInt32((double)StimPulse.STIM_SAMPLING_FREQ * (double)100 / 1000000)); //Fix at 100 us
                postPadding.Add(Convert.ToInt32((double)StimPulse.STIM_SAMPLING_FREQ * (double)100 / 1000000)); //Fix at 100 us
            }
            for (int c = 0; c < interpulseIntervals.Count; ++c) //There'll be one less
                this.interpulseIntervals.Add(Convert.ToInt32((double)StimPulse.STIM_SAMPLING_FREQ * (double)interpulseIntervals[c] / 1000));
        }
开发者ID:rzellertownson,项目名称:neurorighter,代码行数:34,代码来源:StimTrain.cs

示例14: Polygon2D

 public Polygon2D(int s, Point3d c, Double a)
 {
     this.Sides = s;
     this.Center = c;
     this.Apotema = a;
     CreateGeometry();
 }
开发者ID:JOndarza,项目名称:CAD,代码行数:7,代码来源:Polygon2D.cs

示例15: TDerivedClass

 //
 //**********************************************************************************************
 //
 // Class TDerivedClass
 //   Part of  : TDRFree
 //   Function : Class definition of the derived property
 //   Author   : Jan G. Wesseling
 //   Date     : April 9th, 2013
 //
 //**********************************************************************************************
 //
 public TDerivedClass(Double aLow, Double aHigh, Int32 aR, Int32 aG, Int32 aB, String aName)
 {
     LowLimit = aLow;
       HighLimit = aHigh;
       TheColor = System.Drawing.Color.FromArgb(aR, aG, aB);
       TheName = aName;
 }
开发者ID:BFL-JGW,项目名称:TDRFree,代码行数:18,代码来源:TDerivedClass.cs


注:本文中的System.Double类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。