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


C# Windows.Vector类代码示例

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


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

示例1: TestingCompoundVertexInfo

 public TestingCompoundVertexInfo(Vector springForce, Vector repulsionForce, Vector gravityForce, Vector applicationForce)
 {
     SpringForce = springForce;
     RepulsionForce = repulsionForce;
     GravityForce = gravityForce;
     ApplicationForce = applicationForce;
 }
开发者ID:KevinCathcart,项目名称:GraphX,代码行数:7,代码来源:TestingCompoundVertexInfo.cs

示例2: NodeViewModel

        public NodeViewModel(Node node, Vector location, IControlTypesResolver controlTypesResolver)
        {
            Node = node;
            Title = node.Title;
            Location = new CanvasPoint(location);
            ControlTypesResolver = controlTypesResolver;

            foreach (var pin in node.InputPins)
            {
                AddInputPin(pin);
            }

            foreach (var pin in node.OutputPins)
            {
                AddOutputPin(pin);
            }

            node.Processed += OnNodeProcessed;
            node.PinsChanged += OnNodePinsChanged;

            _disposable = Disposable.Create(() =>
            {
                node.PinsChanged -= OnNodePinsChanged;
                node.Processed -= OnNodeProcessed;
            });
        }
开发者ID:misupov,项目名称:Turbina,代码行数:26,代码来源:NodeViewModel.cs

示例3: TestBoundingCirclePushBackLeftTop

        public void TestBoundingCirclePushBackLeftTop()
        {
            //Preconfig
            int radius = 20;
            Vector position = new Vector(100f, 100f);
            Vector ballPos = new Vector(100, 100);
            Vector hitPoint = new Vector(120 - 14.1421f, 120 - 14.1421f);

            Vector ballSpeed = hitPoint - ballPos;

            Vector expectedPushBack = (radius * 2 / 1.9f) * ((hitPoint - (position + new Vector(radius, radius)))).AsNormalized();

            Vector pushBackVec;

            //Creation
            Bumper parent = new Bumper();
            BoundingCircle bC2 = new BoundingCircle(radius, position);
            BoundingContainer bCont = new BoundingContainer(parent);
            bCont.AddBoundingBox(bC2);

            //Operation
            parent.Location = (new Vector(0, 0));
            pushBackVec = bC2.GetOutOfAreaPush(radius * 2, hitPoint, ballSpeed, ballPos);

            //Assertion
            Assert.AreEqual(expectedPushBack, pushBackVec);
        }
开发者ID:EusthEnoptEron,项目名称:Sketchball,代码行数:27,代码来源:BoundingCircle_pushBack.cs

示例4: ApplyFilter

		public override void ApplyFilter(int[] pixels, int width, int height, Vector[,] field)
		{
			double maxLength = Double.NegativeInfinity;
			double minLength = Double.PositiveInfinity;

			for (int ix = 0; ix < width; ix++)
			{
				for (int iy = 0; iy < height; iy++)
				{
					var length = field[ix, iy].Length;
					if (length > maxLength) maxLength = length;
					if (length < minLength) minLength = length;
				}
			}

			for (int i = 0; i < width * height; i++)
			{
				HsbColor color = HsbColor.FromArgb(pixels[i]);

				int ix = i % width;
				int iy = i / width;
				var length = field[ix, iy].Length;

				var ratio = (length - minLength) / (maxLength - minLength);
				if (ratio.IsNaN())
					ratio = 0;

				var paletteColor = Palette.GetColor(ratio).ToHsbColor();

				color.Hue = paletteColor.Hue;
				color.Saturation = paletteColor.Saturation;

				pixels[i] = color.ToArgb();
			}
		}
开发者ID:XiBeichuan,项目名称:hydronumerics,代码行数:35,代码来源:MagnitudeFilter.cs

示例5: IrregularCell

		public IrregularCell(Vector leftBottom, Vector rightBottom, Vector rightTop, Vector leftTop)
		{
			this.leftBottom = leftBottom;
			this.rightBottom = rightBottom;
			this.rightTop = rightTop;
			this.leftTop = leftTop;
		}
开发者ID:XiBeichuan,项目名称:hydronumerics,代码行数:7,代码来源:CellInfo.cs

示例6: Vertex

 // Constructor function
 public Vertex(int id, Vector position, HashSet<int> connections)
 {
     this.ID = id;
     this.PositionVector = position;
     this.connectedVertexIDs = connections;
     this.mass = 1;
 }
开发者ID:michielvh1995,项目名称:OMI,代码行数:8,代码来源:Vertex.cs

示例7: RandomBellArgs

        /// <summary>
        /// Play with the NonlinearRandom tester to come up with values
        /// </summary>
        public RandomBellArgs(double leftArmLength, double leftArmAngle, double rightArmLength, double rightArmAngle)
        {
            List<Point3D> controlPoints = new List<Point3D>();

            // Arm1
            if (!leftArmLength.IsNearZero())
            {
                Vector arm1 = new Vector(1, 1).ToUnit() * leftArmLength;

                controlPoints.Add(arm1.ToVector3D().GetRotatedVector(new Vector3D(0, 0, -1), leftArmAngle).ToPoint());
            }

            // Arm2
            if (!rightArmLength.IsNearZero())
            {
                Vector arm2 = new Vector(-1, -1).ToUnit() * rightArmLength;

                Vector3D arm2Rotated = arm2.
                    ToVector3D().
                    GetRotatedVector(new Vector3D(0, 0, -1), rightArmAngle);

                controlPoints.Add(new Point3D(1 + arm2Rotated.X, 1 + arm2Rotated.Y, 0));
            }

            // Bezier
            this.Bezier = new BezierSegment3D(0, 1, controlPoints.ToArray(), new[] { new Point3D(0, 0, 0), new Point3D(1, 1, 0) });
        }
开发者ID:charlierix,项目名称:AsteroidMiner,代码行数:30,代码来源:StaticRandomWPF.cs

示例8: Character

 /// <summary>
 /// Initializes a new character instance.
 /// </summary>
 /// <param name="p0">Lower left character position.</param>
 /// <param name="size">Size of the character.</param>
 /// <param name="uiTaskSchedule">Scheduler associated with the UI thread.</param>
 public Character(Point p0, Vector size, TaskScheduler uiTaskSchedule)
     : base(uiTaskSchedule)
 {
     this.Position = new Quadrilateral(p0, size);
     this.Gravity = CharacterGravityState.Down;
     this.Animation = CharacterAnimationState.Down;
 }
开发者ID:ronforbes,项目名称:GravityGuy,代码行数:13,代码来源:Character.cs

示例9: GetWaypoint

        public override Point GetWaypoint()
        {
            // update collided point status
            _me.SetStatus(_mo.X, _mo.Y, MapElementStatus.Collided);

            Vector vector = new Vector(_mo.X - _posX, _mo.Y - _posY);
            
            // opposite direction
            vector.Negate();

            // normalize vector (length = 1)
            vector.Normalize();

            // calculate distances to every border
            double tLeft = (-_posX) / vector.X;
            double tRight = (800 - _posX) / vector.X;
            double tTop = (-_posY) / vector.Y;
            double tBottom = (600 - _posY) / vector.Y;

            vector *= 20;

            _point.X = (int)_posX + (int)vector.X;
            _point.Y = (int)_posY + (int)vector.Y;

            _point.Status = MapElementStatus.Waypoint;

            return _point;
        }
开发者ID:villj2,项目名称:ch.bfh.bti7301.searchrobot,代码行数:28,代码来源:WayDecisionCollision.cs

示例10: Equals

		public void Equals ()
		{
			Vector v = new Vector (4, 5);
			Assert.IsTrue (v.Equals (new Vector (4, 5)));
			Assert.IsFalse (v.Equals (new Vector (5, 4)));
			Assert.IsFalse (v.Equals (new object()));
		}
开发者ID:nobled,项目名称:mono,代码行数:7,代码来源:VectorTest.cs

示例11: ByteTagDefinition

 /// <summary>
 /// Private constructor.
 /// </summary>
 /// <param name="physicalCenterOffsetFromTag"></param>
 /// <param name="orientationOffsetFromTag"></param>
 private ByteTagDefinition(
     Vector physicalCenterOffsetFromTag,
     double orientationOffsetFromTag)
 {
     this.physicalCenterOffsetFromTag = physicalCenterOffsetFromTag;
     this.orientationOffsetFromTag = orientationOffsetFromTag;
 }
开发者ID:AnthonyB28,项目名称:Marist_Map,代码行数:12,代码来源:ByteTagDefinition.cs

示例12: GetClosestComponent

        public Component GetClosestComponent(int x, int y, ComponentFilter cf)
        {
            Component result = null;
            int componentType = cf.Type;
            List<Component> components = m_vComponents[componentType];
            Vector v = new Vector(x,y);
            double maxLengthSquared = 0;

            if (components.Count > 0)
            {
                foreach(var c in components)
                {
                    if(cf.TestComponent(c))
                    {
                        GameObject go = c.GetParent();
                        double lengthSquared = (v - go.GetPosition()).LengthSquared; 
                        if(lengthSquared < maxLengthSquared || result == null)
                        {
                            maxLengthSquared = lengthSquared;
                            result = c;
                        }
                    }
                }
            }
            return result;
        }
开发者ID:0trebor0,项目名称:clash-of-warriors-server,代码行数:26,代码来源:ComponentManager.cs

示例13: TestBoundingLineReflect270Left

        public void TestBoundingLineReflect270Left()
        {
            //Preconfig
            Vector position1 = new Vector(0f, 50f);
            Vector target1 = new Vector(50f, 50f);

            Vector ballSpeed = new Vector(5, 0);
            Vector ballPos = new Vector(-20, 50);

            Vector hitPoint = new Vector(0, 50);
            Vector expectedReflection = -ballSpeed;
            expectedReflection.Normalize();
            Vector reflection;

            //Creation
            Line parent = new Line();
            BoundingContainer bCont = new BoundingContainer(parent);
            BoundingLine bL1 = new BoundingLine(position1, target1);
            bCont.AddBoundingBox(bL1);
            parent.Location = (new Vector(0, 0));

            //Operation
            reflection = bL1.Reflect(ballSpeed, hitPoint, ballPos);
            reflection.Normalize();

            //Assertion
            Assert.AreEqual(expectedReflection, reflection);
        }
开发者ID:EusthEnoptEron,项目名称:Sketchball,代码行数:28,代码来源:BoundingLine_reflect.cs

示例14: Physics

 public Physics(GameObject gameObject, double topSpeed, Vector velocity)
 {
     _lastUpdate = DateTime.Now.Ticks;
     GameObject = gameObject;
     _topSpeed = topSpeed;
     Velocity = velocity;
 }
开发者ID:ChrisDaBang,项目名称:BOD-Server,代码行数:7,代码来源:Physics.cs

示例15: Subdivide

        public static Tuple<Point[], Point[], Point[]> Subdivide(Point[] l1, Point[] l2)
        {
            var allPoints = l1.Concat(l2).ToArray();
            var pcaLine = PCALine.Compute(allPoints);

            var minPoint = allPoints.Minimizer(p => ProjectedLinePosition(p, pcaLine.Item1, pcaLine.Item2)).ProjectOnLine(pcaLine);
            var maxPoint = allPoints.Minimizer(p => -ProjectedLinePosition(p, pcaLine.Item1, pcaLine.Item2)).ProjectOnLine(pcaLine);

            var samples = SampleSegment(minPoint, maxPoint);

            var points1 = new List<Point>();
            var points2 = new List<Point>();
            var centers = new List<Point>();
            var perp = new Vector(-pcaLine.Item2.Y, pcaLine.Item2.X);
            for (int i = 0; i < samples.Length; ++i)
            {
                var p1 = DirectionalProject(samples[i], perp, l1);
                var p2 = DirectionalProject(samples[i], perp, l2);
                if (p1 != null && p2 != null)
                {
                    points1.Add(p1.Value);
                    points2.Add(p2.Value);
                    centers.Add(samples[i]);
                }
            }

            return Tuple.Create(points1.ToArray(), points2.ToArray(), centers.ToArray());
        }
开发者ID:alexshtf,项目名称:Various-utility-projects,代码行数:28,代码来源:SilhouettesSubdividor.cs


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