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


C# System.Line类代码示例

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


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

示例1: Impulse

 public void Impulse(Line force)
 {
     var div = force / Mass;
     var cross = (CenterOfMass - force.Start).Normalize().Dot(div.Normalize());
     DTheta -= div.Length * cross / 3;
     Velocity += div * (1 - cross);
 }
开发者ID:kgroat,项目名称:AcculturationPhysics,代码行数:7,代码来源:PhysicsObject.cs

示例2: OnLoadScene

        public override Scene OnLoadScene()
        {
            this.mEngine.RegisterUpdateHandler(new FPSLogger());

            Scene scene = new Scene(1);
            scene.Background = new ColorBackground(0.09804f, 0.6274f, 0.8784f);

            Random random = new Random(RANDOM_SEED);

            for (int i = 0; i < LINE_COUNT; i++)
            {
                float x1 = (float)(random.NextDouble() * CAMERA_WIDTH);
                float x2 = (float)(random.NextDouble() * CAMERA_WIDTH);
                float y1 = (float)(random.NextDouble() * CAMERA_HEIGHT);
                float y2 = (float)(random.NextDouble() * CAMERA_HEIGHT);
                float lineWidth = (float)(random.NextDouble() * 5);

                Line line = new Line(x1, y1, x2, y2, lineWidth);

                line.SetColor((float)random.NextDouble(), (float)random.NextDouble(), (float)random.NextDouble());

                scene.getLastChild().attachChild(line);
            }

            return scene;
        }
开发者ID:jamesburton,项目名称:AndEngine.net,代码行数:26,代码来源:LineExample.cs

示例3: UpdateDependencies

        public override void UpdateDependencies(double currentTime)
        {
            base.UpdateDependencies(currentTime);

            if (Visible)
            {
                if (_line == null)
                {
                    _line = new Line();
                    _circle = new Circle {Radius = Radius};

                    _circle.AttachTo(this, false);
                    _line.AttachTo(_circle, false);
                    _line.RelativePoint1 = new Point3D(0, 0);
                    _line.RelativePoint2 = new Point3D(Radius, 0);
                }

                if (!_added)
                {
                    ShapeManager.AddLine(_line);
                    ShapeManager.AddCircle(_circle);
                    _added = true;
                }
            }

            if (!Visible && _line != null)
            {
                ShapeManager.Remove(_line);
                ShapeManager.Remove(_circle);
                _added = false;
            }
        }
开发者ID:kainazzzo,项目名称:flatredball-spriter,代码行数:32,代码来源:SpriterPoint.cs

示例4: DelayedHitCalc

 public override RealHitInfo DelayedHitCalc(Line by, HitInfo hit)
 {
     RealHitInfo realHit = new RealHitInfo();
     realHit.HitStuff = Surface;
     realHit.Pigment = Pigment;
     realHit.Normal = new Line();
     realHit.Normal.Start = by.Project(hit.HitDist);
     realHit.Normal.Direct.Dx = 0;
     realHit.Normal.Direct.Dy = 0;
     realHit.Normal.Direct.Dz = 0;
     switch (hit.SurfaceIndex)
     {
         case 0:
             Point hitLoc2 = inv.Apply(realHit.Normal.Start);
             realHit.Normal.Direct.Dx = hitLoc2.X;
             realHit.Normal.Direct.Dy = hitLoc2.Y;
             realHit.Normal.Direct.Dz = hitLoc2.Z;
             break;
         default:
             throw new InvalidOperationException("Invalid surface index in hitdata");
     }
     Vector before = realHit.Normal.Direct;
     realHit.Normal.Direct = trans.Apply(realHit.Normal.Direct);
     if (realHit.Normal.Direct.Dot(by.Direct) > 0)
     {
         realHit.Normal.Direct.ScaleSelf(-1.0);
     }
     return realHit;
 }
开发者ID:Tilps,项目名称:Stash,代码行数:29,代码来源:Sphere.cs

示例5: Add

 /// <summary>
 /// Adds string
 /// </summary>
 /// <param name="format"></param>
 /// <param name="args"></param>
 public void Add( Color color, string format, params object[] args )
 {
     Line line = new Line();
     line.text		= string.Format( format, args );
     line.color		= color;
     linesAccum.Add( line );
 }
开发者ID:temik911,项目名称:audio,代码行数:12,代码来源:DebugStrings.cs

示例6: UpdateDependencies

        public override void UpdateDependencies(double currentTime)
        {
            base.UpdateDependencies(currentTime);

            if (Visible)
            {
                if (_line == null)
                {
                    _line = new Line();
                    _line.AttachTo(this, false);
                    _line.RelativePoint1 = new Point3D(0, 0);
                    _line.RelativePoint2 = new Point3D(Length * ScaleX, 0);
                }

                if (!_added)
                {
                    ShapeManager.AddLine(_line);
                    _added = true;
                }
                if (Math.Abs(_line.RelativePoint2.X - Length * ScaleX) > Double.Epsilon)
                {
                    _line.RelativePoint2.X = Length;
                }
            }

            if (!Visible && _line != null)
            {
                ShapeManager.Remove(_line);
                _added = false;
            }
        }
开发者ID:kainazzzo,项目名称:flatredball-spriter,代码行数:31,代码来源:SpriterBone.cs

示例7: DataAccess_IOrmModelSingleGet

        public void DataAccess_IOrmModelSingleGet()
        {
            Line line = new Line();
            line = (Line)line.Get<Line>(1);

            Assert.AreEqual(line.Title, "Lemongrass and Lavender");
        }
开发者ID:gdirlam,项目名称:BathProducts,代码行数:7,代码来源:Data.cs

示例8: DrawLine

 public void DrawLine (Line line, ConsoleColor? color = null, LineWidth lineWidth = LineWidth.Single)
 {
     if (line.IsHorizontal)
         DrawHorizontalLine(line.X, line.Y, line.Width, color, lineWidth);
     else if (line.IsVertical)
         DrawVerticalLine(line.X, line.Y, line.Height, color, lineWidth);
 }
开发者ID:jhorv,项目名称:CsConsoleFormat,代码行数:7,代码来源:ConsoleBuffer.cs

示例9: DrawableLine

 public DrawableLine()
     : base("DrawableLine", Layer.Opaque)
 {
     line = new Line();
     line.StartColor = Color.Yellow;
     line.EndColor = Color.Yellow;
 }
开发者ID:Kitsune001,项目名称:Samples,代码行数:7,代码来源:DrawableLine.cs

示例10: ExecuteCommand

        public void ExecuteCommand()
        {
            barDiameter = TryGetBarDiameter("\nŚrednica pręta [mm] : ");
            if (!barDiameter.HasValue)
                return;

            spanStep = TryGetSpanStep("\nRozstaw [mm] : ");
            if (!spanStep.HasValue)
                return;

            barPoint1 = TryGetPoint("\nPokaż pręt 1 : ");
            if (!barPoint1.HasValue)
                return;

            barPoint2 = TryGetPoint("\nPokaż pręt 2 : ", barPoint1);
            if (!barPoint2.HasValue)
                return;

            firstBarLine = GetRoundBarLine(roundValue);
            if (TryDisplayBarLadder())
            {
                string blockName = CreateBlockRecord();
                Handle handle = InsertBlock(blockName);
                SetXData(handle);
            }
            else
            {
                return;
            }
        }
开发者ID:anielii,项目名称:Acommands,代码行数:30,代码来源:AContourLines.cs

示例11: GetClosestPoint

 public static bool GetClosestPoint(Line line, Vector3F point, out Vector3F closestPointOnLine)
 {
     float parameter;
       GetLineParameter(new LineSegment(line.PointOnLine, line.PointOnLine + line.Direction), point, out parameter);
       closestPointOnLine = line.PointOnLine + parameter * line.Direction;
       return Vector3F.AreNumericallyEqual(point, closestPointOnLine);
 }
开发者ID:,项目名称:,代码行数:7,代码来源:

示例12: ExplotaAReadOnlyLine

        /// <summary>
        /// Devuelve una secuencia de ReadOnlyLine explotando la entidad si es necesario.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="secuenciaOriginal"></param>
        /// <returns></returns>
        public static IEnumerable<ReadOnlyLine> ExplotaAReadOnlyLine(this Entity entidad)
        {
            if (entidad is ReadOnlyLine)
                yield return entidad as ReadOnlyLine;

            if (entidad is ReadOnlyPolygon)
            {
                ReadOnlyPolygon polígono = entidad as ReadOnlyPolygon;

                // Devolvemos primero el contorno exterior como una línea cerrada
                Line línea = new Line(polígono.Codes);
                línea.Points.Add(polígono.Points);
                yield return línea;

                // Devolvemos cada uno de los huecos que son líneas cerradas
                foreach (var hueco in polígono.Holes)
                    yield return hueco;
            }

            if (entidad is ReadOnlyComplex)
            {
                ReadOnlyComplex complejo = entidad as ReadOnlyComplex;

                foreach (var subentidad in complejo.Entities)
                {
                    if (subentidad is ReadOnlyLine)
                        yield return subentidad as ReadOnlyLine;
                }
            }

            yield break;
        }
开发者ID:digi21,项目名称:UtilidadesDigi,代码行数:38,代码来源:UtilidadesEntity.cs

示例13: LerpProjectOnto

 ///<summary>
 ///The proportion that, when lerped across the given line, results in the given point.
 ///If the point is not on the line segment, the result is the closest point on the extended line.
 ///</summary>
 public static double LerpProjectOnto(this Vector2d point, Line line)
 {
     return line.NearestT(point, false);
     /*var b = point - line[0];
     var d = line.Delta;
     return (b * d) / (d * d);*/
 }
开发者ID:AyyTee,项目名称:Aventyr,代码行数:11,代码来源:GeometryUtil.cs

示例14: GivenAnOrderDiscount_WhenApplyToNonOrder_ThenShouldReturnZero

        public void GivenAnOrderDiscount_WhenApplyToNonOrder_ThenShouldReturnZero()
        {
            var sut = new OrderDiscount("d", 1);
            var line = new Line(new Bike(string.Empty, string.Empty, 1), 1);

            Assert.AreEqual(0, sut.Apply(line));
        }
开发者ID:toddweb,项目名称:exercises-bike-distributor-refactor,代码行数:7,代码来源:OrderDiscountTests.cs

示例15: LineIntersection

        public void LineIntersection()
        {
            Line horizontalLine = new Line(new Vector2D(0.0f, 1.0f), new Vector2D(2.0f, 1.0f));
            Line verticalLine = new Line(new Vector2D(1.0f, 0.0f), new Vector2D(1.0f, 2.0f));

            Assert.IsTrue(horizontalLine.TestIntersection(verticalLine));
            Assert.IsTrue(horizontalLine.TestIntersection(horizontalLine));
            Assert.IsTrue(verticalLine.TestIntersection(verticalLine));

            Line offsetHorizontalLine = new Line(new Vector2D(0.0f, 3.0f), new Vector2D(2.0f, 3.0f));

            Assert.IsFalse(offsetHorizontalLine.TestIntersection(horizontalLine));

            Line reverseHorizontalLine = new Line(new Vector2D(2.0f, 1.0f), new Vector2D(0.0f, 1.0f));
            Line reverseVerticalLine = new Line(new Vector2D(1.0f, 2.0f), new Vector2D(1.0f, 0.0f));
            Line reverseOffsetHorizontalLine = new Line(new Vector2D(0.0f, 3.0f), new Vector2D(2.0f, 3.0f));

            Assert.IsTrue(reverseHorizontalLine.TestIntersection(reverseVerticalLine));
            Assert.IsTrue(reverseHorizontalLine.TestIntersection(verticalLine));
            Assert.IsTrue(reverseVerticalLine.TestIntersection(verticalLine));
            Assert.IsTrue(reverseVerticalLine.TestIntersection(reverseVerticalLine));

            Assert.IsFalse(reverseHorizontalLine.TestIntersection(reverseOffsetHorizontalLine));
            Assert.IsFalse(reverseHorizontalLine.TestIntersection(offsetHorizontalLine));
        }
开发者ID:jesseDtucker,项目名称:Autonomy,代码行数:25,代码来源:LineTests.cs


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