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


C# Numerics.Vector3类代码示例

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


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

示例1: GetMapValue

		// get a value based on a position in 3d world space
	    private bool GetMapValue(Vector3 point)
		{
			Vector3 local = point - Center;
            local.Y = 0;
			Vector3 localXZ = local;

			float hxs = XSize / 2;
			float hzs = ZSize / 2;

			float x = localXZ.X;
			float z = localXZ.Z;

			bool isOut = (x > +hxs) || (x < -hxs) || (z > +hzs) || (z < -hzs);

			if (isOut)
			{
				return _outsideValue;
			}
			else
			{
                int i = (int)Utilities.RemapInterval(x, -hxs, hxs, 0.0f, Resolution);
                int j = (int)Utilities.RemapInterval(z, -hzs, hzs, 0.0f, Resolution);
				return GetMapBit(i, j);
			}
		}
开发者ID:cupsster,项目名称:SharpSteer2,代码行数:26,代码来源:TerrainMap.cs

示例2: Line

		// ------------------------------------------------------------------------
		// drawing of lines, circles and (filled) disks to annotate steering
		// behaviors.  When called during OpenSteerDemo's simulation update phase,
		// these functions call a "deferred draw" routine which buffer the
		// arguments for use during the redraw phase.
		//
		// note: "circle" means unfilled
		//       "disk" means filled
		//       "XZ" means on a plane parallel to the X and Z axes (perp to Y)
		//       "3d" means the circle is perpendicular to the given "axis"
		//       "segments" is the number of line segments used to draw the circle

		// draw an opaque colored line segment between two locations in space
		public void Line(Vector3 startPoint, Vector3 endPoint, Vector3 color, float opacity = 1)
		{
			if (_isEnabled && Drawer != null)
			{
				Drawer.Line(startPoint, endPoint, new Color(new Microsoft.Xna.Framework.Vector3(color.X, color.Y, color.Z)), opacity);
			}
		}
开发者ID:cupsster,项目名称:SharpSteer2,代码行数:20,代码来源:AnnotationService.cs

示例3: Redraw

	    public override void Redraw(float currentTime, float elapsedTime)
		{
			// selected vehicle (user can mouse click to select another)
			IVehicle selected = Demo.SelectedVehicle;

			// vehicle nearest mouse (to be highlighted)
			IVehicle nearMouse = Demo.VehicleNearestToMouse();

			// update camera
			Demo.UpdateCamera(elapsedTime, selected);

			// draw "ground plane"
			Demo.GridUtility(selected.Position);

			// update, draw and annotate each agent
			foreach (LowSpeedTurn agent in _all)
			{
			    agent.Draw();

			    // display speed near agent's screen position
			    Color textColor = new Color(new Vector3(0.8f, 0.8f, 1.0f).ToXna());
			    Vector3 textOffset = new Vector3(0, 0.25f, 0);
			    Vector3 textPosition = agent.Position + textOffset;
			    String annote = String.Format("{0:0.00}", agent.Speed);
			    Drawing.Draw2dTextAt3dLocation(annote, textPosition, textColor);
			}

			// highlight vehicle nearest mouse
			Demo.HighlightVehicleUtility(nearMouse);
		}
开发者ID:cupsster,项目名称:SharpSteer2,代码行数:30,代码来源:LowSpeedTurnPlugIn.cs

示例4: CleanUp

 /// <summary>
 /// Cleans up the pair tester.
 /// </summary>
 public override void CleanUp()
 {
     convex = null;
     state = CollisionState.Plane;
     escapeAttempts = 0;
     localSeparatingAxis = new System.Numerics.Vector3();
     Updated = false;
 }
开发者ID:Raverenx,项目名称:GameEngine,代码行数:11,代码来源:TriangleConvexPairTester.cs

示例5: TriangleShape

 ///<summary>
 /// Constructs a triangle shape from cached data.
 ///</summary>
 ///<param name="vA">First vertex in the triangle.</param>
 ///<param name="vB">Second vertex in the triangle.</param>
 ///<param name="vC">Third vertex in the triangle.</param>
 /// <param name="description">Cached information about the shape. Assumed to be correct; no extra processing or validation is performed.</param>
 public TriangleShape(System.Numerics.Vector3 vA, System.Numerics.Vector3 vB, System.Numerics.Vector3 vC, ConvexShapeDescription description)
 {
     //Recenter.  Convexes should contain the origin.
     var center = (vA + vB + vC) / 3;
     this.vA = vA - center;
     this.vB = vB - center;
     this.vC = vC - center;
     UpdateConvexShapeInfo(description);
 }
开发者ID:Raverenx,项目名称:GameEngine,代码行数:16,代码来源:TriangleShape.cs

示例6: CleanUp

 ///<summary>
 /// Cleans up the pair tester.
 ///</summary>
 public void CleanUp()
 {
     state = CollisionState.Separated;
     previousState = CollisionState.Separated;
     cachedSimplex = new CachedSimplex();
     localSeparatingAxis = new System.Numerics.Vector3();
     collidableA = null;
     collidableB = null;
 }
开发者ID:Raverenx,项目名称:GameEngine,代码行数:12,代码来源:GeneralConvexPairTester.cs

示例7: Reset

		// reset state
		public override void Reset()
		{
			base.Reset(); // reset the vehicle 
			Speed = 0.0f;         // speed along Forward direction.

			Position = new Vector3(0, 0, 0);
			if (_trail == null) _trail = new Trail(100, 6000);
			_trail.Clear();    // prevent long streaks due to teleportation 
		}
开发者ID:cupsster,项目名称:SharpSteer2,代码行数:10,代码来源:Ball.cs

示例8: CreateDatabase

 private void CreateDatabase()
 {
     Vector3 center = Vector3.Zero;
     const float DIV = 10.0f;
     Vector3 divisions = new Vector3(DIV, DIV, DIV);
     const float DIAMETER = Fighter.WORLD_RADIUS * 2;
     Vector3 dimensions = new Vector3(DIAMETER, DIAMETER, DIAMETER);
     _pd = new LocalityQueryProximityDatabase<IVehicle>(center, dimensions, divisions);
 }
开发者ID:cupsster,项目名称:SharpSteer2,代码行数:9,代码来源:AirCombatPlugin.cs

示例9: AnnotateAvoidNeighbor

		public void AnnotateAvoidNeighbor(IVehicle threat, Vector3 ourFuture, Vector3 threatFuture)
		{
			Color green = new Color((byte)(255.0f * 0.15f), (byte)(255.0f * 0.6f), 0);

            annotation.Line(Position, ourFuture, green.ToVector3().FromXna());
            annotation.Line(threat.Position, threatFuture, green.ToVector3().FromXna());
            annotation.Line(ourFuture, threatFuture, Color.Red.ToVector3().FromXna());
            annotation.CircleXZ(Radius, ourFuture, green.ToVector3().FromXna(), 12);
            annotation.CircleXZ(Radius, threatFuture, green.ToVector3().FromXna(), 12);
		}
开发者ID:cupsster,项目名称:SharpSteer2,代码行数:10,代码来源:Pedestrian.cs

示例10: Draw

		public void Draw()
		{
			Vector3 b = new Vector3(_min.X, 0, _max.Z);
			Vector3 c = new Vector3(_max.X, 0, _min.Z);
			Color color = new Color(255, 255, 0);
			Drawing.DrawLineAlpha(_min, b, color, 1.0f);
			Drawing.DrawLineAlpha(b, _max, color, 1.0f);
			Drawing.DrawLineAlpha(_max, c, color, 1.0f);
			Drawing.DrawLineAlpha(c, _min, color, 1.0f);
		}
开发者ID:cupsster,项目名称:SharpSteer2,代码行数:10,代码来源:AABBox.cs

示例11: DrawHomeBase

		public void DrawHomeBase()
		{
			Vector3 up = new Vector3(0, 0.01f, 0);
			Color atColor = new Color((byte)(255.0f * 0.3f), (byte)(255.0f * 0.3f), (byte)(255.0f * 0.5f));
			Color noColor = Color.Gray;
			bool reached = Plugin.CtfSeeker.State == SeekerState.AtGoal;
			Color baseColor = (reached ? atColor : noColor);
            Drawing.DrawXZDisk(_baseRadius, Globals.HomeBaseCenter, baseColor, 40);
            Drawing.DrawXZDisk(_baseRadius / 15, Globals.HomeBaseCenter + up, Color.Black, 20);
		}
开发者ID:cupsster,项目名称:SharpSteer2,代码行数:10,代码来源:CtfBase.cs

示例12: AddToBuffer

		public static void AddToBuffer(Vector3 s, Vector3 e, Color c)
		{
		    if (_index >= _deferredLines.Count)
		        _deferredLines.Add(new DeferredLine());

            _deferredLines[_index]._startPoint = s;
            _deferredLines[_index]._endPoint = e;
            _deferredLines[_index]._color = c;

            _index++;
		}
开发者ID:cupsster,项目名称:SharpSteer2,代码行数:11,代码来源:DeferredDraw.cs

示例13: Record

		/// <summary>
		/// Records a position for the current time, called once per update.
		/// </summary>
		/// <param name="currentTime"></param>
		/// <param name="position"></param>
		public void Record(float currentTime, Vector3 position)
		{
			float timeSinceLastTrailSample = currentTime - _lastSampleTime;
			if (timeSinceLastTrailSample > _sampleInterval)
			{
				_currentIndex = (_currentIndex + 1) % _vertices.Length;
				_vertices[_currentIndex] = position;
				_dottedPhase = (_dottedPhase + 1) % 2;
				bool tick = (Math.Floor(currentTime) > Math.Floor(_lastSampleTime));
				_flags[_currentIndex] = (byte)(_dottedPhase | (tick ? 2 : 0));
				_lastSampleTime = currentTime;
			}
			_currentPosition = position;
		}
开发者ID:cupsster,项目名称:SharpSteer2,代码行数:19,代码来源:Trail.cs

示例14: TerrainMap

		public TerrainMap(Vector3 c, float x, float z, int r)
		{
			Center = c;
			XSize = x;
			ZSize = z;
			Resolution = r;
			_outsideValue = false;

			_map = new bool[Resolution * Resolution];
			for (int i = 0; i < Resolution * Resolution; i++)
			{
				_map[i] = false;
			}
		}
开发者ID:cupsster,项目名称:SharpSteer2,代码行数:14,代码来源:TerrainMap.cs

示例15: ExpandMinkowskiSum

        ///<summary>
        /// Computes the expansion of the minkowski sum due to margins in a given direction.
        ///</summary>
        ///<param name="marginA">First margin.</param>
        ///<param name="marginB">Second margin.</param>
        ///<param name="direction">Extreme point direction.</param>
        ///<param name="contribution">Margin contribution to the extreme point.</param>
        public static void ExpandMinkowskiSum(float marginA, float marginB, ref System.Numerics.Vector3 direction, out System.Numerics.Vector3 contribution)
        {
            float lengthSquared = direction.LengthSquared();
            if (lengthSquared > Toolbox.Epsilon)
            {
                //The contribution to the minkowski sum by the margin is:
                //direction * marginA - (-direction) * marginB.
                Vector3Ex.Multiply(ref direction, (marginA + marginB) / (float)Math.Sqrt(lengthSquared), out contribution);

            }
            else
            {
                contribution = new System.Numerics.Vector3();
            }
        }
开发者ID:Raverenx,项目名称:GameEngine,代码行数:22,代码来源:MinkowskiToolbox.cs


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