• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# System.Line类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: Run

 public static void Run()
 {
     using (FastScanner fs = new FastScanner(new BufferedStream(Console.OpenStandardInput())))
     using (StreamWriter writer = new StreamWriter(new BufferedStream(Console.OpenStandardOutput())))
     {
         long x1 = fs.NextInt(), y1 = fs.NextInt();
         long x2 = fs.NextInt(), y2 = fs.NextInt();
         int n = fs.NextInt();
         Line original = new Line 
         { 
             A = y1 - y2, 
             B = x2 - x1, 
             C = x1 * y2 - x2 * y1 
         };
         long minX = Math.Min(x1, x2), maxX = Math.Max(x1, x2);
         long minY = Math.Min(y1, y2), maxY = Math.Max(y1, y2);
         int count = 0;
         for (int i = 0; i < n; i++)
         {
             Line line = new Line { A = fs.NextInt(), B = fs.NextInt(), C = fs.NextInt() };
             double[] cross = GetIntersection(original, line);
             if (cross[0] >= minX && cross[0] <= maxX &&
                 cross[1] >= minY && cross[1] <= maxY) count++;
         }
         writer.WriteLine(count);
     }
 }
开发者ID:dzholmukhanov,项目名称:AlgorithmTraining,代码行数:27,代码来源:CrazyTown284.cs


示例17: CalculateLine

        protected void CalculateLine(int y, [Channel("lines")] out Line line)
        {
            line = new Line(y, width);

            double cy = 1.1*y/height;

            for (int x=0; x<width; x++)
            {
                double cx = 2.5*x/width - 2.0;

                double zx = 0, zy = 0;
                double tx;

                byte i;
                for(i = 255; (i > 0) && (zx*zx + zy*zy < 4); i--)
                {
                    tx = zx;
                    zx = zx*zx-zy*zy + cx;
                    zy = 2.0*tx*zy + cy;
                }

                Color color = Color.FromArgb(i, i, i);
                line.Bitmap.SetPixel(x, 0, color);
            }
        }
开发者ID:Noah1989,项目名称:fmacj,代码行数:25,代码来源:Mandelbrot.cs


示例18: SolveInstance

        /// <summary>
        /// This is the method that actually does the work.
        /// </summary>
        /// <param name="DA">The DA object is used to retrieve from inputs and store in outputs.</param>
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            //Input
            Line line = new Line();
            DA.GetData(0, ref line);

            double eModulus = 0.0;
            DA.GetData(1, ref eModulus);

            double area = 0.0;
            DA.GetData(2, ref area);

            double preStress = 0.0;
            if (this.Params.Input[3].SourceCount != 0)
            {
                DA.GetData(3, ref preStress);
            }


            //Create instance of bar
            GoalObject cableElement = new CableGoal(line, eModulus, area, preStress);


            //Output
            DA.SetData(0, cableElement);
        }
开发者ID:CecilieBrandt,项目名称:K2Engineering,代码行数:30,代码来源:Cable.cs


示例19: DataAccess_GenericSingleGet

 public void DataAccess_GenericSingleGet()
 {
     Line line = new Line();
     line = line.Get<Line>(1);
     Console.WriteLine("line {0} title:{1}", line.Line_Pk.ToString(), line.Title);
     Assert.AreEqual(line.Title, "Lemongrass and Lavender");
 }
开发者ID:gdirlam,项目名称:BathProducts,代码行数:7,代码来源:Data.cs


示例20: checkIntersection

        private void checkIntersection(Event upper,Event lower, OrderedSet<Event> Q,List<Point> outPoints)
        {
            Line a = new Line(upper.point,segments[upper.segIdx].End);
            Line b = new Line(lower.point,segments[lower.segIdx].End);

            if (HelperMethods.CheckTurn(new Line(a.Start, a.End), b.Start) == HelperMethods.CheckTurn(new Line(a.Start, a.End), b.End)
             || (HelperMethods.CheckTurn(new Line(b.Start, b.End), a.Start) == HelperMethods.CheckTurn(new Line(b.Start, b.End), a.End)))
                return;
            double aa, bb, cc, dd;
            Point interPoint;
            if (Math.Abs(a.Start.X - a.End.X) < Constants.Epsilon)
            {
                bb = (b.Start.Y - b.End.Y) / (b.Start.X - b.End.X);
                dd = b.Start.Y - b.Start.X * bb;
                interPoint = new Point(a.Start.X, (bb * a.Start.X + dd));
            }
            else if (Math.Abs(b.Start.X - b.End.X) < Constants.Epsilon)
            {
                aa = (a.Start.Y - a.End.Y) / (a.Start.X - a.End.X);
                cc = a.Start.Y - a.Start.X * aa;
                interPoint = new Point(b.Start.X, (aa * a.Start.X + cc));
            }
            else
            {
                aa = (a.Start.Y - a.End.Y) / (a.Start.X - a.End.X);
                bb = (b.Start.Y - b.End.Y) / (b.Start.X - b.End.X);
                cc = a.Start.Y - a.Start.X * aa;
                dd = b.Start.Y - b.Start.X * bb;
                double interX = (dd - cc) / (aa - bb);
                interPoint = new Point(interX, (aa * interX + cc));
            }
            Q.Add(new Event(interPoint, PointType.Intersection,-1 ,upper,lower));
            outPoints.Add(interPoint);
        }
开发者ID:PlastecProfiles,项目名称:Computational-Geometry,代码行数:34,代码来源:SweepLine.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# System.Local类代码示例发布时间:2022-05-26
下一篇:
C# System.Language类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap