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

C# Geom.Vector2f类代码示例

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

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



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

示例1: ElasticForce

		public static Vector2f ElasticForce(Vector2f displacement,
				float forceConstant) {
			float forceX = -forceConstant * displacement.GetX();
			float forceY = -forceConstant * displacement.GetY();
			Vector2f theForce = new Vector2f(forceX, forceY);
			return theForce;
		}
开发者ID:207h2Flogintvg,项目名称:LGame,代码行数:7,代码来源:Speed.cs


示例2: Line

        public Line(Vector2f start_0, Vector2f end_1)
            : base()
        {
			this.loc = new Vector2f(0, 0);
			this.closest = new Vector2f(0, 0);
			Set(start_0, end_1);
		}
开发者ID:207h2Flogintvg,项目名称:LGame,代码行数:7,代码来源:Line.cs


示例3: GetVelocity

		public static Vector2f GetVelocity(Vector2f velocity, Vector2f force,
				float mass) {
			Vector2f acceleration = new Vector2f(force.GetX() / mass, force.GetY()
					/ mass);
			velocity.Add(acceleration);
			return velocity;
		}
开发者ID:207h2Flogintvg,项目名称:LGame,代码行数:7,代码来源:Speed.cs


示例4: PConcavePolygonShape

		public PConcavePolygonShape(float[] xvers, float[] yvers, float density) {
			fig = new PFigure();
			tri = new PTriangulator();
			poly = new PPolygonizer();
			numVertices = xvers.Length;
			localVers = new Vector2f[numVertices];
			vers = new Vector2f[numVertices];
			_dens = density;
			for (int i = 0; i < numVertices; i++) {
				localVers[i] = new Vector2f(xvers[i], yvers[i]);
				vers[i] = new Vector2f(xvers[i], yvers[i]);
			}
	
			fig.Figure(localVers, numVertices);
			numVertices = fig.numVertices;
			localVers = new Vector2f[numVertices];
			vers = new Vector2f[numVertices];
			for (int i_0 = 0; i_0 < numVertices; i_0++) {
				localVers[i_0] = new Vector2f(fig.done[i_0].x, fig.done[i_0].y);
				vers[i_0] = new Vector2f(fig.done[i_0].x, fig.done[i_0].y);
			}
			tri.Triangulate(fig.done, fig.numVertices);
			poly.Polygonize(tri.triangles, tri.numTriangles);
			convexes = new PConvexPolygonShape[1024];
			for (int i_1 = 0; i_1 < poly.numPolygons; i_1++) {
				convexes[i_1] = new PConvexPolygonShape(poly.polygons[i_1].xs,
						poly.polygons[i_1].ys, _dens);
			}
			numConvexes = poly.numPolygons;
			CalcMassData();
			_type = PShapeType.CONCAVE_SHAPE;
		}
开发者ID:207h2Flogintvg,项目名称:LGame,代码行数:32,代码来源:PConcavePolygonShape.cs


示例5: Action

		public static LNScaleTo Action(float duration, Vector2f s) {
			LNScaleTo to = new LNScaleTo();
			to._duration = duration;
			to._endX = s.x;
			to._endY = s.y;
			return to;
		}
开发者ID:DONGChuan,项目名称:LGame,代码行数:7,代码来源:LNScaleTo.cs


示例6: Line

		public Line(float[] start_0, float[] end_1):base() {
			
			this.loc = new Vector2f(0, 0);
			this.closest = new Vector2f(0, 0);
			this.type = ShapeType.LINE_SHAPE;
			Set(start_0, end_1);
		}
开发者ID:wethinkall,项目名称:LGame,代码行数:7,代码来源:Line.cs


示例7: LObjectCamera

 public LObjectCamera(RectBox r, object f, int width, int height,
         int horBorderPixel_0, int vertBorderPixel_1, Vector2f maxSpeed_2)
 {
     this.cameraX = 0;
     this.cameraY = 0;
     this.renderWidth = width;
     this.renderHeight = height;
     this.follow = new Bind(f);
     this.horBorderPixel = horBorderPixel_0;
     this.vertBorderPixel = vertBorderPixel_1;
     this.maxSpeed = maxSpeed_2;
     if (follow != null)
     {
         this.cameraX = follow.GetX() - (this.renderWidth / 2);
         this.cameraY = follow.GetY() - (this.renderHeight / 2);
     }
     this.cameraRect = r;
     this.visibleRect = new RectBox(cameraX - horBorderPixel_0, cameraY
             - vertBorderPixel_1, renderWidth + horBorderPixel_0, renderHeight
             + vertBorderPixel_1);
     this.moveRect = new RectBox(cameraX - horBorderPixel_0, cameraY
             - vertBorderPixel_1, renderWidth + horBorderPixel_0, renderHeight
             + vertBorderPixel_1);
     this.UpdateCamera();
 }
开发者ID:hellogithubtesting,项目名称:LGame,代码行数:25,代码来源:LObjectCamera.cs


示例8: PPhysManager

		public PPhysManager(float s, float gx, float gy) {
			this.world = new PPhysWorld();
			this.gravity = new Vector2f(gx, gy);
			this.start = false;
			this.enableGravity = true;
			this.scale = s;
		}
开发者ID:207h2Flogintvg,项目名称:LGame,代码行数:7,代码来源:PPhysManager.cs


示例9: ClipEdge

		private PPolygonPolygonCollider.PWContactedVertex [] ClipEdge(PPolygonPolygonCollider.PWContactedVertex [] clips,
				Vector2f normal, float dist) {
			PPolygonPolygonCollider.PWContactedVertex [] line = new PPolygonPolygonCollider.PWContactedVertex [2];
			int numClips = 0;
			float dist0 = normal.Dot(clips[0].v) - dist;
			float dist1 = normal.Dot(clips[1].v) - dist;
			if (dist0 < 0.0F) {
				line[numClips] = clips[0];
				numClips++;
			}
			if (dist1 < 0.0F) {
				line[numClips] = clips[1];
				numClips++;
			}
			if (numClips == 0)
				return null;
			if (numClips == 2)
				return line;
			int c = 0;
			if (dist0 < 0.0F && dist1 > 0.0F)
				c = 1;
			float d = dist0 / (dist0 - dist1);
			line[1] = new PPolygonPolygonCollider.PWContactedVertex ();
			line[1].v = clips[1].v.Sub(clips[0].v).Clone();
			line[1].v.MulLocal(d);
			line[1].v.AddLocal(clips[0].v);
			line[1].data = clips[c].data;
			return line;
		}
开发者ID:207h2Flogintvg,项目名称:LGame,代码行数:29,代码来源:PPolygonPolygonCollider.cs


示例10: CreateOrigin

		private static Vector2f CreateOrigin(LObject o, Origin origin) {
			Vector2f v = new Vector2f(o.X(), o.Y());
			switch (origin) {
			case Origin.CENTER:
				v.Set(o.GetWidth() / 2f, o.GetHeight() / 2f);
				return v;
			case Origin.TOP_LEFT:
				v.Set(0.0f, o.GetHeight());
				return v;
			case Origin.TOP_RIGHT:
				v.Set(o.GetWidth(), o.GetHeight());
				return v;
			case Origin.BOTTOM_LEFT:
				v.Set(0.0f, 0.0f);
				return v;
			case Origin.BOTTOM_RIGHT:
				v.Set(o.GetWidth(), 0.0f);
				return v;
			case Origin.LEFT_CENTER:
				v.Set(0.0f, o.GetHeight() / 2f);
				return v;
			case Origin.TOP_CENTER:
				v.Set(o.GetWidth() / 2f, o.GetHeight());
				return v;
			case Origin.BOTTOM_CENTER:
				v.Set(o.GetWidth() / 2f, 0.0f);
				return v;
			case Origin.RIGHT_CENTER:
				v.Set(o.GetWidth(), o.GetHeight() / 2f);
				return v;
			default:
				return v;
			}
		}
开发者ID:207h2Flogintvg,项目名称:LGame,代码行数:34,代码来源:Director.cs


示例11: GetVelocity

 public static Vector2f GetVelocity(Vector2f velocity, List<Vector2f> forces)
 {
     foreach (Vector2f v in forces)
     {
         velocity.Add(v);
     }
     return velocity;
 }
开发者ID:hellogithubtesting,项目名称:LGame,代码行数:8,代码来源:Speed.cs


示例12: Line

 public Line(Vector2f start_0, Vector2f end_1)
     : base()
 {
     this.loc = new Vector2f(0, 0);
     this.closest = new Vector2f(0, 0);
     this.type = Loon.Core.Geom.ShapeType.LINE_SHAPE;
     Set(start_0, end_1);
 }
开发者ID:hellogithubtesting,项目名称:LGame,代码行数:8,代码来源:Line.cs


示例13: Action

		public static LNJumpParabolaBy Action(float duration, Vector2f position,
				Vector2f refPoint) {
			LNJumpParabolaBy by = new LNJumpParabolaBy();
			by._delta = position;
			by._duration = duration;
			by._refPoint = refPoint;
			return by;
		}
开发者ID:keppelcao,项目名称:LGame,代码行数:8,代码来源:LNJumpParabolaBy.cs


示例14: CalculateVector

		public static Vector2f CalculateVector(float angle, float magnitude) {
			Vector2f v = new Vector2f();
			v.x = MathUtils.Sin(MathUtils.ToRadians(angle));
			v.x *= magnitude;
			v.y = -MathUtils.Cos(MathUtils.ToRadians(angle));
			v.y *= magnitude;
			return v;
		}
开发者ID:keppelcao,项目名称:LGame,代码行数:8,代码来源:ShapeUtils.cs


示例15: Action

        new public static LNMoveBy Action(float duration, Vector2f pos)
        {
			LNMoveBy by = new LNMoveBy();
			by._diff = pos;
			by._duration = duration;
			by._lastTime = 0f;
			return by;
		}
开发者ID:keppelcao,项目名称:LGame,代码行数:8,代码来源:LNMoveBy.cs


示例16: Cpy

        public static Vector2f Cpy(Vector2f vectorA)
        {
            Vector2f newSVector2 = new Vector2f();

            newSVector2.x = vectorA.x;
            newSVector2.y = vectorA.y;

            return newSVector2;
        }
开发者ID:hellogithubtesting,项目名称:LGame,代码行数:9,代码来源:Vector2f.cs


示例17: GetOrigin

 public Vector2f GetOrigin(string text)
 {
     Vector2f result = (Vector2f)CollectionUtils.Get(fontSizes, text);
     if (result == null)
     {
         result = new Vector2f(StringWidth(text) / 2f, GetHeight() / 2f);
     }
     return result;
 }
开发者ID:207h2Flogintvg,项目名称:LGame,代码行数:9,代码来源:LFont.cs


示例18: Action

        new public static LNJumpTo Action(float duration, Vector2f delta, float height,
				int jumps) {
			LNJumpTo to = new LNJumpTo();
			to._duration = duration;
			to._delta = delta;
			to._height = height;
			to._jumps = jumps;
			return to;
		}
开发者ID:207h2Flogintvg,项目名称:LGame,代码行数:9,代码来源:LNJumpTo.cs


示例19: AngleTo

 public static float AngleTo(Vector2f vectorA)
 {
     float angle = MathUtils.Atan2(vectorA.y, vectorA.x)
             * MathUtils.RAD_TO_DEG;
     if (angle < 0) {
         angle += 360;
     }
     return angle;
 }
开发者ID:hellogithubtesting,项目名称:LGame,代码行数:9,代码来源:Vector2f.cs


示例20: Action

		public static LNJumpBy Action(float duration, Vector2f delta, float height,
				int jumps) {
			LNJumpBy by = new LNJumpBy();
			by._duration = duration;
			by._delta = delta;
			by._height = height;
			by._jumps = jumps;
			return by;
		}
开发者ID:darragh-murphy,项目名称:LGame,代码行数:9,代码来源:LNJumpBy.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# Graphics.LColor类代码示例发布时间:2022-05-26
下一篇:
C# Geom.RectBox类代码示例发布时间: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