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


C# Vector4F类代码示例

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


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

示例1: AdditionOperator

 public void AdditionOperator()
 {
     Vector4F a = new Vector4F(1.0f, 2.0f, 3.0f, 4.0f);
       Vector4F b = new Vector4F(2.0f, 3.0f, 4.0f, 5.0f);
       Vector4F c = a + b;
       Assert.AreEqual(new Vector4F(3.0f, 5.0f, 7.0f, 9.0f), c);
 }
开发者ID:Zolniu,项目名称:DigitalRune,代码行数:7,代码来源:Vector4FTest.cs

示例2: Addition

 public void Addition()
 {
     Vector4F a = new Vector4F(1.0f, 2.0f, 3.0f, 4.0f);
       Vector4F b = new Vector4F(2.0f, 3.0f, 4.0f, 5.0f);
       Vector4F c = Vector4F.Add(a, b);
       Assert.AreEqual(new Vector4F(3.0f, 5.0f, 7.0f, 9.0f), c);
 }
开发者ID:Zolniu,项目名称:DigitalRune,代码行数:7,代码来源:Vector4FTest.cs

示例3: Normalize

        public void Normalize()
        {
            Vector4F v, n1, n2;
            float magnitude;

            v = new Vector4F(3.0f, 4.0f, 0.0f, 0.0f);
            n1 = v.Normalize();
            n2 = v.Normalize(out magnitude);
            Assert.AreEqual(1.0f, n1.Magnitude, 1e-14);
            Assert.AreEqual(1.0f, n2.Magnitude, 1e-14);
            Assert.AreEqual(5.0f, magnitude, 1e-14);

            v = new Vector4F(3.0f, 0.0f, 4.0f, 0.0f);
            n1 = v.Normalize();
            n2 = v.Normalize(out magnitude);
            Assert.AreEqual(1.0f, n1.Magnitude, 1e-14);
            Assert.AreEqual(1.0f, n2.Magnitude, 1e-14);
            Assert.AreEqual(5.0f, magnitude, 1e-14);

            v = new Vector4F(0.0f, 3.0f, 4.0f, 0.0f);
            n1 = v.Normalize();
            n2 = v.Normalize(out magnitude);
            Assert.AreEqual(1.0f, n1.Magnitude, 1e-14);
            Assert.AreEqual(1.0f, n2.Magnitude, 1e-14);
            Assert.AreEqual(5.0f, magnitude, 1e-14);

            v = new Vector4F(0.0f, 0.0f, 3.0f, 4.0f);
            n1 = v.Normalize();
            n2 = v.Normalize(out magnitude);
            Assert.AreEqual(1.0f, n1.Magnitude, 1e-14);
            Assert.AreEqual(1.0f, n2.Magnitude, 1e-14);
            Assert.AreEqual(5.0f, magnitude, 1e-14);
        }
开发者ID:jpespartero,项目名称:OpenGlobe,代码行数:33,代码来源:Vector4FTests.cs

示例4: CascadedShadow

 //--------------------------------------------------------------
 /// <summary>
 /// Initializes a new instance of the <see cref="CascadedShadow"/> class.
 /// </summary>
 public CascadedShadow()
 {
     NumberOfCascades = 4;
       Distances = new Vector4F(4, 12, 20, 80);
       MinLightDistance = 100;
       DepthBias = new Vector4F(5);
       NormalOffset = new Vector4F(2);
       NumberOfSamples = -1;
       FilterRadius = 1;
       JitterResolution = 2048;
       FadeOutRange = 0.1f;
       ShadowFog = 0;
     #if XBOX
       CascadeSelection = ShadowCascadeSelection.Fast;
     #else
       CascadeSelection = ShadowCascadeSelection.Best;
     #endif
       IsCascadeLocked = new[] { false, false, false, false };
     #pragma warning disable 618
       SplitDistribution = 0.9f;
       FadeOutDistance = 50;
       MaxDistance = 70;
       DepthBiasScale = new Vector4F(0.99f);
       DepthBiasOffset = new Vector4F(-0.001f);
     #pragma warning restore 618
 }
开发者ID:Zolniu,项目名称:DigitalRune,代码行数:30,代码来源:CascadedShadow.cs

示例5: GradientTextureSkyNode

 //--------------------------------------------------------------
 /// <summary>
 /// Initializes a new instance of the <see cref="GradientTextureSkyNode" /> class.
 /// </summary>
 public GradientTextureSkyNode()
 {
     SunDirection = new Vector3F(1, 1, 1);
       TimeOfDay = new TimeSpan(12, 0, 0);
       Color = new Vector4F(1, 1, 1, 1);
       CieSkyParameters = CieSkyParameters.Type12;
 }
开发者ID:Zolniu,项目名称:DigitalRune,代码行数:11,代码来源:GradientTextureSkyNode.cs

示例6: Construct2

 public void Construct2()
 {
     Vector4F v = new Vector4F(new Vector2F(1.0f, 2.0f), 3.0f, 4.0f);
     Assert.AreEqual(1.0f, v.X);
     Assert.AreEqual(2.0f, v.Y);
     Assert.AreEqual(3.0f, v.Z);
     Assert.AreEqual(4.0f, v.W);
 }
开发者ID:jpespartero,项目名称:OpenGlobe,代码行数:8,代码来源:Vector4FTests.cs

示例7: VectorMultiply

 public static Vector4F VectorMultiply(Matrix4x4F a, Vector4F b)
 {
     return new Vector4F(
         a.M11 * b.X + a.M21 * b.Y + a.M31 * b.Z + a.M41 * b.W,
         a.M12 * b.X + a.M22 * b.Y + a.M32 * b.Z + a.M42 * b.W,
         a.M13 * b.X + a.M23 * b.Y + a.M33 * b.Z + a.M43 * b.W,
         a.M14 * b.X + a.M24 * b.Y + a.M34 * b.Z + a.M44 * b.W
         );
 }
开发者ID:Corillian,项目名称:Windows-API-Code-Pack-1.1,代码行数:9,代码来源:Matrix.cs

示例8: Fog

 //--------------------------------------------------------------
 /// <summary>
 /// Initializes a new instance of the <see cref="Fog"/> class.
 /// </summary>
 public Fog()
 {
     Density = 1f;
       Height0 = 0;
       Color0 = new Vector4F(0.5f, 0.5f, 0.5f, 1);
       Height1 = 100;
       Color1 = new Vector4F(0.5f, 0.5f, 0.5f, 1);
       HeightFalloff = 0;
       Start = 0;
       End = 50;
 }
开发者ID:Zolniu,项目名称:DigitalRune,代码行数:15,代码来源:Fog.cs

示例9: Terrain

        //--------------------------------------------------------------
        /// <summary>
        /// Initializes a new instance of the <see cref="Terrain"/> class.
        /// </summary>
        public Terrain()
        {
            InvalidBaseRegions = new List<Aabb>();
              InvalidDetailRegions = new List<Aabb>();
              Shape = Shape.Infinite;
              BaseClearValues = new Vector4F[4];
              DetailClearValues = new Vector4F[4];
              BaseClearValues[0] = new Vector4F(-10000, 0, 0, 1);

              Tiles = new TerrainTileCollection(this);

              Aabb = new Aabb();
        }
开发者ID:Zolniu,项目名称:DigitalRune,代码行数:17,代码来源:Terrain.cs

示例10: GradientSkyNode

        //--------------------------------------------------------------
        /// <summary>
        /// Initializes a new instance of the <see cref="GradientSkyNode" /> class.
        /// </summary>
        public GradientSkyNode()
        {
            SunDirection = new Vector3F(1, 1, 1);
              FrontColor = new Vector4F(0.9f, 0.5f, 0, 1);
              ZenithColor = new Vector4F(0, 0.4f, 0.9f, 1);
              BackColor = new Vector4F(0.4f, 0.6f, 0.9f, 1);
              GroundColor = new Vector4F(1, 0.8f, 0.6f, 1);
              FrontZenithShift = 0.5f;
              BackZenithShift = 0.5f;
              FrontGroundShift = 0.5f;
              BackGroundShift = 0.5f;

              CieSkyParameters = CieSkyParameters.Type12;
        }
开发者ID:Zolniu,项目名称:DigitalRune,代码行数:18,代码来源:GradientSkyNode.cs

示例11: AreEqual

        public void AreEqual()
        {
            float originalEpsilon = Numeric.EpsilonF;
              Numeric.EpsilonF = 1e-8f;

              Vector4F u = new Vector4F(1.0f, 2.0f, 3.0f, 4.0f);
              Vector4F v = new Vector4F(1.000001f, 2.000001f, 3.000001f, 4.000001f);
              Vector4F w = new Vector4F(1.00000001f, 2.00000001f, 3.00000001f, 4.00000001f);

              Assert.IsTrue(Vector4F.AreNumericallyEqual(u, u));
              Assert.IsFalse(Vector4F.AreNumericallyEqual(u, v));
              Assert.IsTrue(Vector4F.AreNumericallyEqual(u, w));

              Numeric.EpsilonF = originalEpsilon;
        }
开发者ID:Zolniu,项目名称:DigitalRune,代码行数:15,代码来源:Vector4FTest.cs

示例12: Absolute

        public void Absolute()
        {
            Vector4F v = new Vector4F(-1, -2, -3, -4);
              v.Absolute();

              Assert.AreEqual(1, v.X);
              Assert.AreEqual(2, v.Y);
              Assert.AreEqual(3, v.Z);
              Assert.AreEqual(4, v.W);

              v = new Vector4F(1, 2, 3, 4);
              v.Absolute();
              Assert.AreEqual(1, v.X);
              Assert.AreEqual(2, v.Y);
              Assert.AreEqual(3, v.Z);
              Assert.AreEqual(4, v.W);
        }
开发者ID:Zolniu,项目名称:DigitalRune,代码行数:17,代码来源:Vector4FTest.cs

示例13: FigureNode

        //--------------------------------------------------------------
        /// <summary>
        /// Initializes a new instance of the <see cref="FigureNode" /> class.
        /// </summary>
        /// <param name="figure">The figure.</param>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="figure"/> is <see langword="null"/>.
        /// </exception>
        public FigureNode(Figure figure)
        {
            if (figure == null)
            throw new ArgumentNullException("figure");

              IsRenderable = true;
              _figure = figure;
              Shape = figure.BoundingShape;

              StrokeColor = new Vector3F(1, 1, 1);
              StrokeAlpha = 1;
              StrokeThickness = 1;
              StrokeDashPattern = new Vector4F(1, 0, 0, 0);
              DashInWorldSpace = true;
              FillColor = new Vector3F(1, 1, 1);
              FillAlpha = 1;
        }
开发者ID:Zolniu,项目名称:DigitalRune,代码行数:25,代码来源:FigureNode.cs

示例14: AbsoluteStatic

        public void AbsoluteStatic()
        {
            Vector4F v = new Vector4F(-1, -2, -3, -4);
              Vector4F absoluteV = Vector4F.Absolute(v);

              Assert.AreEqual(1, absoluteV.X);
              Assert.AreEqual(2, absoluteV.Y);
              Assert.AreEqual(3, absoluteV.Z);
              Assert.AreEqual(4, absoluteV.W);

              v = new Vector4F(1, 2, 3, 4);
              absoluteV = Vector4F.Absolute(v);
              Assert.AreEqual(1, absoluteV.X);
              Assert.AreEqual(2, absoluteV.Y);
              Assert.AreEqual(3, absoluteV.Z);
              Assert.AreEqual(4, absoluteV.W);
        }
开发者ID:Zolniu,项目名称:DigitalRune,代码行数:17,代码来源:Vector4FTest.cs

示例15: Magnitude

        public void Magnitude()
        {
            Vector4F v = new Vector4F(3.0f, 4.0f, 0.0f, 0.0f);
            Assert.AreEqual(25.0f, v.MagnitudeSquared, 1e-14);
            Assert.AreEqual(5.0f, v.Magnitude, 1e-14);

            v = new Vector4F(3.0f, 0.0f, 4.0f, 0.0f);
            Assert.AreEqual(25.0f, v.MagnitudeSquared, 1e-14);
            Assert.AreEqual(5.0f, v.Magnitude, 1e-14);

            v = new Vector4F(0.0f, 3.0f, 4.0f, 0.0f);
            Assert.AreEqual(25.0f, v.MagnitudeSquared, 1e-14);
            Assert.AreEqual(5.0f, v.Magnitude, 1e-14);

            v = new Vector4F(0.0f, 0.0f, 3.0f, 4.0f);
            Assert.AreEqual(25.0f, v.MagnitudeSquared, 1e-14);
            Assert.AreEqual(5.0f, v.Magnitude, 1e-14);
        }
开发者ID:jpespartero,项目名称:OpenGlobe,代码行数:18,代码来源:Vector4FTests.cs


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