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


C# Numerics.Vector2类代码示例

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


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

示例1: PolygonShape

 public PolygonShape()
 {
     ShapeType = ShapeType.Polygon;
     _radius = Settings.b2_polygonRadius;
     _vertexCount = 0;
     _centroid = Vector2.Zero;
 }
开发者ID:Nukepayload2,项目名称:Box2D,代码行数:7,代码来源:PolygonShape.cs

示例2: Scale

        public void Scale(RenderTarget2D source, RenderTarget2D destination)
        {
            _effect.CurrentTechnique = source.Format.IsFloatingPoint() ? _effect.Techniques["Software"] : _effect.Techniques["Hardware"];

            Vector2 resolution = new Vector2(source.Width, source.Height);
            float scaleFactor = (destination.Width > source.Width) ? 2 : 0.5f;

            RenderTarget2D input = source;

            while (IntermediateNeeded(resolution, destination, scaleFactor))
            {
                resolution *= scaleFactor;

                RenderTarget2D output = RenderTargetManager.GetTarget(_device, (int)resolution.X, (int)resolution.Y, source.Format, name:"scaled", usage: RenderTargetUsage.DiscardContents);
                Draw(input, output);

                if (input != source)
                    RenderTargetManager.RecycleTarget(input);
                input = output;
            }

            Draw(input, destination);

            if (input != source)
                RenderTargetManager.RecycleTarget(input);
        }
开发者ID:xoxota99,项目名称:Myre,代码行数:26,代码来源:Scale.cs

示例3: Canvas_Draw

        private void Canvas_Draw(CanvasControl sender, CanvasDrawEventArgs args)
        {
            var a = new Vector2(10, 10);
            var b = new Vector2(100, 100);

            args.DrawingSession.DrawLine(a, b, Colors.Yellow);
        }
开发者ID:chrisi,项目名称:IoTCanvas,代码行数:7,代码来源:MainPage.xaml.cs

示例4: Vector4

 /// <summary>
 /// Constructs a Vector4 from the given Vector2 and a Z and W component.
 /// </summary>
 /// <param name="value">The vector to use as the X and Y components.</param>
 /// <param name="z">The Z component.</param>
 /// <param name="w">The W component.</param>
 public Vector4(Vector2 value, Single z, Single w)
 {
     X = value.X;
     Y = value.Y;
     Z = z;
     W = w;
 }
开发者ID:uQr,项目名称:referencesource,代码行数:13,代码来源:Vector4_Intrinsics.cs

示例5: IntermediateNeeded

        private bool IntermediateNeeded(Vector2 currentResolution, RenderTarget2D target, float scale)
        {
// ReSharper disable CompareOfFloatsByEqualityOperator
            return (scale == 2) ? (currentResolution.X * 2 < target.Width && currentResolution.Y * 2 < target.Height)
// ReSharper restore CompareOfFloatsByEqualityOperator
                                : (currentResolution.X / 2 > target.Width && currentResolution.Y / 2 > target.Height);
        }
开发者ID:xoxota99,项目名称:Myre,代码行数:7,代码来源:Scale.cs

示例6: VertexPositionTextureNormalBinormalTangent

// ReSharper restore NotAccessedField.Global
// ReSharper restore MemberCanBePrivate.Global

        public VertexPositionTextureNormalBinormalTangent(Vector3 position, Vector2 textureCoordinate, Vector3 normal, Vector3 binormal, Vector3 tangent)
        {
            Position = position.ToXNA();
            TextureCoordinate = textureCoordinate.ToXNA();
            Normal = normal.ToXNA();
            Binormal = binormal.ToXNA();
            Tangent = tangent.ToXNA();
        }
开发者ID:xoxota99,项目名称:Myre,代码行数:11,代码来源:VertexPositionTextureNormalBinormalTangent.cs

示例7: OrientedBox2D

 public OrientedBox2D(float centerX, float centerY, float sizeX, float sizeY, float angle)
 {
     center.X = centerX;
     center.Y = centerY;
     Angle = angle;
     Radii = new Vector2(sizeX / 2.0f, sizeY / 2.0f);
     CalcHelpers();
 }
开发者ID:danielscherzer,项目名称:Framework,代码行数:8,代码来源:OrientedBox2D.cs

示例8: Line

        public SvgBuilder Line(Vector2 start, Vector2 end, float width, string stroke)
        {
            _parts.Add($"<line x1=\"{start.X * Scale}\" y1=\"{start.Y * Scale}\" x2=\"{end.X * Scale}\" y2=\"{end.Y * Scale}\" stroke=\"{stroke}\" stroke-width=\"{width}\" />");

            UpdateMinMax(start, end);

            return this;
        }
开发者ID:martindevans,项目名称:PrimitiveSvgBuilder,代码行数:8,代码来源:SvgBuilder.cs

示例9: VertexMetadata

 public VertexMetadata(float x, float y, float z, float u, float v, Color color, uint faceIndex, uint triangleIndex)
 {
     Position = new Vector4(x, y, z, 1f);
     TextureCoordinate = new Vector2(u, v);
     Color = color;
     FaceIndex = faceIndex;
     TriangleIndex = triangleIndex;
 }
开发者ID:gitter-badger,项目名称:Grasshopper,代码行数:8,代码来源:VertexMetadata.cs

示例10: Circle

        public SvgBuilder Circle(Vector2 center, float radius, string fill = "blue")
        {
            _parts.Add($"<circle cx=\"{center.X * Scale}\" cy=\"{center.Y * Scale}\" r=\"{radius * Scale}\" fill=\"{fill}\"></circle>");

            UpdateMinMax(center - new Vector2(radius));
            UpdateMinMax(center + new Vector2(radius));

            return this;
        }
开发者ID:martindevans,项目名称:PrimitiveSvgBuilder,代码行数:9,代码来源:SvgBuilder.cs

示例11: Operation

 public void Operation(Operations operation)
 {
     Random rand = new Random(84329);
     Vector2 v1 = new Vector2(Convert.ToSingle(rand.NextDouble()), Convert.ToSingle(rand.NextDouble()));
     Vector2 v2 = new Vector2(Convert.ToSingle(rand.NextDouble()), Convert.ToSingle(rand.NextDouble()));
     foreach (var iteration in Benchmark.Iterations)
         using (iteration.StartMeasurement())
             ExecuteTest(operation, 1000000, v1, v2);
 }
开发者ID:er0dr1guez,项目名称:corefx,代码行数:9,代码来源:Perf.Vector2.cs

示例12: RadialGradientStyle

 /// <summary>
 ///     Initializes a new instance of the <see cref="RadialGradientStyle" /> class.
 /// </summary>
 /// <param name="unitOriginOffset">The unit origin offset.</param>
 /// <param name="transform">The transform.</param>
 /// <param name="gradientStops">The gradient stops.</param>
 public RadialGradientStyle(
     Vector2 unitOriginOffset,
     Matrix3x2 transform,
     [NotNull] IReadOnlyList<GradientStop> gradientStops)
     : base(gradientStops)
 {
     UnitOriginOffset = unitOriginOffset;
     GradientTransform = transform;
 }
开发者ID:billings7,项目名称:EscherTilier,代码行数:15,代码来源:RadialGradientStyle.cs

示例13: DrawLine

 public void DrawLine(Vector2 p1, Vector2 p2, Color color, float strokeWidth, CanvasStrokeStyle strokeStyle)
 {
     if (m_renderingType == TestSceneRenderingType.Default)
     {
         m_drawingSession.DrawLine(p1, p2, color, strokeWidth, strokeStyle);
     }
     else
     {
         m_drawingSession.DrawLine(p1, p2, Colors.Black);
     }
 }
开发者ID:gfcprogramer,项目名称:Win2D,代码行数:11,代码来源:TestSceneRenderer.cs

示例14: FillEllipse

 public void FillEllipse(Vector2 center, float radiusX, float radiusY, Color color)
 {
     if (m_renderingType == TestSceneRenderingType.Default)
     {
         m_drawingSession.FillEllipse(center, radiusX, radiusY, color);
     }
     else
     {
         m_drawingSession.DrawEllipse(center, radiusX, radiusY, Colors.Black);
     }
 }
开发者ID:gfcprogramer,项目名称:Win2D,代码行数:11,代码来源:TestSceneRenderer.cs

示例15: TextSprite

 public TextSprite(
     string text,
     FontId font = default(FontId),
     float fontSize = 12,
     Vector2 position = default(Vector2),
     Color? color = null)
 {
     this.Text = text;
     this.Font = font;
     this.FontSize = fontSize;
     this.Position = position;
     this.Color = color ?? Color.White;
 }
开发者ID:OpenLocalization,项目名称:Nine.Graphics,代码行数:13,代码来源:TextSprite.cs


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