當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。